认证流程统一提交任务接口开发。
This commit is contained in:
+7
@@ -206,4 +206,11 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
|
||||
public Result<?> getFlowStatusList(@RequestParam("cut") String cut) {
|
||||
return this.projectCertificationInventoryEOService.getFlowStatusList(cut);
|
||||
}
|
||||
|
||||
@AutoLog(value = "项目库-认证清单表-认证流程统一提交任务接口")
|
||||
@ApiOperation(value="项目库-认证清单表-认证流程统一提交任务接口", notes="项目库-认证清单表-认证流程统一提交任务接口")
|
||||
@PostMapping(value = "/submitTask")
|
||||
public Result<?> submitTask(@RequestBody JSONObject json) {
|
||||
return this.projectCertificationInventoryEOService.submitTask(json);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-4
@@ -10,6 +10,7 @@ public enum CertificationFlowNodeEnum {
|
||||
|
||||
STUDIOFQ("studiofq","R&H Studio发起","R&H Studio initiate"),
|
||||
RZGCSJSRW ("rzgcsjsrw","认证工程师接受任务","Certified engineers accept tasks"),
|
||||
RZGCSTHRW ("rzgcsthrw","认证工程师退回至studio任务","Certified engineer returns to studio task"),
|
||||
ZRRJSRW ("zrrjsrw","责任人接受任务","The responsible person accepts the task"),
|
||||
ZRRTJRW ("zrrtjrw","责任人提交任务","The responsible person submits the task"),
|
||||
RZGCSSC ("rzgcssc","认证工程师审查","Certified engineer review"),
|
||||
@@ -51,15 +52,30 @@ public enum CertificationFlowNodeEnum {
|
||||
|
||||
public static String getTextByValue(String key,String cut) {
|
||||
CertificationFlowNodeEnum[] values = values();
|
||||
for (CertificationFlowNodeEnum inventoryAffirmNodeEnum : values) {
|
||||
if (inventoryAffirmNodeEnum.key.equals(key)) {
|
||||
for (CertificationFlowNodeEnum certificationFlowNodeEnum : values) {
|
||||
if (certificationFlowNodeEnum.key.equals(key)) {
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
return inventoryAffirmNodeEnum.cnName;
|
||||
return certificationFlowNodeEnum.cnName;
|
||||
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
return inventoryAffirmNodeEnum.enName;
|
||||
return certificationFlowNodeEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key获取枚举类
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static CertificationFlowNodeEnum getEnumByKey(String key) {
|
||||
CertificationFlowNodeEnum[] values = values();
|
||||
for (CertificationFlowNodeEnum certificationFlowNodeEnum : values) {
|
||||
if (certificationFlowNodeEnum.key.equals(key)) {
|
||||
return certificationFlowNodeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -114,4 +114,18 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
|
||||
String cut);
|
||||
|
||||
void createQueryPermission(QueryWrapper<ProjectCertificationInventoryEO> queryWrapper, String roleCode);
|
||||
|
||||
/**
|
||||
* 认证流程统一提交任务
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
Result<?> submitTask(JSONObject json);
|
||||
|
||||
/**
|
||||
* 认证工程师发起任务
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
Result<?> certificationInitiatingTask(JSONObject json);
|
||||
}
|
||||
|
||||
+74
@@ -615,4 +615,78 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
throw new JeroBootException("当前用户角色有误,请重新选择后角色进行操作!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<?> submitTask(JSONObject json) {
|
||||
String nodeKey = json.getString("nodeKey");
|
||||
|
||||
CertificationFlowNodeEnum flowNodeEnum = CertificationFlowNodeEnum.getEnumByKey(nodeKey);
|
||||
if(ObjectUtils.isEmpty(flowNodeEnum)){
|
||||
throw new JeroBootException("根据" + nodeKey + " 的操作节点没有获取到节点信息,请联系管理员!");
|
||||
}
|
||||
|
||||
switch (flowNodeEnum){
|
||||
case RZGCSJSRW:
|
||||
return this.certificationInitiatingTask(json);
|
||||
case RZGCSTHRW:
|
||||
|
||||
break;
|
||||
case ZRRJSRW:
|
||||
|
||||
break;
|
||||
case ZRRTJRW:
|
||||
|
||||
break;
|
||||
case RZGCSSC:
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new JeroBootException(nodeKey + " 的操作节点传递有误,请联系管理员!");
|
||||
}
|
||||
|
||||
return Result.OK("提交任务成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证工程师发起任务
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<?> certificationInitiatingTask(JSONObject json) {
|
||||
String ids = json.getString("ids");
|
||||
if(StringUtils.isEmpty(ids)){
|
||||
throw new JeroBootException("至少选择一条数据进行操作!");
|
||||
}
|
||||
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
List<String> flowStatusList = new ArrayList<>();
|
||||
flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
|
||||
flowStatusList.add(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue());
|
||||
|
||||
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList);
|
||||
queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
|
||||
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.list(queryWrapper);
|
||||
|
||||
if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){
|
||||
throw new JeroBootException("至少选择一条数据流程状态为'清单待校核 或 责任人拒绝的数据'!");
|
||||
}
|
||||
|
||||
try {
|
||||
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
|
||||
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
|
||||
}
|
||||
// 认证工程师发起任务,将数据的状态更新为 任务待确认。
|
||||
this.updateBatchById(projectCertificationInventoryEOList);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("认证工程师-发起认证清单任务失败:" + ex.getMessage());
|
||||
throw new JeroBootException("发起任务失败!");
|
||||
}
|
||||
|
||||
return Result.OK("发起任务成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user