|
@@ -237,28 +237,30 @@ public class StDingProcServiceImpl extends ServiceImpl<ShantaiMapper, Shantai> i
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public McR commentSync(Map map,String flowId){
|
|
public McR commentSync(Map map,String flowId){
|
|
- String procInstId = map.get("procInstId").toString();
|
|
|
|
- //查询表中是否存在同步评论记录
|
|
|
|
- LambdaQueryWrapper<Shantai> shantaiLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
- shantaiLambdaQueryWrapper.eq(Shantai::getProcInstId,procInstId)
|
|
|
|
- .eq(Shantai::getValidFlag,"1");
|
|
|
|
- Shantai shantai = shantaiMapper.selectOne(shantaiLambdaQueryWrapper);
|
|
|
|
|
|
+ try{
|
|
|
|
+ String procInstId = map.get("procInstId").toString();
|
|
|
|
|
|
- //获取提交人
|
|
|
|
- String userId = "";
|
|
|
|
|
|
+ //查询表中是否存在同步评论记录
|
|
|
|
+ LambdaQueryWrapper<Shantai> shantaiLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ shantaiLambdaQueryWrapper.eq(Shantai::getProcInstId,procInstId)
|
|
|
|
+ .eq(Shantai::getValidFlag,"1");
|
|
|
|
+ Shantai shantai = shantaiMapper.selectOne(shantaiLambdaQueryWrapper);
|
|
|
|
|
|
- if (Objects.nonNull(shantai)){
|
|
|
|
- if (shantai.getState().equals("1")){
|
|
|
|
- log.info("该单据Id:{}已同步过水单,本次不进行同步",flowId);
|
|
|
|
- return McR.success();
|
|
|
|
|
|
+ //获取提交人
|
|
|
|
+ String userId = "";
|
|
|
|
+
|
|
|
|
+ if (Objects.nonNull(shantai)){
|
|
|
|
+ if (shantai.getState().equals("1")){
|
|
|
|
+ log.info("该单据Id:{}已同步过水单,本次不进行同步",flowId);
|
|
|
|
+ return McR.success();
|
|
|
|
+ }
|
|
|
|
+ userId = shantai.getUserId();
|
|
}
|
|
}
|
|
- userId = shantai.getUserId();
|
|
|
|
- }
|
|
|
|
- if (Objects.isNull(userId)){
|
|
|
|
- userId = map.get("userId").toString();
|
|
|
|
- }
|
|
|
|
- //上传钉盘目前设置为管理员
|
|
|
|
- String unionId = operatorUnionId;
|
|
|
|
|
|
+ if (Objects.isNull(userId)){
|
|
|
|
+ userId = map.get("userId").toString();
|
|
|
|
+ }
|
|
|
|
+ //上传钉盘目前设置为管理员
|
|
|
|
+ String unionId = operatorUnionId;
|
|
|
|
|
|
/*DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", userId), DDR_New.class);
|
|
/*DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", userId), DDR_New.class);
|
|
Map result = (Map) ddrNew.getResult();
|
|
Map result = (Map) ddrNew.getResult();
|
|
@@ -270,61 +272,64 @@ public class StDingProcServiceImpl extends ServiceImpl<ShantaiMapper, Shantai> i
|
|
userId = operatorUserId;//曹艳杰
|
|
userId = operatorUserId;//曹艳杰
|
|
}*/
|
|
}*/
|
|
|
|
|
|
- //获取附件上传到钉盘
|
|
|
|
- List<String> paths = (List<String>) map.get("paths");
|
|
|
|
- List<Map> dentries = new ArrayList<>();
|
|
|
|
- if (Objects.nonNull(paths) && !paths.isEmpty()){
|
|
|
|
- for (String path : paths) {
|
|
|
|
- File file = new File(path);
|
|
|
|
- try{
|
|
|
|
- //上传文件至钉盘
|
|
|
|
- Map dentry = upload(file,unionId);
|
|
|
|
- dentries.add(dentry);
|
|
|
|
- }catch (IOException e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.info("上传文件至钉盘失败:{}",e.getMessage());
|
|
|
|
- return McR.errorUnknown("上传文件至钉盘失败");
|
|
|
|
|
|
+ //获取附件上传到钉盘
|
|
|
|
+ List<String> paths = (List<String>) map.get("paths");
|
|
|
|
+ List<Map> dentries = new ArrayList<>();
|
|
|
|
+ if (Objects.nonNull(paths) && !paths.isEmpty()){
|
|
|
|
+ for (String path : paths) {
|
|
|
|
+ File file = new File(path);
|
|
|
|
+ try{
|
|
|
|
+ //上传文件至钉盘
|
|
|
|
+ Map dentry = upload(file,unionId);
|
|
|
|
+ dentries.add(dentry);
|
|
|
|
+ }catch (IOException e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.info("上传文件至钉盘失败:{}",e.getMessage());
|
|
|
|
+ return McR.errorUnknown("上传文件至钉盘失败");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- String state = map.get("state").toString();
|
|
|
|
|
|
+ String state = map.get("state").toString();
|
|
|
|
|
|
- if (Objects.nonNull(shantai) && shantai.getState().equals("2") && dentries.isEmpty()){
|
|
|
|
- log.info("该单据Id:{}本次无水单上传,不进行同步",flowId);
|
|
|
|
- return McR.success();
|
|
|
|
- }
|
|
|
|
|
|
+ if (Objects.nonNull(shantai) && shantai.getState().equals("2") && dentries.isEmpty()){
|
|
|
|
+ log.info("该单据Id:{}本次无水单上传,不进行同步",flowId);
|
|
|
|
+ return McR.success();
|
|
|
|
+ }
|
|
|
|
|
|
- //新增评论
|
|
|
|
|
|
+ //新增评论
|
|
// comment(dentries,state,userId,procInstId);
|
|
// comment(dentries,state,userId,procInstId);
|
|
- //20241018 评论人统一改为曹艳杰
|
|
|
|
- comment(dentries,state,operatorUserId,procInstId);
|
|
|
|
-
|
|
|
|
- if (Objects.isNull(shantai)){
|
|
|
|
- //更新表中同步状态
|
|
|
|
- shantai = new Shantai();
|
|
|
|
- if (dentries.isEmpty()){
|
|
|
|
- shantai.setState("2");
|
|
|
|
- }else {
|
|
|
|
- shantai.setState("1");
|
|
|
|
- }
|
|
|
|
- shantai.setFlowId(flowId);
|
|
|
|
- shantai.setProcInstId(procInstId);
|
|
|
|
- shantai.setUserId(userId);
|
|
|
|
- shantaiMapper.insert(shantai);
|
|
|
|
- }else {
|
|
|
|
- //更新表中同步状态
|
|
|
|
- if (dentries.isEmpty()){
|
|
|
|
- shantai.setState("2");
|
|
|
|
|
|
+ //20241018 评论人统一改为曹艳杰
|
|
|
|
+ comment(dentries,state,operatorUserId,procInstId);
|
|
|
|
+
|
|
|
|
+ if (Objects.isNull(shantai)){
|
|
|
|
+ //更新表中同步状态
|
|
|
|
+ shantai = new Shantai();
|
|
|
|
+ if (dentries.isEmpty()){
|
|
|
|
+ shantai.setState("2");
|
|
|
|
+ }else {
|
|
|
|
+ shantai.setState("1");
|
|
|
|
+ }
|
|
shantai.setFlowId(flowId);
|
|
shantai.setFlowId(flowId);
|
|
|
|
+ shantai.setProcInstId(procInstId);
|
|
|
|
+ shantai.setUserId(userId);
|
|
|
|
+ shantaiMapper.insert(shantai);
|
|
}else {
|
|
}else {
|
|
- shantai.setState("1");
|
|
|
|
- shantai.setFlowId(flowId);
|
|
|
|
|
|
+ //更新表中同步状态
|
|
|
|
+ if (dentries.isEmpty()){
|
|
|
|
+ shantai.setState("2");
|
|
|
|
+ shantai.setFlowId(flowId);
|
|
|
|
+ }else {
|
|
|
|
+ shantai.setState("1");
|
|
|
|
+ shantai.setFlowId(flowId);
|
|
|
|
+ }
|
|
|
|
+ //更新评论状态
|
|
|
|
+ shantaiMapper.updateById(shantai);
|
|
}
|
|
}
|
|
- //更新评论状态
|
|
|
|
- shantaiMapper.updateById(shantai);
|
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.info("单据Id:{}同步失败,原因:{}",flowId,e.getMessage());
|
|
|
|
+ return McR.errorUnknown("同步评论失败");
|
|
}
|
|
}
|
|
-
|
|
|
|
return McR.success();
|
|
return McR.success();
|
|
}
|
|
}
|
|
|
|
|