diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java index 62008417e..c3ebbf844 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java @@ -7,7 +7,6 @@ import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO; import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; -import com.jero.modules.system.entity.SysUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestEO.java index ec48a8cd3..7c70544d3 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestEO.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestEO.java @@ -151,6 +151,11 @@ public class ParamsCollectManifestEO implements Serializable { @ApiModelProperty(value = "参数清单id") private String paramsManifestId; + /**变更标识*/ + @Excel(name = "变更标识", width = 15) + @ApiModelProperty(value = "变更标识") + private String changeFlag; + @TableField(exist = false) private String userTypes; } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/enums/CollectManifestChangeFlagEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/enums/CollectManifestChangeFlagEnum.java new file mode 100644 index 000000000..e807d9b8c --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/enums/CollectManifestChangeFlagEnum.java @@ -0,0 +1,35 @@ +package com.jero.modules.cert.collect.enums; + +/** + * @Author: liyawei + * @Description: + * @Date: Created in 17:49 2022/5/16 + */ +public enum CollectManifestChangeFlagEnum { + CHANGE_BEFORE("变更前","0"), + CHANGE_AFTER("变更后","1"); + + String name; + String value; + + CollectManifestChangeFlagEnum(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml index 5edd61fb9..8ce0ee2b9 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestEOMapper.xml @@ -26,6 +26,7 @@ + @@ -73,7 +74,7 @@ select * from params_collect_manifest - order by create_time asc + order by change_flag desc, create_time asc \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestHistoryEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestHistoryEOMapper.xml index dadc1b2cd..feae422a6 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestHistoryEOMapper.xml +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectManifestHistoryEOMapper.xml @@ -26,7 +26,7 @@ - + diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java index a9775d1e7..19e50f23b 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java @@ -5,14 +5,18 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.exception.JeroBootException; import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; import com.jero.modules.cert.collect.entity.ParamsConfigEO; import com.jero.modules.cert.collect.entity.ParamsManifestEO; +import com.jero.modules.cert.collect.enums.CollectManifestChangeFlagEnum; import com.jero.modules.cert.collect.enums.CollectManifestStateEnum; import com.jero.modules.cert.collect.enums.ManifestStateEnum; +import com.jero.modules.cert.collect.mapper.ParamsCollectManifestEOMapper; import com.jero.modules.cert.collect.mapper.ParamsConfigEOMapper; import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper; import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; +import com.jero.modules.cert.collect.service.IParamsConfigDataEOService; import com.jero.modules.cert.collect.service.IParamsManifestEOService; import com.jero.modules.cert.collect.service.IParamsManifestHistoryEOService; import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO; @@ -65,6 +69,14 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl newParamsInfoPublishEOList = paramsInfoPublishEOService.getListByPublishVersion(id, newestVersion); + // 查询项目所有参数项(这时候参数项都收集完了) + ParamsCollectManifestEO paramsCollectManifestEO = new ParamsCollectManifestEO(); + paramsCollectManifestEO.setParamsManifestId(id); + List oldParamsCollectManifestEOList = paramsCollectManifestEOMapper.listInfo(paramsCollectManifestEO); + + // 比较模板参数项 和 项目参数项 + // nio编号一样时,比较参数填写规则(控件类型,控件备选值,控件校验)是否一样;nio编号不一样时,不用管,用户自己添加 + List nioNumberList = oldParamsCollectManifestEOList.stream().map(ParamsCollectManifestEO::getNioNumber).collect(Collectors.toList()); + List sameList = newParamsInfoPublishEOList.stream().filter(e->nioNumberList.contains(e.getNioNumber())).collect(Collectors.toList()); + + List delCollectManifestIdList = new ArrayList<>(); + List updateCollectManifestEOList = new ArrayList<>(); + + for (ParamsInfoPublishEO paramsInfoPublishEO : sameList) { + ParamsCollectManifestEO oldCollectManifestEO = oldParamsCollectManifestEOList.stream() + .filter(e->e.getNioNumber().equals(paramsInfoPublishEO.getNioNumber())) + .collect(Collectors.toList()).get(0); + String newControlType = paramsInfoPublishEO.getControlType(); + String newControlVerify = paramsInfoPublishEO.getControlVerify(); + String newControlValues = paramsInfoPublishEO.getControlValues(); + + String oldControlType = oldCollectManifestEO.getControlType(); + String oldControlVerify = oldCollectManifestEO.getControlVerify(); + String oldControlValues = oldCollectManifestEO.getControlValues(); + + ParamsCollectManifestEO updateCollectManifestEO = new ParamsCollectManifestEO(); + // 比较参数填写规则 + if (!newControlType.equals(oldControlType) + || (newControlVerify != null && !newControlVerify.equals(oldControlVerify)) + || (oldControlVerify != null && !oldControlVerify.equals(newControlVerify)) + || (newControlValues != null && !newControlValues.equals(oldControlValues)) + || (oldControlValues != null && !oldControlValues.equals(newControlValues))) { + + // 参数填写规则改变,删除参数项配置数据,状态变为:待发起收集,拍列表前边 + updateCollectManifestEO.setId(oldCollectManifestEO.getId()); + updateCollectManifestEO.setState(CollectManifestStateEnum.WAIT_COLLECT.getValue()); + updateCollectManifestEO.setChangeFlag(CollectManifestChangeFlagEnum.CHANGE_AFTER.getValue()); + + delCollectManifestIdList.add(oldCollectManifestEO.getId()); + } else { + // 参数填写规则没有改变,状态变为:变更 + updateCollectManifestEO.setId(oldCollectManifestEO.getId()); + updateCollectManifestEO.setState(CollectManifestStateEnum.CHANGE.getValue()); + updateCollectManifestEO.setChangeFlag(CollectManifestChangeFlagEnum.CHANGE_BEFORE.getValue()); + + } + updateCollectManifestEOList.add(updateCollectManifestEO); + } + + // 删除参数项配置数据 + paramsConfigDataEOService.deleteByParamsCollectManifestIdList(delCollectManifestIdList); + // 更新项目参数项 + paramsCollectManifestEOService.updateBatchById(updateCollectManifestEOList); + // 参数清单版本加 1 + ParamsManifestEO updateManifestEO = new ParamsManifestEO(); + updateManifestEO.setId(id); + updateManifestEO.setVersion(paramsManifestEO.getVersion() + 1); + updateManifestEO.setParamsTemplatePublishVersion(newestVersion); + return updateById(updateManifestEO); } @Override diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java index f6c577f8d..2b471463c 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java @@ -2,6 +2,7 @@ package com.jero.modules.cert.template.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; +import org.apache.ibatis.annotations.Param; /** * @Description: 参数项基本信息表发布版 @@ -11,4 +12,5 @@ import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; */ public interface ParamsInfoPublishEOMapper extends BaseMapper { + Integer getNewestVersion(@Param("paramsTemplateId") String paramsTemplateId); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml index 5970251fc..a41f24b12 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml @@ -23,4 +23,10 @@ + + \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java index d4a823ab8..d5f9c7ccb 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java @@ -63,4 +63,5 @@ public interface IParamsInfoPublishEOService extends IService implements IParamsInfoPublishEOService { + @Autowired + private ParamsInfoPublishEOMapper paramsInfoPublishEOMapper; + @Autowired private IParamsTemplateEOService paramsTemplateEOService; @Autowired @@ -167,4 +170,9 @@ public class ParamsInfoPublishEOServiceImpl extends ServiceImpl