Commit dfb10d8c authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcInspectionApplicationServiceImpl.java
parents c9f2a116 57fdd284
...@@ -264,6 +264,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -264,6 +264,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
e.printStackTrace(); e.printStackTrace();
} }
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr()); registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
objMap.putAll(registerInfoMap); objMap.putAll(registerInfoMap);
} }
//维保备案 //维保备案
......
...@@ -73,6 +73,8 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -73,6 +73,8 @@ public class JyjcInspectionApplicationController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JyjcInspectionApplicationModel model) { public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JyjcInspectionApplicationModel model) {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
model.setApplicationUnitCode(selectedOrgInfo.getCompany().getCompanyCode());
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.save(model)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.save(model));
} }
...@@ -135,6 +137,8 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -135,6 +137,8 @@ public class JyjcInspectionApplicationController extends BaseController {
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<JyjcInspectionApplicationModel> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JyjcInspectionApplicationModel> selectOne(@PathVariable Long sequenceNbr) {
jyjcInspectionApplicationServiceImpl.selectBySeq(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryBySeq(sequenceNbr));
} }
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstDto; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstDto;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException; import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,10 +27,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel; ...@@ -25,10 +27,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -97,6 +96,11 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -97,6 +96,11 @@ public class JyjcOpeningApplicationController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
JyjcOpeningApplication jyjcOpeningApplication = jyjcOpeningApplicationServiceImpl.getById(sequenceNbr);
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()),String.valueOf(FlowStatusEnum.REJECTED.getCode()));
if(status.contains(jyjcOpeningApplication.getStatus())){
throw new BadRequest("除撤回跟驳回的流程之外其余流程不可删除!");
}
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.removeById(sequenceNbr));
} }
...@@ -110,7 +114,7 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -110,7 +114,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@DeleteMapping(value = "batchDelete") @DeleteMapping(value = "batchDelete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){ public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.deleteBatchSeq(sequenceNbrList)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.deleteBatchByIds(sequenceNbrList));
} }
/** /**
......
...@@ -47,6 +47,7 @@ import java.util.ArrayList; ...@@ -47,6 +47,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl.buildOrderNo; import static com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl.buildOrderNo;
...@@ -60,6 +61,7 @@ import java.util.Optional; ...@@ -60,6 +61,7 @@ import java.util.Optional;
* @date 2023-12-14 * @date 2023-12-14
*/ */
@Service @Service
public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspectionApplicationModel, JyjcInspectionApplication, JyjcInspectionApplicationMapper> implements IJyjcInspectionApplicationService {
@Slf4j @Slf4j
public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspectionApplicationModel,JyjcInspectionApplication,JyjcInspectionApplicationMapper> implements IJyjcInspectionApplicationService { public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspectionApplicationModel,JyjcInspectionApplication,JyjcInspectionApplicationMapper> implements IJyjcInspectionApplicationService {
...@@ -87,29 +89,27 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -87,29 +89,27 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
WorkflowFeignService workflowFeignService; WorkflowFeignService workflowFeignService;
public JyjcInspectionApplicationModel save(@RequestBody JyjcInspectionApplicationModel model) { public JyjcInspectionApplicationModel save(@RequestBody JyjcInspectionApplicationModel model) {
//开启报检流程工作流 //开启报检流程工作流
if ( !model.getOperationType().equals("2")){ if (!model.getOperationType().equals("2")) {
if (model.getOperationType().equals("0")){ if (model.getOperationType().equals("0")) {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
String businessKey = buildOrderNo(); String businessKey = buildOrderNo();
body.put(WorkFlowEnum.BUSINESSKEY.getCode(), businessKey); body.put(WorkFlowEnum.BUSINESSKEY.getCode(), businessKey);
body.put(WorkFlowEnum.processDefinitionKey.getCode(), model.getProcessKey()); body.put(WorkFlowEnum.processDefinitionKey.getCode(), model.getProcessKey());
JSONObject jsonObject = workflowFeignService.startProcess(body); JSONObject jsonObject = workflowFeignService.startByVariable(body);
String processId = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("result"))).getString("id"); String processId = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("data"))).getString("id");
model.setProcessInstanceId(processId); model.setProcessInstanceId(processId);
model.setStatus("已提交"); model.setStatus("已提交");
}else if ( model.getOperationType().equals("1")){ } else if (model.getOperationType().equals("1")) {
model.setStatus("草稿"); model.setStatus("草稿");
} }
model.setApplicationNo(UUID.randomUUID().toString());
model.setApplicationDate(new Date());
model = this.createWithModel(model); model = this.createWithModel(model);
//保存报检装备监管码 //保存报检装备监管码
if ( model.getEquip().size() > 0){ if (null != model.getEquip()&&model.getEquip().size() > 0) {
List<Map<String, Object>> equip = model.getEquip(); List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList()); List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) { for (String s : jgm) {
...@@ -125,7 +125,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -125,7 +125,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<String> enumNameList = DocumentEnum.getEnumNameList(); List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>(); List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
for (String code : enumNameList) { for (String code : enumNameList) {
if (map.containsKey(code)){ if (map.containsKey(code)) {
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment(); JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code); attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code))); attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
...@@ -133,11 +133,11 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -133,11 +133,11 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments); jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
} }
} }
}else { } else {
//更新报检装备监管码 //更新报检装备监管码
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr()); jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
if ( model.getEquip().size() > 0){ if (model.getEquip().size() > 0) {
List<Map<String, Object>> equip = model.getEquip(); List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList()); List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) { for (String s : jgm) {
...@@ -155,7 +155,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -155,7 +155,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr()); jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
for (String code : enumNameList) { for (String code : enumNameList) {
if (map.containsKey(code)){ if (map.containsKey(code)) {
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment(); JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code); attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code))); attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
...@@ -170,12 +170,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -170,12 +170,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
public void deleteBatchData(List<Long> sequenceNbr){ public void deleteBatchData(List<Long> sequenceNbr) {
List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr); List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr);
long count = jyjcInspectionApplications.stream().filter(e -> !e.getStatus().equals("已撤销") && !e.getStatus().equals("已撤回")).count(); long count = jyjcInspectionApplications.stream().filter(e -> !e.getStatus().equals("已撤销") && !e.getStatus().equals("已撤回")).count();
if (count > 0){ if (count > 0) {
throw new BadRequest("存在 非已撤销、已退回状态的报检单 不可删除!"); throw new BadRequest("存在 非已撤销、已退回状态的报检单 不可删除!");
} }
...@@ -203,9 +203,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -203,9 +203,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
String applicationDate, String applicationDate,
String acceptDate, String acceptDate,
String inspectionChargePerson, String inspectionChargePerson,
String status , String bizType) { String status, String bizType) {
return this.getBaseMapper().queryForDataList(page,applicationNo,inspectionClassify,applicationUnitCode,applicationUnitName,equipClassify,inspectionUnitCode,inspectionUnitName,applicationDate,acceptDate,inspectionChargePerson,status,bizType); return this.getBaseMapper().queryForDataList(page, applicationNo, inspectionClassify, applicationUnitCode, applicationUnitName, equipClassify, inspectionUnitCode, inspectionUnitName, applicationDate, acceptDate, inspectionChargePerson, status, bizType);
} }
...@@ -213,9 +213,16 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -213,9 +213,16 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JyjcInspectionApplicationModel> queryForJyjcInspectionApplicationList() { public List<JyjcInspectionApplicationModel> queryForJyjcInspectionApplicationList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
public JyjcInspectionApplicationModel selectBySeq(Long sequenceNbr) {
JyjcInspectionApplicationModel model = this.selectBySeq(sequenceNbr);
return model;
}
/** /**
* 接收 * 接收
* *
......
...@@ -41,12 +41,15 @@ import org.apache.commons.lang3.StringUtils; ...@@ -41,12 +41,15 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.expression.Ids;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -420,4 +423,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -420,4 +423,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
return record; return record;
} }
public Boolean deleteBatchByIds(List<Long> ids){
List<JyjcOpeningApplication> jyjcOpeningApplicationList=jyjcOpeningApplicationMapper.selectList(new QueryWrapper<JyjcOpeningApplication>()
.in("sequence_nbr"));
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()),String.valueOf(FlowStatusEnum.REJECTED.getCode()));
jyjcOpeningApplicationList = jyjcOpeningApplicationList.stream().filter(jyjcOpeningApplication ->!status.contains(jyjcOpeningApplication.getStatus())).collect(Collectors.toList());
if(jyjcOpeningApplicationList.isEmpty()){
throw new BadRequest("除撤回跟驳回的流程之外其余流程不可删除,请核对数据后重新提交!");
}
deleteBatchByIds(ids);
return true;
}
} }
\ No newline at end of file
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