diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java index c918602fa..82e3acd96 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java @@ -45,14 +45,14 @@ public class WxPropertyContractController extends BaseController public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); wxPropertyContract.setTenantId(getTenantId()); - return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); + return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId(),getUser().getName()); } @PostMapping("update") public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); wxPropertyContract.setTenantId(getTenantId()); - return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); + return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId(),getUser().getName()); } @GetMapping("/del") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java index e4b2f3e0f..09293a725 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java @@ -65,10 +65,9 @@ public class WxRentContractController extends BaseController { public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); wxRentContract.setTenantId(getTenantId()); - return wxRentContractService.updateFile(wxRentContract, getUser().getId()); + return wxRentContractService.updateFile(wxRentContract, getUser().getId(),getUser().getName()); } - @GetMapping("/del") @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) public ResultData delete(String id) { diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java index 8aef0bd0f..c9f179255 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java @@ -5,8 +5,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxMsgValidationcode; -import com.iformall.enums.EnumMerchantBUserStatus; -import com.iformall.enums.EnumMerchantStatus; +import com.iformall.enums.*; import com.iformall.service.WxMerchantBUserService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxMsgValidationcodeService; @@ -69,7 +68,7 @@ public class WxMsgValidationcodeController extends BaseController { WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setTenantId(user.getTenantId()); wxMsgValidationcode.setPhone(phone); - wxMsgValidationcode.setType(Integer.valueOf(type)); + wxMsgValidationcode.setType(EnumMsgModel.VALIDATION_CODE.getCode()); wxMsgValidationcode.setAppid(appid); return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); } @@ -85,7 +84,7 @@ public class WxMsgValidationcodeController extends BaseController { WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setTenantId(tenantId); wxMsgValidationcode.setPhone(phone); - wxMsgValidationcode.setType(type); + wxMsgValidationcode.setType(EnumMsgModel.VALIDATION_CODE.getCode()); wxMsgValidationcode.setCode(code); wxMsgValidationcode.setAppid(appid); return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index 2140b705a..39d186bfd 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -226,7 +226,7 @@ public class WxOrderController extends BaseController { // c端用户应该只能看到自己的订单 if (wxOrder == null) wxOrder = new WxOrder(); wxOrder.setcUserId(getUser().getId()); - wxOrder.setSortColumns(WxOrder.Field.CreateDate_DESC); + wxOrder.setSortColumns(WxOrder.Field.UpdateDate_DESC); final PageInfo page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java new file mode 100644 index 000000000..f4a51d95e --- /dev/null +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java @@ -0,0 +1,186 @@ +package com.iformall.schedule; + +import com.alibaba.fastjson.JSONObject; +import com.iformall.common.IdWorker; +import com.iformall.domain.po.WxMsgCallback; +import com.iformall.domain.po.WxMsgConfig; +import com.iformall.domain.po.WxMsgValidationcode; +import com.iformall.domain.po.WxMsgValidationcodeModel; +import com.iformall.enums.EnumMsgModel; +import com.iformall.enums.EnumMsgSendStatus; +import com.iformall.enums.EnumVerifyCode; +import com.iformall.mapper.*; +import com.iformall.utils.WiwideUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @author gongbiao + */ +@Component +public class BillNotificationSchedule { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxMsgValidationcodeMapper wxMsgValidationcodeMapper; + + @Autowired + private WxMsgConfigMapper wxMsgConfigMapper; + + @Autowired + private WxMsgValidationcodeModelMapper wxMsgValidationcodelModelMapper; + + @Autowired + private WxBillAllMapper wxBillAllMapper; + + @Autowired + private WxMsgCallbackMapper wxMsgCallbackMapper; + + + /** + * 每天9点执行 + */ + @Scheduled(cron = "0 0 9 * * ?") + public void sendMsgFromBill() { + logger.info("账单通知任务启动"); + sendWaitPayBill(); + sendOweBill(); + logger.info("账单通知任务结束"); + } + + private void sendOweBill() { + logger.info("查询欠缴账单数据"); + List> oweBillList = wxBillAllMapper.getOweBill(); + for (Map bill : oweBillList) { + logger.info("欠缴账单:" + JSONObject.toJSONString(bill)); + String tenantId = bill.get("tenantId").toString(); + BigDecimal owe = (BigDecimal) bill.get("owe"); + BigDecimal price = owe.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + String phone = bill.get("linkPhone").toString(); + String appname = bill.get("appname").toString(); + logger.info("欠缴账单检验短信配置信息"); + WxMsgConfig wxMsgConfig = checkMsgConfig(tenantId); + if (wxMsgConfig != null) { + logger.info("欠缴账单获取模板内容"); + WxMsgValidationcodeModel wxMsgValidationcodeModel = getMsgModel(tenantId, EnumMsgModel.BILL_OWE.getCode()); + if (wxMsgValidationcodeModel != null) { + String signature = wxMsgValidationcodeModel.getSignature(); + String msg = wxMsgValidationcodeModel.getContent(). + replace("{price}", price.toString()). + replace("{app}", appname); + String notifyUrl = wxMsgConfig.getNotifyurl(); + String secret = wxMsgConfig.getSecret(); + String bid = wxMsgConfig.getBid(); + String publickey = wxMsgConfig.getPublickey(); + sendWaitPayBillMsg(phone, signature, msg, notifyUrl, secret, bid, publickey); + } + } + } + } + + private void sendWaitPayBill() { + logger.info("查询待缴账单数据"); + List> waitBillList = wxBillAllMapper.getWaitPayBill(); + for (Map bill : waitBillList) { + logger.info("待缴账单账单:" + JSONObject.toJSONString(bill)); + String tenantId = bill.get("tenantId").toString(); + String receiveDate = bill.get("receiveDate").toString(); + BigDecimal needPay = (BigDecimal) bill.get("needPay"); + BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + String phone = bill.get("linkPhone").toString(); + String appname = bill.get("appname").toString(); + logger.info("待缴账单检验短信配置信息"); + WxMsgConfig wxMsgConfig = checkMsgConfig(tenantId); + if (wxMsgConfig != null) { + logger.info("待缴账单获取模板内容"); + WxMsgValidationcodeModel wxMsgValidationcodeModel = getMsgModel(tenantId, EnumMsgModel.BILL_WAIT_PAY.getCode()); + if (wxMsgValidationcodeModel != null) { + String signature = wxMsgValidationcodeModel.getSignature(); + String msg = wxMsgValidationcodeModel.getContent(). + replace("{price}", price.toString()). + replace("{date}", receiveDate). + replace("{app}", appname); + String notifyUrl = wxMsgConfig.getNotifyurl(); + String secret = wxMsgConfig.getSecret(); + String bid = wxMsgConfig.getBid(); + String publickey = wxMsgConfig.getPublickey(); + sendWaitPayBillMsg(phone, signature, msg, notifyUrl, secret, bid, publickey); + } + } + } + + } + + private WxMsgConfig checkMsgConfig(String tenantId) { + WxMsgConfig wxMsgConfig = new WxMsgConfig(); + wxMsgConfig.setTenantId(tenantId); + List wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); + if (wxMsgConfigs.size() == 0) { + logger.info("缺少系统短信配置"); + return null; + } + wxMsgConfig = wxMsgConfigs.get(0); + if (wxMsgConfig.getRemains() == 0) { + logger.info("短信数量为0"); + return null; + } + return wxMsgConfigs.get(0); + } + + private WxMsgValidationcodeModel getMsgModel(String tenantId, Integer type) { + logger.info("获取通知模板-租户:" + tenantId + ",类型:" + type); + WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); + wxMsgValidationcodeModel.setTenantId(tenantId); + wxMsgValidationcodeModel.setType(type); + List list = wxMsgValidationcodelModelMapper.findList(wxMsgValidationcodeModel); + if (!list.isEmpty()) { + return wxMsgValidationcodelModelMapper.findList(wxMsgValidationcodeModel).get(0); + } + return null; + } + + private void sendWaitPayBillMsg(String phone, String signature, String msg, String notifyUrl, String secret, String bid, String publickey) { + logger.info("开始调用迈外迪短信接口"); + String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), null); + logger.info("迈外迪短信接口返回值:" + result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + String ret = jsonObjectResult.get("ret").toString(); + String batchNo = jsonObjectResult.get("data").toString(); + if (ret.equals(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode())) { + final IdWorker idWorker = IdWorker.get(); + WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); + wxMsgValidationcode.setId(idWorker.nextId()); + wxMsgValidationcode.setCreatetime(new Date()); + wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); + addMsgCallback(wxMsgValidationcode, batchNo); + } + } + + public void addMsgCallback(WxMsgValidationcode wxmsg, String batchNo) { + logger.info("验证码发送时主动添加回调记录开始..."); + String phone = wxmsg.getPhone(); + final IdWorker idWorker = IdWorker.get(); + WxMsgCallback wxMsgCallback = new WxMsgCallback(); + wxMsgCallback.setId(idWorker.nextId()); + wxMsgCallback.setPhone(phone); + wxMsgCallback.setTenantId(wxmsg.getTenantId()); + wxMsgCallback.setBatchNo(batchNo); + wxMsgCallback.setMsgId(wxmsg.getId()); + wxMsgCallback.setStatus(EnumMsgSendStatus.MSG_SENDING.getCode()); + wxMsgCallback.setCreatetime(new Date()); + wxMsgCallbackMapper.insertSelective(wxMsgCallback); + logger.info("验证码发送时主动添加回调记录结束..."); + } + + +} \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java b/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java index 95e9d4436..69a88f69a 100644 --- a/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java +++ b/mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java @@ -57,7 +57,12 @@ public class GlobalDefultExceptionHandler { mailService.sendSimpleMail(receivers, "请求地址:" + request.getRequestURL() + "异常", sb.toString()); } - return new ResultData(Result.ERROR, e.getMessage()); + if(checkExceptionType(e)) { + MallinkException me = (MallinkException)e; + return new ResultData(me.getErrorCode(),me.getMessage()); + }else { + return new ResultData(Result.ERROR, e.getMessage()); + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index 83dc5e25a..987394893 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -7,6 +7,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; /** * @author gongbiao @@ -159,6 +160,18 @@ public class WxPropertyContract implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "计租周期", name = "计租周期") private Integer adjustPeriod; + @Transient + @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") + private Map flowParams; + + public Map getFlowParams() { + return flowParams; + } + + public void setFlowParams(Map flowParams) { + this.flowParams = flowParams; + } + public Integer getApplyStatus() { return applyStatus; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 427009b78..0470a89bb 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -191,9 +191,7 @@ public class WxRentContract implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") private Integer rentShopType; - @io.swagger.annotations.ApiModelProperty(value = "创建合同方式1新建2补录", name = "way") - private Integer way; - + @Transient @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") private Map flowParams; @@ -501,14 +499,6 @@ public class WxRentContract implements Serializable { this.rentShopType = rentShopType; } - public Integer getWay() { - return way; - } - - public void setWay(Integer way) { - this.way = way; - } - public static enum Field { Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC"); private String value; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java b/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java new file mode 100644 index 000000000..4c955d020 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java @@ -0,0 +1,43 @@ +package com.iformall.enums; + +/** + * Created by luozukai + * 短信模板 + */ +public enum EnumMsgModel { + // type,name + MALL_APPLY(1, "申请试用"), + FLOW_ASSIGNEE_NODIFY(2, "代办通知"), + FLOW_APPLY_NODIFY(3, "审批通知"), + FLOW_PASS_NODIFY(4, "通过审批通知"), + FLOW_REJECT_NODIFY(5, "驳回通知"), + VALIDATION_CODE(6, "B端验证码"), + BILL_WAIT_PAY(7, "账单待缴通知"), + BILL_OWE(8, "账单欠缴通知") + ; + + public static EnumMsgModel getEnum(Integer code) { + for (EnumMsgModel value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumMsgModel(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMsgModelType.java b/mallinkService/src/main/java/com/iformall/enums/EnumMsgModelType.java deleted file mode 100644 index 1c15e6551..000000000 --- a/mallinkService/src/main/java/com/iformall/enums/EnumMsgModelType.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.iformall.enums; - -/** - * Created by luozukai - * 消息模板类型 1登录 2工作流通知 - */ -public enum EnumMsgModelType { - - LOGIN(1, "登录"), - FLOW(2, "工作流通知") - ; - - public static EnumMsgModelType getEnum(Integer code) { - for (EnumMsgModelType value : values()) { - if (value.getCode().equals(code)) { - return value; - } - } - return null; - } - - private Integer code; - private String message; - - EnumMsgModelType(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getMessage() { - return message; - } -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java index f46073d9b..a3c0f5384 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java @@ -1,7 +1,5 @@ package com.iformall.mapper; -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.MallPermission; import com.iformall.domain.vo.WxBillAll; import java.util.List; @@ -10,7 +8,7 @@ import java.util.Map; /** * @author gongbiao */ -public interface WxBillAllMapper extends CommonMapper { +public interface WxBillAllMapper { List> list(WxBillAll record); @@ -21,4 +19,8 @@ public interface WxBillAllMapper extends CommonMapper { List> listData(WxBillAll wxBillAll); + List> getWaitPayBill(); + + List> getOweBill(); + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java index eaac4f2a9..cc0efd48a 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java @@ -37,6 +37,6 @@ public interface WxPropertyContractMapper extends CommonMapper getRentContractList(Map params); void updateApplyStatus(WxPropertyContract wxPropertyContract); - - + + void updateStatus(WxPropertyContract wxPropertyContract); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java index b1b83af35..3bd4b81bc 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java @@ -41,4 +41,5 @@ public interface WxRentContractMapper extends CommonMapper getRentInvalidList(WxRentContract wxRentContract); + void updateStatus(WxRentContract wxRentContract); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index dc003f0d8..70a31ebee 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java @@ -16,7 +16,7 @@ public interface WxFlowService { * @param businessId * @param flowType */ - void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus); + void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus,Boolean supplement); ResultData getTaskStatusList(Long businessId,String tenantId); diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java index b92f88249..f9e666102 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -29,13 +29,14 @@ public interface WxPropertyContractService { * @return */ ResultData getById(Long id); - - /** + + /** * 保存或更新实体 - * - * @param record - */ - ResultData saveOrUpdate(WxPropertyContract record, Long userId); + * @param record + * @param userId + * @return + */ + ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName); /** * 根据Id删除实体 diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index 1de4b358b..c62dd7e7f 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -62,7 +62,7 @@ public interface WxRentContractService { void exportContract(HttpServletRequest request, HttpServletResponse response, String tenantId, Long id); - ResultData updateFile(WxRentContract wxRentContract, Long userId); + ResultData updateFile(WxRentContract wxRentContract, Long userId,String userName); ResultData updateRentContractStatus(Long id); 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 d165bdbde..91e391ecb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -1,15 +1,11 @@ package com.iformall.service.impl; -import com.alibaba.druid.support.json.JSONUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; -import com.iformall.enums.EnumFlowKey; -import com.iformall.enums.EnumFlowRecordStatus; -import com.iformall.enums.EnumMsgModelType; -import com.iformall.enums.EnumRentContractAppStatus; +import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractMapper; @@ -86,7 +82,8 @@ public class WxFlowServiceImpl implements WxFlowService { * @param flowType */ @Override - public void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus){ + public void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus,Boolean supplement){ + logger.info("businessId:{},supplement:{}",businessId.toString(),supplement); if(1 == flowType){ // 1租赁合同 2点位合同wx_rent_contract 3物业wx_property_contract 4点位物业合同 if(contractType.intValue() == 1 || contractType.intValue() == 2){ @@ -94,6 +91,11 @@ public class WxFlowServiceImpl implements WxFlowService { rent.setId(businessId); rent.setApplyStatus(applyStatus); wxRentContractService.updateApplyStatus(rent); + + // 如果审批完成,而且是补录,修改状态 + if(supplement!=null && supplement && EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { + wxRentContractService.updateRentContractStatus(businessId); + } }else if(contractType.intValue() == 3 || contractType.intValue() == 4){ WxPropertyContract wxPropertyContract = new WxPropertyContract(); wxPropertyContract.setId(businessId); @@ -116,6 +118,7 @@ public class WxFlowServiceImpl implements WxFlowService { Integer flowType = (Integer)params.get("businessType"); List> taskAssignee = (List)params.get("taskAssignee"); List> variables = (List)params.get("variables"); + Boolean supplement = (Boolean)params.get("supplement"); // 设置节点处理人 HashMap map = new HashMap<>(); @@ -130,6 +133,7 @@ public class WxFlowServiceImpl implements WxFlowService { map.put("flowType",flowType); map.put("taskAssignee",taskAssignee); map.put("variables",variables); + map.put("supplement",supplement); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getFlowKeyByType(flowType), map); logger.debug("流程启动,流程id:{}",processInstance.getId()); @@ -140,7 +144,7 @@ public class WxFlowServiceImpl implements WxFlowService { if(StringUtils.isNotBlank(str)){ contractType = Integer.parseInt(str); } - updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.APPLYING.getCode()); + updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.APPLYING.getCode(),supplement); // 保存wx_flow_record表审批记录 WxFlowRecord wxFlowRecord = new WxFlowRecord(); @@ -160,12 +164,11 @@ public class WxFlowServiceImpl implements WxFlowService { Map content = new HashedMap(); content.put("userName",starterInfo.getName()); content.put("page", Constant.adminPage); - content.put("modelName","代办通知"); WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setTenantId(tenantId); wxMsgValidationcode.setPhone(mallUserInfo.getPhone()); - wxMsgValidationcode.setType(EnumMsgModelType.FLOW.getCode()); + wxMsgValidationcode.setType(EnumMsgModel.FLOW_ASSIGNEE_NODIFY.getCode()); wxMsgValidationcodeService.sendWorkFlowNodify(wxMsgValidationcode,content); } @@ -355,10 +358,10 @@ public class WxFlowServiceImpl implements WxFlowService { Map msgReplaceMap = new HashedMap(); WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setTenantId(tenantId); - wxMsgValidationcode.setType(EnumMsgModelType.FLOW.getCode()); MallUserInfo starter = (MallUserInfo)mapInfo.get("starter"); List> taskAssigneeList = (List)mapInfo.get("taskAssignee"); Long businessId = (Long)mapInfo.get("businessId"); + Boolean supplement = (Boolean)mapInfo.get("supplement"); // 判断下个节点是否有设置审批人,没有,直接通过,有,发短信通知 if(!isEnded(processInstanceId)){ @@ -369,10 +372,10 @@ public class WxFlowServiceImpl implements WxFlowService { for (MallUserInfo mallUserInfo:mallUserInfoList) { msgReplaceMap.put("userName",mallUserInfo.getName()); msgReplaceMap.put("page",Constant.adminPage); - msgReplaceMap.put("modelName","代办通知"); assignee += mallUserInfo.getName()+" "; wxMsgValidationcode.setPhone(mallUserInfo.getPhone()); + wxMsgValidationcode.setType(EnumMsgModel.FLOW_ASSIGNEE_NODIFY.getCode()); wxMsgValidationcodeService.sendWorkFlowNodify(wxMsgValidationcode,msgReplaceMap); } @@ -380,12 +383,12 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap = new HashedMap(); msgReplaceMap.put("userName",userName); msgReplaceMap.put("page",Constant.adminPage); - msgReplaceMap.put("modelName","审批通知"); msgReplaceMap.put("contract",businessId+""); msgReplaceMap.put("toUserName",assignee.trim()); wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setPhone(starter.getPhone()); + wxMsgValidationcode.setType(EnumMsgModel.FLOW_APPLY_NODIFY.getCode()); wxMsgValidationcodeService.sendWorkFlowNodify(wxMsgValidationcode,msgReplaceMap); }else{ //需要测下三节点 @@ -405,15 +408,15 @@ public class WxFlowServiceImpl implements WxFlowService { wxPropertyContractService.updatePropertyContractStatus(businessId); } } - updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.FINISH.getCode()); + updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.FINISH.getCode(),supplement); // 给发起人发送审批通过消息 msgReplaceMap = new HashedMap(); - msgReplaceMap.put("modelName","通过审批通知"); msgReplaceMap.put("contract",businessId+""); msgReplaceMap.put("page",Constant.adminPage); wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setPhone(starter.getPhone()); + wxMsgValidationcode.setType(EnumMsgModel.FLOW_PASS_NODIFY.getCode()); wxMsgValidationcodeService.sendWorkFlowNodify(wxMsgValidationcode,msgReplaceMap); } } @@ -455,6 +458,7 @@ public class WxFlowServiceImpl implements WxFlowService { Integer flowType = (Integer)mapInfo.get("flowType"); MallUserInfo starter = (MallUserInfo)mapInfo.get("starter"); List> variables = (List)mapInfo.get("variables"); + Boolean supplement = (Boolean)mapInfo.get("supplement"); String taskName; String taskKey; @@ -473,7 +477,7 @@ public class WxFlowServiceImpl implements WxFlowService { if(StringUtils.isNotBlank(str)){ contractType = Integer.parseInt(str); } - updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.REJECT.getCode()); + updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.REJECT.getCode(),supplement); //保存wx_flow_record表审批记录 WxFlowRecord wxFlowRecord = new WxFlowRecord(); @@ -493,13 +497,12 @@ public class WxFlowServiceImpl implements WxFlowService { Map msgReplaceMap = new HashedMap(); WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setTenantId(tenantId); - wxMsgValidationcode.setType(EnumMsgModelType.FLOW.getCode()); - msgReplaceMap.put("modelName","驳回通知"); msgReplaceMap.put("contract",businessId+""); msgReplaceMap.put("page",Constant.adminPage); wxMsgValidationcode = new WxMsgValidationcode(); wxMsgValidationcode.setPhone(starter.getPhone()); + wxMsgValidationcode.setType(EnumMsgModel.FLOW_REJECT_NODIFY.getCode()); wxMsgValidationcodeService.sendWorkFlowNodify(wxMsgValidationcode,msgReplaceMap); return new ResultData(); } 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 501dcb128..7924f708b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -92,7 +92,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { for (WxMerchant merchant : merchants) { List collect = list.stream().filter(ms -> ms.getMerchantId() != null && ms.getMerchantId().equals(merchant.getId()) && !ms.getStatus().equals(EnumRentContractStatus.WAIT_SIGN.getCode()) - && !ms.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode())).collect(Collectors.toList()); + && !ms.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) + && !ms.getStatus().equals(EnumRentContractStatus.INTENTION.getCode())).collect(Collectors.toList()); if (collect != null && collect.size() > 0) { merchant.setRentalStartDate(collect.get(0).getRentalStartDate()); merchant.setRentalEndDate(collect.get(0).getRentalEndDate()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java index c675bd359..0d94b07ae 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java @@ -8,6 +8,7 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; +import com.iformall.enums.EnumMsgModel; import com.iformall.enums.EnumMsgSendStatus; import com.iformall.enums.EnumVerifyCode; import com.iformall.mapper.*; @@ -60,7 +61,6 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); - wxMsgValidationcodeModel.setName(dynamicContentMap.get("modelName")); wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); @@ -157,8 +157,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); - wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); - wxMsgValidationcodeModel.setName("验证码"); + wxMsgValidationcodeModel.setType(EnumMsgModel.VALIDATION_CODE.getCode()); wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 134c9230e..91adec163 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -10,6 +10,7 @@ import com.iformall.domain.po.*; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; +import com.iformall.service.WxFlowService; import com.iformall.service.WxPropertyContractService; import com.iformall.utils.Constant; import org.slf4j.Logger; @@ -50,6 +51,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Autowired WxRentContractMapper wxRentContractMapper; + @Autowired + WxFlowService wxFlowService; + @Override public Map listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -96,7 +100,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService } @Override - public ResultData saveOrUpdate(WxPropertyContract record, Long userId) { + @Transactional(rollbackFor = {Exception.class}) + public ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName) { if (null == record.getShopId()) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "shopId不能为空"); @@ -149,6 +154,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService } //保存物业合同信息 + String message = ""; if (record.getId() == null) { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); @@ -177,7 +183,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService logger.error("保存物业合同信息失败,e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); } - return new ResultData(Result.SUCCESS, "保存物业合同信息成功", record); + message = "保存物业合同信息成功"; } else {//更新物业合同信息 WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(record.getId()); if (wxPropertyContract == null) { @@ -207,8 +213,24 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService logger.error("更新物业合同信息失败,e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); } - return new ResultData(Result.SUCCESS, "更新物业合同信息成功", record); + message = "更新物业合同信息成功"; + } + + try { + record.getFlowParams().put("businessId",record.getId().toString()); + wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); + + // 合同状态改成待签约 + WxPropertyContract updateRentContract = new WxPropertyContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); + wxPropertyContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功",record.getId().toString()); + } catch (Exception e) { + logger.error("启动审批流失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.FLOW_FAIL.getCode(), "FLOW FAILD " + e.getMessage()); } + return new ResultData(Result.SUCCESS, message, record); } @Override 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 404a5cd95..d8839340c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -180,7 +180,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) - && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode())).count(); + && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) + && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).count(); if (count > 0) { return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); } @@ -191,10 +192,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { } try { - // 如果是补录,启动审批流 - if(record.getMerchantId() != null && record.getFlowParams() != null){ - record.getFlowParams().put("businessId",record.getId()); + // 启动审批流 + 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()); @@ -253,6 +264,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) + && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode()) && !rc.get("id").equals(wxRentContract.getId())).count(); if (count > 0) { return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); @@ -639,11 +651,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { logger.error("deleteProcessInstance error",e); } } - } - //把状态为签约而商户未关联的数据改为待签约状态 - wxRentContractMapper.updateStatusForUnsign(wxRentContract); + //把状态为意见而商户未关联的数据改为待签约状态 + //wxRentContractMapper.updateStatusForUnsign(wxRentContract); //作废合同 wxRentContract.setStatus(EnumRentContractStatus.INVALID.getCode()); @@ -651,7 +662,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //待签约 wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); - wxRentContractMapper.updateRentWaitSignStatus(wxRentContract); + //wxRentContractMapper.updateRentWaitSignStatus(wxRentContract); int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); resultData.put("waitSignCount", waitSignCount); @@ -794,8 +805,30 @@ public class WxRentContractServiceImpl implements WxRentContractService { } @Override - public ResultData updateFile(WxRentContract record, Long userId) { - return getResultDataForUpdate(record, userId); + @Transactional(rollbackFor = {Exception.class}) + public ResultData updateFile(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; } @Override @@ -956,7 +989,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { .stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) - && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode())).findFirst(); + && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) + && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).findFirst(); Map wxPropertyContract = null; if (first.isPresent()) { wxPropertyContract = first.get(); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index 1ca519175..bf197dfef 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -212,4 +212,83 @@ + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index d5ee46b4c..a2d141025 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -143,6 +143,7 @@ and view_coupon_data.couponTitle like concat('%', #{couponTitle},'%') + order by view_coupon_data.createTime desc @@ -297,7 +298,7 @@ c.title,c.sale_price,c.use_price,c.price,c.unit, (case when com.mc=1 then (select m.name from wx_merchant m, wx_coupon_merchant cm - where m.id = cm.merchant_id and cm.product_id=co.coupon_id) else '[多商户通用]' end) as merchant_name + where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name @@ -315,9 +316,9 @@ wx_coupon c, (select tco.id as tcoid, (select count(*) from wx_coupon_merchant tcm - where tcm.product_id = tco.coupon_id - and tcm.status = 0) as mc - from wx_coupon_order tco) com + where tcm.product_id = tco.coupon_id + and tcm.status = 0) as mc + from wx_coupon_order tco) com where com.tcoid = co.id and co.coupon_type < 100 and c.id = co.coupon_id @@ -330,10 +331,14 @@ - and (case when com.mc=1 then - (select m.name from wx_merchant m, wx_coupon_merchant cm - where m.id = cm.merchant_id and cm.product_id=co.coupon_id) else '[多商户通用]' end) - like concat('%', #{merchantName},'%') + and (case when com.mc=1 + then + (select m.name from wx_merchant m, wx_coupon_merchant cm + where m.id = cm.merchant_id + and cm.product_id=co.coupon_id + and cm.status = 0) + else'[多商户通用]' end) + like concat('%', #{merchantName},'%') diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 372ebe7f6..ec857fe2a 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -652,7 +652,7 @@ from wx_coupon c,wx_order o left join wx_coupon_order co on co.order_id = o.id - where o.product_id = c.id and c.type = 8 + where o.product_id = c.id and c.type = 8 and o.order_status in (6,7,8,9) and o.c_user_id = #{cUserId} diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 35352513e..1944d8556 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -185,4 +185,8 @@ update wx_property_contract set apply_status=#{applyStatus} where id=#{id} + + + update wx_property_contract set status=#{status} where id=#{id} + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 58ed45e22..cf42e17ea 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -38,7 +38,6 @@ - @@ -47,7 +46,7 @@ `tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`, `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`, `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, - `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,`way` + `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type` @@ -83,7 +82,6 @@ and `start_date` = #{startDate} and `end_date` = #{endDate} and `rent_shop_type` = #{rentShopType} - and `way` = #{way} and id in @@ -107,7 +105,7 @@ 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,rc.way + 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 @@ -121,7 +119,6 @@ and rc.`shop_id` = #{shopId} and rc.`type` = #{type} and rc.`rent_shop_type` = #{rentShopType} - and rc.`way` = #{way} order by rc.id desc @@ -133,44 +130,49 @@ - update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) <= 30 and rental_end_date > now() + update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) <= 30 and rental_end_date > now() - update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date <= now() and rental_end_date >= now() + update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and status!=7 and rental_start_date <= now() and rental_end_date >= now() - update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date <now() + update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and status!=7 and rental_end_date <now() - update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=7 and merchant_id is null + update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=7 and merchant_id is null update wx_rent_contract set apply_status=#{applyStatus} where id=#{id} + + update wx_rent_contract set status=#{status} where id=#{id} + update wx_rent_contract set status=#{status} where shop_id in (