Procházet zdrojové kódy

Merge commit 'refs/tags/jenkins-back-end-715^{}' into release

# Conflicts:
#	mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java
release_toaliyun_real
hupeng před 7 roky
rodič
revize
32060004d7
26 změnil soubory, kde provedl 478 přidání a 127 odebrání
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java
  2. +1
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java
  3. +3
    -4
      mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java
  4. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  5. +186
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java
  6. +6
    -1
      mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java
  7. +13
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java
  8. +1
    -11
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  9. +43
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java
  10. +0
    -37
      mallinkService/src/main/java/com/iformall/enums/EnumMsgModelType.java
  11. +5
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java
  12. +2
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java
  13. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java
  14. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxFlowService.java
  15. +7
    -6
      mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java
  16. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxRentContractService.java
  17. +20
    -17
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  18. +2
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  19. +2
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java
  20. +25
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  21. +45
    -11
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  22. +79
    -0
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  23. +13
    -8
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  24. +1
    -1
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml
  25. +4
    -0
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
  26. +14
    -12
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java Zobrazit soubor

@@ -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")


+ 1
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java Zobrazit soubor

@@ -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) {


+ 3
- 4
mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java Zobrazit soubor

@@ -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);


+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java Zobrazit soubor

@@ -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<WxOrderCouponVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize);
return new ResultData(page);
}


+ 186
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java Zobrazit soubor

@@ -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<Map<String, Object>> oweBillList = wxBillAllMapper.getOweBill();
for (Map<String, Object> 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<Map<String, Object>> waitBillList = wxBillAllMapper.getWaitPayBill();
for (Map<String, Object> 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<WxMsgConfig> 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<WxMsgValidationcodeModel> 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("验证码发送时主动添加回调记录结束...");
}


}

+ 6
- 1
mallinkService/src/main/java/com/iformall/common/GlobalDefultExceptionHandler.java Zobrazit soubor

@@ -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());
}
}




+ 13
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java Zobrazit soubor

@@ -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<String, Object> flowParams;

public Map<String, Object> getFlowParams() {
return flowParams;
}

public void setFlowParams(Map<String, Object> flowParams) {
this.flowParams = flowParams;
}

public Integer getApplyStatus() {
return applyStatus;
}


+ 1
- 11
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java Zobrazit soubor

@@ -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<String, Object> 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;


+ 43
- 0
mallinkService/src/main/java/com/iformall/enums/EnumMsgModel.java Zobrazit soubor

@@ -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;
}
}

+ 0
- 37
mallinkService/src/main/java/com/iformall/enums/EnumMsgModelType.java Zobrazit soubor

@@ -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;
}
}

+ 5
- 3
mallinkService/src/main/java/com/iformall/mapper/WxBillAllMapper.java Zobrazit soubor

@@ -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<MallPermission, Long> {
public interface WxBillAllMapper {


List<Map<String,Object>> list(WxBillAll record);
@@ -21,4 +19,8 @@ public interface WxBillAllMapper extends CommonMapper<MallPermission, Long> {

List<Map<String,Object>> listData(WxBillAll wxBillAll);

List<Map<String, Object>> getWaitPayBill();

List<Map<String, Object>> getOweBill();

}

+ 2
- 2
mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java Zobrazit soubor

@@ -37,6 +37,6 @@ public interface WxPropertyContractMapper extends CommonMapper<WxPropertyContrac
List<WxRentContract> getRentContractList(Map<String, Object> params);

void updateApplyStatus(WxPropertyContract wxPropertyContract);
void updateStatus(WxPropertyContract wxPropertyContract);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java Zobrazit soubor

@@ -41,4 +41,5 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Strin

List<WxRentContract> getRentInvalidList(WxRentContract wxRentContract);

void updateStatus(WxRentContract wxRentContract);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxFlowService.java Zobrazit soubor

@@ -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);



+ 7
- 6
mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java Zobrazit soubor

@@ -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删除实体


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxRentContractService.java Zobrazit soubor

@@ -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);



+ 20
- 17
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java Zobrazit soubor

@@ -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<Map<String,String>> taskAssignee = (List)params.get("taskAssignee");
List<Map<String,String>> variables = (List)params.get("variables");
Boolean supplement = (Boolean)params.get("supplement");

