diff --git a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java index 1bb2e13..32425b6 100644 --- a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java +++ b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java @@ -5,11 +5,13 @@ import com.zcloud.controller.base.BaseController; import com.zcloud.dto.Response; import com.zcloud.dto.TenCorpConst; import com.zcloud.dto.TenCorpDto; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.logs.LogAnno; import com.zcloud.service.eightwork.HotworkService; import com.zcloud.service.mq.SendMessageService; import com.zcloud.util.DateUtil; +import com.zcloud.util.Tools; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; @@ -66,4 +68,26 @@ public class AppHotworkController extends BaseController { map.put("result", errInfo); //返回结果 return map; } + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/list") + @ResponseBody + @LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "列表") + public Object list(Page page) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + page.setPd(pd); + List varList = hotworkService.list(page); //列出hotwork列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java index a4de844..e4b1455 100644 --- a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java @@ -1,7 +1,10 @@ package com.zcloud.mapper.datasource.eightwork; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import java.util.List; + /** * @author fangjiakai * @date 2024/01/17 11:31 @@ -10,5 +13,8 @@ public interface HotworkMapper { PageData getCode(PageData pd); void save(PageData pd); void delete(PageData pd); + void edit(PageData pd); + void editStep(PageData pd); + List datalistPage(Page page); } diff --git a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkSignMapper.java b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkSignMapper.java index b579305..60ce6fe 100644 --- a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkSignMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkSignMapper.java @@ -1,6 +1,5 @@ package com.zcloud.mapper.datasource.eightwork; -import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import java.util.List; @@ -25,9 +24,12 @@ public interface HotworkSignMapper { void edit(PageData pd); /**根据动火ID查询签字列表 - * @param page * @throws Exception */ - List listById(Page page); + List listById(PageData pd); + /**根据动火ID查询未签字列表 + * @throws Exception + */ + List checkUnsigned(PageData sign); } diff --git a/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkToMeasuresMapper.java b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkToMeasuresMapper.java new file mode 100644 index 0000000..0c29db5 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkToMeasuresMapper.java @@ -0,0 +1,55 @@ +package com.zcloud.mapper.datasource.eightwork; + +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; + +import java.util.List; + +/** + * 说明:动火措施中间表 + * 作者:luoxiaobao + * 时间:2021-09-18 + * 官网:www.zcloudchina.com + */ +public interface HotworkToMeasuresMapper { + + /**新增 + * @param pd + * @throws Exception + */ + void save(PageData pd); + + void saveBatch(List signers); + + /**删除 + * @param pd + * @throws Exception + */ + void delete(PageData pd); + + /**修改 + * @param pd + * @throws Exception + */ + void edit(PageData pd); + + /**列表(全部) + * @param pd + * @throws Exception + */ + List listAll(PageData pd); + + /**通过id获取数据 + * @param pd + * @throws Exception + */ + PageData findById(PageData pd); + + /**批量删除 + * @param ArrayDATA_IDS + * @throws Exception + */ + void deleteAll(String[] ArrayDATA_IDS); + +} + diff --git a/src/main/java/com/zcloud/service/eightwork/HotworkService.java b/src/main/java/com/zcloud/service/eightwork/HotworkService.java index 3099dd4..f5267ae 100644 --- a/src/main/java/com/zcloud/service/eightwork/HotworkService.java +++ b/src/main/java/com/zcloud/service/eightwork/HotworkService.java @@ -1,6 +1,10 @@ package com.zcloud.service.eightwork; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; /** * @author fangjiakai @@ -11,5 +15,10 @@ public interface HotworkService { void delete(PageData pd)throws Exception; + List list(Page page) throws Exception; + + void nextStep(PageData pd, MultipartFile file) throws Exception; + + void accept(PageData pd)throws Exception; void cancel(PageData pd)throws Exception; } diff --git a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java index feea65b..09168a0 100644 --- a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java +++ b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java @@ -4,18 +4,19 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.zcloud.dto.TenCorpConst; import com.zcloud.dto.TenCorpDto; +import com.zcloud.entity.Page; import com.zcloud.entity.PageData; -import com.zcloud.mapper.datasource.eightwork.EightWorkFlowLogMapper; -import com.zcloud.mapper.datasource.eightwork.EightWorkTaskFlowMapper; -import com.zcloud.mapper.datasource.eightwork.HotworkMapper; -import com.zcloud.mapper.datasource.eightwork.HotworkSignMapper; +import com.zcloud.mapper.datasource.eightwork.*; import com.zcloud.service.eightwork.HotworkService; import com.zcloud.service.mq.SendMessageService; +import com.zcloud.util.Const; import com.zcloud.util.DateUtil; +import com.zcloud.util.Smb; import com.zcloud.util.UuidUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import java.text.DecimalFormat; import java.util.*; @@ -31,14 +32,17 @@ public class HotworkServiceImpl implements HotworkService { @Autowired private HotworkMapper hotworkMapper; @Autowired - private SendMessageService sendMessageService; - @Autowired private EightWorkTaskFlowMapper eightWorkTaskFlowMapper; @Autowired private EightWorkFlowLogMapper eightWorkFlowLogMapper; @Autowired private HotworkSignMapper hotworkSignMapper; + @Autowired + private HotworkToMeasuresMapper hotworkToMeasuresMapper; + @Autowired + private Smb smb; + private final static String primary_key = "HOTWORK_ID"; @Override @Transactional public void save(PageData pd) throws Exception { @@ -53,37 +57,16 @@ public class HotworkServiceImpl implements HotworkService { pd2 = hotworkMapper.getCode(pd2); //根据ID读取 String code = "DH" + year + month + day + dft.format((Integer.parseInt(pd2.get("code").toString()) + 1)); pd.put("CHECK_NO", code); - pd.put("HOTWORK_ID", UuidUtil.get32UUID()); //主键 + pd.put(primary_key, UuidUtil.get32UUID()); //主键 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 hotworkMapper.save(pd); - List signers = new ArrayList<>(); - if (pd.get("PREPARERS") != null && !pd.get("PREPARERS").equals("")) { - List list = (List) JSON.parse(pd.get("PREPARERS").toString()); - Object STEP_ID = getStepId(1,"PREPARE_USER_ID"); - for (JSONObject json : list) { - if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null - && json.get("USER_ID") != "") { - PageData preparer = new PageData(); - preparer.put("HOTWORK_SIGN_ID", UuidUtil.get32UUID()); // 主键 - preparer.put("HOTWORK_ID", pd.get("HOTWORK_ID")); - preparer.put("CORPINFO_ID", pd.get("CORPINFO_ID")); - preparer.put("SIGN_USER_DEPARTMENT_ID", json.get("DEPARTMENT_ID")); - preparer.put("SIGN_USER_ID", json.get("USER_ID")); - preparer.put("STEP_ID", STEP_ID); - signers.add(preparer); - } - } - } - if(signers.size() > 0){ - hotworkSignMapper.saveBatch(signers); - } - if (pd.get("APPLY_STATUS").equals("1")) { - saveLog(pd); - sendMq(pd); +// PageData flow = getStep(pd.get("TASK_ID"),"1"); + saveLog(pd,pd.getString("CREATOR"),"1"); +// saveNext(pd,flow); } } @@ -93,39 +76,152 @@ public class HotworkServiceImpl implements HotworkService { } @Override - public void cancel(PageData pd)throws Exception{ - + public List list(Page page) throws Exception { + return hotworkMapper.datalistPage(page); } - private Object getStepId(Integer TASK_ID, String ACTOR_FIELD) throws Exception { + /* + * 下一步 + */ + @Override + @Transactional + public void nextStep(PageData pd, MultipartFile file) throws Exception { + //保存签名文件 + String ffile = DateUtil.getDays(); + String fileName = UuidUtil.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + String filePath = Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName; + + //保存签名信息 + PageData sign = new PageData(); + sign.put(primary_key, pd.get(primary_key)); + sign.put("STEP_ID", pd.get("STEP_ID")); + sign.put("SIGN_USER_ID", pd.get("USER_ID")); + sign.put("SIGN_USER_DEPARTMENT_ID", pd.get("DEPARTMENT_ID")); + sign.put("SIGN_TIME", DateUtil.date2Str(new Date())); + sign.put("SIGN_PATH", filePath); + sign.put("DESCR", pd.get("DESCR")); + + hotworkSignMapper.edit(sign); + + if (pd.get("PREPARERS") != null && !pd.get("PREPARERS").equals("")) { + savePreparers(pd); + } + + if (pd.get("MEASURES") != null && !pd.get("MEASURES").equals("")) { + saveMeasures(pd); + } + + List unsignedList = hotworkSignMapper.checkUnsigned(sign);//当前步骤未签名人列表 + if(unsignedList == null || unsignedList.size() == 0){//如果没有未签人 则跳转下一步 + PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID")); + pd.put("STEP_ID",flow.get("NEXT_STEP_ID")); + hotworkMapper.edit(pd); + + //提前保存下一步签字人 + List signers = new ArrayList<>(); + PageData signer = new PageData(); + signer.put("HOTWORK_SIGN_ID", UuidUtil.get32UUID()); // 主键 + signer.put(primary_key, pd.get(primary_key)); + signer.put("CORPINFO_ID", pd.get("CORPINFO_ID")); + signer.put("SIGN_USER_DEPARTMENT_ID", pd.get(flow.get("NEXT_ACTOR_FIELD"))); + signer.put("SIGN_USER_ID", pd.get(flow.get("NEXT_ACTOR_FIELD"))); + signer.put("STEP_ID", flow.get("NEXT_STEP_ID")); + signers.add(signer); + if(signers.size() > 0){ + hotworkSignMapper.saveBatch(signers); + } + //保存日志 + saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1"); + } + } + + private void saveMeasures(PageData pd) { + List list = (List) JSON.parse(pd.get("PREPARERS").toString()); + for (JSONObject json : list) { + if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null + && json.get("USER_ID") != "") { + PageData measure = new PageData(); + measure.put("HOTWORKTOMEASURES_ID",json.get("BUS_HOTWORK_MEASURES_ID")); + measure.put("STATUS", json.get("STATUS")); + measure.put("ANSWER1", json.get("ANSWER1")); + measure.put("ANSWER2", json.get("ANSWER2")); + measure.put("ANSWER3", json.get("ANSWER3")); + measure.put("ANSWER4", json.get("ANSWER4")); + measure.put("SIGN_PATH", json.get("SIGN_PATH")); + measure.put("IMG_PATH", json.get("IMG_PATH")); + hotworkToMeasuresMapper.edit(measure); + } + } + } + + private void savePreparers(PageData pd) { + List signers = new ArrayList<>(); + List list = (List) JSON.parse(pd.get("PREPARERS").toString()); + for (JSONObject json : list) { + if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null + && json.get("USER_ID") != "") { + PageData preparer = new PageData(); + preparer.put("HOTWORKTOMEASURES_ID", UuidUtil.get32UUID()); // 主键 + preparer.put("HOTWORK_ID", pd.get("HOTWORK_ID")); + preparer.put("BUS_HOTWORK_MEASURES_ID", json.get("BUS_HOTWORK_MEASURES_ID")); + preparer.put("CONFIRM_ID", json.get("USER_ID")); + signers.add(preparer); + } + } + if(signers.size() > 0){ + hotworkToMeasuresMapper.saveBatch(signers); + } + } + + /** + * 验收归档 + */ + @Override + public void accept(PageData pd)throws Exception{ + PageData flow = getStep(pd.get("TASK_ID"), 99); + hotworkMapper.edit(pd); + saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1"); + } + + /** + * 取消 + */ + @Override + public void cancel(PageData pd)throws Exception{ + PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID")); + hotworkMapper.edit(pd); + saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"-1"); + } + + private PageData getStep(Object TASK_ID, Object STEP_ID) throws Exception { PageData flow = new PageData(); flow.put("TASK_ID", TASK_ID); - flow.put("ACTOR_FIELD", ACTOR_FIELD); + flow.put("STEP_ID", STEP_ID); flow = eightWorkTaskFlowMapper.getStep(flow); - return flow.get("STEP_ID"); + return flow; } - private void saveLog(PageData pd) throws Exception { + private void saveLog(PageData pd,String act_user,String status) throws Exception { PageData log = new PageData(); log.put("LOG_ID", UuidUtil.get32UUID()); - log.put("WORK_ID", pd.get("HOTWORK_ID")); + log.put("WORK_ID", pd.get(primary_key)); log.put("TASK_ID", pd.get("TASK_ID")); log.put("STEP_ID", pd.get("STEP_ID")); - log.put("ACT_USER", pd.get("HOTWORK_ID")); - log.put("ACT_TIME", pd.get("CREATTIME")); - log.put("STATUS", "1"); + log.put("ACT_USER", act_user); + log.put("ACT_TIME", DateUtil.date2Str(new Date())); + log.put("STATUS", status); eightWorkFlowLogMapper.save(log); } - private void sendMq(PageData pd) throws Exception { - TenCorpDto tenCorpDto = new TenCorpDto(); - tenCorpDto.setMark(pd.getString("HOTWORK_ID")); - tenCorpDto.setMark_name("HOTWORK_ID"); - tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); - tenCorpDto.setData(pd); - tenCorpDto.setMessage(TenCorpConst.hotWork); +// private void saveNext(PageData pd,PageData flow) throws Exception { +// PageData log = new PageData(); +// log.put("LOG_ID", UuidUtil.get32UUID()); +// log.put("WORK_ID", pd.get(primary_key)); +// log.put("TASK_ID", pd.get("TASK_ID")); +// log.put("STEP_ID", flow.get("NEXT_STEP_ID")); +// log.put("STATUS", "0"); +// eightWorkFlowLogMapper.save(log); +// } - sendMessageService.sendDelayQueue(tenCorpDto); - } } diff --git a/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml b/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml index 39c12ac..f727bfd 100644 --- a/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml @@ -55,13 +55,19 @@ diff --git a/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml b/src/main/resources/mybatis/datasource/eightwork/HighWorkMapper.xml similarity index 84% rename from src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml rename to src/main/resources/mybatis/datasource/eightwork/HighWorkMapper.xml index fd452ec..d59bb55 100644 --- a/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/HighWorkMapper.xml @@ -3,7 +3,7 @@ - BUS_HIGHWORK + BUS_HOTWORK @@ -220,4 +220,38 @@ where HIGHWORK_ID = #{HIGHWORK_ID} + + + + update + + set + STEP_ID = #{pd.STEP_ID} + where + HIGHWORK_ID = #{HIGHWORK_ID} + + + diff --git a/src/main/resources/mybatis/datasource/eightwork/HotworkSignMapper.xml b/src/main/resources/mybatis/datasource/eightwork/HotworkSignMapper.xml index 72639ff..01da704 100644 --- a/src/main/resources/mybatis/datasource/eightwork/HotworkSignMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/HotworkSignMapper.xml @@ -66,17 +66,21 @@ insert into ( - - ) values ( + HOTWORK_SIGN_ID, + HOTWORK_ID, + CORPINFO_ID, + SIGN_USER_DEPARTMENT_ID, + SIGN_USER_ID, + STEP_ID + ) values - #{item.HOTWORK_SIGN_ID}, + (#{item.HOTWORK_SIGN_ID}, #{item.HOTWORK_ID}, #{item.CORPINFO_ID}, #{item.SIGN_USER_DEPARTMENT_ID}, #{item.SIGN_USER_ID}, - #{item.STEP_ID} + #{item.STEP_ID}) - ) @@ -88,10 +92,10 @@ SIGN_PATH = #{SIGN_PATH}, SIGN_TIME= #{SIGN_TIME}, where - HOTWORK_ID = #{HOTWORK_ID} and SIGN_USER_ID = #{SIGN_USER_ID} + HOTWORK_ID = #{HOTWORK_ID} and SIGN_USER_ID = #{SIGN_USER_ID} and STEP_ID = #{STEP_ID} - select from @@ -101,4 +105,16 @@ order by f.SIGN_TIME desc + + + diff --git a/src/main/resources/mybatis/datasource/eightwork/HotworkToMeasuresMapper.xml b/src/main/resources/mybatis/datasource/eightwork/HotworkToMeasuresMapper.xml new file mode 100644 index 0000000..ec5adbd --- /dev/null +++ b/src/main/resources/mybatis/datasource/eightwork/HotworkToMeasuresMapper.xml @@ -0,0 +1,145 @@ + + + + + + + BUS_HOTWORKTOMEASURES + + + + + SYS_DICTIONARIES + + + + + f.HOTWORK_ID, + f.BUS_HOTWORK_MEASURES_ID, + f.STATUS, + f.ANSWER1, + f.ANSWER2, + f.ANSWER3, + f.ANSWER4, + f.HOTWORKTOMEASURES_ID, + f.CONFIRM_ID, + f.SIGN_PATH, + f.IMG_PATH + + + + + HOTWORK_ID, + BUS_HOTWORK_MEASURES_ID, + STATUS, + ANSWER1, + ANSWER2, + ANSWER3, + ANSWER4, + HOTWORKTOMEASURES_ID, + CONFIRM_ID, + SIGN_PATH, + IMG_PATH + + + + + #{HOTWORK_ID}, + #{BUS_HOTWORK_MEASURES_ID}, + #{STATUS}, + #{ANSWER1}, + #{ANSWER2}, + #{ANSWER3}, + #{ANSWER4}, + #{HOTWORKTOMEASURES_ID}, + #{CONFIRM_ID}, + #{SIGN_PATH}, + #{IMG_PATH} + + + + + insert into + + ( + + ) values ( + + ) + + + + insert into + + ( + HOTWORK_ID, + BUS_HOTWORK_MEASURES_ID, + HOTWORKTOMEASURES_ID, + CONFIRM_ID + ) values + + ( + #{item.HOTWORK_ID}, + #{item.BUS_HOTWORK_MEASURES_ID}, + #{item.HOTWORKTOMEASURES_ID}, + #{item.CONFIRM_ID} + ) + + + + + + delete from + + where + HOTWORK_ID = #{HOTWORK_ID} + + + + + update + + set + STATUS = #{STATUS}, + ANSWER1 = #{ANSWER1}, + ANSWER2 = #{ANSWER2}, + ANSWER3 = #{ANSWER3}, + ANSWER4 = #{ANSWER4}, + SIGN_PATH = #{SIGN_PATH}, + IMG_PATH = #{IMG_PATH} + where + HOTWORKTOMEASURES_ID = #{HOTWORKTOMEASURES_ID} + + + + + + + + + + + update + + set + ISDELETE = '1' + where + HOTWORKTOMEASURES_ID in + + #{item} + + + +