临时用电 暂时提交 报错未解决

pull/3/head
zhaoyu 2023-12-13 09:18:54 +08:00
parent cce02a4d42
commit 7f3883c401
1 changed files with 370 additions and 47 deletions

View File

@ -3,6 +3,8 @@ package com.zcloud.controller.gf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.mq.Response;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.gf.*;
@ -11,13 +13,14 @@ import org.apache.commons.lang.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -30,6 +33,8 @@ import java.util.*;
@RequestMapping("/app/gfElectricity")
public class AppGFElectricityController extends BaseController {
@Resource
private GFElectricityAcceptUserService electricityacceptuserService;
@Resource
private GFElectricityService GFelectricityService;
@Resource
@ -40,6 +45,12 @@ public class AppGFElectricityController extends BaseController {
private GFElectricityGasService GFelectricityGasService;
@Autowired
private SendMessageUtil sendMessageUtil;
@Autowired
private Smb smb;
@Resource
private MqClient mqClient;
/**
* @param
* @throws Exception
@ -77,6 +88,18 @@ public class AppGFElectricityController extends BaseController {
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
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 = GFelectricityService.getCode(pd2); //根据ID读取
String code = "YD"+year + month + day + dft.format((Integer.parseInt(pd2.get("code").toString())+1));
pd = this.getPageData();
pd.put("CHECK_NO", code);
pd.put("ELECTRICITY_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
@ -120,7 +143,41 @@ public class AppGFElectricityController extends BaseController {
params4.put("name", "params3");// 存入短信模板中的参数名称
params4.put("value", "确认");// 存入上面参数名称所传递的值
paramsList.add(params4);
//sendMessageUtil.sendMessages(mes, paramsList);
sendMessageUtil.sendMessages(mes, paramsList);
}
if("1".equals(pd.get("ISANALYZE"))){
TenCorpDto tenCorpDto = new TenCorpDto();
tenCorpDto.setMark(pd.getString("ELECTRICITY_ID"));
tenCorpDto.setMark_name("ELECTRICITY_ID");
tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000");
tenCorpDto.setTopic("eightWork");
tenCorpDto.setData(pd);
tenCorpDto.setMessage(TenCorpConst.electricity);
Response response = mqClient.sendDelayQueue(tenCorpDto);
if (!"succeed".equals(response.getResult()) || !"0".equals(response.getCode())){
throw new RuntimeException("系统异常");
}
System.out.println("amazing:!!!!!"+JSONObject.toJSONString(response));
// 发短信
PageData mes1 = new PageData();
mes1.put("RECEIVER_ID", pd.get("ANALYZE_USER_ID"));// 收信人userid
mes1.put("templateCode", "DH_QT");// 短信模板编码
mes1.put("SMSCode", "SMS_223540753");// 短信模板编码
mes1.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList1 = new ArrayList<PageData>();
// 第1个参数
PageData params5 = new PageData();
params5.put("name", "params1");// 存入短信模板中的参数名称
params5.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList1.add(params5);
// 第2个参数
PageData params6 = new PageData();
params6.put("name", "params2");// 存入短信模板中的参数名称
params6.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList1.add(params6);
sendMessageUtil.sendMessages(mes1, paramsList1);
}
map.put("result", errInfo);
return map;
@ -194,6 +251,21 @@ public class AppGFElectricityController extends BaseController {
paramsList.add(params4);
sendMessageUtil.sendMessages(mes, paramsList);
}
if("1".equals(pd.get("ISANALYZE"))){
TenCorpDto tenCorpDto = new TenCorpDto();
tenCorpDto.setMark(pd.getString("ELECTRICITY_ID"));
tenCorpDto.setMark_name("ELECTRICITY_ID");
tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000");
tenCorpDto.setTopic("eightWork");
tenCorpDto.setData(pd);
tenCorpDto.setMessage(TenCorpConst.electricity);
Response response = mqClient.sendDelayQueue(tenCorpDto);
if (!"succeed".equals(response.getResult()) || !"0".equals(response.getCode())){
throw new RuntimeException("系统异常");
}
System.out.println("amazing:!!!!!"+JSONObject.toJSONString(response));
}
map.put("result", errInfo);
return map;
}
@ -220,7 +292,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("GUARDIAN_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("GUARDIAN_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
@ -254,7 +326,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("CONFESS_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("CONFESS_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
@ -272,9 +344,7 @@ public class AppGFElectricityController extends BaseController {
@RequestMapping(value="/editAcceptconfess")
@ResponseBody
@Transactional
public Object editAcceptconfess(
@RequestParam(value="FFILE",required=false) MultipartFile[] files
) throws Exception {
public Object editAcceptconfess(MultipartRequest request) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
@ -283,22 +353,186 @@ public class AppGFElectricityController extends BaseController {
pd2 = GFelectricityService.findById(pd);
pd2.put("OPERATOR", pd.get("OPERATOR")); //修改人
pd2.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
if (files != null && files.length > 0) {
MultipartFile file = files[0];
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
String signertime = "";
String SIGNTIME[] = pd.getString("SIGNTIME").split(",");
String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("ACCEPT_CONFESS_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("ACCEPT_CONFESS_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
// pd2.put("GUARDIAN_CONTENT", pd.get("CONTENT"));
// pd2.put("APPLY_STATUS", pd.get("APPLY_STATUS"));
GFelectricityService.edit(pd2);
for (int i = 0; i < SIGNTIME.length; i++) {
signertime = SIGNTIME[i];
fileList.add(request.getFile("file"+i));
MultipartFile[] fileArr = new MultipartFile[fileList.size()];
saveImg(fileList.toArray(fileArr),signertime,pd.getString("ELECTRICITY_ID"),pd.getString("CORPINFO_ID"),pd.getString("ACCEPT_CONFESS_USER_ID"),pd.getString("ACCEPT_CONFESS_DEPARTMENT_ID"));
fileList.clear();
}
map.put("result", errInfo);
return map;
}
private void saveImg(MultipartFile[] files,String signertime, String ELECTRICITY_ID, String CORPINFO_ID, String ACCEPT_CONFESS_USER_ID, String ACCEPT_CONFESS_DEPARTMENT_ID) throws Exception{
if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) {
PageData pd = new PageData();
pd = this.getPageData();
MultipartFile file = files[i];
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName,Const.FILEPATHFILE + CORPINFO_ID + "/" + ffile);
pd.put("ACCEPT_CONFESS_USER_SIGNER_TIME", signertime);
pd.put("ACCEPT_CONFESS_ID", this.get32UUID());
pd.put("OPERATOR", pd.get("OPERATOR")); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ACCEPT_CONFESS_USER_SIGNER_PATH", Const.FILEPATHFILE + CORPINFO_ID + "/" + ffile + "/" + fileName);
pd.put("ISDELETE", '0');
pd.put("CORPINFO_ID", CORPINFO_ID);
pd.put("ELECTRICITY_ID", ELECTRICITY_ID);
pd.put("ACCEPT_CONFESS_USER_ID", ACCEPT_CONFESS_USER_ID);
pd.put("ACCEPT_CONFESS_DEPARTMENT_ID", ACCEPT_CONFESS_DEPARTMENT_ID);
pd.put("ACCEPT_USER_ID","");
pd.put("ACCEPT_DEPARTMENT_ID", "");
electricityacceptuserService.save(pd);
}
}
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/editAcceptStatus")
@ResponseBody
@Transactional
public Object editAcceptStatus(MultipartRequest request) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
PageData pd2 = new PageData();
pd2 = GFelectricityService.findById(pd);
pd2.put("OPERATOR", pd.get("OPERATOR")); //修改人
pd2.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
PageData log = new PageData();
log.put("ELECTRICITYLOG_ID", this.get32UUID());
// log.put("ACTION", "审核打回");
log.put("ELECTRICITY_ID", pd.get("ELECTRICITY_ID"));
log.put("CREATOR",pd.get("ACTION_USER"));
log.put("CREATTIME", DateUtil.date2Str(new Date()));
String status = pd.get("STATUS").toString();
if ("2".equals(status) || "3".equals(status) || "4".equals(status)) {
String OTHER_PROTECTIVE_MEASURES = (StringUtils.isNotBlank(pd2.getString("OTHER_PROTECTIVE_MEASURES")) ? pd2.getString("OTHER_PROTECTIVE_MEASURES") : "") +
(StringUtils.isNotBlank(pd.getString("OTHER_PROTECTIVE_MEASURES")) ? (pd.getString("OTHER_PROTECTIVE_MEASURES") + ";_;") : ";_;");
pd.put("OTHER_PROTECTIVE_MEASURES", OTHER_PROTECTIVE_MEASURES);
pd2.put("OTHER_PROTECTIVE_MEASURES", OTHER_PROTECTIVE_MEASURES);
} else if ("-2".equals(status) || "-3".equals(status) || "-4".equals(status) || "-5".equals(status)) {
//打回清空数据
pd2.put("OTHER_PROTECTIVE_MEASURES", "");
}
switch (status) {
case "5"://验收人
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
String signertime = "";
String SIGNTIME[] = pd.getString("SIGNTIME").split(",");
for (int i = 0; i < SIGNTIME.length; i++) {
signertime = SIGNTIME[i];
fileList.add(request.getFile("file"+i));
MultipartFile[] fileArr = new MultipartFile[fileList.size()];
saveAcceptImg(fileList.toArray(fileArr),signertime,pd.getString("ELECTRICITY_ID"),pd.getString("CORPINFO_ID"),pd.getString("ACCEPT_USER_ID"),pd.getString("ACCEPT_DEPARTMENT_ID"));
fileList.clear();
}
pd2.put("ACCEPT_CONTENT", pd.get("CONTENT"));
pd2.put("APPLY_STATUS", pd.get("APPLY_STATUS"));
GFelectricityService.edit(pd2);
log.put("ACTION", "验收通过");
// 发短信
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd2.get("APPLY_USER_ID"));// 收信人userid
mes.put("templateCode", "YD_Y05");// 短信模板编码
mes.put("SMSCode", "SMS_227250920");// 短信模板编码
mes.put("CORPINFO_ID", pd2.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd2.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "type");// 存入短信模板中的参数名称
params2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
break;
case "-5"://验收打回
log.put("ACTION", "验收人打回");
pd2.put("APPLY_STATUS", pd.get("APPLY_STATUS"));
pd2.put("ACCEPT_CONTENT", pd.get("CONTENT"));
GFelectricityService.edit(pd2);
PageData mes3 = new PageData();
mes3.put("RECEIVER_ID", pd2.get("APPLY_USER_ID"));// 收信人userid
mes3.put("templateCode", "YD_N05");// 短信模板编码
mes3.put("SMSCode", "SMS_223580715");// 短信模板编码
mes3.put("CORPINFO_ID", pd2.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList3 = new ArrayList<PageData>();
// 第1个参数
PageData paramsc1 = new PageData();
paramsc1.put("name", "params1");// 存入短信模板中的参数名称
paramsc1.put("value", pd2.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList3.add(paramsc1);
// 第2个参数
PageData paramsc2 = new PageData();
paramsc2.put("name", "params2");// 存入短信模板中的参数名称
paramsc2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList3.add(paramsc2);
// 第3个参数
PageData paramsc3 = new PageData();
paramsc3.put("name", "params3");// 存入短信模板中的参数名称
paramsc3.put("value", "验收");// 存入上面参数名称所传递的值
paramsList3.add(paramsc3);
sendMessageUtil.sendMessages(mes3, paramsList3);
break;
default:
break;
}
GFelectricityLogService.save(log);
map.put("result", errInfo);
return map;
}
private void saveAcceptImg(MultipartFile[] files,String signertime, String ELECTRICITY_ID, String CORPINFO_ID, String ACCEPT_USER_ID, String ACCEPT_DEPARTMENT_ID) throws Exception{
if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) {
PageData cpd = new PageData();
cpd = this.getPageData();
MultipartFile file = files[i];
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName,Const.FILEPATHFILE + CORPINFO_ID + "/" + ffile);
cpd.put("ACCEPT_USER_SIGNER_TIME", signertime);
cpd.put("ACCEPT_CONFESS_ID", this.get32UUID());
cpd.put("OPERATOR", cpd.get("OPERATOR")); //修改人
cpd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
cpd.put("ACCEPT_USER_SIGNER_PATH", Const.FILEPATHFILE + CORPINFO_ID + "/" + ffile + "/" + fileName);
cpd.put("ISDELETE", '0');
cpd.put("CORPINFO_ID", CORPINFO_ID);
cpd.put("ELECTRICITY_ID", ELECTRICITY_ID);
cpd.put("ACCEPT_USER_ID", ACCEPT_USER_ID);
cpd.put("ACCEPT_CONFESS_DEPARTMENT_ID", "");
cpd.put("ACCEPT_CONFESS_USER_ID", "");
cpd.put("ACCEPT_DEPARTMENT_ID", ACCEPT_DEPARTMENT_ID);
electricityacceptuserService.save(cpd);
}
}
}
/**
* @param
* @throws Exception
@ -342,7 +576,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.putAll(pd);
pd2.put("CONFIRM_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
@ -393,6 +627,22 @@ public class AppGFElectricityController extends BaseController {
params4.put("value", "审核");// 存入上面参数名称所传递的值
paramsList.add(params4);
sendMessageUtil.sendMessages(mes, paramsList);
if("1".equals(pd.get("ISANALYZE"))){
TenCorpDto tenCorpDto = new TenCorpDto();
tenCorpDto.setMark(pd.getString("ELECTRICITY_ID"));
tenCorpDto.setMark_name("ELECTRICITY_ID");
tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000");
tenCorpDto.setTopic("eightWork");
tenCorpDto.setData(pd);
tenCorpDto.setMessage(TenCorpConst.electricity);
Response response = mqClient.sendDelayQueue(tenCorpDto);
if (!"succeed".equals(response.getResult()) || !"0".equals(response.getCode())){
throw new RuntimeException("系统异常");
}
System.out.println("amazing:!!!!!"+JSONObject.toJSONString(response));
}
}
break;
@ -402,7 +652,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("AUDIT_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("AUDIT_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
@ -449,7 +699,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("APPROVE_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("APPROVE_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
@ -479,34 +729,14 @@ public class AppGFElectricityController extends BaseController {
// 第3个参数
PageData params3 = new PageData();
params3.put("name", "params2");// 存入短信模板中的参数名称
params3.put("value", "验收");// 存入上面参数名称所传递的值
params3.put("value", "用电单位审核");// 存入上面参数名称所传递的值
paramsList.add(params3);
// 第4个参数
PageData params4 = new PageData();
params4.put("name", "params3");// 存入短信模板中的参数名称
params4.put("value", "验收");// 存入上面参数名称所传递的值
params4.put("value", "审核");// 存入上面参数名称所传递的值
paramsList.add(params4);
sendMessageUtil.sendMessages(mes, paramsList);
// 发短信
PageData mes1 = new PageData();
mes1.put("RECEIVER_ID", pd2.get("ANALYZE_USER_ID"));// 收信人userid
mes1.put("templateCode", "YD_QT");// 短信模板编码
mes1.put("SMSCode", "SMS_223540753");// 短信模板编码
mes1.put("CORPINFO_ID", pd2.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList1 = new ArrayList<PageData>();
// 第1个参数
PageData params5 = new PageData();
params5.put("name", "params1");// 存入短信模板中的参数名称
params5.put("value", pd2.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList1.add(params5);
// 第2个参数
PageData params6 = new PageData();
params6.put("name", "params2");// 存入短信模板中的参数名称
params6.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList1.add(params6);
sendMessageUtil.sendMessages(mes1, paramsList1);
}
break;
@ -516,7 +746,7 @@ public class AppGFElectricityController extends BaseController {
String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd2.put("ACCEPT_USER_SIGNER_PATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd2.put("ACCEPT_USER_SIGNER_TIME", pd.get("SIGNER_TIME"));
@ -758,6 +988,96 @@ public class AppGFElectricityController extends BaseController {
return map;
}
/**
* @param out
* @throws Exception
*/
@PostMapping(value="/cancel")
@ResponseBody
public void cancel(@RequestBody PageData pd) throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
System.out.println(JSONObject.toJSONString(pd));
PageData cpd = new PageData();
cpd = GFelectricityService.findById(pd);
if(cpd!=null && cpd.size()>0 && cpd.getString("ANALYZE_TIME") != null){
String WORK_START_DATE = pd.getString("WORK_START_DATE");
String ANALYZE_TIME = cpd.getString("ANALYZE_TIME");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
System.out.println(WORK_START_DATE);
System.out.println(ANALYZE_TIME);
System.out.println("-------------123----------");
try {
Date date1 = format.parse(WORK_START_DATE);
Date date2 = format.parse(ANALYZE_TIME);
long workTime = date1.getTime();
long analyzeTime = date2.getTime();
System.out.println(workTime - analyzeTime);
System.out.println(analyzeTime - workTime);
if (workTime - analyzeTime >= 0) {
return;
} else {
GFelectricityService.cancel(pd);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YD_ZF");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}
} catch (ParseException e) {
e.printStackTrace();
}
}else{
GFelectricityService.cancel(pd);
PageData pd2 = new PageData();
pd2 = GFelectricityService.checkno(pd);
PageData pd3 = new PageData();
pd3.put("CHECK_NO",pd2.getString("CHECK_NO"));
pd3.put("CORPINFO_ID",pd.getString("CORPINFO_ID"));
GFelectricityService.editSpecialwork(pd3);
GFelectricityService.editSpecialwork1(pd3);
GFelectricityService.editSpecialwork2(pd3);
GFelectricityService.editSpecialwork3(pd3);
GFelectricityService.editSpecialwork4(pd3);
GFelectricityService.editSpecialwork5(pd3);
GFelectricityService.editSpecialwork6(pd3);
GFelectricityService.editSpecialwork7(pd3);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YD_ZF");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}
map.put("result", errInfo); //返回结果
return ;
}
/**
* @param
* @throws Exception
@ -772,6 +1092,8 @@ public class AppGFElectricityController extends BaseController {
pd = GFelectricityService.findById(pd); //根据ID读取
map.put("measuresList", GFelectricityService.listAllMeasures(pd));
map.put("gasList", GFelectricityGasService.listAll(pd));
map.put("imgList1",electricityacceptuserService.findById(pd));
map.put("imgList",electricityacceptuserService.findByIds(pd));
map.put("pd", pd);
map.put("result", errInfo);
return map;
@ -824,6 +1146,7 @@ public class AppGFElectricityController extends BaseController {
pd.put("ELECTRICITYGAS_ID", this.get32UUID()); //主键
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
GFelectricityGasService.save(pd);
GFelectricityService.edittime(pd);
map.put("result", errInfo); //返回结果
return map;
}