From 4cc3f351b88a4121020060ce7eec207a82cfb77a Mon Sep 17 00:00:00 2001 From: luozukai Date: Fri, 18 Jan 2019 10:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=A1=E6=89=B9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/domain/po/WxCarPayRecord.java | 9 +++- .../com/iformall/domain/po/WxFlowRecord.java | 30 ++++-------- .../iformall/enums/EnumFlowRecordStatus.java | 4 +- .../enums/EnumRentContractAppStatus.java | 3 +- .../com/iformall/service/WxFlowService.java | 1 + .../impl/WxCUserBasicInfoServiceImpl.java | 11 ++--- .../service/impl/WxFlowServiceImpl.java | 2 - .../impl/WxRentContractServiceImpl.java | 46 +++++++++++++++++-- .../resources/mapper/WxCarPayRecordMapper.xml | 3 +- .../resources/mapper/WxFlowRecordMapper.xml | 7 ++- 10 files changed, 76 insertions(+), 40 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCarPayRecord.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCarPayRecord.java index 8810c5b99..9e74b2004 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCarPayRecord.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCarPayRecord.java @@ -31,7 +31,7 @@ public class WxCarPayRecord implements Serializable { private String phone; private Date createDate; private Date updateDate; - + private Long stayedTime; @Transient @io.swagger.annotations.ApiModelProperty(value="开始日期",name="startDate") @@ -43,6 +43,13 @@ public class WxCarPayRecord implements Serializable { @io.swagger.annotations.ApiModelProperty(value="是否缴费",name="isPay") private Integer isPay; + public Long getStayedTime() { + return stayedTime; + } + + public void setStayedTime(Long stayedTime) { + this.stayedTime = stayedTime; + } public String getStartDate() { return startDate; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java index b0a9d23ad..de865f52f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java @@ -27,12 +27,8 @@ public class WxFlowRecord implements Serializable { private String taskKey; // key private String taskName;// 名称 - // 是否是当前代办节点 @Transient - private Integer isRunningTask; - // 候选人列表 - @Transient - private List assigneeUserList; + protected List ids; public WxFlowRecord(){} public WxFlowRecord(Long businessId){ @@ -43,6 +39,14 @@ public class WxFlowRecord implements Serializable { this.tenantId = tenantId; } + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + public String getTaskKey() { return taskKey; } @@ -59,22 +63,6 @@ public class WxFlowRecord implements Serializable { this.taskName = taskName; } - public Integer getIsRunningTask() { - return isRunningTask; - } - - public void setIsRunningTask(Integer isRunningTask) { - this.isRunningTask = isRunningTask; - } - - public List getAssigneeUserList() { - return assigneeUserList; - } - - public void setAssigneeUserList(List assigneeUserList) { - this.assigneeUserList = assigneeUserList; - } - public String getTenantId() { return tenantId; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumFlowRecordStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumFlowRecordStatus.java index 6694b35b8..9a4e2addd 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumFlowRecordStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumFlowRecordStatus.java @@ -9,8 +9,8 @@ public enum EnumFlowRecordStatus { NEW(1, "发起申请"), APPLY(2, "审批通过"), REJECT(3, "审批驳回"), - ASSIGNEE(4, "待审批") - //FINISH(4, "审批通过") + ASSIGNEE(4, "待审批"), + CANCLE(5, "合同作废") ; public static EnumFlowRecordStatus getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAppStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAppStatus.java index e3d639c8a..857d66e35 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAppStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAppStatus.java @@ -8,7 +8,8 @@ public enum EnumRentContractAppStatus { DEFAULT(0, "未审核"), APPLYING(1, "审核中"), FINISH(2, "审核完成"), - REJECT(3, "驳回") + REJECT(3, "驳回"), + CANCLE(4,"合同作废") ; public static EnumRentContractAppStatus getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index d7d4979a5..d2cc5ac71 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java @@ -10,6 +10,7 @@ import java.util.Map; * 流程审批服务 */ public interface WxFlowService { + ResultData getTaskStatusList(Long businessId,String tenantId); /** diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index eae1e9631..8c56b67e4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -642,14 +642,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } String filename = UUID.randomUUID() + ".xlsx"; filepath = filepath + filename; - WxTags wxTagsQ = new WxTags(); - List tagList = wxTagsMapper.findList(wxTagsQ); - List tagIdList = new ArrayList(); try { File file = new File(filepath); workbook = new SXSSFWorkbook(100); - SXSSFSheet sheetTwo = workbook.createSheet((1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"); + SXSSFSheet sheetTwo = workbook.createSheet((record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"); Row rowtwo = sheetTwo.createRow(0); Cell cell1 = rowtwo.createCell(0); Cell cell2 = rowtwo.createCell(1); @@ -681,17 +678,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { cell2.setCellValue(entity.getPhone()); cell3.setCellValue(sdf.format(entity.getEntranceTime())); cell4.setCellValue(sdf.format(entity.getExitTime())); - //todo 加个逗留时长 - //cell5.setCellValue(entity.get()); + cell5.setCellValue(entity.getStayedTime()/60); cell6.setCellValue(entity.getFee()); - } FileOutputStream fileOut = new FileOutputStream(file); workbook.write(fileOut); fileOut.close(); workbook.close(); - downFile(filepath, filename,(1==record.getIsPay())?"线上缴费车辆数据":"进出车辆数据"+".xlsx",response, request); + downFile(filepath, filename,(record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆数据":"进出车辆数据"+".xlsx",response, request); FileUtils.forceDelete(file); } catch (Exception e) { e.printStackTrace(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index a80d574c4..3c6a24e36 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -18,8 +18,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.map.HashedMap; import org.flowable.bpmn.model.BpmnModel; import org.flowable.engine.*; -import org.flowable.engine.impl.RepositoryServiceImpl; -import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity; import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.identitylink.api.IdentityLink; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index ff3992a8b..e32fcdb52 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -12,6 +12,8 @@ import com.iformall.domain.po.*; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; +import com.iformall.service.WxFlowRecordService; +import com.iformall.service.WxFlowService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxRentContractService; import com.iformall.utils.Constant; @@ -19,12 +21,14 @@ import com.iformall.utils.DateUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.flowable.engine.RuntimeService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -73,6 +77,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxBrandMapper WxBrandMapper; + @Autowired + WxFlowRecordService wxFlowRecordService; + + @Autowired + RuntimeService runtimeService; + @Override public Map listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { Object rentContractStatusInfo = getRentContractStatusInfo(record.getTenantId()); @@ -611,9 +621,39 @@ public class WxRentContractServiceImpl implements WxRentContractService { //审核流程中止 List collect = wxRentContractMapper.getRentInvalidList(wxRentContract).stream() .map(r -> r.getId()).collect(Collectors.toList()); - if (!collect.isEmpty()) { - //中止 - //todo:结束审批流 by luozukai + if (!CollectionUtils.isEmpty(collect)) { + // 结束审批流 by luozukai + WxFlowRecord wxFlowRecord = new WxFlowRecord(); + wxFlowRecord.setIds(collect); + List flowRecordList = wxFlowRecordService.findList(wxFlowRecord); + if (!CollectionUtils.isEmpty(flowRecordList)) { + for (WxFlowRecord flowRecord:flowRecordList) { + try { + runtimeService.deleteProcessInstance(flowRecord.getProcessInstanceId(), "合同作废"); + // 修改合同审核状态为驳回 + WxRentContract rentContract = new WxRentContract(); + rentContract.setId(flowRecord.getBusinessId()); + rentContract.setApplyStatus(EnumRentContractAppStatus.REJECT.getCode()); + updateApplyStatus(rentContract); + + // 保存审批历史入 + WxFlowRecord updateRecord = new WxFlowRecord(); + updateRecord.setBusinessId(flowRecord.getBusinessId()); + updateRecord.setTaskId(flowRecord.getTaskId()); + updateRecord.setProcessInstanceId(flowRecord.getProcessInstanceId()); + updateRecord.setRemark(flowRecord.getRemark()); + updateRecord.setUserId(flowRecord.getUserId()); + updateRecord.setStatus(EnumFlowRecordStatus.CANCLE.getCode()); + updateRecord.setBusinessType(flowRecord.getBusinessType()); + updateRecord.setUserName(flowRecord.getUserName()); + updateRecord.setTaskKey(flowRecord.getTaskKey()); + updateRecord.setTaskName(flowRecord.getTaskName()); + wxFlowRecordService.saveOrUpdate(updateRecord); + }catch (Exception e){ + logger.error("deleteProcessInstance error",e); + } + } + } } //把状态为签约而商户未关联的数据改为待签约状态 diff --git a/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml index fc0d44d33..9685ecdeb 100644 --- a/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml @@ -23,12 +23,13 @@ + `id`,`tenant_id`,`vendor_type`,`create_date`,`update_date`,syn_id,park_id,park_name,user_type, plate_number,entrance_time,exit_time,fee,fee_time,coupon,coupon_code,fix_parking_id,remaining_days,discount_amount,phone - ,paid_service_fee,create_date,update_date + ,paid_service_fee,create_date,update_date,stayed_time diff --git a/mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml index c38a687e7..87e47cb52 100644 --- a/mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml @@ -34,7 +34,12 @@ and `business_id` = #{businessId} - + + and id in + + #{idItem} + + order by create_date desc