Commit e3d53c4b authored by 李秀明's avatar 李秀明

feat(jg): 安装告知-详情编辑流程提交

parent a1047513
...@@ -2,24 +2,25 @@ package com.yeejoin.amos.boot.module.jg.api.dto; ...@@ -2,24 +2,25 @@ package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.springframework.util.StringUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
*
*
* @author system_generator * @author system_generator
* @date 2023-12-12 * @date 2023-12-12
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="JgInstallationNoticeDto", description="") @ApiModel(value = "JgInstallationNoticeDto", description = "")
public class JgInstallationNoticeDto extends BaseDto { public class JgInstallationNoticeDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -192,9 +193,17 @@ public class JgInstallationNoticeDto extends BaseDto { ...@@ -192,9 +193,17 @@ public class JgInstallationNoticeDto extends BaseDto {
@ApiModelProperty(value = "省名字") @ApiModelProperty(value = "省名字")
private String provinceName; private String provinceName;
@ApiModelProperty(value = "完整地址")
private String fullAddress;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "告知设备列表") @ApiModelProperty(value = "告知设备列表")
private List<Map<String, Object>> deviceList; private List<Map<String, Object>> deviceList;
public String getFullAddress() {
return (StringUtils.isEmpty(this.provinceName) ? "" : this.provinceName)
+ (StringUtils.isEmpty(this.cityName) ? "" : this.cityName)
+ (StringUtils.isEmpty(this.countyName) ? "" : this.countyName)
+ (StringUtils.isEmpty(this.address) ? "" : this.address);
}
} }
...@@ -12,7 +12,11 @@ ...@@ -12,7 +12,11 @@
isn.region_no AS regionNo, isn.region_no AS regionNo,
isn.address AS address, isn.address AS address,
isn.notice_status AS noticeStatus, isn.notice_status AS noticeStatus,
isn.install_unit_name AS installUnitName isn.install_unit_name AS installUnitName,
isn.province_name AS provinceName,
isn.city_name AS cityName,
isn.county_name AS countyName,
isn.instance_id AS instanceId
FROM FROM
tzs_jg_installation_notice isn tzs_jg_installation_notice isn
<where> <where>
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto; 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.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;
...@@ -56,12 +57,12 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -56,12 +57,12 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/update") @PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知")
public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody Map<String, Object> model) { public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody Map<String, Object> model, @RequestParam("op") String op) {
JgInstallationNoticeDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("installationInfo")), JgInstallationNoticeDto.class, true); JgInstallationNoticeDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("installationInfo")), JgInstallationNoticeDto.class, true);
if (Objects.isNull(installationInfo)) { if (Objects.isNull(installationInfo)) {
throw new IllegalArgumentException("参数installationInfo不能为空"); throw new IllegalArgumentException("参数installationInfo不能为空");
} }
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateInstallationNotice(installationInfo)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateInstallationNotice(installationInfo, op));
} }
/** /**
...@@ -77,6 +78,22 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -77,6 +78,22 @@ public class JgInstallationNoticeController extends BaseController {
} }
/** /**
* 根据sequenceNbr批量删除
*
* @param sequenceNbrs 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/batchDelete")
@ApiOperation(value = "根据sequenceNbr删除维保合同备案", notes = "根据sequenceNbr删除维保合同备案")
public ResponseModel<Boolean> deleteForBatch(@RequestParam("sequenceNbrs") Long[] sequenceNbrs) {
try {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.deleteForBatch(sequenceNbrs));
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
}
/**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
...@@ -89,18 +106,6 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -89,18 +106,6 @@ public class JgInstallationNoticeController extends BaseController {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySequenceNbr(sequenceNbr)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySequenceNbr(sequenceNbr));
} }
/**
* 根据sequenceNbr批量删除
*
* @param sequenceNbrs 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/batchDelete")
@ApiOperation(value = "根据sequenceNbr删除维保合同备案", notes = "根据sequenceNbr删除维保合同备案")
public ResponseModel<Boolean> deleteForBatch(@RequestParam("sequenceNbrs") Long[] sequenceNbrs) {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.deleteForBatch(sequenceNbrs));
}
/** /**
* 列表分页查询 * 列表分页查询
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
...@@ -13,12 +15,14 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; ...@@ -13,12 +15,14 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
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;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*; import java.util.*;
...@@ -37,8 +41,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -37,8 +41,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
JgRelationEquipMapper jgRelationEquipMapper; JgRelationEquipMapper jgRelationEquipMapper;
@Autowired @Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper; private JgInstallationNoticeMapper jgInstallationNoticeMapper;
@Autowired
private ICommonService commonService;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
...@@ -70,7 +72,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -70,7 +72,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
* @param noticeDto 安装告知 * @param noticeDto 安装告知
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public JgInstallationNoticeDto updateInstallationNotice(JgInstallationNoticeDto noticeDto) { public JgInstallationNoticeDto updateInstallationNotice(JgInstallationNoticeDto noticeDto, String op) {
this.convertField(noticeDto); this.convertField(noticeDto);
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
...@@ -82,12 +84,38 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -82,12 +84,38 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString(); String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId); noticeDto.setInstanceId(instanceId);
noticeDto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode())); noticeDto.setStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
noticeDto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
JgInstallationNotice bean = new JgInstallationNotice(); JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean); BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean); jgInstallationNoticeMapper.updateById(bean);
} catch (Exception e) { } catch (Exception e) {
log.error("提交失败:{}", e); log.error("提交失败:{}", e);
} }
ajaxResult = Workflow.taskClient.getTask(noticeDto.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
//组装信息
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setResultCode("approvalStatus");
taskResultDTO.setTaskId(taskId);
taskResultDTO.setComment("提交流程");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
taskResultDTO.setVariable(map);
//执行流程
AjaxResult ajaxResult1;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, taskResultDTO);
if (ObjectUtils.isEmpty(ajaxResult1)) {
noticeDto.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(dto,bean);
jgInstallationNoticeMapper.updateById(bean);
}
} catch (Exception e) {
log.error("提交失败:{}", e);
}
return noticeDto; return noticeDto;
} }
...@@ -138,7 +166,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -138,7 +166,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return false; return false;
} }
Collection<JgInstallationNotice> jgInstallationNotices = this.listByIds(Arrays.asList(sequenceNbrs)); Collection<JgInstallationNotice> jgInstallationNotices = this.listByIds(Arrays.asList(sequenceNbrs));
jgInstallationNotices.forEach(notice -> notice.setIsDelete(true)); jgInstallationNotices.forEach(notice -> {
if (StringUtils.hasText(notice.getInspectUnitId())) {
throw new IllegalStateException("所选数据已存在流程,不能删除!");
}
notice.setIsDelete(true);
});
return this.updateBatchById(jgInstallationNotices); return this.updateBatchById(jgInstallationNotices);
} }
......
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