Commit 8ec767aa authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register
parents 6830e828 05eae0ff
......@@ -20,11 +20,7 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ymt-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-tcm-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
......
......@@ -164,10 +164,10 @@ public class JgInstallationNoticeDto extends BaseDto {
private String inputUnitNo;
@ApiModelProperty(value = "安装委托书图片")
private List<Map<String, String>> proxyStatementAttachmentList;
private String proxyStatementAttachmentList;
@ApiModelProperty(value = "安装合同照片")
private List<Map<String, String>> installContractAttachmentList;
private String installContractAttachmentList;
@ApiModelProperty(value = "安装委托书图片")
private String proxyStatementAttachment;
......
......@@ -11,13 +11,8 @@ import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.tcm.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.service.ICreateCodeService;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
......@@ -26,12 +21,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*;
import java.util.stream.Collectors;
......@@ -47,10 +40,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public static final String SUBMIT_TYPE_FLOW = "1";
public static final String PROCESS_DEFINITION_KEY = "installationNotification";
public static final String TABLE_PAGE_ID = "1734141426742095873";
@Autowired
private JgRelationEquipMapper jgRelationEquipMapper;
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
@Autowired
@SuppressWarnings("all")
private ICreateCodeService iCreateCodeService;
/**
* 根据sequenceNbr查询
......@@ -82,25 +78,33 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
*
* @param noticeDto 安装告知
*/
@SuppressWarnings("rawtypes")
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgInstallationNoticeDto updateInstallationNotice(JgInstallationNoticeDto noticeDto, String op) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(op)) {
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey("installationNotification");
dto.setBusinessKey("1");
AjaxResult ajaxResult;
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
noticeDto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
noticeDto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean);
} catch (Exception e) {
log.error("提交失败:{}", e);
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey("installationNotification");
dto.setBusinessKey("1");
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
noticeDto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
noticeDto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean);
} catch (Exception e) {
log.error("提交失败:{}", e);
}
}
ajaxResult = Workflow.taskClient.getTask(noticeDto.getInstanceId());
......@@ -121,7 +125,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (ObjectUtils.isEmpty(ajaxResult1)) {
noticeDto.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(dto,bean);
BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean);
}
} catch (Exception e) {
......@@ -130,11 +134,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return noticeDto;
}
@Autowired
private ICreateCodeService iCreateCodeService;
@Autowired
JgRelationEquipMapper jgRelationEquipMapper;
/**
* 分页查询
*
......@@ -194,6 +193,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
@Override
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public void saveNotice(String submitType, Map<String, JgInstallationNoticeDto> jgInstallationNoticeDtoMap) {
JgInstallationNoticeDto model = jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID);
......@@ -217,7 +217,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
for (int i = 0 ; i< deviceList.size(); i++) {
for (int i = 0; i < deviceList.size(); i++) {
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey("1");
AjaxResult ajaxResult = null;
......@@ -282,10 +282,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void convertField(JgInstallationNoticeDto model) {
// 处理图片
String proxyStatementAttachment = convertImageUrl(model.getInstallContractAttachmentList());
String installContractAttachment = convertImageUrl(model.getProxyStatementAttachmentList());
model.setProxyStatementAttachment(proxyStatementAttachment);
model.setInstallContractAttachment(installContractAttachment);
model.setProxyStatementAttachment(model.getProxyStatementAttachmentList());
model.setInstallContractAttachment(model.getInstallContractAttachmentList());
// 分割省市区字段
String province = model.getProvince();
......
......@@ -18,8 +18,9 @@
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-tcm-api</artifactId>
<artifactId>amos-boot-module-ymt-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -79,7 +79,11 @@ public class JyjcOpeningApplication extends BaseEntity {
*/
@TableField("status")
private String status;
/**
* 状态
*/
@TableField("status_name")
private String statusName;
/**
* 备注
*/
......
package com.yeejoin.amos.boot.module.jyjc.api.enums;
/**
* 办理状态枚举
*/
public enum FlowStatusEnum {
/**
* 待提交
*/
TO_BE_SUBMITTED(6610, "待提交"),
/**
* 已提交
*/
SUBMITTED(6611, "已提交"),
/**
* 待受理
*/
TO_BE_PROCESSED(6612, "待受理"),
/**
* 已办理
*/
HAVE_PROCESSED(6613, "已办理"),
/**
* 已驳回
*/
REJECTED(6614, "已驳回");
private final int code;
private final String name;
FlowStatusEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(Long code) {
String name = null;
for (FlowStatusEnum enumOne : FlowStatusEnum.values()) {
if (enumOne.getCode() == code) {
name = enumOne.getName();
break;
}
}
return name;
}
public int getCode() {
return code;
}
public String getName() {
return name;
}
}
\ No newline at end of file
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.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
......
......@@ -3,8 +3,8 @@ package com.yeejoin.amos.boot.module.jyjc.api.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
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.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -52,11 +52,14 @@ public class JyjcOpeningApplicationModel extends BaseModel {
@ApiModelProperty (value = "状态")
private String status;
@ApiModelProperty (value = "状态Name")
private String statusName;
@ApiModelProperty (value = "备注")
private String remark;
@ApiModelProperty (value = "申请时间")
private String applyTime;
private Date applyTime;
@ApiModelProperty (value = "工作流执行角色")
private String workflowRole;
......
......@@ -2,7 +2,7 @@
<!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">
<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.ymt.api.dto.TzBaseUnitLicenceDto">
select * from tz_base_unit_licence
where unit_code = #{unitCode}
<if test="licenceType !=null and licenceType != ''">
......
......@@ -22,7 +22,8 @@
apply_time,
workflow_prostance_id,
workflow_role,
unit_code_name
unit_code_name,
status_name
from tz_jyjc_opening_application
<where>
<if test="jyjcOpeningApplicationModel.applicationSeq != '' and jyjcOpeningApplicationModel.applicationSeq != null">
......
......@@ -15,6 +15,7 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jyjc-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
......
package com.yeejoin.amos.boot.module.jyjc.biz.config;
import com.yeejoin.amos.boot.module.tcm.api.enums.BaseExceptionEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.BaseExceptionEnum;
/**
* @Author cpp
......
package com.yeejoin.amos.boot.module.jyjc.biz.config;
import com.yeejoin.amos.boot.module.tcm.api.common.BaseException;
import com.yeejoin.amos.boot.module.tcm.api.enums.CommonErrorEnum;
import com.yeejoin.amos.boot.module.ymt.api.common.BaseException;
import com.yeejoin.amos.boot.module.ymt.api.enums.CommonErrorEnum;
/**
* @description: 共同异常类
......
package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.map.MapBuilder;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -23,6 +24,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -68,9 +70,9 @@ public class JyjcOpeningApplicationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}/submit")
@PutMapping(value = "/submit")
@ApiOperation(httpMethod = "PUT", value = "保存并提交", notes = "保存并提交")
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrAndStartFlow(@RequestBody JyjcOpeningApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrAndStartFlow(@RequestBody JyjcOpeningApplicationModel model, @RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(model,true));
}
......@@ -80,7 +82,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "重新提交开通申请", notes = "重新提交开通申请")
public ResponseModel<JyjcOpeningApplicationModel> resubmitJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(model, true));
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.resubmit(model));
}
/**
......@@ -127,6 +129,25 @@ public class JyjcOpeningApplicationController extends BaseController {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryForJyjcOpeningApplicationPage(page,jyjcOpeningApplicationDto));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageForCompany")
@ApiOperation(httpMethod = "GET",value = "分页查询-公司", notes = "分页查询-公司")
public ResponseModel<Page<JyjcOpeningApplicationModel>> querypageForCompany(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size,JyjcOpeningApplicationModel jyjcOpeningApplicationDto) {
Page<JyjcOpeningApplication> page = new Page<JyjcOpeningApplication>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.querypageForCompany(page,jyjcOpeningApplicationDto));
}
/**
* 列表全部数据查询
*
......@@ -149,9 +170,12 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "接收或者驳回业务开通申请", notes = "接收或者驳回业务开通申请")
@PostMapping(value = "/execueFlow")
public void execueFlow(@RequestBody Map<String,Object> params) {
public ResponseModel<HashMap<String,String>> execueFlow(@RequestBody Map<String,Object> params) {
jyjcOpeningApplicationServiceImpl.execueFlow(params);
HashMap<String,String> result =new HashMap<>();
result.put("result","success");
return ResponseHelper.buildResponse(result);
}
/**
......
......@@ -4,31 +4,27 @@ import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
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.ReginParams;
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.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcOpeningApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcOpeningApplicationService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.boot.module.jyjc.biz.config.CommonException;
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.TzBaseUnitLicenceDto;
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.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.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseUnitLicenceMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -36,8 +32,7 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.apache.commons.lang3.ObjectUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.bouncycastle.cert.ocsp.Req;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
......@@ -47,8 +42,6 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -77,6 +70,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
@Value ("${process-definition-key.jyjc.openapplication:}")
private String processDefinitionKey;
@Value("${jyjc.user-post:6615}")
private String jyjcUserPost;
@Autowired
private RedisUtils redisUtils;
......@@ -102,8 +98,14 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
String roleGroups = executorArray.stream().map(json -> Optional.ofNullable(((LinkedHashMap) json).get("groupId")).orElse("").toString()).collect(Collectors.joining(","));
model.setWorkflowRole(roleGroups);
}
model.setStatus(!ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : "");
model.setStatus(FlowStatusEnum.SUBMITTED.getCode() + "");
model.setStatusName(FlowStatusEnum.SUBMITTED.getName());
model.setApplyTime(new Date());
// model.setStatus(!ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : "");
model.setWorkflowProstanceId(instanceId);
} else {
model.setStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode() + "");
model.setStatusName(FlowStatusEnum.TO_BE_SUBMITTED.getName());
}
if (model.getSequenceNbr() == null) {
CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany();
......@@ -121,7 +123,16 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
public void updateModelByInstanceId(String instanceId) {
@Transactional (rollbackFor = {Exception.class, BaseException.class})
public JyjcOpeningApplicationModel resubmit(JyjcOpeningApplicationModel model) {
model.setStatus(FlowStatusEnum.SUBMITTED.getCode() + "");
model.setStatusName(FlowStatusEnum.SUBMITTED.getName());
model = this.updateWithModel(model);
execueFlow(MapBuilder.<String,Object>create().put("op", "0").put("instanceId", model.getWorkflowProstanceId()).put("comments", "").build());
return model;
}
public void updateModelByInstanceId(String instanceId, String status) {
log.info("updateModelByInstanceId, instanceId={}", instanceId);
JyjcOpeningApplication entity = this.lambdaQuery().eq(JyjcOpeningApplication::getWorkflowProstanceId, instanceId).one();
if (entity == null) {
......@@ -130,30 +141,12 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
JSONObject taskJson = getTask(instanceId);
log.info("taskJson => {}", taskJson);
entity.setWorkflowRole(getWorkflowRoleGroups(taskJson));
entity.setStatus(getWorkflowStatus(taskJson));
// entity.setStatus(getWorkflowStatus(taskJson));
entity.setStatus(status);
entity.setStatusName(FlowStatusEnum.getNameByType(Long.parseLong(status)));
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;
}
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;
}
/**
* 分页查询
......@@ -171,6 +164,10 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
public Page<JyjcOpeningApplicationModel> queryForJyjcOpeningApplicationPage(Page<JyjcOpeningApplication> page, JyjcOpeningApplicationModel jyjcOpeningApplicationModel) {
return jyjcOpeningApplicationMapper.selectJyjcOpeningApplicationList(page, jyjcOpeningApplicationModel);
}
public Page<JyjcOpeningApplicationModel> querypageForCompany(Page<JyjcOpeningApplication> page, JyjcOpeningApplicationModel jyjcOpeningApplicationModel) {
//根据申请单中的单位信息对于列表数据进行过滤
CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany();
if (companyBo.getLevel().equals("company")) {
......@@ -208,7 +205,14 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if (baseUnitLicenceEntity != null) {
jyjcOpeningApplicationModel.setUseContact(baseUnitLicenceEntity.getUseContact());
jyjcOpeningApplicationModel.setContactPhone(baseUnitLicenceEntity.getContactPhone());
jyjcOpeningApplicationModel.setIndustrySupervisor(baseUnitLicenceEntity.getIndustrySupervisor());
if (StringUtils.isNotBlank(baseUnitLicenceEntity.getIndustrySupervisor())) {
List<Map<String, String>> dicts = baseMapper.selectDataDictionaryList(Arrays.asList(baseUnitLicenceEntity.getIndustrySupervisor()));
if (!ValidationUtil.isEmpty(dicts)) {
jyjcOpeningApplicationModel.setIndustrySupervisor(dicts.get(0).get("name"));
} else {
jyjcOpeningApplicationModel.setIndustrySupervisor(baseUnitLicenceEntity.getIndustrySupervisor());
}
}
jyjcOpeningApplicationModel.setLongitude(baseUnitLicenceEntity.getLongitude());
jyjcOpeningApplicationModel.setLatitude(baseUnitLicenceEntity.getLatitude());
if(ObjectUtils.isNotEmpty(baseUnitLicenceEntity.getUnitBusinessLicense())) {
......@@ -230,22 +234,23 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
userInfoQueryWrapper.eq("unit_code", unitCode);
List<TzsUserInfo> userInfos = userInfoMapper.selectList(userInfoQueryWrapper);
if (!ValidationUtil.isEmpty(userInfos)) {
List<String> codes = userInfos.stream()
.map(o -> o.getPost() != null ? JSON.parseArray(o.getPost(), String.class) : null)
.filter(Objects::nonNull)
.collect(Collectors.toList())
.stream().flatMap(o -> o.stream()).distinct().collect(Collectors.toList());
List<Map<String, String>> dicts = baseMapper.selectDataDictionaryList(codes);
// List<String> codes = userInfos.stream()
// .map(o -> o.getPost() != null ? JSON.parseArray(o.getPost(), String.class) : null)
// .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);
}
// 字段不要了
// 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());
}).filter(o -> o.getPost() != null && o.getPost().contains(jyjcUserPost)).collect(Collectors.toList());
jyjcOpeningApplicationModel.setUserInfos(userInfoDtos);
}
return jyjcOpeningApplicationModel;
......@@ -263,8 +268,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
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;
return ((Map) ajaxResult.get("data")).get("id").toString();
}
/**
......@@ -292,14 +296,14 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if (ObjectUtils.isEmpty(ajaxResult1)) {
}
updateModelByInstanceId(instanceId);
updateModelByInstanceId(instanceId, "0".equals(op) ? FlowStatusEnum.HAVE_PROCESSED.getCode() + "" : FlowStatusEnum.REJECTED.getCode() + "");
if(op.equals("0")){
String originalDataId = params.get("originalDataId").toString();
JyjcOpeningApplication jyjcOpeningApplication=jyjcOpeningApplicationMapper.selectById(originalDataId);
List<String> detectionRegion = Arrays.asList(params.get("detectionRegion").toString().split(",")) ;
String detectionRegionName = params.get("detectionRegionName").toString();
List<String> detectionRegion = Arrays.asList(params.get("detectionRegion").toString().replace("[","").replace("]","").split(",")) ;
// String detectionRegionName = params.get("detectionRegionName").toString();
jyjcOpeningApplication.setDetectionRegion(detectionRegion);
jyjcOpeningApplication.setDetectionRegionName(detectionRegionName);
// jyjcOpeningApplication.setDetectionRegionName(detectionRegionName);
jyjcOpeningApplicationMapper.updateById(jyjcOpeningApplication);
}
} catch (Exception e) {
......@@ -307,8 +311,6 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
/**
* 撤回流程办理单
*/
......@@ -319,12 +321,32 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if (ObjectUtils.isEmpty(ajaxResult1)) {
}
updateModelByInstanceId(instanceId);
updateModelByInstanceId(instanceId, FlowStatusEnum.REJECTED.getCode() + "");
} catch (Exception e) {
e.printStackTrace();
}
}
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;
}
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;
}
/**
* JY+年(4位)+月(2位)+日(2位)+序列号(3位
......
......@@ -32,6 +32,9 @@ public class TzsUserInfoDto extends BaseDto {
@ApiModelProperty(value = "岗位")
private String post;
@ApiModelProperty(value = "岗位名称")
private String postName;
@ApiModelProperty(value = "联系电话")
private String phone;
......
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
package com.yeejoin.amos.boot.module.ymt.biz.service.impl;
import com.yeejoin.amos.boot.module.tcm.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.service.ICreateCodeService;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
* @author LiuLin
* @date 2023-12-14
*/
@Service
@Component
public class CreateCodeServiceImpl implements ICreateCodeService {
private static final String LOCK_VALUE = "locked";
......
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