Commit 22942d0a authored by yangyang's avatar yangyang

fix(改造告知 & 检验开通 & 报检):撤回新增按钮控制

parent 33cddc31
......@@ -178,7 +178,13 @@ public class JgReformNoticeDto extends BaseDto {
@ApiModelProperty(value = "设备使用地点-街道(镇)")
private String streetName;
//
// private String receiveOrgCreditCode;
@ApiModelProperty(value = "下一执行节点ids")
private String nextExecuteIds;
private String receiveOrgCreditCode;
@ApiModelProperty(value = "发起人id用于撤回操作")
private String promoter;
}
......@@ -276,4 +276,14 @@ public class JgReformNotice extends BaseEntity {
@TableField(value ="\"street_name\"")
private String streetName;
/**
* 下一执行节点ids
*/
@TableField("next_execute_ids")
private String nextExecuteIds;
/**
* 发起人id用于撤回操作
*/
@TableField(value = "promoter")
private String promoter;
}
......@@ -33,4 +33,6 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
*/
@MapKey ("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
void updatePromoter(@Param("id") Long id);
}
......@@ -23,7 +23,9 @@
isn.instance_id AS instanceId,
isn.plan_date AS planDate,
isn.receive_company_code AS receiveCompanyCode,
isn.receive_org_name AS receiveOrgName
isn.receive_org_name AS receiveOrgName,
isn.next_execute_ids as nextExecuteIds,
isn.promoter
FROM
tzs_jg_reform_notice isn
<where>
......@@ -123,4 +125,9 @@
isn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
<update id="updatePromoter">
UPDATE tzs_jg_reform_notice set promoter = null
where sequence_nbr = #{id}
</update>
</mapper>
......@@ -540,9 +540,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
model.setUseUnitName(useUnitList[1]);
}
}
if (org.apache.commons.lang3.StringUtils.isEmpty(model.getReceiveOrgCode())) {
model.setReceiveOrgCode(model.getReceiveOrgCreditCode());
}
String receiveOrgId = model.getReceiveOrgCode();
if (!ObjectUtils.isEmpty(receiveOrgId)) {
String[] receiveOrgIdList = receiveOrgId.split("_");
......
......@@ -163,10 +163,14 @@ public class JyjcInspectionApplication extends BaseEntity {
*/
@TableField("result_type")
private String resultType;
/**
* 工作流下一个可执行节点
* 下一执行节点ids
*/
@TableField("next_execute_ids")
private String nextExecuteIds;
/**
* 发起人id用于撤回操作
*/
@TableField(value = "promoter")
private String promoter;
}
......@@ -114,9 +114,13 @@ public class JyjcOpeningApplication extends BaseEntity {
@TableField (value = "workflow_active_key")
private String workflowActiveKey;
/**
* 工作流下一个可执行节点
* 下一执行节点ids
*/
@TableField("next_execute_ids")
private String nextExecuteIds;
/**
* 发起人id用于撤回操作
*/
@TableField(value = "promoter")
private String promoter;
}
......@@ -8,7 +8,7 @@ public enum FlowStatusEnum {
/**
* 待提交
*/
TO_BE_SUBMITTED(6610, "提交"),
TO_BE_SUBMITTED(6610, "提交"),
/**
* 已提交
*/
......@@ -34,7 +34,11 @@ public enum FlowStatusEnum {
/**
* 已完成
*/
TO_BE_FINISHED(6616, "已完成");
TO_BE_FINISHED(6616, "已完成"),
/**
* 已作废
*/
TO_BE_DISCARD(6617, "已作废");
private final int code;
......
......@@ -23,4 +23,6 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
Page<JyjcInspectionApplicationEquipModel> listByCategory(Page<JyjcInspectionApplicationEquipModel> page,@Param("equipClassify") String equipClassify);
JyjcInspectionApplicationModel selectDataBySeq(Long sequenceNbr);
void updatePromoter(@org.apache.ibatis.annotations.Param ("id") Long id);
}
......@@ -18,4 +18,5 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl
Page<JyjcOpeningApplicationModel> selectJyjcOpeningApplicationList(@Param("page")Page<JyjcOpeningApplication> page,
@Param("jyjcOpeningApplicationRequstDto") JyjcOpeningApplicationRequstDto jyjcOpeningApplicationRequstDto, @Param("applyStartTime") String applyStartTime, @Param("applyendTime") String applyendTime);
void updatePromoter(@Param("id") Long id);
}
......@@ -148,7 +148,10 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty("检验结果方式")
private String resultType;
@ApiModelProperty("工作流下一个可执行节点")
@ApiModelProperty(value = "下一执行节点ids")
private String nextExecuteIds;
@ApiModelProperty(value = "发起人id用于撤回操作")
private String promoter;
}
......@@ -77,8 +77,11 @@ public class JyjcOpeningApplicationModel extends BaseModel {
@ApiModelProperty (value = "工作流节点")
private String workflowActiveKey;
@ApiModelProperty (value = "工作流下一个可执行节点")
@ApiModelProperty(value = "下一执行节点ids")
private String nextExecuteIds;
@ApiModelProperty(value = "发起人id用于撤回操作")
private String promoter;
/* ---------------- -------------- */
@ApiModelProperty (value = "企业资质信息")
List<TzBaseUnitLicenceDto> baseUnitLicences;
......
......@@ -24,7 +24,8 @@
tbei.use_unit AS inspectionUnitName,
tzjia.status,
cdd2.NAME AS statusName,
tzjia.next_execute_ids as nextExecuteIds
tzjia.next_execute_ids as nextExecuteIds,
tzjia.promoter
FROM
tz_jyjc_inspection_application AS tzjia
LEFT JOIN tz_base_enterprise_info tbei ON tbei.use_code = tzjia.application_unit_code
......@@ -123,4 +124,9 @@
WHERE
tzjia.sequence_nbr = #{sequenceNbr}
</select>
<update id="updatePromoter">
UPDATE tz_jyjc_inspection_application set promoter = null
where sequence_nbr = #{id}
</update>
</mapper>
......@@ -25,7 +25,8 @@
unit_code_name,
status_name,
workflow_active_key,
next_execute_ids
next_execute_ids,
promoter
from tz_jyjc_opening_application
<where>
<if test="jyjcOpeningApplicationRequstDto.applicationSeq != '' and jyjcOpeningApplicationRequstDto.applicationSeq != null">
......@@ -50,4 +51,9 @@
order by sequence_nbr desc
</select>
<update id="updatePromoter">
UPDATE tz_jyjc_opening_application set promoter = null
where sequence_nbr = #{id}
</update>
</mapper>
......@@ -100,8 +100,8 @@ public class JyjcOpeningApplicationController extends BaseController {
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
JyjcOpeningApplication jyjcOpeningApplication = jyjcOpeningApplicationServiceImpl.getById(sequenceNbr);
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.SUBMITTED.getCode()),String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
if(!status.contains(jyjcOpeningApplication.getStatus())){
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.SUBMITTED.getCode()), String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()), String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
if(status.contains(jyjcOpeningApplication.getStatus())) {
throw new BadRequest("除撤回跟驳回的流程之外其余流程不可删除!");
}
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.removeById(sequenceNbr));
......
......@@ -7,8 +7,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.*;
......@@ -36,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -85,9 +90,11 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Autowired
JgFeignClient jgFeignClient;
@Autowired
private RedisUtils redisUtils;
public JyjcInspectionApplicationModel save(@RequestBody JSONObject obj) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
//开启报检流程工作流
......@@ -132,6 +139,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Map<String, Object> nextNodeInfo = workflowHelper.getNextWorkflowNode(model.getProcessInstanceId());
String role = (String) nextNodeInfo.get("role");
model.setNextExecuteIds(role);
model.setPromoter(reginParams.getUserModel().getUserId());
if (!org.springframework.util.ObjectUtils.isEmpty(model.getWorkflowRole())) {
model.setWorkflowRole(model.getWorkflowRole() + "," + role);
} else {
......@@ -219,6 +227,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Map<String, Object> nextNodeInfo = workflowHelper.getNextWorkflowNode(model.getProcessInstanceId());
String role = (String) nextNodeInfo.get("role");
model.setNextExecuteIds(role);
model.setPromoter(reginParams.getUserModel().getUserId());
if (!org.springframework.util.ObjectUtils.isEmpty(model.getWorkflowRole())) {
model.setWorkflowRole(model.getWorkflowRole() + "," + role);
} else {
......@@ -334,7 +343,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Long sequenceNbr = Long.parseLong(params.get("sequenceNbr") + "");
JyjcInspectionApplicationModel inspectionApplicationModel = this.queryBySeq(sequenceNbr);
params.put("status", FlowStatusEnum.TO_BE_FINISHED.getCode() + "");
updateModelByInstanceId(inspectionApplicationModel.getProcessInstanceId(), params);
String op = params.get("op").toString();
Boolean rollBack = "1".equals(op) ? true : false;
updateModelByInstanceId(sequenceNbr, inspectionApplicationModel.getProcessInstanceId(), params, rollBack);
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(sequenceNbr);
if (inspectionApplicationModel == null || ValidationUtil.isEmpty(applicationEquipModels)) {
log.warn("JyjcInspectionApplicationModel Not Found!");
......@@ -377,9 +388,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
*/
public Boolean doReject(Map<String, Object> params) {
execueFlow(params);
String op = params.get("op").toString();
Long sequenceNbr = Long.parseLong(params.get("sequenceNbr") + "");
String instanceId = Optional.ofNullable(params.get("instanceId")).orElse("").toString();
params.put("status", FlowStatusEnum.TO_BE_SUBMITTED.getCode() + "");
updateModelByInstanceId(instanceId, params);
params.put("status", FlowStatusEnum.REJECTED.getCode() + "");
Boolean rollBack = "1".equals(op) ? true : false;
updateModelByInstanceId(sequenceNbr, instanceId, params, rollBack);
return true;
}
......@@ -431,7 +445,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
log.error("撤回工作流错误, => {}", jsonObject);
return false;
}
updateModelByInstanceId(inspectionApplicationModel.getProcessInstanceId(), MapBuilder.<String, Object>create().put("status", FlowStatusEnum.TO_BE_SUBMITTED.getCode() + "").build());
updateModelByInstanceId(inspectionApplicationModel.getSequenceNbr(), inspectionApplicationModel.getProcessInstanceId(), MapBuilder.<String, Object>create().put("status", FlowStatusEnum.ROLLBACK.getCode() + "").build(), true);
return true;
} catch (Exception e) {
e.printStackTrace();
......@@ -440,8 +454,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
}
public void updateModelByInstanceId(String instanceId, Map<String, Object> params) {
JyjcInspectionApplication entity = this.lambdaQuery().eq(JyjcInspectionApplication::getProcessInstanceId, instanceId).one();
public void updateModelByInstanceId(Long sequenceNbr, String instanceId, Map<String, Object> params, Boolean rollBack) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
LambdaQueryWrapper<JyjcInspectionApplication> lambda = new QueryWrapper<JyjcInspectionApplication>().lambda();
lambda.eq(JyjcInspectionApplication::getSequenceNbr, sequenceNbr);
JyjcInspectionApplication entity = this.getBaseMapper().selectOne(lambda);
// JyjcInspectionApplication entity = this.lambdaQuery().eq(JyjcInspectionApplication::getProcessInstanceId, instanceId).one();
if (entity == null) {
return;
}
......@@ -461,6 +479,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Map<String, Object> nextNodeInfo = workflowHelper.getNextWorkflowNode(instanceId);
String role = (String) nextNodeInfo.get("role");
entity.setNextExecuteIds(role);
entity.setPromoter(reginParams.getUserModel().getUserId());
if (!org.springframework.util.ObjectUtils.isEmpty(entity.getWorkflowRole())) {
entity.setWorkflowRole(entity.getWorkflowRole() + "," + role);
} else {
......@@ -469,5 +488,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
entity.setStatus(status);
entity.setAcceptDate(new Date());
this.updateById(entity);
if (rollBack) {
this.getBaseMapper().updatePromoter(entity.getSequenceNbr());
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment