动火作业

pull/4/head
fangjiakai 2024-01-17 13:41:44 +08:00
parent 20fdf49bbc
commit c3a95c61c0
6 changed files with 137 additions and 1 deletions

View File

@ -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<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hotworkService.save(pd);
map.put("result", errInfo);
return map;
}
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -261,7 +261,7 @@ public class RiskPointServiceImpl implements RiskPointService {
pages.put("showCount", page.getShowCount()); pages.put("showCount", page.getShowCount());
pages.put("totalPage", page.getTotalPage()); pages.put("totalPage", page.getTotalPage());
pages.put("currentPage", page.getCurrentPage()); pages.put("currentPage", page.getCurrentPage());
map.put("page", pages); map.put("page", page);
return map; return map;
} }