Merge branch 'develop_3' into 'develop_master'
Develop 3 See merge request LiuChao/foton-slrs-system-rest!380
This commit is contained in:
@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -227,10 +229,14 @@ public class ScheduledJob {
|
||||
*/
|
||||
QueryWrapper<SarStandAttrInfo> columnForDTBJH = new QueryWrapper<>();
|
||||
|
||||
columnForDTBJH.select("DTBJH");
|
||||
columnForDTBJH.select("DTBJH")
|
||||
.eq("VALID_FLAG","0")
|
||||
.ne("DTBJH","");
|
||||
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表
|
||||
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
|
||||
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH).subList(0,100);
|
||||
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
|
||||
|
||||
|
||||
// 格式为 T/CSAE 175-2021
|
||||
/**
|
||||
* 国内外表准号格式不统一
|
||||
@@ -286,22 +292,37 @@ public class ScheduledJob {
|
||||
|
||||
|
||||
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
for (String key : replaceIdCountMap.keySet()) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
String reasonMsg="";
|
||||
switch (replaceIdCountMap.get(key)){
|
||||
case 1 :
|
||||
sarStandardsInfo.setTextStatus("chblaarg77");//废止状态
|
||||
//废止状态
|
||||
sarStandardsInfo.setTextStatus("chblaarg77");
|
||||
sarStandardsInfo.setId(key);
|
||||
reasonMsg="该标准被一个标准代替";
|
||||
break;
|
||||
default :
|
||||
sarStandardsInfo.setTextStatus("qke0ckro2p");//被代替状态
|
||||
case 2 :
|
||||
//被代替状态
|
||||
sarStandardsInfo.setTextStatus("qke0ckro2p");
|
||||
sarStandardsInfo.setId(key);
|
||||
reasonMsg="该标准被一个以上标准代替";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// sarUpdLogEOService.createUpdateLog(sarStandardsInfoEO.getStandType() + "_STAND", sarStandardsInfoEO.getId(), oldMap, newMap, content);
|
||||
//更新日志
|
||||
SarStandardsInfo beforeSarStandardsInfoEO = sarStandardsInfoDao.selectById(sarStandardsInfo.getId());
|
||||
sarStandardsInfo.setStandType(beforeSarStandardsInfoEO.getStandType());
|
||||
sarStandardsInfo.setStandSort(beforeSarStandardsInfoEO.getStandSort());
|
||||
sarStandardsInfo.setStandNumber(beforeSarStandardsInfoEO.getStandNumber());
|
||||
sarStandardsInfo.setStandYear(beforeSarStandardsInfoEO.getStandYear());
|
||||
sarStandardsInfo.setStandName(beforeSarStandardsInfoEO.getStandName());
|
||||
saveUpdateLog(sarStandardsInfo,beforeSarStandardsInfoEO,reasonMsg);
|
||||
//更新日志
|
||||
sarStandardsInfoDao.updateById(sarStandardsInfo);
|
||||
}catch (Exception e){
|
||||
System.out.println("代替标准状态更新:id为"+key+"文本状态更新失败");
|
||||
@@ -311,4 +332,24 @@ public class ScheduledJob {
|
||||
logger.info("==================================更新文本状态结束======================================");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void saveUpdateLog(SarStandardsInfo sarStandardsInfoEO, SarStandardsInfo beforeSarStandardsInfo,String reasonMsg) throws Exception {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
Map<String, Object> oldMap = new HashMap<>();
|
||||
String attrStr = sarStandardsInfoEO.getSarStandAttrEOStr();
|
||||
if (StringUtils.isNotBlank(attrStr)) {
|
||||
newMap = JSONObject.fromObject(attrStr);
|
||||
}
|
||||
newMap.put("textStatus",sarStandardsInfoEO.getTextStatus());
|
||||
oldMap.put("textStatus",beforeSarStandardsInfo.getTextStatus());
|
||||
// 增加关联事件
|
||||
String number = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
|
||||
if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
|
||||
number += "-" + sarStandardsInfoEO.getStandYear();
|
||||
}
|
||||
String content ="==定时任务执行修改==:" + number + " 《" + sarStandardsInfoEO.getStandName() + "》"+reasonMsg;
|
||||
sarUpdLogEOService.createUpdateLog(sarStandardsInfoEO.getStandType() + "_STAND", sarStandardsInfoEO.getId(), oldMap, newMap, content);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-15
@@ -8,6 +8,7 @@ import com.adc.da.slrs.customWorkGroup.service.IWorkGroupService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.codec.language.Nysiis;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -37,18 +38,21 @@ public class WorkGroupController extends BaseController<WorkGroup> {
|
||||
@ApiModelProperty("新增工作组")
|
||||
@PostMapping
|
||||
public ResponseMessage addWorkGroup(WorkGroup workGroup) {
|
||||
String meg="";
|
||||
if (isDistinct(workGroup.getWorkGroup())){
|
||||
ResponseMessage<Object> result = Result.success();
|
||||
|
||||
if (isDistinct(workGroup.getWorkGroup(),null)){
|
||||
if (iWorkGroupService.add(workGroup)){
|
||||
meg="新增成功!";
|
||||
result=Result.success("200","新增成功");
|
||||
}else {
|
||||
meg="新增失败!";
|
||||
result=Result.error("201","新增失败");
|
||||
|
||||
}
|
||||
}else {
|
||||
meg="组名已存在!";
|
||||
result=Result.error("202","组名已存在");
|
||||
|
||||
}
|
||||
|
||||
return Result.success("200",meg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,32 +76,39 @@ public class WorkGroupController extends BaseController<WorkGroup> {
|
||||
@ApiModelProperty("修改工作组")
|
||||
@PutMapping
|
||||
public ResponseMessage updateWorkGroup(WorkGroup workGroup){
|
||||
String meg="";
|
||||
if (isDistinct(workGroup.getWorkGroup())){
|
||||
|
||||
ResponseMessage<Object> result = Result.success();
|
||||
|
||||
if (isDistinct(workGroup.getWorkGroup(),workGroup.getId())){
|
||||
if (iWorkGroupService.update(workGroup)){
|
||||
meg="修改成功!";
|
||||
result=Result.success("200", "修改成功");
|
||||
}else {
|
||||
meg="修改失败";
|
||||
result=Result.error("201", "修改失败");
|
||||
}
|
||||
|
||||
}else {
|
||||
meg="组名已存在!";
|
||||
result=Result.error("202", "组名已存在");
|
||||
}
|
||||
|
||||
return Result.success("200",meg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断提交的工作组名称是否重复
|
||||
* @param groupName
|
||||
* @return true 没有重复 false 有重复
|
||||
* @param groupName 条件
|
||||
* @param id 排除id
|
||||
* @returntrue 没有重复 false 有重复
|
||||
*/
|
||||
private boolean isDistinct(String groupName){
|
||||
private boolean isDistinct(String groupName,String id){
|
||||
|
||||
QueryWrapper<WorkGroup> ew = new QueryWrapper<>();
|
||||
|
||||
ew.eq("work_group_name",groupName);
|
||||
|
||||
if (id!=null){
|
||||
ew.ne("id",id);
|
||||
}
|
||||
|
||||
List<WorkGroup> list = iWorkGroupService.list(ew);
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
+2
@@ -135,6 +135,7 @@ public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> i
|
||||
selectFieldMap.put("standSort","STANDCLASSIFY");
|
||||
selectFieldMap.put("standState","STANDSTATE");
|
||||
selectFieldMap.put("standNature","STANDNATURE");
|
||||
selectFieldMap.put("textStatus","TEXTSTATUS");
|
||||
} else if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType) || SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
|
||||
selectFieldMap = InitStandAttrUtil.selectFieldMapLaws;
|
||||
selectFieldMap.put("isRelateAccess","SHIFOUGL");
|
||||
@@ -199,6 +200,7 @@ public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> i
|
||||
|
||||
public String changeStandName (String field,String sarType) throws Exception{
|
||||
switch (field) {
|
||||
case "textStatus":return "文本状态";
|
||||
case "country": return "适用区域";
|
||||
case "isRelateAccess": return "重要度";
|
||||
case "issueTime": return "发布日期";
|
||||
|
||||
Reference in New Issue
Block a user