develop # Conflicts: # mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xmlrelease_toaliyun_real
| @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| import java.util.Objects; | |||
| @RestController | |||
| @@ -57,7 +58,15 @@ public class WxCreditHistoryController extends BaseController { | |||
| if(Objects.isNull(merchantId)|| StringUtils.isEmpty(spendStr)||Objects.isNull(userId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | |||
| } | |||
| return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId,getTenantId())); | |||
| try { | |||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId,getTenantId()) ; | |||
| return new ResultData(result); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(),e.getMessage()); | |||
| } catch (Exception e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @@ -0,0 +1,3 @@ | |||
| alter table wx_refund_order | |||
| change column `pos_refund_desc` `pos_refund_des` varchar(100) NULL COMMENT 'POS退款描述'; | |||
| @@ -0,0 +1,4 @@ | |||
| update wx_flow_config set name='商铺租金+物业合同签约' where name ='商铺租赁合同签约'; | |||
| update wx_flow_config set name='商铺租金+物业合同终止' where name ='商铺租赁合同终止'; | |||
| update wx_flow_config set name='多经点位租金+物业合同签约' where name ='多经点位商铺租赁合同签约'; | |||
| update wx_flow_config set name='多经点位租金+物业合同终止' where name ='多经点位商铺租赁合同终止'; | |||
| @@ -66,11 +66,9 @@ public class Test { | |||
| private MockMvc mockMvc; | |||
| @Autowired | |||
| MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| private WxBillSettleService wxBillSettleService; | |||
| @Autowired | |||
| @@ -148,10 +146,7 @@ public class Test { | |||
| @org.junit.Test | |||
| public void testmq2(){ | |||
| WxBillAll wxBillAll = new WxBillAll(); | |||
| wxBillAll.setTenantId("456"); | |||
| wxBillAll.setMerchantId(324754110547066880l); | |||
| System.out.println("--------"+JsonUtil.obj2Json(wxBillAllService.listBill(wxBillAll))); | |||
| } | |||
| @org.junit.Test | |||
| @@ -5,7 +5,6 @@ import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxMsgRecordMapper; | |||
| import com.iformall.service.msg.impl.*; | |||
| import com.iformall.utils.JsonUtil; | |||
| import org.checkerframework.checker.units.qual.A; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -0,0 +1,79 @@ | |||
| package com.iformall.schedule; | |||
| import com.iformall.domain.po.msg.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.WxMsgRecordService; | |||
| import com.iformall.utils.JsonUtil; | |||
| 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.util.List; | |||
| /** | |||
| * 消息重发 | |||
| */ | |||
| @Component | |||
| public class MsgReSendSchedule { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgRecordService wxMsgRecordService; | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| //@Scheduled(cron = "0 */1 * * * *?") // 每5分钟检查一次 | |||
| @Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||
| public void msgReSend() { | |||
| logger.info("消息重发开始..."); | |||
| //消息重发 | |||
| WxMsgRecord msgRecord = new WxMsgRecord(); | |||
| msgRecord.setMsgStatus(EnumMsgRecordStatus.SEND_FAIL.getCode()); | |||
| List<WxMsgRecord> recordList = wxMsgRecordService.findList(msgRecord); | |||
| for (WxMsgRecord wxMsgRecord:recordList) { | |||
| logger.info("消息重发:{}",wxMsgRecord.getMsgJson()); | |||
| try { | |||
| if(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode().equals(wxMsgRecord.getMsgType())){ | |||
| //内部消息 - 下订单成功 | |||
| FmInsideOrderSuccessMsg msg = (FmInsideOrderSuccessMsg) JsonUtil.readValue(wxMsgRecord.getMsgJson(),FmInsideOrderSuccessMsg.class); | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else if(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode().equals(wxMsgRecord.getMsgType())){ | |||
| FmInsideCouponVerifyMsg msg = (FmInsideCouponVerifyMsg) JsonUtil.readValue(wxMsgRecord.getMsgJson(),FmInsideCouponVerifyMsg.class); | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else if(EnumMsgRecordType.INSIDE_C_LOGIN.getCode().equals(wxMsgRecord.getMsgType())){ | |||
| FmInsideCLoginMsg msg = (FmInsideCLoginMsg) JsonUtil.readValue(wxMsgRecord.getMsgJson(),FmInsideCLoginMsg.class); | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else if(EnumMsgRecordType.INSIDE_NOTIFY_PAY_SUCCESS.getCode().equals(wxMsgRecord.getMsgType())){ | |||
| FmInsideNotifyPaySuccessMsg msg = (FmInsideNotifyPaySuccessMsg) JsonUtil.readValue(wxMsgRecord.getMsgJson(),FmInsideNotifyPaySuccessMsg.class); | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else if(EnumMsgRecordType.INSIDE_NOTIFY_REFUND_SUCCESS.getCode().equals(wxMsgRecord.getMsgType())){ | |||
| FmInsideNotifyRefundSuccessMsg msg = (FmInsideNotifyRefundSuccessMsg) JsonUtil.readValue(wxMsgRecord.getMsgJson(),FmInsideNotifyRefundSuccessMsg.class); | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| logger.error("消息重发错误:" + e.getMessage()); | |||
| } | |||
| } | |||
| logger.info("消息重发结束..."); | |||
| } | |||
| } | |||
| @@ -2,14 +2,13 @@ package com.iformall.schedule; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.enums.EnumRefundStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxCouponMapper; | |||
| import com.iformall.mapper.WxOrderGroupMapper; | |||
| import com.iformall.mapper.WxOrderMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.WxMsgRecordService; | |||
| import com.iformall.service.WxOrderGroupService; | |||
| import com.iformall.service.WxOrderService; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| @@ -20,7 +19,6 @@ import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -42,9 +40,6 @@ public class OrderExpiringSchedule { | |||
| @Autowired | |||
| WxOrderGroupMapper wxOrderGroupMapper; | |||
| @Autowired | |||
| WxOrderGroupService wxOrderGroupService; | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @@ -143,7 +138,6 @@ public class OrderExpiringSchedule { | |||
| } | |||
| }); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @@ -236,7 +236,7 @@ public enum ErrorCode{ | |||
| MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"), | |||
| UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"), | |||
| USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"), | |||
| USER_NOT_AUTH_PHONE(11011, "用户小程序未授权手机号码"), | |||
| USER_NOT_AUTH_PHONE(11012, "用户小程序未授权手机号码"), | |||
| /** | |||
| * POS | |||
| @@ -32,8 +32,8 @@ public enum EnumMsgModel { | |||
| FLOW_C_REJECT_NODIFY(22, "驳回通知"), | |||
| //会员生日券 | |||
| COUPON_BIRTHDAY_OPENED(28, "会员生日券开启"), | |||
| COUPON_BIRTHDAY_OPENED_NO(29, "会员生日券未开启"), | |||
| COUPON_BIRTHDAY_OPENED(28, "会员生日券倍率开启"), | |||
| COUPON_BIRTHDAY_OPENED_NO(29, "会员生日券倍率未开启"), | |||
| ; | |||
| public static EnumMsgModel getEnum(Integer code) { | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by luozukai | |||
| */ | |||
| @@ -46,17 +46,19 @@ public class RabbitMqMessageProducer implements MqBaseProducer , RabbitTemplate. | |||
| @Override | |||
| public void confirm(CorrelationData correlationData, boolean ack, String cause) { | |||
| log.info("confirm:: correlationData {},ack {}, cause {}", correlationData,ack,cause); | |||
| System.out.println(); | |||
| if(ack){ | |||
| System.out.println(); | |||
| }else{ | |||
| BaseMsg data = new BaseMsg(); | |||
| data.setMsgStatus(EnumMsgRecordStatus.SEND_FAIL.getCode()); | |||
| wxMsgRecordMapper.update(data); | |||
| if(!ack){ | |||
| try { | |||
| BaseMsg data = new BaseMsg(); | |||
| data.setUuid(correlationData.getId()); | |||
| data.setMsgStatus(EnumMsgRecordStatus.SEND_FAIL.getCode()); | |||
| data.setStatusMessage(cause); | |||
| wxMsgRecordMapper.update(data); | |||
| } catch (Exception e) { | |||
| log.error(" RabbitMqMessageProducer.confirm.updateDb Error", e); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) { | |||
| log.info("returnedMessage::message {} 消息发送失败,应答码:{}, 应答描述:{} ,exchange: {} ,routingKey :{}", new String(message.getBody()), replyCode, replyText, exchange, routingKey); | |||
| @@ -64,18 +66,18 @@ public class RabbitMqMessageProducer implements MqBaseProducer , RabbitTemplate. | |||
| @Override | |||
| public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | |||
| String tag = UUID.randomUUID().toString(); | |||
| String uuid = UUID.randomUUID().toString(); | |||
| try { | |||
| data.setUuid(tag); | |||
| data.setUuid(uuid); | |||
| wxMsgRecordService.save(data); | |||
| CorrelationData correlationData = new CorrelationData(tag); | |||
| CorrelationData correlationData = new CorrelationData(uuid); | |||
| rabbitTemplate.convertAndSend(topic, (Object) JsonUtil.obj2Json(data),correlationData); | |||
| // data.setMsgStatus(EnumMsgRecordStatus.SEND_SUCC.getCode()); | |||
| // wxMsgRecordMapper.update(data); | |||
| log.info(data.getUuid()+"发送mq成功。"); | |||
| } catch (Exception e) { | |||
| log.error(tag + " RabbitMqMessageProducer: Send Message Error", e); | |||
| log.error(uuid + " RabbitMqMessageProducer: Send Message Error", e); | |||
| } | |||
| } | |||
| } | |||
| @@ -54,7 +54,12 @@ public class WxBillSettleRecordServiceImpl implements WxBillSettleRecordService | |||
| record.setSettleMoney(-record.getSettleMoney()); | |||
| } | |||
| String str = EnumSettleRecordWay.getEnum(record.getSettleWay()).getMessage()+"收款"+new BigDecimal(record.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)+"元"; | |||
| String str; | |||
| if(EnumSettleRecordWay.OTHER.getCode().equals(record.getSettleWay())){ | |||
| str = record.getRemark()+"-收款"+new BigDecimal(record.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)+"元"; | |||
| }else{ | |||
| str = EnumSettleRecordWay.getEnum(record.getSettleWay()).getMessage()+"收款"+new BigDecimal(record.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)+"元"; | |||
| } | |||
| record.setDetail(str); | |||
| if(mallUserInfo != null) { | |||
| record.setUserid(mallUserInfo.getId()); | |||
| @@ -192,7 +192,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay() ); //押金是ReceivePay | |||
| wxBillRent.setPayDate(new Date()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -212,7 +216,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| wxBillOtherDeposit.setPay(dbBill.getPay()+ dbBill.getReceivePay()); | |||
| wxBillOtherDeposit.setPayDate(new Date()); | |||
| wxBillOtherDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| wxBillOtherDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -232,7 +240,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| propertyDeposit.setPay(dbBill.getPay()+ dbBill.getReceivePay()); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -272,7 +284,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| propertyDeposit.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -311,7 +327,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -339,7 +359,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| @@ -382,6 +406,28 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| } | |||
| } | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | |||
| propertyDeposit.setId(bill.getBillId()); | |||
| if(freezeStatus != null) propertyDeposit.setFreeze(freezeStatus); | |||
| if(status != null){ | |||
| propertyDeposit.setStatus(status); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| } | |||
| if(EnumBillRentStatus.PAID.getCode().equals(status)){ | |||
| WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| propertyDeposit.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| }else{ | |||
| propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); | |||
| } | |||
| addBillAction(bill.getBillId(), dbBill.getOwe()); | |||
| } | |||
| } | |||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); | |||
| } | |||
| } | |||
| } | |||
| @@ -198,14 +198,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record) { | |||
| WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); | |||
| if (wxCUser == null) { | |||
| //验证此用户是否存在 | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| if(wxCUserBasicInfo == null) { | |||
| throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); | |||
| } | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); | |||
| if (StringUtils.isNotEmpty(record.getSpendStr())) { | |||
| record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); | |||
| } | |||
| @@ -429,6 +429,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| logger.info("id:{},启动审批流成功,是否补录:{}", record.getRentContractId().toString(), record.getMerchantId() != null); | |||
| } | |||
| } | |||
| }else{ | |||
| //审批状态重置 | |||
| WxPropertyContract updateRentContract = new WxPropertyContract(); | |||
| updateRentContract.setId(record.getId()); | |||
| updateRentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| wxPropertyContractMapper.updateByPrimaryKeySelective(updateRentContract); | |||
| } | |||
| return new ResultData(Result.SUCCESS, message, record); | |||
| @@ -542,7 +542,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| try { | |||
| signMap = BeanUtils.toStringMap(wxRefundOrderSP); | |||
| } catch (Exception e) { | |||
| logger.error("退款命令生辰: " + e.getMessage()); | |||
| logger.error("退款命令生成: " + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); | |||
| } | |||
| @@ -580,7 +580,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| errMsg = errObj.toJSONString(); | |||
| record.setFailReason(errMsg); | |||
| } else { | |||
| errMsg = returnMap.get("return_msg"); | |||
| errMsg = returnMap.get("err_code_des"); | |||
| record.setFailReason(errMsg); | |||
| } | |||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | |||
| @@ -510,6 +510,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractMapper.updateStatus(updateRentContract); | |||
| logger.info("id:{},启动审批流成功, 是否补录:{}", record.getId().toString(), record.getMerchantId() != null); | |||
| } | |||
| }else{ | |||
| //审批状态重置 | |||
| WxRentContract updateRentContract = new WxRentContract(); | |||
| updateRentContract.setId(record.getId()); | |||
| updateRentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| updateApplyStatus(updateRentContract); | |||
| } | |||
| //生成预览账单(补录第二步,第三步走编辑) | |||
| @@ -567,6 +573,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractMapper.updateStatus(updateRentContract); | |||
| logger.info("id:{},启动审批流成功 ,是否补录:{}", record.getId().toString(), record.getMerchantId() != null); | |||
| } | |||
| }else{ | |||
| //审批状态重置 | |||
| WxRentContract updateRentContract = new WxRentContract(); | |||
| updateRentContract.setId(record.getId()); | |||
| updateRentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| updateApplyStatus(updateRentContract); | |||
| } | |||
| //保存调整金额(预账单调整) | |||
| @@ -1642,6 +1654,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractMapper.updateStatus(updateRentContract); | |||
| logger.info("id:{},启动审批流成功,是否补录:{}", record.getId().toString(), record.getMerchantId() != null); | |||
| } | |||
| }else{ | |||
| //审批状态重置 | |||
| WxRentContract updateRentContract = new WxRentContract(); | |||
| updateRentContract.setId(record.getId()); | |||
| updateRentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| updateApplyStatus(updateRentContract); | |||
| } | |||
| return resultData; | |||
| @@ -731,7 +731,7 @@ | |||
| select tt.* from ( | |||
| select m.tenant_id,m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | |||
| xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, | |||
| round( | |||
| ifnull(round( | |||
| (select sum(bill.receive_pay) from ( | |||
| select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6) | |||
| union all | |||
| @@ -747,8 +747,8 @@ | |||
| union all | |||
| select merchant_id,receive_pay from wx_bill_other_deposit where status not in(3,6) | |||
| ) bill where bill.merchant_id = m.id | |||
| )/100,2) receivePay, | |||
| round( | |||
| )/100,2),0) receivePay, | |||
| ifnull(round( | |||
| (select sum(ss.money) from ( | |||
| select ms.subsidy money,mm.id | |||
| from wx_merchant_subsidy ms | |||
| @@ -765,9 +765,9 @@ | |||
| union all | |||
| select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | |||
| )ss where ss.id = m.id | |||
| )/100,2) payOut, | |||
| (round( | |||
| )/100,2),0) payOut, | |||
| (ifnull(round( | |||
| (select sum(bill.receive_pay) from ( | |||
| select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6) | |||
| union all | |||
| @@ -783,8 +783,8 @@ | |||
| union all | |||
| select merchant_id,receive_pay from wx_bill_other_deposit where status not in(3,6) | |||
| ) bill where bill.merchant_id = m.id | |||
| )/100,2)- | |||
| round( | |||
| )/100,2),0)- | |||
| ifnull(round( | |||
| (select sum(ss.money) from ( | |||
| select ms.subsidy money,mm.id | |||
| from wx_merchant_subsidy ms | |||
| @@ -801,7 +801,7 @@ | |||
| union all | |||
| select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | |||
| )ss where ss.id = m.id | |||
| )/100,2)) balance | |||
| )/100,2),0)) balance | |||
| from wx_merchant m | |||
| left join (select ms.merchant_id,s.type,GROUP_CONCAT(s.shop_number) as shop_number | |||
| @@ -1,214 +1,207 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillSettleBillMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleBill"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleBill"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <result column="settle_id" property="settleId"/> | |||
| <result column="type" property="type"/> | |||
| <result column="bill_id" property="billId"/> | |||
| <result column="bill_type" property="billType"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="settle_id" property="settleId"/> | |||
| <result column="type" property="type"/> | |||
| <result column="bill_id" property="billId"/> | |||
| <result column="bill_type" property="billType"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="billName" property="billName"/> | |||
| <result column="receivePay" property="receivePay"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="billName" property="billName"/> | |||
| <result column="receivePay" property="receivePay"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| </resultMap> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`settle_id`,`type`,`bill_id`,`bill_type` | |||
| ,`createtime`,`updatetime` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_settle_bill | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.owe,0) receivePay | |||
| from wx_bill_settle_bill bl left join | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金-租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费-物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费-水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费-电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费-空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as | |||
| need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit | |||
| union all | |||
| select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,subsidy owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type,'' starttime,'' endtime from wx_merchant_subsidy | |||
| ) bill | |||
| on(bl.bill_id = bill.id) | |||
| where 1=1 | |||
| <if test=" null != billId ">and bill.`id` = #{billId}</if> | |||
| <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if> | |||
| <if test=" null != type ">and bl.`type` = #{type}</if> | |||
| </select> | |||
| <!--同上面的sql--> | |||
| <select id="findByBillId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bill.bill_type billName,bill.owe receivePay FROM | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金-租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费-物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费-水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费-电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费-空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as | |||
| need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit | |||
| union all | |||
| select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,subsidy owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type,'' starttime,'' endtime from wx_merchant_subsidy | |||
| ) bill | |||
| where 1=1 | |||
| <if test=" null != billId ">and bill.`id` = #{billId}</if> | |||
| </select> | |||
| <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle"> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.owe,0) receivePay | |||
| from wx_bill_settle_bill bl left join | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金-租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费-物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费-水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费-电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费-空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as | |||
| need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit | |||
| union all | |||
| select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,subsidy owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type,'' starttime,'' endtime from wx_merchant_subsidy | |||
| ) bill | |||
| on(bl.bill_id = bill.id) | |||
| where 1=1 | |||
| <if test=" null != billId ">and bill.`id` = #{billId}</if> | |||
| <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if> | |||
| <if test=" null != type ">and bl.`type` = #{type}</if> | |||
| </select> | |||
| <!--同上面的sql--> | |||
| <select id="findByBillId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bill.bill_type billName,bill.owe receivePay FROM | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金-租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费-物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金' | |||
| bill_type,need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费-水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费-电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费-空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as | |||
| need_pay,receive_pay,pay, | |||
| <choose> | |||
| <when test="1==type"> | |||
| receive_pay owe | |||
| </when> | |||
| <otherwise> | |||
| owe | |||
| </otherwise> | |||
| </choose> | |||
| ,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit | |||
| union all | |||
| select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as | |||
| need_pay,subsidy receive_pay,0 pay,subsidy owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type,'' starttime,'' endtime from wx_merchant_subsidy | |||
| ) bill | |||
| where 1=1 | |||
| <if test=" null != billId ">and bill.`id` = #{billId}</if> | |||
| </select> | |||
| <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle"> | |||
| delete from wx_bill_settle_bill where settle_id = #{id} | |||
| </update> | |||
| <select id="findExist" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> | |||
| select * from wx_bill_settle_bill where 1=1 | |||
| <if test=" null != id "> | |||
| and settle_id !=#{id} | |||
| </if> | |||
| <if test=" null != receiveBillIds "> | |||
| and bill_id in | |||
| <foreach collection="receiveBillIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem.billId} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="findExist" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> | |||
| select * from wx_bill_settle_bill where 1=1 | |||
| <if test=" null != id "> | |||
| and settle_id !=#{id} | |||
| </if> | |||
| <if test=" null != receiveBillIds "> | |||
| and bill_id in | |||
| <foreach collection="receiveBillIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem.billId} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -587,7 +587,7 @@ | |||
| <sql id="allAdminCouponOrderListColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_num, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | |||
| (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) as merchant_name, | |||
| @@ -598,7 +598,7 @@ | |||
| <sql id="allAdminCouponOrderDetailColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_num, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num, | |||
| bu.name, bu.phone as bphone, | |||
| cu.phone, | |||
| m.name as merchant_name,m.id as merchant_id | |||
| @@ -606,8 +606,8 @@ | |||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap"> | |||
| select <include refid="allAdminCouponOrderListColumns" /> | |||
| from | |||
| wx_coupon_order co inner join wx_coupon c on c.id = co.coupon_id | |||
| from wx_coupon_order co | |||
| inner join wx_coupon c on c.id = co.coupon_id | |||
| inner join (select tco.id as tcoid, | |||
| (select count(*) from wx_coupon_merchant tcm | |||
| where tcm.product_id = tco.coupon_id | |||
| @@ -619,6 +619,7 @@ | |||
| from wx_merchant_b_user bu inner join wx_merchant m on bu.merchant_id=m.id | |||
| where bu.tenant_id = #{tenantId} | |||
| ) bu on bu.bu_id = co.b_user_id | |||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id | |||
| left join wx_coupon_action_log cal on co.id = cal.coupon_order_id and co.coupon_id = cal.coupon_id | |||
| where 1=1 | |||
| <choose> | |||
| @@ -703,6 +704,7 @@ | |||
| left join wx_c_user cu on cu.id = co.c_user_id | |||
| left join wx_merchant_b_user bu on co.b_user_id = bu.id | |||
| left join wx_merchant m on m.id = bu.merchant_id | |||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id | |||
| where co.id = #{id} | |||
| and c.id = co.coupon_id | |||
| </select> | |||
| @@ -0,0 +1,95 @@ | |||
| package com.iformall.controller.sys; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMsgSignature; | |||
| import com.iformall.domain.po.WxMsgValidationcodeModel; | |||
| import com.iformall.enums.EnumMsgModel; | |||
| import com.iformall.mapper.WxMallMapper; | |||
| import com.iformall.mapper.WxMsgSignatureMapper; | |||
| import com.iformall.mapper.WxMsgValidationcodeModelMapper; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.annotation.Resource; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| * 数据初始化 | |||
| */ | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("sys") | |||
| public class DataInitController { | |||
| @Resource | |||
| private WxMallMapper mallMapper; | |||
| @Resource | |||
| private WxMsgSignatureMapper signatureMapper; | |||
| @Resource | |||
| private WxMsgValidationcodeModelMapper modelMapper; | |||
| @GetMapping("/init") | |||
| public ResultData init() { | |||
| try { | |||
| addBirthDayMsgModel(); | |||
| } catch (Exception e) { | |||
| log.error("DataInitController::init error ", e); | |||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR, e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 增加会员生日短信模板 | |||
| */ | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void addBirthDayMsgModel() { | |||
| List<WxMsgSignature> list = signatureMapper.selectAll(); | |||
| Map<String, String> tenantOfSignature = list.stream().collect(Collectors.toMap(WxMsgSignature::getTenantId, WxMsgSignature::getName)); | |||
| IdWorker idWorker = IdWorker.get(); | |||
| addBirthDayMsgModelToMall(tenantOfSignature, EnumMsgModel.COUPON_BIRTHDAY_OPENED, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,并在生日当天消费领取{creditScale}倍积分,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||
| addBirthDayMsgModelToMall(tenantOfSignature, EnumMsgModel.COUPON_BIRTHDAY_OPENED_NO, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||
| } | |||
| private void addBirthDayMsgModelToMall(Map<String, String> tenantOfSignature, EnumMsgModel type, IdWorker idWorker, String content) { | |||
| //查找已经添加过的接口列表 | |||
| WxMsgValidationcodeModel query = new WxMsgValidationcodeModel(); | |||
| query.setMsgType(1); | |||
| query.setType(type.getCode()); | |||
| List<WxMsgValidationcodeModel> dbModelList = modelMapper.select(query); | |||
| Map<String, String> dbModelMap = dbModelList.stream().collect(Collectors.toMap(WxMsgValidationcodeModel::getTenantId, WxMsgValidationcodeModel::getName)); | |||
| List<WxMall> malls = mallMapper.selectAll(); | |||
| malls.stream().filter(wxMall -> !dbModelMap.containsKey(wxMall.getTenantId())).forEach(wxMall -> { | |||
| addBirthDayMsgModelItem(tenantOfSignature, idWorker, wxMall, type, content); | |||
| }); | |||
| } | |||
| private void addBirthDayMsgModelItem(Map<String, String> tenantOfSignature, IdWorker idWorker, WxMall wxMall, EnumMsgModel msgModel, String content) { | |||
| WxMsgValidationcodeModel model = new WxMsgValidationcodeModel(); | |||
| model.setTenantId(wxMall.getTenantId()); | |||
| model.setId(idWorker.nextId()); | |||
| model.setType(msgModel.getCode()); | |||
| model.setName(msgModel.getMessage()); | |||
| model.setSignature(tenantOfSignature.get(wxMall.getTenantId())); | |||
| model.setContent(content); | |||
| model.setCreatetime(new Date()); | |||
| model.setStatus(1); | |||
| model.setMinutes(0); | |||
| model.setOpen(0); | |||
| model.setMsgType(1); | |||
| model.setRoleType(3); | |||
| modelMapper.insertSelective(model); | |||
| } | |||
| } | |||