Commit 5024d32e authored by 李秀明's avatar 李秀明

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

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
parents e3d53c4b b91654b7
......@@ -23,6 +23,11 @@
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-tcm-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
......
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jg.api.service;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import java.util.Map;
/**
* 接口类
*
......@@ -13,7 +15,8 @@ public interface IJgInstallationNoticeService {
/**
* 保存安装告知单
* @param model
* @param model 数据
* @param submitType 保存类型
*/
void saveNotice(JgInstallationNoticeDto model);
void saveNotice(String submitType, Map<String, JgInstallationNoticeDto> model);
}
......@@ -4,11 +4,8 @@
<select id="getUnitListByType" resultType="java.util.Map">
SELECT
sequence_nbr sequenceNbr,
use_code useCode,
use_unit useUnit,
use_contact useContact,
contact_phone contactPhone
use_unit useUnit
FROM
tz_base_enterprise_info
WHERE
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import org.omg.PortableInterceptor.SUCCESSFUL;
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
......@@ -20,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
/**
......@@ -42,12 +48,12 @@ public class JgInstallationNoticeController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知")
public ResponseModel<JgInstallationNoticeDto> save(@RequestBody JgInstallationNoticeDto model) {
jgInstallationNoticeServiceImpl.saveNotice(model);
return ResponseHelper.buildResponse(model);
}
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知")
public ResponseModel<String> save(@RequestParam String submitType,@RequestBody Map<String, JgInstallationNoticeDto> model) {
jgInstallationNoticeServiceImpl.saveNotice(submitType, model);
return ResponseHelper.buildResponse("");
}
/**
* 根据sequenceNbr更新
......
......@@ -162,8 +162,9 @@ public class CommonServiceImpl implements ICommonService {
type = "使用单位";
} else if (type.equals("maintenance")) {
type = "维保单位";
} else if (type.equals("inspection")) {
type = "检验检测机构";
}
return commonMapper.getUnitListByType(type);
}
......
......@@ -11,6 +11,12 @@ import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.tcm.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.service.ICreateCodeService;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -18,6 +24,7 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -37,8 +44,11 @@ import java.util.stream.Collectors;
@Service
public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationNoticeDto, JgInstallationNotice, JgInstallationNoticeMapper> implements IJgInstallationNoticeService {
@Autowired
JgRelationEquipMapper jgRelationEquipMapper;
public static final String SUBMIT_TYPE_FLOW = "1";
public static final String PROCESS_DEFINITION_KEY = "installationNotification";
public static final String TABLE_PAGE_ID = "1734141426742095873";
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
......@@ -119,6 +129,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return noticeDto;
}
@Autowired
private ICreateCodeService iCreateCodeService;
@Autowired
JgRelationEquipMapper jgRelationEquipMapper;
/**
* 分页查询
*
......@@ -176,19 +191,40 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
@Override
public void saveNotice(JgInstallationNoticeDto model) {
@Transactional(rollbackFor = Exception.class)
public void saveNotice(String submitType, Map<String, JgInstallationNoticeDto> jgInstallationNoticeDtoMap) {
JgInstallationNoticeDto model = jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID);
// 字段转换
convertField(model);
// 获取告知设备列表
List<Map<String, Object>> deviceList = model.getDeviceList();
if (CollectionUtils.isEmpty(deviceList)) {
return;
}
// 获取告知单号
// 调用方法
List<String> applyNoList = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < deviceList.size(); i++) {
applyNoList.add(String.valueOf(random.nextInt()));
List<String> applyNoList = iCreateCodeService.createApplicationFormCode(ApplicationFormTypeEnum.GZ.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(applyNoList)) {
return;
}
// 判断当前是否为提交
List<String> instanceIdList = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
for (int i = 0 ; i< deviceList.size(); i++) {
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
AjaxResult ajaxResult = null;
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
instanceIdList.add(instanceId);
} catch (Exception e) {
log.error("流程启动失败:{}", e);
}
}
}
List<JgInstallationNotice> list = new ArrayList<>();
......@@ -200,10 +236,16 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
int i = deviceList.indexOf(obj);
String applyNo = applyNoList.get(i);
dto.setApplyNo(applyNo);
dto.setEquList(String.valueOf(obj.get("sequenceNbr")));
jgRelationEquip.setEquipId(String.valueOf(obj.get("sequenceNbr")));
dto.setEquList(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setApplyNo(applyNo);
jgRelationEquip.setBusinessType("GZ");
if (!CollectionUtils.isEmpty(instanceIdList)) {
dto.setInstanceId(instanceIdList.get(i));
dto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
} else {
dto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
}
list.add(dto);
equipList.add(jgRelationEquip);
});
......
package com.yeejoin.amos.boot.module.tcm.api.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tcm.api.service.ICreateCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
*
* 生成顺序码
* @author LiuLin
* @date 2023-12-14
*/
@RestController
@Api(tags = "生成顺序码")
@RequestMapping(value = "/code")
public class CreateCodeController extends BaseController {
@Autowired
private ICreateCodeService createCodeService;
/**
* 申请单编号生成
* @param type type
* @param batchSize batchSize
* @return List
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/ANCode")
@ApiOperation(httpMethod = "POST", value = "申请单编号生成", notes = "申请单编号生成")
public ResponseModel<List<String>> createANCode(@RequestParam("type") String type,
@RequestParam("batchSize") int batchSize) {
return ResponseHelper.buildResponse(createCodeService.createApplicationFormCode(type,batchSize));
}
/**
* 生成设备注册编码
* @param key key
* @return String
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/DRCode")
@ApiOperation(httpMethod = "POST", value = "申请单编号生成", notes = "申请单编号生成")
public ResponseModel<String> createDRCode(@RequestParam("key") String key) {
return ResponseHelper.buildResponse(createCodeService.createDeviceRegistrationCode(key));
}
}
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