对接bug修复

pull/14/head
limingyu 2024-01-08 16:38:30 +08:00
parent d4d4de3185
commit 27f2bf7925
3 changed files with 32 additions and 9 deletions

View File

@ -7,7 +7,6 @@ import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.entity.system.Dictionaries;
import com.zcloud.entity.system.User;
import com.zcloud.service.bus.*;
import com.zcloud.service.highriskwork.HotWorkApplicationService;
import com.zcloud.service.highriskwork.HotWorkApplicationUserService;
@ -17,11 +16,8 @@ import com.zcloud.service.system.DictionariesService;
import com.zcloud.service.system.FHlogService;
import com.zcloud.util.*;
import com.zcloud.util.message.MessageService;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.xpath.SourceTree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@ -31,7 +27,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@ -236,7 +231,9 @@ public class AppHotWorkApplicationController extends BaseController {
PageData confinedPageData = new PageData(); // pd对接数据
confinedPageData.putAll(pd);
dockData.put("dockData", JSON.toJSONString(confinedPageData));
hotWorkApplicationUserService.saveUserByHot(pd.getString("HOTWORKAPPLICATION_ID"),pd);
Map<String, String> hotuserMap = new HashMap<>();
hotWorkApplicationUserService.saveUserByHot(pd.getString("HOTWORKAPPLICATION_ID"),pd,hotuserMap);
dockData.put("hotuserMap", JSON.toJSONString(hotuserMap));
hotworkapplicationService.save(pd);
this.sendNotice(pd); //发送通知公告
map.put("dockData", JSON.toJSONString(dockData));
@ -356,7 +353,9 @@ public class AppHotWorkApplicationController extends BaseController {
confinedPageData.putAll(pd);
dockData.put("dockData", JSON.toJSONString(confinedPageData));
hotworkapplicationService.edit(pd);
hotWorkApplicationUserService.saveUserByHot(pd.getString("HOTWORKAPPLICATION_ID"),pd);
Map<String, String> hotuserMap = new HashMap<>();
hotWorkApplicationUserService.saveUserByHot(pd.getString("HOTWORKAPPLICATION_ID"),pd, hotuserMap);
dockData.put("hotuserMap", JSON.toJSONString(hotuserMap));
this.sendNotice(pd);
map.put("dockData", JSON.toJSONString(dockData));
map.put("result", errInfo);

View File

@ -1,6 +1,8 @@
package com.zcloud.service.highriskwork;
import java.util.List;
import java.util.Map;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
@ -73,7 +75,7 @@ public interface HotWorkApplicationUserService{
/**
* @throws Exception
*/
public void saveUserByHot(String hotID, PageData hotPd)throws Exception;
public void saveUserByHot(String hotID, PageData hotPd, Map<String, String> syncMap)throws Exception;
/**
*

View File

@ -1,5 +1,6 @@
package com.zcloud.service.highriskwork.impl;
import com.alibaba.fastjson.JSON;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.highriskwork.HotWorkApplicationUserMapper;
@ -107,10 +108,13 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
/**
* @throws Exception
*/
public void saveUserByHot(String hotID, PageData hotPd)throws Exception{
public void saveUserByHot(String hotID, PageData hotPd, Map<String,String> syncMap)throws Exception{
if(!Tools.isEmpty(hotID)){
PageData del = new PageData();
del.put("FOREIGN_KEY",hotID);
PageData dockDatadel = new PageData(); // pd对接数据
dockDatadel.putAll(del);
syncMap.put("dockDatadel", JSON.toJSONString(dockDatadel));
hotworkapplicationuserMapper.delete(del); // 删除 项目相关人员
/**
@ -127,6 +131,8 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
"HOT_WORK_USER_ID","PROJECT_UNIT_LEADER_ID","UNIT_LEADER_ID",
"ISSUING_USER_ID","SAFETY_DIRECTOR_USER_ID",
"SITE_LEADER_ID" };
Map<String,String> userMap = new HashMap<>();
int count = 1;
for (int i = 0;i<userKey.length;i++){
if(!Tools.isEmpty(hotPd.get(userKey[i]))){
if(i == 2 && !"1".equals(hotPd.getString("JOB_TYPE_INDEX"))){
@ -147,6 +153,7 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
siteUesr.put("CREATTIME",DateUtil.date2Str(new Date()));
siteUesr.put("OPERATOR",hotPd.getString("loginUserId"));
siteUesr.put("OPERATTIME",DateUtil.date2Str(new Date()));
userMap.put("other1" + count,JSON.toJSONString(siteUesr));
hotworkapplicationuserMapper.save(siteUesr);
}
PageData siteUesr = new PageData();
@ -160,9 +167,12 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
siteUesr.put("CREATTIME",DateUtil.date2Str(new Date()));
siteUesr.put("OPERATOR",hotPd.getString("loginUserId"));
siteUesr.put("OPERATTIME",DateUtil.date2Str(new Date()));
userMap.put("other2" + count,JSON.toJSONString(siteUesr));
hotworkapplicationuserMapper.save(siteUesr);
}
count++;
}
syncMap.put("userMap", JSON.toJSONString(userMap));
/** 添加 动火操作人 **/
if(!Tools.isEmpty(hotPd.get("operatorUser"))){
String [] workOperators = hotPd.get("operatorUser").toString().split(";");
@ -178,6 +188,9 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
workOperator.put("CREATTIME",DateUtil.date2Str(new Date()));
workOperator.put("OPERATOR",hotPd.getString("loginUserId"));
workOperator.put("OPERATTIME",DateUtil.date2Str(new Date()));
PageData dockData3 = new PageData(); // pd对接数据
dockData3.putAll(workOperator);
syncMap.put("dockData3", JSON.toJSONString(dockData3));
hotworkapplicationuserMapper.save(workOperator); // 添加 动火操作人
}
}
@ -194,6 +207,9 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
workOperator.put("CREATTIME",DateUtil.date2Str(new Date()));
workOperator.put("OPERATOR",hotPd.getString("loginUserId"));
workOperator.put("OPERATTIME",DateUtil.date2Str(new Date()));
PageData dockData4 = new PageData(); // pd对接数据
dockData4.putAll(workOperator);
syncMap.put("dockData4", JSON.toJSONString(dockData4));
hotworkapplicationuserMapper.save(workOperator); //
}
if("1".equals(hotPd.getString("IS_GAS_TESTING"))){ //气体检测
@ -208,6 +224,9 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
hotUser.put("CREATTIME",DateUtil.date2Str(new Date()));
hotUser.put("OPERATOR",hotPd.getString("loginUserId"));
hotUser.put("OPERATTIME",DateUtil.date2Str(new Date()));
PageData dockData5 = new PageData(); // pd对接数据
dockData5.putAll(hotUser);
syncMap.put("dockData5", JSON.toJSONString(dockData5));
hotworkapplicationuserMapper.save(hotUser);
}
// 特级动火
@ -223,6 +242,9 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
hotUser.put("CREATTIME",DateUtil.date2Str(new Date()));
hotUser.put("OPERATOR",hotPd.getString("loginUserId"));
hotUser.put("OPERATTIME",DateUtil.date2Str(new Date()));
PageData dockData6 = new PageData(); // pd对接数据
dockData6.putAll(hotUser);
syncMap.put("dockData6", JSON.toJSONString(dockData6));
hotworkapplicationuserMapper.save(hotUser);
}
}