Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-13 18:15:48 +08:00
commit c9edff06dd
8 changed files with 56 additions and 22 deletions

View File

@ -58,8 +58,8 @@ public class AbilityCenterController {
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ActRunningService actRunningService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
private static final String key = "abilityprocess";

View File

@ -2,6 +2,7 @@ package io.renren.common.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import io.renren.common.annotation.LogOperation;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
@ -69,8 +70,8 @@ public class AbilityCenterControllerV2 {
private JdbcTemplate jdbcTemplate;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
@ -88,6 +89,7 @@ public class AbilityCenterControllerV2 {
*/
@PostMapping(value = "/apply")
@ApiOperation("批量进行能力申请")
@LogOperation("批量进行能力申请")
public Result<List<ProcessInstanceDTO>> applyV2(@RequestBody TAbilityBatchApplicationDTO abilityBatchApplicationDTO) {
// 仿照请求接口 /act/process/lastestPage
PageData<Map<String, Object>> page = actProcessService.page(params);
@ -123,7 +125,7 @@ public class AbilityCenterControllerV2 {
tAbilityApplicationDTO.setApproveStatus("审核中");
tAbilityApplicationDTO.setDelFlag(0);
// v2 新增字段
tAbilityApplicationDTO.setCameraList(index.get("cameraId").toString());
tAbilityApplicationDTO.setCameraList(index.get("cameraId") == null ? null : JSON.toJSONString(index.get("cameraId")));
tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle());
tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground());
tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene());

View File

@ -48,8 +48,8 @@ public class CommentController {
private TDemandCommentService tDemandCommentService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
private static final Logger logger = LoggerFactory.getLogger(CommentController.class);

View File

@ -44,8 +44,8 @@ public class DemandDataController {
private ActRunningService actRunningService;
@Autowired
private TDemandDataService tDemandDataService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
private static final String key = "abilitydemandapply";

View File

@ -58,8 +58,7 @@ public class ResourceMountController {
private ResourceService resourceService;
@Autowired
private SysUserService sysUserService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
@Autowired
protected TaskService taskService;

View File

@ -3,7 +3,6 @@ package io.renren.common.utils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -11,7 +10,6 @@ import java.util.Date;
/**
* 编码生成工具类
*/
@Component
public class CodeGenerationUtils {
@Autowired
@ -28,7 +26,7 @@ public class CodeGenerationUtils {
/**
* 生成流程单号
*
* <p>
* 流程单号编码规则
* 流程类型大写首字母 + 年月日 + 四位流水号
* 示例能力上架申请单号NLSJ202201010001
@ -36,7 +34,7 @@ public class CodeGenerationUtils {
* @param type 流程类型首字母大写
* @return 流程单号
*/
public String getApplyNumber(String type) {
public synchronized String getApplyNumber(String type) {
String applyNumberPattern = type + day;
@ -45,23 +43,23 @@ public class CodeGenerationUtils {
}
switch (type) {
//能力上架
case "NLSJ" :
case "NLSJ":
return getApplyNumberString("t_resource_mount_apply", applyNumberPattern);
//能力使用
case "NLSY" :
case "NLSY":
return getApplyNumberString("t_ability_application", applyNumberPattern);
//能力需求
case "NLXQ" :
case "NLXQ":
return getApplyNumberString("t_demand_data", applyNumberPattern);
//需求评论
case "XQPL" :
case "XQPL":
return getApplyNumberString("t_demand_comment", applyNumberPattern);
//能力下架
case "NLXJ" :
case "NLXJ":
return getApplyNumberString("tb_data_resource", applyNumberPattern);
default:
@ -69,7 +67,7 @@ public class CodeGenerationUtils {
}
}
private String getApplyNumberString (String tableName, String applyNumberPattern) {
private synchronized String getApplyNumberString(String tableName, String applyNumberPattern) {
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
" WHERE 1 = 1 AND apply_number IS NOT NULL " +
"AND apply_number LIKE '" + applyNumberPattern + "%' " +
@ -82,4 +80,14 @@ public class CodeGenerationUtils {
return applyNumberPattern + "0001";
}
}
private CodeGenerationUtils() {
}
private static CodeGenerationUtils codeGenerationUtils = new CodeGenerationUtils();
public static CodeGenerationUtils getInstance() {
return codeGenerationUtils;
}
}

View File

@ -27,7 +27,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
@Override
public void getDevelopmentFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.info("----------------------------------开始上传开发指南--------------------------------------------------");
logger.info("----------------------------------获取开发指南--------------------------------------------------");
String type = request.getParameter("type");
Long resourceId = Long.parseLong(request.getParameter("resourceId"));
logger.info("读取文件类型及能力ID" + type + ";" + resourceId);
@ -53,6 +53,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
IOUtils.copy(fis, outputStream);
//清空缓存的读取流保证数据完整性
response.flushBuffer();
logger.info("----------------------------------获取文件成功!!!--------------------------------------");
} catch (IOException e) {
e.printStackTrace();
throw e;

View File

@ -24,6 +24,9 @@ public class SecurityUser {
* 获取用户信息
*/
public static UserDetail getUser() {
logger.info("当前调用的方法为————————————————————————————" + getMyGrandpaStackTrace());
Subject subject = getSubject();
if (subject == null) {
return new UserDetail();
@ -37,6 +40,27 @@ public class SecurityUser {
return user;
}
public static String getMyGrandpaStackTrace(){
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
StackTraceElement log = stackTrace[2];
String tag = null;
for (int i = 1; i < stackTrace.length; i++) {
StackTraceElement e = stackTrace[i];
if (!e.getClassName().equals(log.getClassName())) {
tag = e.getClassName() + "." + e.getMethodName();
break;
}
}
if (tag == null) {
tag = log.getClassName() + "." + log.getMethodName();
}
return tag;
}
/**
* 获取用户ID
*/