Commit d815c99b authored by 刘林's avatar 刘林

fix(jg):超设计使用年限功能开发

parent 79684bb7
......@@ -119,4 +119,7 @@ public class JgUseRegistrationManageDto extends BaseDto {
@ApiModelProperty(value = "变更原因")
private String changeReason;
@ApiModelProperty(value = "是否超设计使用年限(0-否,1-是)")
private String isOverDesign;
}
......@@ -2,12 +2,9 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import java.util.Date;
/**
......@@ -210,4 +207,10 @@ public class JgUseRegistrationManage extends BaseEntity {
*/
@TableField("change_reason")
private String changeReason;
/**
* 是否超设计使用年限(0-否,1-是)
*/
@TableField("is_over_design")
private String isOverDesign;
}
......@@ -50,7 +50,9 @@ public enum BusinessTypeEnum {
JG_VEHICLE_GAS_CYLINDER_CHANGE("119", "车用气瓶变更登记"),
JG_HISTORY_USAGE_REGISTRATION("119", "历史设备登记");
JG_HISTORY_USAGE_REGISTRATION("119", "历史设备登记"),
JG_OVER_DESIGN_SERVICE_LIFE("120", "超设计使用年限登记");
private final String code;
......
......@@ -795,6 +795,22 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse(commonService.getRegistrationFormUrl(manageType, formData));
}
/**
* 使用登记证变更证明
* @param map 参数
* @return 变更证明url
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "使用登记变更证明生成", notes = "使用登记变更证明生成")
@PostMapping(value = "/getRegistrationChangeCertificateUrl")
public ResponseModel<Map<String,Object>> getRegistrationChangeCertificateUrl(@RequestBody JSONObject map) {
JSONObject formData = JSONObject.parseObject(JSONObject.toJSONString(map.get("formData")));
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String manageType = String.valueOf(map.get("manageType"));
formData.put("userName",selectedOrgInfo.getUserModel().getRealName());
return ResponseHelper.buildResponse(commonService.getRegistrationChangeCertificateUrl(manageType, formData));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "pdf流生成", notes = "pdf流生成")
@PostMapping(value = "/getRegistrationFormStream")
......
......@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgOverDesignServiceLifeServiceImpl;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -122,4 +123,40 @@ public class JgOverDesignServiceLifeController extends BaseController {
public ResponseModel<List<JgOverDesignServiceLife>> selectForList() {
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.queryForJgOverDesignServiceLifeList());
}
/**
* 撤回操作
* @param map map
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/cancel")
@ApiOperation(httpMethod = "POST", value = "超设计使用年限撤回", notes = "撤回")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> cancel(@RequestBody JSONObject map) {
jgOverDesignServiceLifeServiceImpl.cancel(String.valueOf(map.get("instanceId")), String.valueOf(map.get("nextTaskId")),
String.valueOf(map.getOrDefault("manageType", "")));
return ResponseHelper.buildResponse("ok");
}
/**
* 执行流程
*
* @param map map
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "超设计使用年限执行流程", notes = "超设计使用年限执行流程")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgOverDesignServiceLifeServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),
String.valueOf(map.get("instanceId")),
String.valueOf(map.get("operate")),
String.valueOf(map.get("comment")),
String.valueOf(map.get("nextTaskId")),
String.valueOf(map.get("equDefineCode")));
return ResponseHelper.buildResponse("ok");
}
}
......@@ -264,4 +264,6 @@ public interface ICommonService {
Map<String, Object> getRegistrationFormUrl(String manageType, JSONObject formData);
void getRegistrationFormStream(JSONObject formData,String manageType,HttpServletResponse response);
Map<String, Object> getRegistrationChangeCertificateUrl(String manageType ,JSONObject formData);
}
......@@ -2252,7 +2252,6 @@ public class CommonServiceImpl implements ICommonService {
return equipmentCategoryMapper.getEquDefineByParentId(parentId);
}
public JSONObject buildFile (String manageType, JSONObject jsonObject){
JSONObject formData = new JSONObject();
formData.putAll(jsonObject);
......@@ -2295,6 +2294,8 @@ public class CommonServiceImpl implements ICommonService {
if (formData.containsKey("safetyManagerId") && formData.getString("safetyManagerId").contains("_")){
formData.put("safetyManagerName",formData.getString("safetyManagerId").split("_")[1]);
}
formData.put("changeCategory", "达到设计使用年限继续使用");
//产权单位赋值
if (formData.containsKey("estateUnitName") && null != formData.getString("estateUnitName") && formData.getString("estateUnitName").contains("_")){
......@@ -2498,6 +2499,37 @@ public class CommonServiceImpl implements ICommonService {
}
@Override
public Map<String, Object> getRegistrationChangeCertificateUrl(String manageType ,JSONObject jsonObject) {
JSONObject formData = buildFile(manageType, jsonObject);
String wordPath;
String fileName;
if (UNIT.equals(manageType)){
wordPath = "use-registration-form-unit.ftl";
fileName = "台套使用登记表_";
}else if (SET.equals(manageType)){
wordPath = "use-registration-change-certificate.ftl";
fileName = "单位使用登记表_";
}else {
wordPath = "use-registration-form-vehicle.ftl";
fileName = "车用气瓶使用登记表_";
formData.put("equipBasicInfoList",formData.get("equipmentLists"));
}
File pdfFile = null;
try {
pdfFile = wordToPdf(fileName, wordPath, formData);
return MapBuilder.<String, Object>create().put("useRegistrationFormUrl", "").build();
} catch (Exception e) {
throw new RuntimeException(e);
}finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
}
}
@Override
public List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode) {
List<EquipmentClassifyDto> equipmentCategoryDtos = commonMapper.getEquClassifyByCode(parentCode);
if (ValidationUtil.isEmpty(equipmentCategoryDtos)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment