认证-参数清单-变更扩展-配置数据来源修改为上报库

This commit is contained in:
liyawei
2022-12-05 15:31:29 +08:00
parent 329c63f1bb
commit 88f41e91a1
6 changed files with 70 additions and 1 deletions
@@ -231,7 +231,8 @@ public class ParamsManifestEOController extends JeroController<ParamsManifestEO,
@ApiOperation(value="参数清单-变更扩展", notes="参数清单-变更扩展")
@GetMapping(value = "/changeExtension")
@RequiresPermissions("params:manifest:change")
public Result<?> changeExtension(@RequestParam(name="id",required=true) String id, @RequestParam(name="cut",required=true) String cut) {
public Result<?> changeExtension(@RequestParam(name="id",required=true) String id,
@RequestParam(name="cut",required=true) String cut) {
boolean isSuccess = paramsManifestEOService.changeExtension(id, cut);
if(isSuccess) {
return Result.OK("变更扩展成功!");
@@ -22,6 +22,8 @@ import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper;
import com.jero.modules.cert.collect.service.*;
import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO;
import com.jero.modules.cert.collect.vo.ParamsManifestVO;
import com.jero.modules.cert.report.entity.ParamsReportEO;
import com.jero.modules.cert.report.service.IParamsReportDetailEOService;
import com.jero.modules.cert.report.service.IParamsReportEOService;
import com.jero.modules.cert.template.entity.ParamsInfoPublishEO;
import com.jero.modules.cert.template.entity.ParamsTemplateEO;
@@ -97,6 +99,9 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
@Autowired
private IProjectLibraryBaseService projectLibraryBaseService;
@Autowired
private IParamsReportDetailEOService paramsReportDetailEOService;
/**
@@ -426,6 +431,10 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
paramsCollectManifestEO.setParamsManifestId(id);
List<ParamsCollectManifestEO> oldParamsCollectManifestEOList = paramsCollectManifestEOMapper.listInfo(paramsCollectManifestEO);
// 查询上报库的项目所有参数项的配置数据
ParamsReportEO paramsReportEO = paramsReportEOService.queryByOldParamsManifestId(id, paramsManifestEO.getVersion());
List<Map<String, Object>> paramsReportConfigDataList = paramsReportDetailEOService.listInfoForChange(paramsReportEO.getId());
// 比较模板参数项 和 项目参数项
// nio编号一样时,比较参数填写规则(控件类型,控件备选值,控件校验)是否一样;nio编号不一样时,不用管,用户自己添加
List<String> oldNioNumberList = oldParamsCollectManifestEOList.stream().map(ParamsCollectManifestEO::getNioNumber).collect(Collectors.toList());
@@ -437,6 +446,7 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
List<String> delCollectManifestIdList = new ArrayList<>();
List<ParamsCollectManifestEO> updateCollectManifestEOList = new ArrayList<>();
List<ParamsConfigDataEO> updateConfigDataEOList = new ArrayList<>();
// 模板里没有,清单里有
if (CollectionUtil.isNotEmpty(diffList)) {
@@ -503,10 +513,48 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
updateCollectManifestEOList.add(updateCollectManifestEO);
}
}
// 查询配置信息
List<String> configIdList = paramsConfigEOService.queryList(id).stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
List<ParamsConfigDataEO> paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(configIdList);
// 按照上报库参数项配置数据 更新 参数收集清单配置数据
List<Map<String, Object>> reportConfigDataEOList = new ArrayList<>();
List<ParamsConfigDataEO> configDataEOList = new ArrayList<>();
for (ParamsCollectManifestEO updateCollectManifestEO : updateCollectManifestEOList) {
for (String configId : configIdList) {
reportConfigDataEOList = paramsReportConfigDataList.stream().filter(e-> updateCollectManifestEO.getNioNumber().equals(e.get("nio_number"))
&& configId.equals(e.get("old_params_config_id"))).collect(Collectors.toList());
configDataEOList = paramsConfigDataEOList.stream().filter(e-> updateCollectManifestEO.getId().equals(e.getParamsCollectManifestId())
&& configId.equals(e.getParamsConfigId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(reportConfigDataEOList) && CollectionUtil.isNotEmpty(configDataEOList)) {
ParamsConfigDataEO updateParamsConfigDataEO = new ParamsConfigDataEO();
updateParamsConfigDataEO.setId(String.valueOf(configDataEOList.get(0)));
updateParamsConfigDataEO.setTextData((String) reportConfigDataEOList.get(0).get("text_data"));
updateParamsConfigDataEO.setPullData((String) reportConfigDataEOList.get(0).get("pull_data"));
updateParamsConfigDataEO.setFileConnectId((String) reportConfigDataEOList.get(0).get("file_connect_id"));
updateConfigDataEOList.add(updateParamsConfigDataEO);
} else if (CollectionUtil.isNotEmpty(reportConfigDataEOList) && CollectionUtil.isEmpty(configDataEOList)) {
ParamsConfigDataEO addParamsConfigDataEO = new ParamsConfigDataEO();
addParamsConfigDataEO.setId(UUID.randomUUID().toString().replace("-", ""));
addParamsConfigDataEO.setTextData((String) reportConfigDataEOList.get(0).get("text_data"));
addParamsConfigDataEO.setPullData((String) reportConfigDataEOList.get(0).get("pull_data"));
addParamsConfigDataEO.setFileConnectId((String) reportConfigDataEOList.get(0).get("file_connect_id"));
addParamsConfigDataEO.setParamsConfigId(configId);
addParamsConfigDataEO.setParamsCollectManifestId(updateCollectManifestEO.getId());
updateConfigDataEOList.add(addParamsConfigDataEO);
}
}
}
if (CollectionUtil.isNotEmpty(updateConfigDataEOList)) {
paramsConfigDataEOService.saveOrUpdateBatch(updateConfigDataEOList);
}
// 删除参数项配置数据
if (CollectionUtil.isNotEmpty(delCollectManifestIdList)) {
paramsConfigDataEOService.deleteByParamsCollectManifestIdList(delCollectManifestIdList);
}
// 更新项目参数项
paramsCollectManifestEOService.updateBatchById(updateCollectManifestEOList);
@@ -24,4 +24,5 @@ public interface ParamsReportDetailEOMapper extends BaseMapper<ParamsReportDetai
List<Map<String, Object>> listInfoForExport(@Param("idList") List<String> idList,
@Param("paramsReportDetailVO") ParamsReportDetailVO paramsReportDetailVO);
List<Map<String, Object>> listInfoForChange(@Param("paramsReportId") String paramsReportId);
}
@@ -167,4 +167,15 @@
order by prd.sync_time desc, prd.nio_number ASC
</select>
<select id="listInfoForChange" resultType="java.util.LinkedHashMap">
select
prcd.*,
prc.old_params_config_id,
prd.nio_number
from params_report_detail prd
left join params_report_config_data prcd on prd.id = prcd.params_collect_manifest_id
left join params_report_config prc on prd.params_manifest_id = prc.params_manifest_id
where prd.params_manifest_id = #{paramsReportId}
</select>
</mapper>
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.cert.report.entity.ParamsReportDetailEO;
import com.jero.modules.cert.report.vo.ParamsReportDetailVO;
import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -61,4 +62,6 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
// 删除
boolean deleteByIds(List<String> ids);
List<Map<String, Object>> listInfoForChange(String paramsReportId);
}
@@ -1839,6 +1839,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return removeByIds(ids);
}
@Override
public List<Map<String, Object>> listInfoForChange(String paramsReportId) {
return this.baseMapper.listInfoForChange(paramsReportId);
}
/**
* 实体对象转成Map
* @param obj 实体对象