diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java index 09293a725..eb080c6bd 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java @@ -51,14 +51,14 @@ public class WxRentContractController extends BaseController { public ResultData update(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); wxRentContract.setTenantId(getTenantId()); - return wxRentContractService.update(wxRentContract, getUser().getId()); + return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); } @PostMapping("updateMoney") public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); wxRentContract.setTenantId(getTenantId()); - return wxRentContractService.update(wxRentContract, getUser().getId()); + return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); } @PostMapping("updateFile") diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 9a44be55a..11c340efb 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index 4e3fe8273..6a7ae47a9 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml index 73665ba7c..95614d338 100644 --- a/mallinkAdmin/src/main/resources/application-test.yml +++ b/mallinkAdmin/src/main/resources/application-test.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkBApi/src/main/resources/application-dev.yml b/mallinkBApi/src/main/resources/application-dev.yml index 9313311da..737b9d17b 100644 --- a/mallinkBApi/src/main/resources/application-dev.yml +++ b/mallinkBApi/src/main/resources/application-dev.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkBApi/src/main/resources/application-prod.yml b/mallinkBApi/src/main/resources/application-prod.yml index 12e579a99..db4aba906 100644 --- a/mallinkBApi/src/main/resources/application-prod.yml +++ b/mallinkBApi/src/main/resources/application-prod.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkBApi/src/main/resources/application-test.yml b/mallinkBApi/src/main/resources/application-test.yml index 13c973402..26f6f0ede 100644 --- a/mallinkBApi/src/main/resources/application-test.yml +++ b/mallinkBApi/src/main/resources/application-test.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkCApi/src/main/resources/application-dev.yml b/mallinkCApi/src/main/resources/application-dev.yml index ea2d43c65..07091e190 100644 --- a/mallinkCApi/src/main/resources/application-dev.yml +++ b/mallinkCApi/src/main/resources/application-dev.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkCApi/src/main/resources/application-prod.yml b/mallinkCApi/src/main/resources/application-prod.yml index d93753e5d..ec942d369 100644 --- a/mallinkCApi/src/main/resources/application-prod.yml +++ b/mallinkCApi/src/main/resources/application-prod.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkCApi/src/main/resources/application-test.yml b/mallinkCApi/src/main/resources/application-test.yml index 7121e560b..6dd07629d 100644 --- a/mallinkCApi/src/main/resources/application-test.yml +++ b/mallinkCApi/src/main/resources/application-test.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkSchedule/src/main/resources/application-dev.yml b/mallinkSchedule/src/main/resources/application-dev.yml index 4d216e66a..70c47007f 100644 --- a/mallinkSchedule/src/main/resources/application-dev.yml +++ b/mallinkSchedule/src/main/resources/application-dev.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkSchedule/src/main/resources/application-prod.yml b/mallinkSchedule/src/main/resources/application-prod.yml index 52c9a9bd3..41098c265 100644 --- a/mallinkSchedule/src/main/resources/application-prod.yml +++ b/mallinkSchedule/src/main/resources/application-prod.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkSchedule/src/main/resources/application-test.yml b/mallinkSchedule/src/main/resources/application-test.yml index 6a7759992..29602f8c0 100644 --- a/mallinkSchedule/src/main/resources/application-test.yml +++ b/mallinkSchedule/src/main/resources/application-test.yml @@ -11,8 +11,8 @@ spring: initialSize: 1 maxWait: 60000 minIdle: 1 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 713e73875..5caecb556 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -28,11 +28,16 @@ public enum ErrorCode{ SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), /** - * 数据库 + * 审批流 */ FLOW_FAIL(24000, "审批流操作出错"), + /** + * 审批流不存在 + */ + FLOW_INST_NOT_EXIST(24001, "任务不存在"), + /** * 数据库 */ diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index c62dd7e7f..0ab69056f 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -40,7 +40,7 @@ public interface WxRentContractService { */ ResultData save(WxRentContract record,Long userId,String userName); - ResultData update(WxRentContract record, Long userId); + ResultData update(WxRentContract record, Long userId,String userName); /** * 根据Id删除实体 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 0a9bd8312..b9d3eb09f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -1,6 +1,7 @@ package com.iformall.service.impl; import java.util.*; +import java.util.stream.Collectors; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; @@ -10,6 +11,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponMerchant; import com.iformall.domain.vo.WxCouponCVo; +import com.iformall.domain.vo.WxMerchantVo; import com.iformall.enums.*; import com.iformall.mapper.WxCouponMapper; import com.iformall.mapper.WxCouponMerchantMapper; @@ -71,7 +73,15 @@ public class WxCouponServiceImpl implements WxCouponService { @Override public WxCouponCVo getVoById(Long id) { - return wxCouponMapper.findVoDetail(id); + WxCouponCVo wxCouponCVo = wxCouponMapper.findVoDetail(id); + List merchantList = wxCouponCVo.getMerchantVoList(); + if (merchantList != null) { + merchantList = merchantList.stream().filter( + m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())) + .collect(Collectors.toList()); + } + wxCouponCVo.setMerchantVoList(merchantList); + return wxCouponCVo; } 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 91e391ecb..733bfc4bc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -2,6 +2,7 @@ package com.iformall.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; @@ -92,7 +93,7 @@ public class WxFlowServiceImpl implements WxFlowService { rent.setApplyStatus(applyStatus); wxRentContractService.updateApplyStatus(rent); - // 如果审批完成,而且是补录,修改状态 + // 如果审批完成,而且是补录直接改为已签约状态(普通需要绑定商户才是已签约) if(supplement!=null && supplement && EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { wxRentContractService.updateRentContractStatus(businessId); } @@ -252,6 +253,9 @@ public class WxFlowServiceImpl implements WxFlowService { } String processInstanceId = resultList.get(0).getProcessInstanceId(); ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + if(pi == null){ + return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); + } Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); Map mapInfo = taskService.getVariables(task.getId()); List> taskAssigneeList = (List)mapInfo.get("taskAssignee"); @@ -318,7 +322,7 @@ public class WxFlowServiceImpl implements WxFlowService { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (task == null) { - throw new MallinkException(Result.ERROR, "流程不存在"); + return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); } taskName = task.getName(); taskKey = task.getTaskDefinitionKey(); @@ -464,7 +468,7 @@ public class WxFlowServiceImpl implements WxFlowService { String taskKey; Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (task == null) { - throw new MallinkException(Result.ERROR, "流程不存在"); + return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); } taskName = task.getName(); taskKey = task.getTaskDefinitionKey(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 7924f708b..675c48bb7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -247,6 +247,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { couponIds.stream().filter(cid->!isCouponMerchantValid(cid)).forEach(cid->{ WxCoupon wxCoupon = new WxCoupon(); wxCoupon.setId(cid); + wxCoupon.setTenantId(wxMerchant.getTenantId()); wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); wxCouponService.saveOrUpdate(wxCoupon); }); 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 d8839340c..f27cb9afe 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -215,11 +215,31 @@ public class WxRentContractServiceImpl implements WxRentContractService { return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); } - @Transactional(rollbackFor = {Exception.class}) @Override - public ResultData update(WxRentContract record, Long userId) { - return getResultDataForUpdate(record, userId); + public ResultData update(WxRentContract record, Long userId,String userName) { + ResultData resultData = getResultDataForUpdate(record, userId); + try { + // 启动审批流 + if(record.getFlowParams() != null){ + record.getFlowParams().put("businessId",record.getId().toString()); + if(record.getMerchantId() != null) { + record.getFlowParams().put("supplement", true); //设置补录 + } + wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); + + // 合同状态改成待签约 + WxRentContract updateRentContract = new WxRentContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); + wxRentContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功 ,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); + } + } catch (Exception e) { + logger.error("启动审批流失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.FLOW_FAIL.getCode(), "FLOW FAILD " + e.getMessage()); + } + return resultData; } public ResultData getResultDataForUpdate(WxRentContract record, Long userId) { diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index ed67253d4..c510e418c 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -97,7 +97,11 @@ - update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId} + update wx_coupon_channel set status=#{status} + where coupon_id=#{couponId} + + and tenant_id = #{tenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml index 56cf63396..df27907ce 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml @@ -89,7 +89,11 @@ - update wx_coupon_send set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId} + update wx_coupon_send set status=#{status} + where coupon_id=#{couponId} + + and tenant_id = #{tenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index ec857fe2a..f901dfc48 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -173,8 +173,13 @@ - update wx_order set order_status=#{orderStatus} where tenant_id=#{tenantId} and product_id=#{productId} and press_end_date is not null - + update wx_order set order_status=#{orderStatus} + where product_id=#{productId} + and press_end_date is not null + + and `tenant_id` = #{tenantId} + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index cf42e17ea..ec1ffc72a 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -104,8 +104,7 @@ rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName, rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name - bankName, - rc.rent_shop_type rentShopType + bankName,rc.merchant_id merchantId,rc.rent_shop_type rentShopType from wx_rent_contract rc left join wx_shop s on rc.shop_id=s.id left join wx_mall_floor f on s.floor=f.id @@ -186,7 +185,7 @@ left join wx_shop s on rc.shop_id=s.id left join wx_mall_building b on s.building=b.id left join wx_mall_floor f on s.floor=f.id - where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId} + where rc.status not in(0,1,5,6,7) and rc.tenant_id=#{tenantId} and rc.rent_shop_type = #{rentShopType} order by id desc