This commit is contained in:
dinggang 2022-07-13 15:17:10 +08:00
parent 1290072076
commit e5dc75844c
22 changed files with 75 additions and 32 deletions

View File

@ -15,6 +15,13 @@ import java.lang.annotation.Target;
@Documented
public @interface LogOperation {
/**
* 操作名称
*/
String value() default "";
/**
* 操作数据库表
*/
String operationTable() default "";
}

View File

@ -43,9 +43,11 @@ import java.util.concurrent.Executors;
@Aspect
@Component
public class ActivitiNoticeAspect {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 3);
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
private static final Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired
private SysNoticeService sysNoticeService;
@Autowired
@ -56,6 +58,7 @@ public class ActivitiNoticeAspect {
private SysDeptService sysDeptService;
@Autowired
private SysRoleService sysRoleService;
private Set<String> work_ = new CopyOnWriteArraySet<>();
@Value("${big_date.name}")

View File

@ -1,16 +1,10 @@
package io.renren.common.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
/**
* Swagger配置
*
@ -21,12 +15,7 @@ public class TomcatConfig {
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "^|{}[]");
}
});
factory.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "^|{}[]"));
return factory;
}
}

View File

@ -4,6 +4,7 @@ package io.renren.common.controller;
import cn.hutool.core.util.ObjectUtil;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -44,7 +45,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/ability/center")
public class AbilityCenterController {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
@ -57,6 +58,8 @@ public class AbilityCenterController {
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ActRunningService actRunningService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final String key = "abilityprocess";
@ -83,6 +86,7 @@ public class AbilityCenterController {
if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程");
}
String applyNumber = codeGenerationUtils.getApplyNumber("NLSY");
return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (index.get("resourceId") == null) {
logger.error("未携带资源id");
@ -93,6 +97,7 @@ public class AbilityCenterController {
return null;
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setApplyNumber(applyNumber);
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -68,6 +69,9 @@ public class AbilityCenterControllerV2 {
private JdbcTemplate jdbcTemplate;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
private static final String key = "abilityprocess_v2";
@ -92,6 +96,7 @@ public class AbilityCenterControllerV2 {
}
final String applyFlag = UUID.randomUUID().toString();
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
String applyNumber = codeGenerationUtils.getApplyNumber("NLSY");
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
final UserDetail user = SecurityUser.getUser();
@ -101,6 +106,7 @@ public class AbilityCenterControllerV2 {
return null;
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setApplyNumber(applyNumber);
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());
@ -117,7 +123,7 @@ public class AbilityCenterControllerV2 {
tAbilityApplicationDTO.setApproveStatus("审核中");
tAbilityApplicationDTO.setDelFlag(0);
// v2 新增字段
tAbilityApplicationDTO.setCameraList(index.get("cameraId"));
tAbilityApplicationDTO.setCameraList(index.get("cameraId").toString());
tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle());
tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground());
tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene());

View File

@ -3,6 +3,7 @@ package io.renren.common.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
import io.renren.modules.activiti.dto.ProcessStartDTO;
@ -47,6 +48,8 @@ public class CommentController {
private TDemandCommentService tDemandCommentService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final Logger logger = LoggerFactory.getLogger(CommentController.class);
@ -81,6 +84,7 @@ public class CommentController {
if (tDemandCommentDTO.getId() == null) {
return new Result().error("该评论不存在");
}
tDemandCommentDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("XQPL"));
tDemandCommentDTO.setDelFlag(2); // 待审核
tDemandCommentDTO.setCompleteEntry(Boolean.TRUE);
tDemandCommentService.update(tDemandCommentDTO);

View File

@ -4,6 +4,7 @@ package io.renren.common.controller;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -43,6 +44,8 @@ public class DemandDataController {
private ActRunningService actRunningService;
@Autowired
private TDemandDataService tDemandDataService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final String key = "abilitydemandapply";
@ -66,6 +69,7 @@ public class DemandDataController {
logger.info(JSONObject.toJSONString(tDemandDataDTO));
logger.info("####################################################");
tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag());
tDemandDataDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXQ"));
ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class);
tDemandDataService.save(tDemandDataDTO);

View File

@ -6,6 +6,7 @@ import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -57,6 +58,8 @@ public class ResourceMountController {
private ResourceService resourceService;
@Autowired
private SysUserService sysUserService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
@Autowired
protected TaskService taskService;
@ -102,6 +105,7 @@ public class ResourceMountController {
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index)));
tResourceMountApplyDTO.setResourceDTO(index);
tResourceMountApplyDTO.setEnclosure(index.getEnclosure());
tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ"));
try {
tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId());
} catch (Exception e) {
@ -184,6 +188,7 @@ public class ResourceMountController {
}
dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason());
dto.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); // 设置为正常
dto.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXJ"));
String userId = SecurityUser.getUserId().toString();
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId)));
userDTO.ifPresent(user -> {

View File

@ -4,7 +4,6 @@ import lombok.Data;
import java.io.Serializable;
/**
* 审核流程各数据类 基础DTO
*/

View File

@ -1,6 +1,5 @@
package io.renren.common.interceptor;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;

View File

@ -1,6 +1,5 @@
package io.renren.common.listener;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
@ -22,7 +21,8 @@ import java.util.Map;
*/
@Component
public class InitiatorDataEntryListener implements TaskListener {
private static Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class);
private static final Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class);
@Autowired
private TaskService taskService;

View File

@ -3,6 +3,7 @@ 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;
@ -10,6 +11,7 @@ import java.util.Date;
/**
* 编码生成工具类
*/
@Component
public class CodeGenerationUtils {
@Autowired
@ -68,12 +70,16 @@ public class CodeGenerationUtils {
}
private 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 + "%'" +
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
" WHERE 1 = 1 AND apply_number IS NOT NULL " +
"AND apply_number LIKE '" + applyNumberPattern + "%' " +
"ORDER BY apply_number DESC " +
"LIMIT 1";
String s = jdbcTemplate.queryForObject(sql, String.class);
return StringUtils.isNotBlank(s) ? applyNumberPattern + "0001" : String.valueOf(Long.parseLong(s) + 1);
try {
String s = jdbcTemplate.queryForObject(sql, String.class);
return "NLSY" + (Long.parseLong(s) + 1);
} catch (Exception e) {
return applyNumberPattern + "0001";
}
}
}

View File

@ -49,7 +49,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 能力申请表单
*
@ -86,7 +85,10 @@ public class TAbilityApplicationController {
*/
@GetMapping("my_page")
@LogOperation("我的申请分页")
@ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")})
@ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")})
public Result<PageData<TAbilityApplicationDTO>> myPage(@ApiIgnore @RequestParam Map<String, Object> params) {
final UserDetail user = SecurityUser.getUser();
params.put("abilityprocess_v2", Boolean.TRUE); // 是否根据流程 abilityprocess_v2 来分页
@ -122,7 +124,6 @@ public class TAbilityApplicationController {
*
* @return
*/
@GetMapping("deal")
public Result<String> test() {
List<Map<String, Object>> re = jdbcTemplate.queryForList("SELECT t_ability_application.id,t_ability_application.resource_id,tb_data_resource.dept_id from t_ability_application JOIN tb_data_resource ON t_ability_application.resource_id = tb_data_resource.id WHERE resource_owner_dept IS NULL;");

View File

@ -107,6 +107,9 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable {
@ApiModelProperty(value = "总体评价")
private Integer total;
@ApiModelProperty(value = "申请单号")
private String applyNumber;
public String getDelFlagTip() {
if (this.delFlag != null) {
Optional<ResourceEntityDelFlag> resourceEntityDelFlagOptional = Optional.ofNullable(ResourceEntityDelFlag.getByFlag(this.delFlag));

View File

@ -136,4 +136,9 @@ public class ResourceEntity extends BaseEntity {
@TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class)
private List<AttrEntity> infoList;
/**
* 申请单号
*/
private String applyNumber;
}

View File

@ -54,8 +54,8 @@
<logger name="org.springframework.web" level="ERROR">
<appender-ref ref="FILE_INFO"/>
</logger>
<logger name="org.springboot.sample" level="ERROR"></logger>
<logger name="io.renren" level="ERROR"></logger>
<logger name="org.springboot.sample" level="ERROR"/>
<logger name="io.renren" level="ERROR"/>
</springProfile>
<root level="INFO">

View File

@ -22,6 +22,7 @@
<result property="approvalUserName" column="approval_user_name"/>
<result property="approvalUserDeptName" column="approval_user_dept_name"/>
<result property="visits" column="visits"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -16,6 +16,7 @@
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<select id="commentCount" resultType="java.lang.Long">
SELECT

View File

@ -27,6 +27,7 @@
<result property="applyFlag" column="apply_flag"/>
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.processForm.dto.TAbilityApplicationDTO">
<result property="id" column="id"/>
@ -51,6 +52,7 @@
<result property="applyFlag" column="apply_flag"/>
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -35,6 +35,7 @@
<result property="undercarriageUserName" column="undercarriage_user_name"/>
<result property="infoList" column="info_list"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.resource.dto.ResourceDTO">
@ -77,6 +78,7 @@
<result property="infoList" column="info_list"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="total" column="total"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="deleteByIds">

View File

@ -17,6 +17,7 @@
<result property="resourceDTO" column="resource_dto"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="createtime" column="createtime"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -36,7 +36,7 @@
</select>
<select id="getByUsername" resultType="io.renren.modules.sys.entity.SysUserEntity">
select * from sys_user where username = #{value}
select * from sys_user where BINARY username = #{value}
</select>
<update id="updatePassword">
@ -44,7 +44,7 @@
</update>
<select id="getCountByDeptId" resultType="int">
select count(*) from sys_user where dept_id = #{value}
SELECT count(*) FROM sys_user WHERE dept_id = #{value}
</select>
<select id="getUserIdListByDeptId" resultType="Long">