// 设置节点处理人
HashMap<String, Object> 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<String,String> 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<String,String> msgReplaceMap = new HashedMap();
WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
wxMsgValidationcode.setTenantId(tenantId);
wxMsgValidationcode.setType(EnumMsgModelType.FLOW.getCode());
MallUserInfo starter = (MallUserInfo)mapInfo.get("starter");
List<Map<String,String>> 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<Map<String,String>> 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<String,String> 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();
}


+ 2
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Zobrazit soubor

@@ -92,7 +92,8 @@ public class WxMerchantServiceImpl implements WxMerchantService {
for (WxMerchant merchant : merchants) {
List<WxRentContract> 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());


+ 2
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeServiceImpl.java Zobrazit soubor

@@ -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());



+ 25
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Zobrazit soubor

@@ -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<String, Object> 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


+ 45
- 11
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Zobrazit soubor

@@ -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<String, Object> wxPropertyContract = null;
if (first.isPresent()) {
wxPropertyContract = first.get();


+ 79
- 0
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Zobrazit soubor

@@ -212,4 +212,83 @@
</select>
<select id="getWaitPayBill" resultType="hashmap">
select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate,
bill.need_pay needPay,m.link_phone linkPhone,app.appname from (
select bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from (
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent
union
select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent_deposit
union
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_property
union
select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_property_deposit
union
select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_daily where type=1
union
select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_daily where type=2
union
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_other
) bill
where DATEDIFF(bill.receive_date,now())=3 and bill.status!=3
group by bill.tenant_id,bill.merchant_id,bill.receive_date) bill
left join wx_merchant m on bill.merchant_id=m.id
left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id

</select>
<select id="getOweBill" resultType="hashmap">
select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.owe,m.link_phone linkPhone,app.appname from (
select bill.tenant_id,bill.merchant_id,sum(owe) owe from (
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent
union
select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent_deposit
union
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_property
union
select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_property_deposit
union
select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_daily where type=1
union
select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_daily where type=2
union
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_other
) bill
where DATEDIFF(bill.receive_date,now())&lt;0 and bill.status!=3
group by bill.tenant_id,bill.merchant_id) bill
left join wx_merchant m on bill.merchant_id=m.id
left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id

</select>

</mapper>

+ 13
- 8
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Zobrazit soubor

@@ -143,6 +143,7 @@
<if test="couponTitle != null">
and view_coupon_data.couponTitle like concat('%', #{couponTitle},'%')
</if>
order by view_coupon_data.createTime desc

</select>

@@ -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
</sql>

<sql id="allAdminCouponOrderDetailColumns">
@@ -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 &lt; 100
and c.id = co.coupon_id
@@ -330,10 +331,14 @@
</if>
<if test=" null != merchantName and 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) 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},'%')
</if>

<if test="startDate != null">


+ 1
- 1
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Zobrazit soubor

@@ -652,7 +652,7 @@
<include refid="allOrderPressListColumns"/>
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)
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>


+ 4
- 0
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml Zobrazit soubor

@@ -185,4 +185,8 @@
<update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
update wx_property_contract set apply_status=#{applyStatus} where id=#{id}
</update>

<update id="updateStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
update wx_property_contract set status=#{status} where id=#{id}
</update>
</mapper>

+ 14
- 12
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Zobrazit soubor

@@ -38,7 +38,6 @@
<result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
<result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
<result column="way" jdbcType="INTEGER" property="way"/>
</resultMap>
@@ -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`
</sql>
@@ -83,7 +82,6 @@
<if test=" null != startDate ">and `start_date` = #{startDate}</if>
<if test=" null != endDate ">and `end_date` = #{endDate}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != way ">and `way` = #{way}</if>
<if test=" null != ids ">
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 @@
<if test=" null != shopId ">and rc.`shop_id` = #{shopId}</if>
<if test=" null != type ">and rc.`type` = #{type}</if>
<if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if>
<if test=" null != way ">and rc.`way` = #{way}</if>
</where>
order by rc.id desc
@@ -133,44 +130,49 @@
</select>
<select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6
and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and
status!=7
and rental_start_date &lt;= now() and rental_end_date >= now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and
status!=7
and rental_end_date &lt;now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract">
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()) &lt;= 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()) &lt;= 30 and rental_end_date > now()
</update>
<update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date &lt;= 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 &lt;= now() and rental_end_date >= now()
</update>
<update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date &lt;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 &lt;now()
</update>
<update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract">
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>

<update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set apply_status=#{applyStatus} where id=#{id}
</update>

<update id="updateStatus" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} where id=#{id}
</update>

<update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} where shop_id in (


Načítá se…
Zrušit
Uložit