Commit d80bc65b authored by suhuiguang's avatar suhuiguang

1.openapi接口开发

1.1.附件上传 1.2.特种设备目录查询(feign调用jyjc) 1.3.检验检测结果回传(feign调用jyjc) 2.jyjc回传数据更新调整为按照设备及单号唯一进行更新
parent 7b9ba3d9
......@@ -41,7 +41,7 @@ public class ControllerAop {
HttpServletRequest request = attributes.getRequest();
logger.info("request>>>",request);
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany","/openapi/bizToken/applyToken","/openapi/bizToken/getAppId","/lift/upload","/lift/status","/lift/run","/lift/fault","/lift/video/preview","/cylinderPage/serviceProvider","/cylinderPage/getTableInfo","/cylinderPage/initCylinderNum","/openapi/appId/setAppId"};
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany","/bizToken/applyToken","/openapi/bizToken/getAppId","/lift/upload","/lift/status","/lift/run","/lift/fault","/lift/video/preview","/cylinderPage/serviceProvider","/cylinderPage/getTableInfo","/cylinderPage/initCylinderNum","/openapi/appId/setAppId"};
// 获取请求路径
for(String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) {
......
......@@ -5,6 +5,7 @@ import feign.RequestTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
......@@ -35,6 +36,12 @@ public class FeignAuthRequestInterceptor implements RequestInterceptor {
if (product == null) {
product = request.getParameter("product");
}
if (appKey == null) {
appKey = RequestContext.getAppKey();
}
if (product == null) {
product = RequestContext.getProduct();
}
template.header("X-Access-Token", authToken);
template.header("token", authToken);
template.header("appKey", appKey);
......
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentCategoryDto;
import com.yeejoin.amos.api.openapi.feign.TzsServiceFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 特种设备监管controller
*
* @author Administrator
*/
@RestController
@Api(tags = "设备定义Api")
@RequestMapping(value = "/equipment-category")
public class EquipmentCategoryController {
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
/**
* 设备定义列表数据查询
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "设备定义列表数据查询", notes = "设备定义列表数据查询")
public ResponseModel<List<EquipmentCategoryDto>> page() {
return tzsServiceFeignClient.getEquipmentCategoryList();
}
}
package com.yeejoin.amos.api.openapi.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.SimpleFormatter;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.enums.FileFolderPathEnum;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
@RestController
@RequestMapping(value = "/filestorage")
@Api(tags = "filestorage-上传附件数据对接")
public class FilesController {
private static final Logger logger = LogManager.getLogger(FilesController.class);
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装审核数据")
@PostMapping(value = "/")
public ResponseModel<String> uploadCylinderFiles (
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,FileFolderPathEnum.CYLINDER.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "检验报告数据")
@PostMapping(value = "/csei")
public ResponseModel<String> uploadCseiFiles (
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.JY.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
private static final Logger logger = LogManager.getLogger(FilesController.class);
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "气瓶充装审核数据")
@PostMapping(value = "/")
public ResponseModel<String> uploadCylinderFiles(
@RequestBody MultipartFile file) throws Exception {
logger.info(file);
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.CYLINDER.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "检验报告数据")
@PostMapping(value = "/csei")
public ResponseModel<String> uploadCseiFiles(
@RequestBody MultipartFile file) throws Exception {
logger.info(file);
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.JY.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
private JSONObject uploadFile(MultipartFile file, String tag) {
if (ValidationUtil.isEmpty(file)) {
throw new BadRequest("参数校验失败.");
}
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString = it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
}
return jsonObj;
}
private JSONObject uploadFile(MultipartFile file,String tag) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
}
return jsonObj;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file) {
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.JG.getPath());
return ResponseHelper.buildResponse(jsonObject);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file){
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.JG.getPath());
// FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
// JSONObject jsonObj = new JSONObject();
// if (date != null) {
// Map<String, String> map = date.getResult();
// Iterator<String> it = map.keySet().iterator();
// String urlString=it.next();
// jsonObj.put("fileUrl", urlString);
// jsonObj.put("fileName", map.get(urlString));
// }
return ResponseHelper.buildResponse(jsonObject);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "通用上传附件")
@PostMapping("/{module}/upload")
public ResponseModel<JSONObject> upload2(@RequestBody MultipartFile file, @PathVariable String module) {
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.valueOf(module.toUpperCase()).getPath());
return ResponseHelper.buildResponse(jsonObject);
}
}
package com.yeejoin.amos.api.openapi.controller;
import com.yeejoin.amos.api.openapi.face.dto.JyjcInspectionResultDataModel;
import com.yeejoin.amos.api.openapi.feign.JyjcServiceFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 特种设备监管controller
*
* @author Administrator
*/
@RestController
@Api(tags = "检验检测Api")
@RequestMapping(value = "/inspection")
public class JyjcController {
@Autowired
JyjcServiceFeignClient jyjcServiceFeignClient;
/**
* 设备定义列表数据查询
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/result-submit")
@ApiOperation(httpMethod = "POST", value = "检验检测结果回传", notes = "检验检测结果回传")
public ResponseModel<List<JyjcInspectionResultDataModel>> resultSubmit(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels) {
return jyjcServiceFeignClient.saveResultDataBatch(resultDataModels);
}
}
......@@ -38,9 +38,14 @@ public enum FileFolderPathEnum {
/**
* 检验报告
*/
JY("jg","/csei")
;
JY("jg","/csei"),
/**
* 检验检测
*/
JYJC("jyjc", "/jyjc");
private String module;
private String path;
}
package com.yeejoin.amos.api.openapi.face.dto;
import lombok.Data;
import java.util.List;
/**
* @author Administrator
*/
@Data
public class AttachmentData {
/**
* 附件类型
*/
public String attachmentType;
/**
* 附件列表
*/
public List<AttachmentModel> attachmentContent;
}
package com.yeejoin.amos.api.openapi.face.dto;
import lombok.Data;
/**
* @author Administrator
* 附件结构
*/
@Data
public class AttachmentModel {
/**
* 附件名称
*/
String name;
/**
* 附件路径
*/
String url;
/**
* 前端标识
*/
String uid;
/**
* 前端附件状态
*/
String status;
}
package com.yeejoin.amos.api.openapi.face.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 装备分类
*
* @author system_generator
* @date 2021-10-20
*/
@Data
@ApiModel(value="EquipmentCategoryDto", description="装备分类")
public class EquipmentCategoryDto {
private static final long serialVersionUID = 1L;
private Long id;
private String parentId;
@ApiModelProperty(value = "装备分类编码")
private String code;
@ApiModelProperty(value = "装备分类名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "备注")
private String remark;
private Date createDate;
@ApiModelProperty(value = "行业编码")
private String industryCode;
}
package com.yeejoin.amos.api.openapi.face.dto;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 业务开通申请表
*
* @author system_generator
* @date 2023-12-14
*/
@Data
@ApiModel(value = "JyjcInspectionResultDataModel", description = "检验检测结果数据接收")
public class JyjcInspectionResultDataModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "报检单号")
private String applicationNo;
@ApiModelProperty(value = "监管码")
private String supervisoryCode;
@ApiModelProperty(value = "检验结果状态(已出2、未出1)")
private String resultStatus;
@ApiModelProperty(value = "核准证号/许可证号")
private String licenseNumber;
@ApiModelProperty(value = "检验报告编号")
private String resultNo;
@ApiModelProperty(value = "内部人员代码")
private String innerPersonCode;
@ApiModelProperty(value = "检验结论")
private String inspectionConclusion;
@ApiModelProperty(value = "检验日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionDate;
@ApiModelProperty(value = "下次检验日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date nextInspectionDate;
@ApiModelProperty(value = "检验开始日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionStartDate;
@ApiModelProperty(value = "检验结束日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionEndDate;
@ApiModelProperty(value = "检验结果汇总")
private String inspectionResultSummary;
@ApiModelProperty(value = "不符合项")
private JSONArray nonConformance;
@ApiModelProperty(value = "附件")
private List<AttachmentData> attachments;
@ApiModelProperty(value = "检验结果技术参数")
private JSONObject techParams;
/**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/
private String traceId;
}
package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.face.dto.JyjcInspectionResultDataModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
@FeignClient(name = "TZS-JYJC", path = "/jyjc", configuration = {FeignConfiguration.class})
public interface JyjcServiceFeignClient {
/**
* 报检结果接收
*
* @param resultDataModels 请求体
* @return 是否成功
*/
@RequestMapping(value = "/jyjc-inspection-result/receive", method = RequestMethod.POST)
ResponseModel<List<JyjcInspectionResultDataModel>> saveResultDataBatch(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentCategoryDto;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentInfoDto;
import com.yeejoin.amos.api.openapi.face.model.InspectionDetectionInfoModel;
import com.yeejoin.amos.api.openapi.face.model.UnitLicenceModel;
......@@ -95,4 +96,11 @@ public interface TzsServiceFeignClient {
@RequestMapping(value = "/equipment-category/deleteByRecord", method = RequestMethod.POST)
ResponseModel<Boolean> deleteEquipmentInfo(@RequestParam String record);
/**
* 设备定义列表数据
* @return <List<EquipmentCategoryDto>>
*/
@RequestMapping(value = "/equipment-category/list", method = RequestMethod.GET)
ResponseModel<List<EquipmentCategoryDto>> getEquipmentCategoryList();
}
......@@ -2,22 +2,12 @@ package com.yeejoin.amos.api.openapi.feign;
import com.yeejoin.amos.api.openapi.config.FeignConfiguration;
import com.yeejoin.amos.api.openapi.config.MultipartSupportConfig;
import com.yeejoin.amos.api.openapi.face.dto.EquipmentInfoDto;
import com.yeejoin.amos.api.openapi.face.model.InspectionDetectionInfoModel;
import com.yeejoin.amos.api.openapi.face.model.UnitLicenceModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.ConstructionInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.MaintenanceInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@FeignClient(name = "TZS-COMMON", path = "/tcm", configuration =
{FeignConfiguration.class})
public interface TzsTcmServiceFeignClient {
......
spring.application.name=AMOS-API-OPENAPI-JYJC
server.servlet.context-path=/openapijyjc
server.port=11003
# jdbc_config
spring.datasource.url=jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl&allowMultiQueries=true
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.243
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone=http://172.16.10.243:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.243:2883
emqx.client-user-name=admin
emqx.client-password=public
emqx.keepAliveInterval=1000
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/openapicyl.log.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>20mb</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis" level="ERROR" />
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.typroject" level="ERROR"/>
<logger name="com.yeejoin" level="ERROR"/>
<logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
......@@ -292,8 +292,8 @@ public class JyjcInspectionApplicationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报检信息推送测试", notes = "报检信息推送测试")
@GetMapping(value = "/test-push")
@ApiOperation(httpMethod = "GET", value = "报检信息手工推送至kafka", notes = "报检信息手工推送至kafka,预留")
@GetMapping(value = "/data-push")
public void pushTest(
@RequestParam("id") Long id) {
JyjcInspectionApplicationModel model= jyjcInspectionApplicationServiceImpl.queryBySeq(id);
......
......@@ -183,8 +183,8 @@ public class JyjcInspectionResultController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "报检结果接收", notes = "对外对接使用,支持单条及批量")
@PostMapping(value = "/receive/data")
public ResponseModel<List<JyjcInspectionResultDataModel>> receivePushResultData(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels){
@PostMapping(value = "/receive")
public ResponseModel<List<JyjcInspectionResultDataModel>> saveResultDataBatch(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels){
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.receivePushResultData(resultDataModels));
}
}
......@@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
......@@ -27,11 +26,11 @@ import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEqu
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.*;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationService;
import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionApplicationPushEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.JgFeignClient;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jyjc.biz.service.TaskModelServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler.JyjcInspectionApplicationHandlerFactory;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
......@@ -76,6 +75,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
private WorkflowHelper workflowHelper;
@Autowired
EventPublisher eventPublisher;
/**
* 分页查询
*/
......@@ -120,8 +122,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
//接口通用 部分页面按钮无法分开配置类型 所以根据业务情况 将带有工作流实例id的数据 接口类型设置为2 走编辑逻辑
JyjcInspectionApplicationModel model = JSONObject.parseObject(JSON.toJSONString(obj), JyjcInspectionApplicationModel.class);
model.setEquip((List<Map<String, Object>> )obj.get("equip"));
if (CharSequenceUtil.isNotEmpty(model.getProcessInstanceId()) && model.getOperationType().equals("0")){
model.setEquip((List<Map<String, Object>>) obj.get("equip"));
if (CharSequenceUtil.isNotEmpty(model.getProcessInstanceId()) && model.getOperationType().equals("0")) {
model.setOperationType("2");
}
......@@ -170,15 +172,15 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
LambdaQueryWrapper<JyjcOpeningApplication> wa = new LambdaQueryWrapper<JyjcOpeningApplication>().eq(JyjcOpeningApplication::getUnitCode, model.getInspectionUnitCode()).eq(JyjcOpeningApplication::getStatus, FlowStatusEnum.TO_BE_FINISHED.getCode());
List<JyjcOpeningApplication> jyjcOpeningApplications = jyjcOpeningApplicationService.getBaseMapper().selectList(wa);
if (CollectionUtils.isNotEmpty(jyjcOpeningApplications)){
if (CollectionUtils.isNotEmpty(jyjcOpeningApplications)) {
//检验检测结果方式
if (jyjcOpeningApplications.get(0).getResultType()!= null) {
if (jyjcOpeningApplications.get(0).getResultType() != null) {
model.setResultType(jyjcOpeningApplications.get(0).getResultType());
}
}
List<String> codes = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JY.getCode(), 1).getResult();
// List<String> codes = createCodeService.createApplicationFormCode(ApplicationFormTypeEnum.JY.getCode(), 1).getResult();
// List<String> codes = createCodeService.createApplicationFormCode(ApplicationFormTypeEnum.JY.getCode(), 1).getResult();
model.setApplicationNo(codes.get(0));
model.setApplicationDate(new Date());
......@@ -186,7 +188,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
model.setApplicationUnitName(reginParams.getCompany().getCompanyName());
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
List<JyjcInspectionApplicationEquip> equipInfos = new ArrayList<>();
List<JyjcInspectionApplicationEquip> equipInfos = new ArrayList<>();
if (null != model.getEquip() && model.getEquip().size() > 0) {
List<JyjcInspectionApplicationEquipDto> equips = JSONObject.parseArray(JSON.toJSONString(model.getEquip()), JyjcInspectionApplicationEquipDto.class);
for (JyjcInspectionApplicationEquipDto equip : equips) {
......@@ -198,15 +200,15 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
equipInfo.setSupervisoryCode(equip.getSupervisoryCode());
equipInfos.add(equipInfo);
}
model.setEquList(model.getEquip().get(0).getOrDefault("EQU_LIST","").toString());
model.setSupervisoryCode(model.getEquip().get(0).getOrDefault("SUPERVISORY_CODE","").toString());
model.setEquList(model.getEquip().get(0).getOrDefault("EQU_LIST", "").toString());
model.setSupervisoryCode(model.getEquip().get(0).getOrDefault("SUPERVISORY_CODE", "").toString());
}
model.setCreateUserId(reginParams.getUserModel().getUserId());
model.setNumberOfEquip(equipInfos.size());
if (null == model.getSequenceNbr()){
if (null == model.getSequenceNbr()) {
model = this.createWithModel(model);
if (StringUtils.isNotBlank(model.getProcessInstanceId())){
if (StringUtils.isNotBlank(model.getProcessInstanceId())) {
this.createdTaskModel(model);
} else {
TaskModelDto dto = new TaskModelDto();
......@@ -222,37 +224,36 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
ta.setNextTaskId(model.getNextTaskId());
dto.setModel(ta);
//摘要 按原有规则组装
dto.setTaskContent("来自"+model.getEquList()+"【"+model.getSupervisoryCode()+"】的业务办理,【申请单号:"+model.getApplicationNo()+"】");
dto.setTaskContent("来自" + model.getEquList() + "【" + model.getSupervisoryCode() + "】的业务办理,【申请单号:" + model.getApplicationNo() + "】");
//申请单号
dto.setTaskCode(model.getApplicationNo());
//业务类型枚举code值
dto.setTaskType(BizTypeEnum.getNumByCode(model.getBizType()));
////业务主键
dto.setRelationId(model.getSequenceNbr()+"");
dto.setRelationId(model.getSequenceNbr() + "");
taskModelService.buildTaskModel(Arrays.asList(dto));
}
}else {
} else {
model = this.updateWithModel(model);
if (StringUtils.isNotBlank(model.getProcessInstanceId()) && model.getOperationType().equals("0")){
taskModelService.deleteTaskModel(model.getSequenceNbr()+"");
if (StringUtils.isNotBlank(model.getProcessInstanceId()) && model.getOperationType().equals("0")) {
taskModelService.deleteTaskModel(model.getSequenceNbr() + "");
this.createdTaskModel(model);
} else {
String taskContent="来自"+model.getEquList()+"【"+model.getSupervisoryCode()+"】的业务办理,【申请单号:"+model.getApplicationNo()+"】";
taskModelService.updateTaskContentById(MapBuilder.<String,Object>create().put("taskContent",taskContent).
put("relationId",model.getSequenceNbr()+"").build());
String taskContent = "来自" + model.getEquList() + "【" + model.getSupervisoryCode() + "】的业务办理,【申请单号:" + model.getApplicationNo() + "】";
taskModelService.updateTaskContentById(MapBuilder.<String, Object>create().put("taskContent", taskContent).
put("relationId", model.getSequenceNbr() + "").build());
}
}
//保存报检装备监管码
for (JyjcInspectionApplicationEquip equipInfo : equipInfos) {
equipInfo.setApplicationSeq(model.getSequenceNbr());
}
applicationEquipService.saveBatch(equipInfos);
// Map<String, Object> map = BeanUtil.beanToMap(model);
// Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件保存
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
......@@ -268,9 +269,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} else {
LambdaQueryWrapper<JyjcOpeningApplication> wa = new LambdaQueryWrapper<JyjcOpeningApplication>().eq(JyjcOpeningApplication::getUnitCode, model.getInspectionUnitCode()).eq(JyjcOpeningApplication::getStatus, FlowStatusEnum.TO_BE_FINISHED.getCode());
List<JyjcOpeningApplication> jyjcOpeningApplications = jyjcOpeningApplicationService.getBaseMapper().selectList(wa);
if (CollectionUtils.isNotEmpty(jyjcOpeningApplications)){
if (CollectionUtils.isNotEmpty(jyjcOpeningApplications)) {
//检验检测结果方式
if (jyjcOpeningApplications.get(0).getResultType()!= null) {
if (jyjcOpeningApplications.get(0).getResultType() != null) {
model.setResultType(jyjcOpeningApplications.get(0).getResultType());
}
}
......@@ -278,8 +279,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
//更新报检装备监管码
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
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());
// List<Map<String, Object>> equip = model.getEquip();
// List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
List<JyjcInspectionApplicationEquipDto> equips = JSONObject.parseArray(JSON.toJSONString(model.getEquip()), JyjcInspectionApplicationEquipDto.class);
int num = equips.size();
model.setNumberOfEquip(num);
......@@ -292,11 +293,11 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
equipInfo.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationEquipService.save(equipInfo);
}
model.setEquList(model.getEquip().get(0).getOrDefault("EQU_LIST","").toString());
model.setSupervisoryCode(model.getEquip().get(0).getOrDefault("SUPERVISORY_CODE","").toString());
model.setEquList(model.getEquip().get(0).getOrDefault("EQU_LIST", "").toString());
model.setSupervisoryCode(model.getEquip().get(0).getOrDefault("SUPERVISORY_CODE", "").toString());
}
// Map<String, Object> map = BeanUtil.beanToMap(model);
// Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件更新
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
......@@ -334,7 +335,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<WorkflowResultDto> workflowResultDtos = taskModelService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO));
String nextUserIds = workflowResultDtos.get(0).getNextExecutorUserIds();
String executorRoleIds = workflowResultDtos.get(0).getExecutorRoleIds();
if(processTaskDTO != null && processTaskDTO.getNextTask() != null && processTaskDTO.getNextTask().size() >0){
if (processTaskDTO != null && processTaskDTO.getNextTask() != null && processTaskDTO.getNextTask().size() > 0) {
taskCode = processTaskDTO.getNextTask().get(0).getKey();
taskName1 = processTaskDTO.getNextTask().get(0).getName();
nextTaskId = processTaskDTO.getNextTask().get(0).getId();
......@@ -359,14 +360,14 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
private JyjcInspectionApplicationModel buildRedundancyField(JyjcInspectionApplicationModel model) {
// 冗余前端显示检验检测类型名称
if(StringUtils.isNotEmpty(model.getInspectionType())){
if (StringUtils.isNotEmpty(model.getInspectionType())) {
model.setInspectionTypeName(getInspectionTypeName(model.getInspectionType()));
}
return model;
}
private String getInspectionTypeName(String inspectionType){
DataDictionary dictionary = dataDictionaryService.getByCode(inspectionType,"JYJC");
private String getInspectionTypeName(String inspectionType) {
DataDictionary dictionary = dataDictionaryService.getByCode(inspectionType, "JYJC");
return dictionary != null ? dictionary.getName() : "";
}
......@@ -400,20 +401,20 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public Page<JyjcInspectionApplicationModel> queryForJyjcInspectionApplicationPage(Page<JyjcInspectionApplication> page,
String applicationNo,
String inspectionClassify,
String applicationUnitCode,
String equipClassify,
String inspectionUnitCode,
String applicationUnitName,
String inspectionUnitName,
String applicationDate,
String acceptDate,
String inspectionChargePerson,
String status, String bizType ) {
String applicationNo,
String inspectionClassify,
String applicationUnitCode,
String equipClassify,
String inspectionUnitCode,
String applicationUnitName,
String inspectionUnitName,
String applicationDate,
String acceptDate,
String inspectionChargePerson,
String status, String bizType) {
// return this.getBaseMapper().queryForDataList(page, applicationNo, inspectionClassify, applicationUnitCode, applicationUnitName, equipClassify, inspectionUnitCode, inspectionUnitName, applicationDate, acceptDate, inspectionChargePerson, status, bizType,roleIds);
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);
}
......@@ -426,45 +427,45 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
String currentUserId = reginParams.getUserModel().getUserId();
String currentApplicationUnitCode = null;
String currentInspectionUnitCode = null;
if(ValidationUtil.isEmpty(companyType)){
return new Page<>(0,10, 0);
if (ValidationUtil.isEmpty(companyType)) {
return new Page<>(0, 10, 0);
}
// 判断当前登录人身份(报检机构、接收机构、即时报检又是接收机构、都不是(不存在此情况))
String identity= this.getCompanyIdentityByType(reginParams.getCompany().getCompanyType());
if(ValidationUtil.equals("apply", identity)){
String identity = this.getCompanyIdentityByType(reginParams.getCompany().getCompanyType());
if (ValidationUtil.equals("apply", identity)) {
currentApplicationUnitCode = companyCode;
}
if(ValidationUtil.equals("receive", identity)){
if (ValidationUtil.equals("receive", identity)) {
currentInspectionUnitCode = companyCode;
}
if(ValidationUtil.equals("all", identity)){
if (ValidationUtil.equals("all", identity)) {
currentApplicationUnitCode = companyCode;
currentInspectionUnitCode = companyCode;
}
Page<JyjcInspectionApplicationModel> resultPage = this.getBaseMapper().selectForPage(page, model, identity, currentApplicationUnitCode, currentInspectionUnitCode,currentUserId);
Page<JyjcInspectionApplicationModel> resultPage = this.getBaseMapper().selectForPage(page, model, identity, currentApplicationUnitCode, currentInspectionUnitCode, currentUserId);
return resultPage;
}
private String getCompanyIdentityByType(String companyType){
private String getCompanyIdentityByType(String companyType) {
// 可发起单位的单位类型(角色与单位类型已绑定,在业务系统增加的账号不会出现角色与的单位类型不匹配场景)
String[] applyIdentityDefine = {"使用单位", "安装改造维修单位"};
// 可进行检验检测申请接收的单位类型,在业务系统增加的账号不会出现角色与的单位类型不匹配场景
String[] receiveIdentityDefine = {"检验检测机构"};
boolean isApplyIdentityMatch = false;
boolean isReceiveIdentityMatch = false;
if(Arrays.stream(applyIdentityDefine).anyMatch(companyType::contains)){
if (Arrays.stream(applyIdentityDefine).anyMatch(companyType::contains)) {
isApplyIdentityMatch = true;
}
if(Arrays.stream(receiveIdentityDefine).anyMatch(companyType::contains)){
if (Arrays.stream(receiveIdentityDefine).anyMatch(companyType::contains)) {
isReceiveIdentityMatch = true;
}
if(isApplyIdentityMatch && !isReceiveIdentityMatch){
if (isApplyIdentityMatch && !isReceiveIdentityMatch) {
return "apply";
}
if(!isApplyIdentityMatch && isReceiveIdentityMatch){
if (!isApplyIdentityMatch && isReceiveIdentityMatch) {
return "receive";
}
if(isApplyIdentityMatch){
if (isApplyIdentityMatch) {
return "all";
}
return "no";
......@@ -500,14 +501,14 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<JSONObject> records = response.getResult().getRecords();
ArrayList<Map<String, Object>> arrayList = new ArrayList<>();
records.forEach(item -> {
// item.remove("SEQUENCE_NBR");
// item.remove("SEQUENCE_NBR");
HashMap<String, Object> objectHashMap = new HashMap<>();
for (Map.Entry<String, Object> stringObjectEntry : item.entrySet()) {
objectHashMap.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
String s = stringObjectEntry.getKey().toLowerCase();
objectHashMap.put(CharSequenceUtil.toCamelCase(s), stringObjectEntry.getValue());
if (stringObjectEntry.getKey().equals("SEQUENCE_NBR")){
objectHashMap.put("record",stringObjectEntry.getValue());
if (stringObjectEntry.getKey().equals("SEQUENCE_NBR")) {
objectHashMap.put("record", stringObjectEntry.getValue());
}
}
arrayList.add(objectHashMap);
......@@ -540,7 +541,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskResultDTO task = new TaskResultDTO();
task.setResultCode("approvalStatus");
task.setTaskId(taskId);
task.setComment(params.getOrDefault("comments","").toString());
task.setComment(params.getOrDefault("comments", "").toString());
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "0");
task.setVariable(map);
......@@ -551,13 +552,13 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
JyjcInspectionApplicationModel model = new JyjcInspectionApplicationModel();
model.setStatusName(FlowStatusEnum.TO_BE_FINISHED.getName());
entity.setAcceptDate(new Date());
entity.setInnerPersonCode(params.getOrDefault("innerPersonCode","").toString());
String processDescription = (String)params.get("comments");
entity.setInnerPersonCode(params.getOrDefault("innerPersonCode", "").toString());
String processDescription = (String) params.get("comments");
if (StringUtils.isNotBlank(processDescription)) {
entity.setProcessDescription(processDescription);
}
List<String> persons = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePerson")), String.class);
if (CollectionUtil.isNotEmpty(persons)){
if (CollectionUtil.isNotEmpty(persons)) {
List<String> personCodes = new ArrayList<>();
List<String> personNames = new ArrayList<>();
......@@ -566,24 +567,23 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
personCodes.add(s[0]);
personNames.add(s[1]);
}
String inspectionChargePerson = persons == null?"":String.join(",",persons);
String inspectionChargePerson = persons == null ? "" : String.join(",", persons);
if (StringUtils.isNotBlank(inspectionChargePerson)) {
entity.setInspectionChargePerson(String.join(",",personCodes));
entity.setInspectionChargePersonName(String.join(",",personNames));
entity.setInspectionChargePerson(String.join(",", personCodes));
entity.setInspectionChargePersonName(String.join(",", personNames));
}
}
String inspectionChargePhone = (String)params.get("inspectionChargePhone");
String inspectionChargePhone = (String) params.get("inspectionChargePhone");
if (StringUtils.isNotBlank(inspectionChargePhone)) {
entity.setInspectionChargePhone(inspectionChargePhone);
}
this.updateById(entity);
BeanUtils.copyProperties(entity,model);
BeanUtils.copyProperties(entity, model);
updateTaskModel(model);
// 执行接收业务
String type = (String) params.get("type");
JyjcInspectionApplicationModel inspectionApplicationModel = this.queryBySeq(sequenceNbr);
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(sequenceNbr);
......@@ -594,7 +594,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<JyjcInspectionResult> resultModels = new ArrayList(applicationEquipModels.size());
//List<String> codes = createCodeService.createApplicationFormCode(ApplicationFormTypeEnum.JG.getCode(), applicationEquipModels.size());
List<String> codes = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JG.getCode(), applicationEquipModels.size()).getResult();
......@@ -622,13 +621,17 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
resultModels.add(resultModel);
}
inspectionResultService.saveOrUpdateBatch(resultModels);
// 通知对应的检验机构
Map<String, Object> thiryPartParams = MapBuilder.<String, Object>create().put("inspectionApplication", inspectionApplicationModel).put("applicationEquips", applicationEquipModels).build();
JyjcInspectionApplicationHandlerFactory.apply(type).notifyInspectionUnit(thiryPartParams);
this.pushInspectionApplication(inspectionApplicationModel);
}
private void pushInspectionApplication(JyjcInspectionApplicationModel inspectionApplicationModel) {
// 将检验检测申请信息推送至对应的检验机构
InspectionApplicationPushEvent event = new InspectionApplicationPushEvent(this, inspectionApplicationModel);
eventPublisher.publish(event);
}
private String getDictNameByCode(String code) {
DataDictionary dataDictionary = dataDictionaryService.getByCode(code,"JYJC");
DataDictionary dataDictionary = dataDictionaryService.getByCode(code, "JYJC");
return dataDictionary != null ? dataDictionary.getName() : "";
}
......@@ -655,7 +658,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskResultDTO task = new TaskResultDTO();
task.setResultCode("approvalStatus");
task.setTaskId(taskId);
task.setComment(params.getOrDefault("comments","").toString()); HashMap<String, Object> map = new HashMap<>();
task.setComment(params.getOrDefault("comments", "").toString());
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", "1");
task.setVariable(map);
//执行流程
......@@ -669,15 +673,15 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
entity.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
JyjcInspectionApplicationModel model = new JyjcInspectionApplicationModel();
BeanUtils.copyProperties(entity,model);
BeanUtils.copyProperties(entity, model);
model.setStatusName(FlowStatusEnum.REJECTED.getName());
String processDescription = (String)params.get("comments");
String processDescription = (String) params.get("comments");
if (StringUtils.isNotBlank(processDescription)) {
entity.setProcessDescription(processDescription);
}
String nextUserIds = workflowResultDtos.get(0).getNextExecutorUserIds();
String executorRoleIds = workflowResultDtos.get(0).getExecutorRoleIds();
if(processTaskDTO != null && processTaskDTO.getNextTask() != null && processTaskDTO.getNextTask().size() >0){
if (processTaskDTO != null && processTaskDTO.getNextTask() != null && processTaskDTO.getNextTask().size() > 0) {
taskCode = processTaskDTO.getNextTask().get(0).getKey();
taskName1 = processTaskDTO.getNextTask().get(0).getName();
nextTaskId = processTaskDTO.getNextTask().get(0).getId();
......@@ -694,10 +698,10 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
model.setNextExecuteIds(executorRoleIds);
model.setNextExecuteUserIds(nextUserIds);
executeOneStep(model, taskName1, nextUserIds);
BeanUtils.copyProperties(model,entity);
BeanUtils.copyProperties(model, entity);
this.updateById(entity);
// updateModelByInstanceId(sequenceNbr, instanceId, params, rollBack);
// updateModelByInstanceId(sequenceNbr, instanceId, params, rollBack);
return true;
}
......@@ -730,7 +734,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} catch (Exception e) {
e.printStackTrace();
log.error("执行工作流错误, => {}", params, e);
throw new BaseException("该项流程发生变化,刷新查看状态后重试","400","");
throw new BaseException("该项流程发生变化,刷新查看状态后重试", "400", "");
}
}
......@@ -768,15 +772,15 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
JyjcInspectionApplication jyjcInspectionApplication = new JyjcInspectionApplication();
BeanUtils.copyProperties(inspectionApplicationModel,jyjcInspectionApplication);
BeanUtils.copyProperties(inspectionApplicationModel, jyjcInspectionApplication);
this.getBaseMapper().updateById(jyjcInspectionApplication);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(inspectionApplicationModel));
jsonObject.put("nextTaskId", inspectionApplicationModel.getNextTaskId());
jsonObject.put("nextExecuteUser", inspectionApplicationModel.getNextExecuteIds());
jsonObject.put("taskType", BizTypeEnum.getNumByCode(inspectionApplicationModel.getBizType()));
jsonObject.put("flowStatus",FlowStatusEnum.ROLLBACK.getCode());
jsonObject.put("flowStatusLabel",FlowStatusEnum.ROLLBACK.getName());
jsonObject.put("flowStatus", FlowStatusEnum.ROLLBACK.getCode());
jsonObject.put("flowStatusLabel", FlowStatusEnum.ROLLBACK.getName());
taskModelService.rollbackTask(inspectionApplicationModel.getProcessInstanceId(), jsonObject);
return true;
......@@ -795,18 +799,18 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
String status = (String) params.get("status");
List<String> persons = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePerson")), String.class);
// List<String> phones = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePhone")), String.class);
// List<String> phones = JSONArray.parseArray(JSON.toJSONString(params.get("inspectionChargePhone")), String.class);
String inspectionChargePerson = persons == null?"":String.join(",",persons);
String inspectionChargePerson = persons == null ? "" : String.join(",", persons);
if (StringUtils.isNotBlank(inspectionChargePerson)) {
entity.setInspectionChargePerson(inspectionChargePerson);
}
String processDescription = (String)params.get("comments");
String processDescription = (String) params.get("comments");
if (StringUtils.isNotBlank(processDescription)) {
entity.setProcessDescription(processDescription);
}
String inspectionChargePhone = (String)params.get("inspectionChargePhone");
String inspectionChargePhone = (String) params.get("inspectionChargePhone");
if (StringUtils.isNotBlank(inspectionChargePhone)) {
entity.setInspectionChargePhone(inspectionChargePhone);
}
......@@ -821,14 +825,14 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
entity.setWorkflowRole(role);
}
entity.setStatus(status);
//此处自己撤销也赋予了办理日期 存在问题 与驳回 通过区分处理
//此处自己撤销也赋予了办理日期 存在问题 与驳回 通过区分处理
if (rollBack) {
this.getBaseMapper().updatePromoter(entity.getSequenceNbr());
}
//逻辑变更为 通过后才对办理时间赋值
if (status.equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))){
if (status.equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))) {
entity.setAcceptDate(new Date());
entity.setInnerPersonCode(params.getOrDefault("innerPersonCode","").toString());
entity.setInnerPersonCode(params.getOrDefault("innerPersonCode", "").toString());
}
this.updateById(entity);
......@@ -844,7 +848,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
});
}
private void createdTaskModel(JyjcInspectionApplicationModel model){
private void createdTaskModel(JyjcInspectionApplicationModel model) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
TaskModelDto dto = new TaskModelDto();
......@@ -863,7 +867,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
dto.setFlowCreateDate(new Date());
dto.setTaskName(model.getNextTaskName());
dto.setFlowCode(model.getNextTaskId());
dto.setTaskContent("来自"+model.getEquList()+"【"+model.getSupervisoryCode()+"】的业务办理,【申请单号:"+model.getApplicationNo()+"】");
dto.setTaskContent("来自" + model.getEquList() + "【" + model.getSupervisoryCode() + "】的业务办理,【申请单号:" + model.getApplicationNo() + "】");
dto.setTaskCode(model.getApplicationNo());
dto.setTaskType(BizTypeEnum.getNumByCode(model.getBizType()));
dto.setTaskTypeLabel(BizTypeEnum.getNameByCode(model.getBizType()));
......@@ -903,7 +907,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskModelDto modelDto = new TaskModelDto();
BeanUtil.copyProperties(taskV2Model, modelDto);
modelDto.setNextExecuteUser(model.getNextExecuteIds());
if (model.getStatus().equals(FlowStatusEnum.REJECTED.getCode()+"")){
if (model.getStatus().equals(FlowStatusEnum.REJECTED.getCode() + "")) {
modelDto.setPageType("edit");
}
TaskMessageDto obj = new TaskMessageDto();
......@@ -927,12 +931,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
private TaskV2Model updateTaskModel(JyjcInspectionApplicationModel model) {
Map<String, Object> params = new HashMap<>();
params.put("relationId",model.getProcessInstanceId());
params.put("relationId", model.getProcessInstanceId());
params.put("taskStatus", model.getStatus());
params.put("taskStatusLabel", model.getStatusName());
params.put("flowStatus",model.getStatus());
params.put("flowStatusLabel",model.getStatusName());
params.put("model",model);
params.put("flowStatus", model.getStatus());
params.put("flowStatusLabel", model.getStatusName());
params.put("model", model);
return taskModelService.updateTaskModel(params);
}
}
\ No newline at end of file
......@@ -381,11 +381,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
List<JyjcInspectionResultParam> resultParams = new ArrayList<>();
resultDataModels.forEach(r -> {
// 填充主表数据
this.fillResultData(r, resultListMap.get(r.getApplicationNo()));
this.fillResultData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()));
// 填充附件数据
this.fillResultAttachmentData(r, resultListMap.get(r.getApplicationNo()), resultAttachments);
this.fillResultAttachmentData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()), resultAttachments);
// 填充技术参数数据
this.fillResultParamData(r, resultListMap.get(r.getApplicationNo()), resultParams);
this.fillResultParamData(r, resultListMap.get(r.getApplicationNo() + ":" + r.getSupervisoryCode()), resultParams);
});
// 2.批量保存主表数据
this.updateBatchById(resultListMap.values());
......@@ -472,8 +472,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private Map<String, JyjcInspectionResult> queryWaitUpdateResultList(List<JyjcInspectionResultDataModel> resultDataModels) {
List<String> applicationNos = resultDataModels.stream().map(JyjcInspectionResultDataModel::getApplicationNo).collect(Collectors.toList());
LambdaQueryWrapper<JyjcInspectionResult> wrapper = new LambdaQueryWrapper<JyjcInspectionResult>().in(JyjcInspectionResult::getApplicationNo, applicationNos);
List<String> supervisoryCodes = resultDataModels.stream().map(JyjcInspectionResultDataModel::getSupervisoryCode).collect(Collectors.toList());
LambdaQueryWrapper<JyjcInspectionResult> wrapper = new LambdaQueryWrapper<>();
wrapper.in(JyjcInspectionResult::getApplicationNo, applicationNos);
wrapper.in(JyjcInspectionResult::getSupervisoryCode, supervisoryCodes);
List<JyjcInspectionResult> resultList = this.list(wrapper);
return resultList.stream().collect(Collectors.toMap(JyjcInspectionResult::getApplicationNo, Function.identity()));
return resultList.stream().collect(Collectors.toMap((c)-> c.getApplicationNo() + ":" + c.getSupervisoryCode(), Function.identity()));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationPushLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:12
*/
@Component
public class AbstractJyjcInspectionApplicationHandlerServiceImpl implements IJyjcInspectionApplicationHandlerService {
@Autowired
private JyjcInspectionApplicationPushLogServiceImpl applicationPushLogService;
@Override
public String type() {
return "default";
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
// push日志
applicationPushLogService.saveInspectionApplicationPushLog(params);
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 检测
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class DetectionInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.DETECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 定检
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class FirstInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.FIRST_INSPECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* @author yangyang
* @version v1.0
* @date 2023/11/8 15:10
*/
@Service
public class JyjcInspectionApplicationHandlerFactory implements ApplicationContextAware {
private static final Map<String, IJyjcInspectionApplicationHandlerService> SERVICE_POOL = new HashMap<>(12);
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
applicationContext.getBeansOfType(IJyjcInspectionApplicationHandlerService.class).forEach((beanName, bean) -> SERVICE_POOL.put(bean.type(), bean));
}
public static IJyjcInspectionApplicationHandlerService apply(String type) {
IJyjcInspectionApplicationHandlerService objectSceneService = SERVICE_POOL.get(type);
if (Objects.isNull(objectSceneService)) {
throw new IllegalArgumentException("SERVICE_POOL type: " + type + " is not found !");
}
return objectSceneService;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 监督检验
*
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class SuperviseInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.SUPERVISE.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
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