参数收集清单

1.下发收集
2.一键下发收集
3.调整责任领域
操作增加历史log
This commit is contained in:
wangzhijiang
2022-12-26 17:56:17 +08:00
parent 843d9271d4
commit 1ff95d0d62
2 changed files with 83 additions and 4 deletions
@@ -55,6 +55,7 @@ public class ParamsCollectManifestLogEOController extends JeroController<ParamsC
@RequestParam(name="cut", defaultValue="cn") String cut,
HttpServletRequest req) {
QueryWrapper<ParamsCollectManifestLogEO> queryWrapper = QueryGenerator.initQueryWrapper(paramsCollectManifestLogEO, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<ParamsCollectManifestLogEO> page = new Page<ParamsCollectManifestLogEO>(pageNo, pageSize);
IPage<ParamsCollectManifestLogEO> pageList = paramsCollectManifestLogEOService.page(page, queryWrapper);
List<ParamsCollectManifestLogEO> records = pageList.getRecords();
@@ -22,10 +22,7 @@ import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServi
import com.jero.modules.cert.collect.entity.*;
import com.jero.modules.cert.collect.enums.*;
import com.jero.modules.cert.collect.mapper.ParamsCollectManifestEOMapper;
import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService;
import com.jero.modules.cert.collect.service.IParamsConfigDataEOService;
import com.jero.modules.cert.collect.service.IParamsConfigEOService;
import com.jero.modules.cert.collect.service.IParamsManifestEOService;
import com.jero.modules.cert.collect.service.*;
import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO;
import com.jero.modules.cert.collect.vo.ParamsConfigDataVO;
import com.jero.modules.cert.collect.vo.ParamsManifestVO;
@@ -59,6 +56,7 @@ import com.jero.modules.system.service.ISysAnnouncementService;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.ISysUserRoleService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -149,6 +147,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
@Autowired
private IProjectLibraryBaseService projectLibraryBaseService;
@Autowired
private IParamsCollectManifestLogEOService paramsCollectManifestLogEOService;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
@Autowired
private WebSocketServer webSocketServer; // 同步上报库时变更清单状态时使用
@Resource
private WebSocket webSocket; // 消息专用
@@ -1993,6 +1995,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<ParamsCollectManifestEO> updateEOList = new ArrayList<>();
List<Map<String, String>> msgMapList = new ArrayList<>();
List<String> updateEOIdList = new ArrayList<>();
List<ParamsCollectManifestLogEO> paramsCollectManifestLogEOList = new ArrayList<>();
List<ParamsCollectManifestEO> paramsCollectManifestEOList = listByIds(Arrays.asList(paramsCollectManifestIdStr));
paramsCollectManifestEOList = paramsCollectManifestEOList.stream().sorted(Comparator.comparing(ParamsCollectManifestBaseEO::getNioNumber)).collect(Collectors.toList()); // 按NIO编号升序
@@ -2014,6 +2017,13 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
updateEOList.add(updateEO);
updateEOIdList.add(paramsCollectManifestEO.getId());
ParamsCollectManifestLogEO paramsCollectManifestLogEO = new ParamsCollectManifestLogEO();
paramsCollectManifestLogEO.setLogCnContent("认证工程师\""+currentUser.getUsername()+"\"开始了下发收集,工程接口人为\""+paramsCollectManifestEO.getSdt()+"\"");
paramsCollectManifestLogEO.setLogEnContent("The certified engineer \""+currentUser.getUsername()+"\" starts to deliver the collection, and the engineering interface is \""+paramsCollectManifestEO.getSdt()+"\".");
paramsCollectManifestLogEO.setParamsManifestId(paramsManifestId);
paramsCollectManifestLogEO.setParamsCollectManifestId(paramsCollectManifestEO.getId());
paramsCollectManifestLogEOList.add(paramsCollectManifestLogEO);
} else {
Map<String, String> msgMap = new HashMap<>();
msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber());
@@ -2102,6 +2112,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
log.error("飞书消息推送失败");
}
}
if(CollectionUtils.isNotEmpty(paramsCollectManifestLogEOList)){
this.paramsCollectManifestLogEOService.saveBatch(paramsCollectManifestLogEOList);
}
}
return getMsgOfIssueCollection(msgMapList, cut, "1");
@@ -2129,6 +2143,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<ParamsCollectManifestEO> updateEOList = new ArrayList<>();
List<Map<String, String>> msgMapList = new ArrayList<>();
List<String> updateEOIdList = new ArrayList<>();
List<ParamsCollectManifestLogEO> paramsCollectManifestLogEOList = new ArrayList<>();
LambdaQueryWrapper<ParamsCollectManifestEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParamsCollectManifestEO::getParamsManifestId, paramsManifestId)
@@ -2153,6 +2168,13 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
updateEOList.add(updateEO);
updateEOIdList.add(paramsCollectManifestEO.getId());
ParamsCollectManifestLogEO paramsCollectManifestLogEO = new ParamsCollectManifestLogEO();
paramsCollectManifestLogEO.setLogCnContent("认证工程师\""+currentUser.getUsername()+"\"开始了下发收集,工程接口人为\""+paramsCollectManifestEO.getSdt()+"\"");
paramsCollectManifestLogEO.setLogEnContent("The certified engineer \""+currentUser.getUsername()+"\" starts to deliver the collection, and the engineering interface is \""+paramsCollectManifestEO.getSdt()+"\".");
paramsCollectManifestLogEO.setParamsManifestId(paramsManifestId);
paramsCollectManifestLogEO.setParamsCollectManifestId(paramsCollectManifestEO.getId());
paramsCollectManifestLogEOList.add(paramsCollectManifestLogEO);
} else {
Map<String, String> msgMap = new HashMap<>();
msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber());
@@ -2244,6 +2266,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
log.error("飞书消息推送失败");
}
}
if(CollectionUtils.isNotEmpty(paramsCollectManifestLogEOList)){
this.paramsCollectManifestLogEOService.saveBatch(paramsCollectManifestLogEOList);
}
}
return getMsgOfIssueCollection(msgMapList, cut, "1");
@@ -3247,6 +3273,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
String paramsManifestId = paramsCollectManifestVO.getParamsManifestId();
String projectId = paramsCollectManifestVO.getProjectId();
String cut = paramsCollectManifestVO.getCut();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 查询参数清单
ParamsManifestEO paramsManifestEO = paramsManifestEOService.getById(paramsManifestId);
@@ -3255,6 +3282,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
queryWrapper.in(ParamsCollectManifestEO::getId, paramsCollectManifestIdList);
List<ParamsCollectManifestEO> paramsCollectManifestEOList = paramsCollectManifestEOMapper.selectList(queryWrapper);
// 查询所有的责任领域
List<SysDictItem> dutyTerritoryList = this.sysDictItemServiceImpl.selectItemsByDictCode("duty_territory");
List<ParamsCollectManifestLogEO> paramsCollectManifestLogEOList = new ArrayList<>();
List<ParamsCollectManifestEO> updateEOList = new ArrayList<>();
List<Map<String, String>> msgMapList = new ArrayList<>();
paramsCollectManifestEOList.forEach(paramsCollectManifestEO -> {
@@ -3285,6 +3316,18 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
updateEOList.add(updateEO);
String oldDutyTerritoryNameCn = this.getDutyTerritoryNameByCode(dutyTerritoryList,paramsCollectManifestEO.getDutyTerritory(),CutEnum.CN.getValue());
String newDutyTerritoryNameCn = this.getDutyTerritoryNameByCode(dutyTerritoryList,dutyTerritory,CutEnum.CN.getValue());
String oldDutyTerritoryNameEn = this.getDutyTerritoryNameByCode(dutyTerritoryList,paramsCollectManifestEO.getDutyTerritory(),CutEnum.EN.getValue());
String newDutyTerritoryNameEn = this.getDutyTerritoryNameByCode(dutyTerritoryList,dutyTerritory,CutEnum.EN.getValue());
ParamsCollectManifestLogEO paramsCollectManifestLogEO = new ParamsCollectManifestLogEO();
paramsCollectManifestLogEO.setLogCnContent("认证工程师\""+currentUser.getUsername()+"\"将参数责任领域信息由\""+oldDutyTerritoryNameCn+"\"修改为\""+newDutyTerritoryNameCn+"\"");
paramsCollectManifestLogEO.setLogEnContent("The certified engineer \""+currentUser.getUsername()+"\" changed the parameter responsibility domain information from \""+oldDutyTerritoryNameEn+"\" to " + "\""+newDutyTerritoryNameEn+"\"");
paramsCollectManifestLogEO.setParamsManifestId(paramsManifestId);
paramsCollectManifestLogEO.setParamsCollectManifestId(paramsCollectManifestEO.getId());
paramsCollectManifestLogEOList.add(paramsCollectManifestLogEO);
} else {
Map<String, String> msgMap = new HashMap<>();
msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber());
@@ -3297,10 +3340,45 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
// 修改责任领域及工程接口人
updateBatchById(updateEOList);
if(CollectionUtils.isNotEmpty(paramsCollectManifestLogEOList)){
this.paramsCollectManifestLogEOService.saveBatch(paramsCollectManifestLogEOList);
}
// 返回不符合参数项的提示信息
return getMsgOfIssueCollection(msgMapList, cut, "2");
}
/**
* 根据责任领域code,获取责任领域名称,包含中英文切换。
* @param dutyTerritoryList
* @param dutyTerritoryCode
* @param cut
* @return
*/
public String getDutyTerritoryNameByCode(List<SysDictItem> dutyTerritoryList,String dutyTerritoryCode,String cut){
String result = null;
if (CollectionUtils.isNotEmpty(dutyTerritoryList) && StringUtils.isNotEmpty(dutyTerritoryCode)) {
if (StringUtils.equals(cut, CutEnum.CN.getValue())) {
result = dutyTerritoryList.stream().filter(dutyTerritory -> {
boolean flag = false;
if(StringUtils.equals(dutyTerritory.getItemValue(),dutyTerritoryCode)){
flag = true;
}
return flag;
}).map(SysDictItem::getItemText).collect(Collectors.joining(","));
} else if (StringUtils.equals(cut, CutEnum.EN.getValue())) {
result = dutyTerritoryList.stream().filter(dutyTerritory -> {
boolean flag = false;
if(StringUtils.equals(dutyTerritory.getItemValue(),dutyTerritoryCode)){
flag = true;
}
return flag;
}).map(SysDictItem::getEnName).collect(Collectors.joining(","));
}
}
return result;
}
private String[] getWorkbookTitleForExport(ParamsCollectManifestVO paramsCollectManifestVO) {
String cut = paramsCollectManifestVO.getCut();
String paramsManifestId = paramsCollectManifestVO.getParamsManifestId();