diff --git a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java new file mode 100644 index 0000000..c342b15 --- /dev/null +++ b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java @@ -0,0 +1,54 @@ +package com.zcloud.controller.eightwork; + +import com.alibaba.fastjson.JSONObject; +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.PageData; +import com.zcloud.logs.LogAnno; +import com.zcloud.service.eightwork.HotworkService; +import com.zcloud.service.mq.SendMessageService; +import com.zcloud.util.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.text.DecimalFormat; +import java.util.*; + +/** + * 说明:动火作业 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/app/hotwork") +public class AppHotworkController extends BaseController { + @Autowired + private HotworkService hotworkService; + + + /** + * 新增 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/add") + @ResponseBody + @Transactional + @LogAnno(menuType = "手机", menuServer = "动火作业", instructionsOperate = "动火作业", instructionsType = "新增") + @SuppressWarnings("all") + public Object add() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + hotworkService.save(pd); + + 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 new file mode 100644 index 0000000..85c10e6 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/HotworkMapper.java @@ -0,0 +1,11 @@ +package com.zcloud.mapper.datasource.eightwork; + +import com.zcloud.entity.PageData; + +/** + * @author fangjiakai + * @date 2024/01/17 11:31 + */ +public interface HotworkMapper { + PageData getCode(PageData pd); +} diff --git a/src/main/java/com/zcloud/service/eightwork/HotworkService.java b/src/main/java/com/zcloud/service/eightwork/HotworkService.java new file mode 100644 index 0000000..d5f8b82 --- /dev/null +++ b/src/main/java/com/zcloud/service/eightwork/HotworkService.java @@ -0,0 +1,11 @@ +package com.zcloud.service.eightwork; + +import com.zcloud.entity.PageData; + +/** + * @author fangjiakai + * @date 2024/01/17 11:29 + */ +public interface HotworkService { + void save(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 new file mode 100644 index 0000000..383470c --- /dev/null +++ b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java @@ -0,0 +1,60 @@ +package com.zcloud.service.eightwork.impl; + +import com.zcloud.dto.TenCorpConst; +import com.zcloud.dto.TenCorpDto; +import com.zcloud.entity.PageData; +import com.zcloud.mapper.datasource.eightwork.HotworkMapper; +import com.zcloud.service.eightwork.HotworkService; +import com.zcloud.service.mq.SendMessageService; +import com.zcloud.util.DateUtil; +import com.zcloud.util.UuidUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.DecimalFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * @author fangjiakai + * @date 2024/01/17 11:30 + */ +@Service +@Transactional //开启事物 +public class HotworkServiceImpl implements HotworkService { + + @Autowired + private HotworkMapper hotworkMapper; + @Autowired + private SendMessageService sendMessageService; + + @Override + public void save(PageData pd) throws Exception { + PageData pd2 = new PageData(); + Calendar calendar = Calendar.getInstance(); + DecimalFormat dft=new DecimalFormat("00"); + int year = calendar.get(Calendar.YEAR); + String month = dft.format(calendar.get(Calendar.MONTH) + 1); + String day = dft.format(calendar.get(Calendar.DAY_OF_MONTH)); + pd2.put("CREATDATE",year + "-" + month + "-" + day); + pd2.put("CORPINFO_ID",pd.get("CORPINFO_ID")); + 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("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 + + 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); + + sendMessageService.sendDelayQueue(tenCorpDto); + } +} diff --git a/src/main/java/com/zcloud/service/risk/impl/RiskPointServiceImpl.java b/src/main/java/com/zcloud/service/risk/impl/RiskPointServiceImpl.java index 12ab5c8..d0a7e10 100644 --- a/src/main/java/com/zcloud/service/risk/impl/RiskPointServiceImpl.java +++ b/src/main/java/com/zcloud/service/risk/impl/RiskPointServiceImpl.java @@ -261,7 +261,7 @@ public class RiskPointServiceImpl implements RiskPointService { pages.put("showCount", page.getShowCount()); pages.put("totalPage", page.getTotalPage()); pages.put("currentPage", page.getCurrentPage()); - map.put("page", pages); + map.put("page", page); return map; } diff --git a/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml b/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml new file mode 100644 index 0000000..e69de29