Commit 9bb5bb75 authored by chenzhao's avatar chenzhao

报检申请单新增

parent 2bb54d36
......@@ -26,6 +26,11 @@ public interface WorkflowFeignService {
@RequestMapping(value = "/task/startProcess", method = RequestMethod.POST)
JSONObject startByVariable(@RequestBody Object params);
@RequestMapping(value = "/v2/task/startProcess ", method = RequestMethod.POST)
JSONObject startProcess(@RequestBody Object params);
/**
* 以当前登录人作为任务完成人的完成任务操作
*
......
package com.yeejoin.amos.boot.module.jyjc.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
@AllArgsConstructor
@Getter
public enum DocumentEnum {
GZS("gzs", "告知书"),
CPZL("cpzl", "产品质量证明书"),
SGZX("sgzx", "施工自行检查报告"),
SGHT("sght", "施工合同或证明"),
SGFA("sgfa", "施工方案/施工设计文件"),
SGDWXK("sgdwxk", "施工单位许可证书"),
XSSY("xssy", "型式试验证书"),
XSQTS("xsqts", "限速器和渐进式安全钳的调试证书"),
TJSM("tjsm", "土建声明"),
ZLBZ("zlbz", "质量保证手册和程序文件"),
SGZY("sgzy", "施工作业文件"),
SGRY("sgry", "施工人员、质量保证体系责任人、专业技术人员身份证、技术工人的身份证及资质证书"),
SGSJ("sgsj", "施工设计文件"),
SGFB("sgfb", "施工分包方目录"),
FBSPJ("fbspj", "分包方评价资料"),
QT("qt", "其他附件");
private String code;
private String name;
public static List<String> getEnumNameList() {
List<String> codeList = new ArrayList<String>();
for (DocumentEnum c: DocumentEnum.values()) {
codeList.add(c.getCode());
}
return codeList;
}
}
......@@ -6,6 +6,8 @@ import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
......@@ -75,6 +77,9 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "工作流实例ID")
private String processInstanceId;
@ApiModelProperty(value = "工作流key")
private String processKey;
@ApiModelProperty(value = "申请单二维码")
private String applicationQrcode;
......@@ -87,4 +92,12 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "业务类型(与菜单对应拆表使用)")
private String bizType;
private List<Map<String,Object>> gzs;
private List<Map<String,Object>> cpzl;
private List<Map<String,Object>> sgzx ;
private List<Map<String,Object>> sght;
private List<Map<String,Object>> sgfa;
private List<Map<String,Object>> sgdwxk;
private List<Map<String,Object>> equip;
}
package com.yeejoin.amos.boot.module.jyjc.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationAttachment;
/**
* 接口类
*
* @author system_generator
* @date 2023-12-14
*/
public interface IJyjcInspectionApplicationAttachmentService {}
public interface IJyjcInspectionApplicationAttachmentService extends IService<JyjcInspectionApplicationAttachment> {}
package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import com.yeejoin.amos.boot.module.jyjc.api.enums.DocumentEnum;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationAttachmentModel;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationAttachmentServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationEquipServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -17,6 +36,8 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationMode
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import static com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl.buildOrderNo;
/**
*
*
......@@ -30,6 +51,12 @@ public class JyjcInspectionApplicationController extends BaseController {
@Autowired
JyjcInspectionApplicationServiceImpl jyjcInspectionApplicationServiceImpl;
@Autowired
JyjcInspectionApplicationAttachmentServiceImpl jyjcInspectionApplicationAttachmentService;
@Autowired
JyjcInspectionApplicationEquipServiceImpl jyjcInspectionApplicationEquipService;
@Autowired
WorkflowFeignService workflowFeignService;
/**
* 新增
......@@ -40,8 +67,49 @@ public class JyjcInspectionApplicationController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JyjcInspectionApplicationModel model) {
model = jyjcInspectionApplicationServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
//开启报检流程工作流
JSONObject body = new JSONObject();
String businessKey = buildOrderNo();
body.put(WorkFlowEnum.BUSINESSKEY.getCode(), businessKey);
body.put(WorkFlowEnum.processDefinitionKey.getCode(), model.getProcessKey());
JSONObject jsonObject = workflowFeignService.startProcess(body);
String processId = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("result"))).getString("id");
model.setProcessInstanceId(processId);
model = jyjcInspectionApplicationServiceImpl.createWithModel(model);
//保存报检装备监管码
if ( model.getEquip().size() > 0){
List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) {
JyjcInspectionApplicationEquip equipInfo = new JyjcInspectionApplicationEquip();
equipInfo.setApplicationSeq(model.getSequenceNbr());
equipInfo.setEquipUnicode(s);
jyjcInspectionApplicationEquipService.save(equipInfo);
}
}
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件保存
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
for (String code : enumNameList) {
if (map.containsKey(code)){
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
attachments.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
}
}
return ResponseHelper.buildResponse(null);
}
/**
......@@ -54,7 +122,9 @@ public class JyjcInspectionApplicationController extends BaseController {
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JyjcInspectionApplicationModel> updateBySequenceNbrJyjcInspectionApplication(@RequestBody JyjcInspectionApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.updateWithModel(model));
}
......
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