Commit f656ef22 authored by LiuLin's avatar LiuLin

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

parents 78b9b13f 96bb550a
...@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-12-12 * @date 2023-12-12
...@@ -27,9 +27,12 @@ public class JgInstallationNoticeDto extends BaseDto { ...@@ -27,9 +27,12 @@ public class JgInstallationNoticeDto extends BaseDto {
@ApiModelProperty(value = "设备种类") @ApiModelProperty(value = "设备种类")
private String equList; private String equList;
@ApiModelProperty(value = "告知状态") @ApiModelProperty(value = "告知状态编号")
private String noticeStatus; private String noticeStatus;
@ApiModelProperty(value = "告知状态描述")
private String noticeStatusDesc;
@ApiModelProperty(value = "设备数量") @ApiModelProperty(value = "设备数量")
private Integer deviceNum; private Integer deviceNum;
......
...@@ -28,11 +28,7 @@ public class JgUseRegistration extends BaseEntity { ...@@ -28,11 +28,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField("supervisory_code") @TableField("supervisory_code")
private String supervisoryCode; private String supervisoryCode;
/**
* 使用单位ID
*/
@TableField("use_unit_id")
private String useUnitId;
/** /**
* 使用单位名称 * 使用单位名称
...@@ -52,11 +48,7 @@ public class JgUseRegistration extends BaseEntity { ...@@ -52,11 +48,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField("audit_status") @TableField("audit_status")
private String auditStatus; private String auditStatus;
/**
* 接收机构id
*/
@TableField("receive_org_id")
private String receiveOrgId;
/** /**
* 接收机构 * 接收机构
...@@ -64,11 +56,7 @@ public class JgUseRegistration extends BaseEntity { ...@@ -64,11 +56,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField("receive_org_name") @TableField("receive_org_name")
private String receiveOrgName; private String receiveOrgName;
/**
* 检验单位ID
*/
@TableField("inspect_unit_id")
private String inspectUnitId;
/** /**
* 检验单位 * 检验单位
...@@ -118,11 +106,7 @@ public class JgUseRegistration extends BaseEntity { ...@@ -118,11 +106,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField("reg_person_name") @TableField("reg_person_name")
private String regPersonName; private String regPersonName;
/**
* 安装单位ID
*/
@TableField("install_unit_id")
private String installUnitId;
/** /**
* 安装单位名称 * 安装单位名称
...@@ -168,4 +152,7 @@ public class JgUseRegistration extends BaseEntity { ...@@ -168,4 +152,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField("use_unit_credit_code") @TableField("use_unit_credit_code")
private String useUnitCreditCode; private String useUnitCreditCode;
@TableField("inspect_unit_credit_code")
private String inspectUnitCreditCode;
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper 接口 * Mapper 接口
* *
* @author system_generator * @author system_generator
* @date 2023-12-12 * @date 2023-12-12
*/ */
public interface JgInstallationNoticeMapper extends BaseMapper<JgInstallationNotice> { public interface JgInstallationNoticeMapper extends BaseMapper<JgInstallationNotice> {
Page<JgInstallationNotice> queryForPage(Page<JgInstallationNotice> page, @Param("param") JgInstallationNoticeDto model, @Param("type") String type);
} }
package com.yeejoin.amos.boot.module.jg.flc.api.fegin;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
//@FeignClient(value = "AMOS-API-WORKFLOW", configuration = {FeignConfiguration.class})
@FeignClient(name = "AMOS-API-WORKFLOW", path = "workflow", configuration = {MultipartSupportConfig.class})
public interface WorkFlowFeginService {
/***
* 根据task_id 获取节点信息
*
* */
@RequestMapping(value = "/history/task/nodeInfo", method = RequestMethod.GET)
FeignClientResult<JSONObject> getNodeInfo(@RequestParam(value = "taskId") String taskId);
/***
*
* 查询当前流程对应的可执行任务,无权限级别
* */
@RequestMapping(value = "/task/getTaskNoAuth/{processInstanceId}", method = RequestMethod.GET)
JSONObject getTaskNoAuth(@PathVariable(value = "processInstanceId") String processInstanceId);
/***
*
* 获取流程审批日志
* */
@RequestMapping(value = "/task/flowLogger/{procInsId}", method = RequestMethod.GET)
FeignClientResult<Map<String,Object>> getFlowLogger(@PathVariable(value = "procInsId") String procInsId);
@RequestMapping(value = "/history/task/nodeInfo", method = RequestMethod.GET)
FeignClientResult<JSONObject> getNodeInfotoken(
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader(name="product",required = true) String product,
@RequestHeader(name="token",required = true) String token,
@RequestParam(value = "taskId") String taskId);
/***
*
* 查询当前流程对应的可执行任务,无权限级别
* */
@RequestMapping(value = "/task/getTaskNoAuth/{processInstanceId}", method = RequestMethod.GET)
JSONObject getTaskNoAuthtoken(
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader(name="product",required = true) String product,
@RequestHeader(name="token",required = true) String token,
@PathVariable(value = "processInstanceId") String processInstanceId);
}
...@@ -2,4 +2,47 @@ ...@@ -2,4 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice">
select
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.notice_date AS noticeDate,
isn.use_unit_id AS useUnitId,
isn.use_unit_name AS useUnitName,
isn.receive_org_id AS receiveOrgId,
isn.receive_org_name AS receiveOrgName,
isn.region_no AS regionNo,
isn.address AS address,
isn.notice_status AS noticeStatus,
isn.install_unit_id AS installUnitId,
isn.install_unit_name AS installUnitName
FROM
tzs_jg_installation_notice isn
<where>
isn.is_delete = false
<if test="param != null ">
<if test="param.applyNo != null and param.applyNo != ''">
AND isn.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
</if>
<if test="param.receiveOrgName != null and param.receiveOrgName != ''">
AND isn.receive_org_name LIKE CONCAT('%', #{param.receiveOrgName}, '%')
</if>
<if test="param.useUnitName != null and param.useUnitName != ''">
AND isn.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
</if>
<if test="param.installUnitName != null and param.installUnitName != ''">
AND isn.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
</if>
<if test="param.noticeStatus != null and param.noticeStatus != ''">
AND isn.notice_status = #{param.noticeStatus}
</if>
</if>
<if test="type == 'supervision'">
AND isn.notice_status in ('6612', '6613', '6614')
</if>
</where>
ORDER BY
isn.notice_date DESC
</select>
</mapper> </mapper>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-feign-workflow</artifactId> <artifactId>amos-feign-workflow</artifactId>
<version>1.8.5</version> <version>1.10.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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 com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import io.swagger.annotations.Api;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
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 org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* 安装告知 * 安装告知
...@@ -37,28 +38,28 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -37,28 +38,28 @@ public class JgInstallationNoticeController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知") @ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知")
public ResponseModel<JgInstallationNoticeDto> save(@RequestBody JgInstallationNoticeDto model) { public ResponseModel<JgInstallationNoticeDto> save(@RequestBody JgInstallationNoticeDto model) {
model = jgInstallationNoticeServiceImpl.createWithModel(model); model = jgInstallationNoticeServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知")
public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody JgInstallationNoticeDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody JgInstallationNoticeDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateWithModel(model));
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
...@@ -67,50 +68,52 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -67,50 +68,52 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@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) {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.removeById(sequenceNbr));
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个安装告知", notes = "根据sequenceNbr查询单个安装告知") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个安装告知", notes = "根据sequenceNbr查询单个安装告知")
public ResponseModel<JgInstallationNoticeDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JgInstallationNoticeDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySeq(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @PostMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "安装告知分页查询", notes = "安装告知分页查询") @ApiOperation(httpMethod = "GET", value = "安装告知分页查询", notes = "安装告知分页查询")
public ResponseModel<Page<JgInstallationNoticeDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<JgInstallationNoticeDto>> queryForPage(
(value = "size") int size) { @ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current,
Page<JgInstallationNoticeDto> page = new Page<JgInstallationNoticeDto>(); @ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
page.setCurrent(current); @ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type,
page.setSize(size); @RequestBody(required = false) JgInstallationNoticeDto model
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticePage(page)); ) {
} Page<JgInstallationNotice> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticePage(page, model, type));
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "安装告知列表全部数据查询", notes = "安装告知列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "安装告知列表全部数据查询", notes = "安装告知列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<JgInstallationNoticeDto>> selectForList() { public ResponseModel<List<JgInstallationNoticeDto>> selectForList() {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticeList()); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticeList());
} }
} }
...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult; import com.yeejoin.amos.feign.workflow.model.AjaxResult;
...@@ -96,7 +98,8 @@ public class JgUseRegistrationController extends BaseController { ...@@ -96,7 +98,8 @@ public class JgUseRegistrationController extends BaseController {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDetail(id)); return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDetail(id));
} }
@Autowired
WorkFlowFeginService workFlowFeginService;
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/test") @GetMapping(value = "/test")
@ApiOperation(httpMethod = "GET", value = "", notes = "") @ApiOperation(httpMethod = "GET", value = "", notes = "")
...@@ -105,11 +108,8 @@ public class JgUseRegistrationController extends BaseController { ...@@ -105,11 +108,8 @@ public class JgUseRegistrationController extends BaseController {
//启动流程 //启动流程
try { try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey("useRegistrationNew"); dto.setProcessDefinitionKey("useRegistration");
dto.setBusinessKey("1"); dto.setBusinessKey("1");
HashMap<String, Object> dtoMap = new HashMap<>();
dtoMap.put("approvalStatus", op);
dto.setVariables(dtoMap);
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto); AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
instanceId = ((Map) ajaxResult.get("data")).get("id").toString(); instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
...@@ -130,12 +130,19 @@ public class JgUseRegistrationController extends BaseController { ...@@ -130,12 +130,19 @@ public class JgUseRegistrationController extends BaseController {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id"); String taskId = dataObject.getString("id");
// JSONObject taskNoAuth = workFlowFeginService.getTaskNoAuth(instanceId);
// FeignClientResult<JSONObject> nodeInfo = workFlowFeginService.getNodeInfo(taskId);
//组装信息 //组装信息
TaskResultDTO dto = new TaskResultDTO(); TaskResultDTO dto = new TaskResultDTO();
dto.setResult(op); // dto.setResult(op);
dto.setResultCode("approvalStatus"); dto.setResultCode("approvalStatus");
dto.setTaskId(taskId); dto.setTaskId(taskId);
dto.setComment("啦啦啦啦!!!!!"); dto.setComment("啦啦啦啦!!!!!");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
dto.setVariable(map);
// FeignClientResult reject = Workflow.taskV2Client.reject(taskId, dto);
//执行流程 //执行流程
AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto); AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
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.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; 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.jg.api.dto.JgInstallationNoticeDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 服务实现类 * 服务实现类
...@@ -16,18 +21,37 @@ import java.util.List; ...@@ -16,18 +21,37 @@ import java.util.List;
* @date 2023-12-12 * @date 2023-12-12
*/ */
@Service @Service
public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationNoticeDto,JgInstallationNotice,JgInstallationNoticeMapper> implements IJgInstallationNoticeService { public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationNoticeDto, JgInstallationNotice, JgInstallationNoticeMapper> implements IJgInstallationNoticeService {
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNoticeDto> page) { public Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type) {
return this.queryForPage(page, null, false); Page<JgInstallationNotice> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type);
// 将Page<JgInstallationNotice>转化为Page<JgInstallationNoticeDto>
Page<JgInstallationNoticeDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
List<JgInstallationNoticeDto> records = noticePage.getRecords().stream().map(notice -> {
JgInstallationNoticeDto noticeDto = new JgInstallationNoticeDto();
BeanUtils.copyProperties(notice, noticeDto);
if (Objects.nonNull(notice.getNoticeStatus())) {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf(notice.getNoticeStatus()));
noticeDto.setNoticeStatusDesc(noticeStatusDesc);
}
return noticeDto;
}).collect(java.util.stream.Collectors.toList());
noticeDtoPage.setRecords(records);
return noticeDtoPage;
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JgInstallationNoticeDto> queryForJgInstallationNoticeList() { public List<JgInstallationNoticeDto> queryForJgInstallationNoticeList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
} }
\ No newline at end of file
...@@ -12,17 +12,25 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper; ...@@ -12,17 +12,25 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationService; import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeginService;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
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.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
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 java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -43,7 +51,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -43,7 +51,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private OtherInfoMapper otherInfoMapper; private OtherInfoMapper otherInfoMapper;
@Autowired @Autowired
private JgRelationEquipMapper jgRelationEquipMapper; private JgRelationEquipMapper jgRelationEquipMapper;
@Autowired
WorkFlowFeginService workFlowFeginService;
public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, Page<Map<String, Object>> page) { public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, Page<Map<String, Object>> page) {
return this.baseMapper.getListPage(page, dto); return this.baseMapper.getListPage(page, dto);
} }
...@@ -74,6 +83,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -74,6 +83,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgUseRegistration.setSupervisoryCode(supervisoryCode); jgUseRegistration.setSupervisoryCode(supervisoryCode);
jgUseRegistration.setUseUnitName(useInfo.getUseUnitName()); jgUseRegistration.setUseUnitName(useInfo.getUseUnitName());
jgUseRegistration.setUseUnitCreditCode(useInfo.getUseUnitCreditCode()); jgUseRegistration.setUseUnitCreditCode(useInfo.getUseUnitCreditCode());
jgUseRegistration.setInspectUnitCreditCode(map.get("inspectUnitCreditCode").toString());
jgUseRegistration.setInspectUnitName(map.get("inspectOrgName").toString());
// jgUseRegistration.setAuditStatus(); // jgUseRegistration.setAuditStatus();
// jgUseRegistration.setUseRegistrationCode(); // jgUseRegistration.setUseRegistrationCode();
...@@ -84,6 +95,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -84,6 +95,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgRelationEquip.setEquipId(map.get("equipId").toString()); jgRelationEquip.setEquipId(map.get("equipId").toString());
jgRelationEquip.setBusinessType(String.valueOf(BusinessTypeEnum.USAGE_REGISTRATION.getCode())); jgRelationEquip.setBusinessType(String.valueOf(BusinessTypeEnum.USAGE_REGISTRATION.getCode()));
jgRelationEquipMapper.insert(jgRelationEquip); jgRelationEquipMapper.insert(jgRelationEquip);
if (!ObjectUtils.isEmpty(map.get("submit"))){
// 启动并执行流程
String instanceId = startByVariable();
if (ObjectUtils.isEmpty(instanceId)){
// 执行流程
flowExecute(instanceId, "1", "备注"+System.currentTimeMillis());
}
jgUseRegistration.setInstanceId(instanceId);
this.update();
}
}
public String startByVariable (){
String instanceId = "";
//启动流程
try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey("useRegistrationNew");
dto.setBusinessKey("submit");
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
} catch (Exception e) {
e.printStackTrace();
}
return instanceId;
}
public void flowExecute(String instanceId, String operate, String comment){
try {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
JSONObject taskNoAuth = workFlowFeginService.getTaskNoAuth(instanceId);
FeignClientResult<JSONObject> nodeInfo = workFlowFeginService.getNodeInfo(taskId);
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
dto.setComment(comment+System.currentTimeMillis());
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", operate);
dto.setVariable(map);
//执行流程
AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ObjectUtils.isEmpty(ajaxResult1)) {
}
} catch (Exception e) {
e.printStackTrace();
}
} }
public void deleteBatch(List<Long> ids) { public void deleteBatch(List<Long> ids) {
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -17,15 +18,8 @@ import java.util.Map; ...@@ -17,15 +18,8 @@ import java.util.Map;
*/ */
public interface JyjcBaseMapper { public interface JyjcBaseMapper {
TzBaseEnterpriseInfoDto selectEnterpriseInfo(String unitCode);
List<TzBaseUnitLicenceDto> selectBaseUnitLicenceList(Map<String, Object> params); List<TzBaseUnitLicenceDto> selectBaseUnitLicenceList(Map<String, Object> params);
@Select ("SELECT " + @MapKey(value = "code")
" * " + List<Map<String, String>> selectDataDictionaryList(List<String> codes);
" FROM " +
" tzs_user_info " +
" WHERE " +
" unit_code = '${unitCode}'")
List<TzsUserInfoDto> selectUserInfoByUnitCodeList(@Param ("unitCode") String unitCode);
} }
package com.yeejoin.amos.boot.module.jyjc.api.model; package com.yeejoin.amos.boot.module.jyjc.api.model;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -82,5 +83,5 @@ public class JyjcOpeningApplicationModel extends BaseModel { ...@@ -82,5 +83,5 @@ public class JyjcOpeningApplicationModel extends BaseModel {
private String latitude; private String latitude;
@ApiModelProperty ("企业营业执照") @ApiModelProperty ("企业营业执照")
private String unitBusinessLicense; private List<AttachmentDto> unitBusinessLicense;
} }
...@@ -2,15 +2,26 @@ ...@@ -2,15 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper">
<select id="selectEnterpriseInfo" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto">
select * from tz_base_enterprise_info where use_unit_code = #{unitCode}
</select>
<select id="selectBaseUnitLicenceList" parameterType="map" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto"> <select id="selectBaseUnitLicenceList" parameterType="map" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto">
select * from tz_base_unit_licence select * from tz_base_unit_licence
where unit_code = #{unitCode} and licence_type = #{licenceType} where unit_code = #{unitCode}
<if test="licenceType !=null and licenceType != ''">
and licence_type = #{licenceType}
</if>
</select> </select>
<select id="selectDataDictionaryList" resultType="java.util.Map">
select code, name
from cb_data_dictionary
where
1=1
<if test="list !=null and list.size()>0">
AND code in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
rec_date, rec_date,
rec_user_id, rec_user_id,
rec_user_name, rec_user_name,
apply_time apply_time,
workflow_prostance_id,
workflow_role,
unit_code_name
from tz_jyjc_opening_application from tz_jyjc_opening_application
<where> <where>
<if test="jyjcOpeningApplicationModel.applicationSeq != '' and jyjcOpeningApplicationModel.applicationSeq != null"> <if test="jyjcOpeningApplicationModel.applicationSeq != '' and jyjcOpeningApplicationModel.applicationSeq != null">
......
...@@ -55,7 +55,7 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -55,7 +55,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateModel(model,false));
} }
/** /**
...@@ -99,7 +99,6 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -99,7 +99,6 @@ public class JyjcOpeningApplicationController extends BaseController {
Page<JyjcOpeningApplication> page = new Page<JyjcOpeningApplication>(); Page<JyjcOpeningApplication> page = new Page<JyjcOpeningApplication>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
// BaseEnterpriseInfoDto baseEnterpriseInfoDto
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryForJyjcOpeningApplicationPage(page,jyjcOpeningApplicationDto)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryForJyjcOpeningApplicationPage(page,jyjcOpeningApplicationDto));
} }
...@@ -125,8 +124,8 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -125,8 +124,8 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "接收或者驳回业务开通申请", notes = "接收或者驳回业务开通申请") @ApiOperation(httpMethod = "GET",value = "接收或者驳回业务开通申请", notes = "接收或者驳回业务开通申请")
@GetMapping(value = "/execueFlow") @GetMapping(value = "/execueFlow")
public void execueFlow(@RequestParam("op") String op, @RequestParam("instanceId") String instanceId) { public void execueFlow(@RequestParam("op") String op, @RequestParam("instanceId") String instanceId,@RequestParam("comments") String comments) {
jyjcOpeningApplicationServiceImpl.execueFlow(op,instanceId); jyjcOpeningApplicationServiceImpl.execueFlow(op,instanceId,comments);
} }
/** /**
...@@ -141,4 +140,12 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -141,4 +140,12 @@ public class JyjcOpeningApplicationController extends BaseController {
jyjcOpeningApplicationServiceImpl.stopFlow(instanceId); jyjcOpeningApplicationServiceImpl.stopFlow(instanceId);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/restartFlow/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "重新提交开通申请", notes = "重新提交开通申请")
public ResponseModel<JyjcOpeningApplicationModel> resubmitJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateModel(model, true));
}
} }
...@@ -4,9 +4,13 @@ import cn.hutool.core.map.MapBuilder; ...@@ -4,9 +4,13 @@ import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.jyjc.api.common.CommonConstants; import com.yeejoin.amos.boot.module.jyjc.api.common.CommonConstants;
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.mapper.JyjcBaseMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
...@@ -19,7 +23,12 @@ import com.yeejoin.amos.boot.module.jyjc.biz.feign.WorkflowFeignClient; ...@@ -19,7 +23,12 @@ import com.yeejoin.amos.boot.module.jyjc.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum; import com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzBaseUnitLicenceMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
...@@ -27,15 +36,19 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult; ...@@ -27,15 +36,19 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.bouncycastle.cert.ocsp.Req; import org.bouncycastle.cert.ocsp.Req;
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.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.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 javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
...@@ -44,6 +57,7 @@ import java.util.HashMap; ...@@ -44,6 +57,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -74,23 +88,20 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -74,23 +88,20 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private TzBaseUnitLicenceMapper unitLicenceMapper;
@Autowired
private TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
@Autowired
private TzsUserInfoMapper userInfoMapper;
@Autowired
private WorkflowFeignClient workflowFeignClient; private WorkflowFeignClient workflowFeignClient;
@Transactional (rollbackFor = {Exception.class, CommonException.class}) @Transactional (rollbackFor = {Exception.class, CommonException.class})
public JyjcOpeningApplicationModel saveModel(JyjcOpeningApplicationModel model) { public JyjcOpeningApplicationModel saveModel(JyjcOpeningApplicationModel model) {
// 开启工作流 startProcess // 开启工作流 startProcess
try { try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); String instanceId = startFlow();
dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey("1");
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
if (log.isDebugEnabled()) {
log.debug("开启工作流结果:{}", ajaxResult);
}
if (ajaxResult == null || (ajaxResult.get(AjaxResult.CODE_TAG) != null && !"200".equals(ajaxResult.get(AjaxResult.CODE_TAG).toString()))) {
throw new BaseException("开启工作流错误");
}
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
JSONObject dataObject = getTask(instanceId); JSONObject dataObject = getTask(instanceId);
JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor"); JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
if(!ValidationUtil.isEmpty(executorArray)) { if(!ValidationUtil.isEmpty(executorArray)) {
...@@ -99,6 +110,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -99,6 +110,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
} }
CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany(); CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany();
model.setUnitCode(companyBo.getCompanyCode()); model.setUnitCode(companyBo.getCompanyCode());
model.setUnitCode("91611103MAC4Q1EG7B");
model.setUnitCodeName(companyBo.getCompanyName()); model.setUnitCodeName(companyBo.getCompanyName());
model.setApplicationSeq(buildApplicationSeq()); model.setApplicationSeq(buildApplicationSeq());
model.setStatus(!ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : ""); model.setStatus(!ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : "");
...@@ -110,20 +122,60 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -110,20 +122,60 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
} }
} }
private JSONObject getTask(String instanceId) { @Transactional (rollbackFor = {Exception.class, CommonException.class})
public JyjcOpeningApplicationModel updateModel(JyjcOpeningApplicationModel model, Boolean restartFlow) {
if (model.getSequenceNbr() == null) {
throw new BadRequest("sequenceNbr不能为空!");
}
try { try {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); if (restartFlow) {
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); String instanceId = startFlow();
String taskId = dataObject.getString("id");// 工作流ID JSONObject dataObject = getTask(instanceId);
FeignClientResult<JSONObject> nodeInfo = workflowFeignClient.getNodeInfotoken(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), taskId); JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
dataObject.put("nodeInfo", nodeInfo.getResult()); if(!ValidationUtil.isEmpty(executorArray)) {
return dataObject; String roleGroups = executorArray.stream().map(json -> Optional.ofNullable(((LinkedHashMap) json).get("groupId")).orElse("").toString()).collect(Collectors.joining(","));
model.setWorkflowRole(roleGroups);
}
}
return this.updateWithModel(model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("saveModel: model={} error", model, e);
throw new BaseException(e.getMessage());
}
}
public void updateModelByInstanceId(String instanceId) {
JyjcOpeningApplication entity = this.lambdaQuery().eq(JyjcOpeningApplication::getWorkflowProstanceId, instanceId).one();
if (entity == null) {
return;
}
JSONObject taskJson = getTask(instanceId);
entity.setWorkflowRole(getWorkflowRoleGroups(taskJson));
entity.setStatus(getWorkflowStatus(taskJson));
this.updateById(entity);
}
private String getWorkflowStatus(JSONObject dataObject) {
return !ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : "";
}
private String getWorkflowRoleGroups(JSONObject dataObject) {
JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
if(!ValidationUtil.isEmpty(executorArray)) {
return executorArray.stream().map(json -> Optional.ofNullable(((LinkedHashMap) json).get("groupId")).orElse("").toString()).collect(Collectors.joining(","));
} }
return null; return null;
} }
private JSONObject getTask(String instanceId) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");// 工作流ID
FeignClientResult<JSONObject> nodeInfo = workflowFeignClient.getNodeInfotoken(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), taskId);
dataObject.put("nodeInfo", nodeInfo.getResult());
return dataObject;
}
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -169,29 +221,77 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -169,29 +221,77 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel(); jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel();
} }
String unitCode = reginParams.getCompany().getCompanyCode(); String unitCode = reginParams.getCompany().getCompanyCode();
TzBaseEnterpriseInfoDto baseEnterpriseInfoDto = baseMapper.selectEnterpriseInfo(unitCode); unitCode="91611103MAC4Q1EG7B"; // 测试用,之后务必删除!!!
QueryWrapper enterpriseInfoQueryWrapper = new QueryWrapper<>();
enterpriseInfoQueryWrapper.eq("use_code", unitCode);
TzBaseEnterpriseInfo baseUnitLicenceEntity = enterpriseInfoMapper.selectOne(enterpriseInfoQueryWrapper);
// 获取企业资质 // 获取企业资质
if (baseUnitLicenceEntity != null) {
jyjcOpeningApplicationModel.setUseContact(baseUnitLicenceEntity.getUseContact());
jyjcOpeningApplicationModel.setContactPhone(baseUnitLicenceEntity.getContactPhone());
jyjcOpeningApplicationModel.setIndustrySupervisor(baseUnitLicenceEntity.getIndustrySupervisor());
jyjcOpeningApplicationModel.setLongitude(baseUnitLicenceEntity.getLongitude());
jyjcOpeningApplicationModel.setLatitude(baseUnitLicenceEntity.getLatitude());
if(ObjectUtils.isNotEmpty(baseUnitLicenceEntity.getUnitBusinessLicense())) {
jyjcOpeningApplicationModel.setUnitBusinessLicense(JSONArray.parseArray(baseUnitLicenceEntity.getUnitBusinessLicense(), AttachmentDto.class));
}
}
// QueryWrapper unitLicenceQueryWrapper = new QueryWrapper<>();
// unitLicenceQueryWrapper.eq("unit_code", unitCode);
// unitLicenceQueryWrapper.eq("licence_type", LicenceTypeEnum.JYJC.getCode());
// List<TzBaseUnitLicenceDto> baseUnitLicences = Bean.toModels(unitLicenceMapper.selectList(unitLicenceQueryWrapper), TzBaseUnitLicenceDto.class );
//
List<TzBaseUnitLicenceDto> baseUnitLicences = baseMapper.selectBaseUnitLicenceList(MapBuilder.<String, Object>create() List<TzBaseUnitLicenceDto> baseUnitLicences = baseMapper.selectBaseUnitLicenceList(MapBuilder.<String, Object>create()
.put("unitCode", unitCode) .put("unitCode", unitCode)
.put("licenceType", LicenceTypeEnum.JYJC.getCode()).build()); // .put("licenceType", LicenceTypeEnum.JYJC.getCode())
.build());
jyjcOpeningApplicationModel.setBaseUnitLicences(baseUnitLicences);
// 获取检验人员信息 // 获取检验人员信息
List<TzsUserInfoDto> userInfos = baseMapper.selectUserInfoByUnitCodeList(unitCode); QueryWrapper userInfoQueryWrapper = new QueryWrapper<>();
if (baseEnterpriseInfoDto != null) { userInfoQueryWrapper.eq("unit_code", unitCode);
jyjcOpeningApplicationModel.setUseContact(baseEnterpriseInfoDto.getUseContact()); List<TzsUserInfo> userInfos = userInfoMapper.selectList(userInfoQueryWrapper);
jyjcOpeningApplicationModel.setContactPhone(baseEnterpriseInfoDto.getContactPhone()); if (!ValidationUtil.isEmpty(userInfos)) {
jyjcOpeningApplicationModel.setIndustrySupervisor(baseEnterpriseInfoDto.getIndustrySupervisor()); List<String> codes = userInfos.stream()
jyjcOpeningApplicationModel.setLongitude(baseEnterpriseInfoDto.getLongitude()); .map(o -> o.getPost() != null ? JSON.parseArray(o.getPost(), String.class) : null)
jyjcOpeningApplicationModel.setLatitude(baseEnterpriseInfoDto.getLatitude()); .filter(Objects::nonNull)
.collect(Collectors.toList())
.stream().flatMap(o -> o.stream()).distinct().collect(Collectors.toList());
List<Map<String, String>> dicts = baseMapper.selectDataDictionaryList(codes);
List<TzsUserInfoDto> userInfoDtos = userInfos.stream().map(o -> {
TzsUserInfoDto dto = new TzsUserInfoDto();
Bean.toModel(o, dto);
if (o.getPost() != null) {
List<String> temps = JSON.parseArray(o.getPost(), String.class);
String postName = temps.stream().map(m -> dicts.stream().filter(dict -> dict.get("code").equals(m)).findFirst().map(n -> n.get("name")).orElse("")).collect(Collectors.joining(","));
dto.setPostName(postName);
}
return dto;
}).collect(Collectors.toList());
jyjcOpeningApplicationModel.setUserInfos(userInfoDtos);
} }
jyjcOpeningApplicationModel.setBaseUnitLicences(baseUnitLicences);
jyjcOpeningApplicationModel.setUserInfos(userInfos);
return jyjcOpeningApplicationModel; return jyjcOpeningApplicationModel;
} }
public String startFlow() throws Exception {
// 重新开启工作流
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey("1");
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
if (log.isDebugEnabled()) {
log.debug("开启工作流结果:{}", ajaxResult);
}
if (ajaxResult == null || (ajaxResult.get(AjaxResult.CODE_TAG) != null && !"200".equals(ajaxResult.get(AjaxResult.CODE_TAG).toString()))) {
throw new BaseException("开启工作流错误");
}
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
return instanceId;
}
/** /**
* 接收/驳回通知检验单 * 接收/驳回通知检验单
*/ */
public void execueFlow(String op, String instanceId) { public void execueFlow(String op, String instanceId,String comments) {
try { try {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
...@@ -199,20 +299,23 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -199,20 +299,23 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
//组装信息 //组装信息
TaskResultDTO dto = new TaskResultDTO(); TaskResultDTO dto = new TaskResultDTO();
dto.setResult(op); dto.setResult(op);
dto.setResultCode("condition"); dto.setResultCode("approvalStatus");
dto.setTaskId(taskId); dto.setTaskId(taskId);
dto.setComment("流程结束,你可以开始办理业务了"); dto.setComment(comments);
//执行流程 //执行流程
AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto); AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ObjectUtils.isEmpty(ajaxResult1)) { if (ObjectUtils.isEmpty(ajaxResult1)) {
} }
updateModelByInstanceId(instanceId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 撤回流程办理单 * 撤回流程办理单
*/ */
...@@ -223,7 +326,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -223,7 +326,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if (ObjectUtils.isEmpty(ajaxResult1)) { if (ObjectUtils.isEmpty(ajaxResult1)) {
} }
updateModelByInstanceId(instanceId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -91,4 +91,6 @@ public class ESEquipmentCategoryDto { ...@@ -91,4 +91,6 @@ public class ESEquipmentCategoryDto {
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String INSPECT_REPORT; private String INSPECT_REPORT;
@Field(type = FieldType.Text)
private String NEXT_INSPECT_DATE;
} }
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