developrelease_toaliyun_real
| @@ -119,7 +119,12 @@ public class WxCouponSendController extends BaseController { | |||
| wxCouponSend.setCreateDate(new Date()); | |||
| wxCouponSend.setUpdateDate(new Date()); | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| try { | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import com.iformall.domain.po.WxBillSettleRecord; | |||
| import com.iformall.enums.EnumFilterSettle; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.WxBillSettleRecordService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| @@ -59,7 +60,7 @@ public class WxBillSettleController extends BaseController { | |||
| @SystemControllerLog(description = "账单管理-结算单-id查找") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode())); | |||
| } | |||
| @PostMapping("addOrUpdate") | |||
| @@ -9,6 +9,7 @@ import com.iformall.mapper.WxBillSettleMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.JsonUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| @@ -110,23 +111,23 @@ public class Test { | |||
| // wxBillAll.setBillTypeValue(10); | |||
| // log.debug("data:{}", JSON.toJSONString( wxBillAllService.listBill(wxBillAll))); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(330875180045271040l); | |||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||
| settleRecord.setSettleId(wxBillSettle.getId()); | |||
| settleRecord.setSettleMoney(wxBillSettle.getBalance()); | |||
| settleRecord.setSettleTime(new Date()); | |||
| settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||
| settleRecord.setTenantId(wxBillSettle.getTenantId()); | |||
| BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||
| wxBillSettleRecordService.saveOrUpdate(settleRecord,null,wxBillSettle.getId()); | |||
| wxBillSettle.setUpdatetime(new Date()); | |||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | |||
| // WxBillSettle wxBillSettle = wxBillSettleService.getById(330875180045271040l); | |||
| // | |||
| // | |||
| // WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||
| // settleRecord.setSettleId(wxBillSettle.getId()); | |||
| // settleRecord.setSettleMoney(wxBillSettle.getBalance()); | |||
| // settleRecord.setSettleTime(new Date()); | |||
| // settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||
| // settleRecord.setTenantId(wxBillSettle.getTenantId()); | |||
| // | |||
| // BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||
| // settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||
| // wxBillSettleRecordService.saveOrUpdate(settleRecord,null,wxBillSettle.getId()); | |||
| // | |||
| // wxBillSettle.setUpdatetime(new Date()); | |||
| // wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||
| // wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | |||
| } | |||
| @org.junit.Test | |||
| @@ -142,5 +143,11 @@ public class Test { | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| @org.junit.Test | |||
| public void testmq2(){ | |||
| WxBillAll wxBillAll = new WxBillAll(); | |||
| wxBillAll.setTenantId("456"); | |||
| wxBillAll.setMerchantId(324754110547066880l); | |||
| System.out.println("--------"+JsonUtil.obj2Json(wxBillAllService.listBill(wxBillAll))); | |||
| } | |||
| } | |||
| @@ -6,6 +6,7 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.enums.EnumFilterSettle; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| @@ -91,7 +92,7 @@ public class WxBillController extends BaseController { | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @ApiOperation("账单管理-结算单-id查找") | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode())); | |||
| } | |||
| } | |||
| @@ -97,4 +97,9 @@ public class WxBillSettle extends BaseEntity { | |||
| private Integer limitStart; | |||
| @Transient | |||
| private Integer limitEnd; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="是否过滤结算历史 1不过滤",name="filterSettleRecord") | |||
| private Integer filterSettleRecord =0; | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumFilterSettle { | |||
| YES(0, "过滤"), | |||
| NO(1, "不过滤"), | |||
| ; | |||
| public static EnumFilterSettle getEnum(Integer code) { | |||
| for (EnumFilterSettle value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumFilterSettle(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -22,13 +22,14 @@ public interface WxBillSettleService { | |||
| */ | |||
| PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxBillSettle getById(Long id); | |||
| WxBillSettle getById(Long id,Integer filterSettleRecord); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -127,6 +127,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Autowired | |||
| WxBillSettleService wxBillSettleService; | |||
| @Autowired | |||
| WxBillSettleRecordMapper wxBillSettleRecordMapper; | |||
| @Override | |||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||
| //更新各账单状态 | |||
| @@ -192,6 +195,16 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| return new ResultData(pageInfo); | |||
| } | |||
| List<Map<String, Object>> maps = wxBillAllMapper.listData(wxBillAll); | |||
| for (Map<String, Object> map:maps) { | |||
| Integer billType = ((Long)map.get("billTypeValue")).intValue(); | |||
| if(EnumBillType.SETTLE.getCode().equals(billType)){ | |||
| BigDecimal rp = (BigDecimal)map.get("receivePay"); | |||
| WxBillSettle query = new WxBillSettle(); | |||
| query.setId((Long)map.get("id")); | |||
| Long sum = wxBillSettleRecordMapper.getSumMoneyBySettleId(query); | |||
| map.put("owe",rp.subtract(new BigDecimal(sum))); | |||
| } | |||
| } | |||
| return new ResultData(maps); | |||
| } | |||
| @@ -257,7 +270,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| try { | |||
| logger.info("更新结算单id:{}", JsonUtil.obj2Json(bill)); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById((Long)bill.get("id")); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById((Long)bill.get("id"), EnumFilterSettle.NO.getCode()); | |||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||
| settleRecord.setSettleId((Long)bill.get("id")); | |||
| @@ -813,7 +826,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Override | |||
| public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId()); | |||
| wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); | |||
| if(wxBillSettle.getReceiveBillIds() == null) wxBillSettle.setReceiveBillIds(new ArrayList<>()); | |||
| if(wxBillSettle.getPayBillIds() == null) wxBillSettle.setPayBillIds(new ArrayList<>()); | |||
| @@ -97,7 +97,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| } | |||
| @Override | |||
| public WxBillSettle getById(Long id){ | |||
| public WxBillSettle getById(Long id,Integer filterSettleRecord){ | |||
| WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | |||
| if(billSettle != null){ | |||
| @@ -124,6 +124,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| //加载应收、承付、结余 | |||
| WxBillSettle query = new WxBillSettle(); | |||
| query.setId(id); | |||
| query.setFilterSettleRecord(filterSettleRecord); | |||
| query = wxBillSettleMapper.findList(query).get(0); | |||
| billSettle.setReceiveMoney(query.getReceiveMoney()); | |||
| billSettle.setPayMoney(query.getPayMoney()); | |||
| @@ -304,7 +304,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxBillSettle.setApplyStatus(applyStatus); | |||
| //审批完成,账单解冻 | |||
| WxBillSettle settle = wxBillSettleService.getById(businessId); | |||
| WxBillSettle settle = wxBillSettleService.getById(businessId, EnumFilterSettle.NO.getCode()); | |||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxBillSettle.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | |||
| wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | |||
| @@ -414,12 +414,12 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| //给审批人发送代办通知短信 | |||
| List<MallUserInfo> mallUserInfoList = getUserByProcessInstanceId(processInstance.getId()); | |||
| for (MallUserInfo mallUserInfo:mallUserInfoList) { | |||
| sendAssigneeMsgAndEmail(tenantId,mallUserInfo.getPhone(),mallUserInfo.getEmail(),starterInfo.getName(),businessId,flowType); | |||
| sendAssigneeMsgAndEmail(tenantId, mallUserInfo.getPhone(), mallUserInfo.getEmail(), starterInfo.getName(), businessId, flowType, variables); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| public void sendAssigneeMsgAndEmail(String tenantId,String phone,String email,String userName,Long businessId,Integer flowType){ | |||
| public void sendAssigneeMsgAndEmail(String tenantId, String phone, String email, String userName, Long businessId, Integer flowType, List<Map<String, Object>> variables) { | |||
| Map<String,String> dynamicContentMap = new HashMap<>(); | |||
| dynamicContentMap.put("userName",userName); | |||
| dynamicContentMap.put("page", Constant.adminPage); | |||
| @@ -437,7 +437,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_ASSIGNEE_NODIFY.getCode()); | |||
| }else if(isSettle(flowType)){ | |||
| dynamicContentMap.put("bustype","结算单"); | |||
| dynamicContentMap.put("contract", businessId.toString()); | |||
| dynamicContentMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| wxMsgRecord.setDynamicContentMap(dynamicContentMap); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -518,7 +518,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| mailMsg.setModelType(EnumMailMsgModel.MAIL_C_ASSIGNEE_NODIFY.getCode()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -936,7 +936,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| List<MallUserInfo> mallUserInfoList = getUserByProcessInstanceId(processInstanceId); | |||
| for (int i = 0; i < mallUserInfoList.size(); i++) { | |||
| MallUserInfo mallUserInfo = mallUserInfoList.get(i); | |||
| sendAssigneeMsgAndEmail(tenantId,mallUserInfo.getPhone(),mallUserInfo.getEmail(),userName,businessId,flowType); | |||
| sendAssigneeMsgAndEmail(tenantId, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); | |||
| if(i == mallUserInfoList.size()-1){ | |||
| assignee += mallUserInfo.getName(); | |||
| }else{ | |||
| @@ -967,7 +967,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| wxMsgRecord.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -994,7 +994,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -1031,7 +1031,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| wxMsgRecord.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -1058,7 +1058,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -1184,7 +1184,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if (isSettle(flowType)) { | |||
| msgReplaceMap.put("bustype", "结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| wxMsgRecord.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -1219,7 +1219,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| msgReplaceMap.put("name",wxCoupon.getTitle()); | |||
| }else if(isSettle(flowType)){ | |||
| msgReplaceMap.put("bustype","结算单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| msgReplaceMap.put("contract", (String) getVariableByKey(variables, "settleNumber")); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -105,7 +105,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| Integer billTypeValue = ((Long) bill.get("billTypeValue")).intValue(); | |||
| if(EnumBillType.SETTLE.getCode().equals(billTypeValue)){ | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(record.getBillId()); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(record.getBillId(), EnumFilterSettle.NO.getCode()); | |||
| owe = wxBillSettle.getBalance(); | |||
| bill.put("owe",owe); | |||
| logger.info("wxBillSettle.balance:{}",owe); | |||
| @@ -279,8 +279,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return ratioVo; | |||
| } | |||
| List<String> ratioList = JSONArray.parseArray(busDiscountRatio, String.class); | |||
| ratioVo.setUseRatio("["); | |||
| ratioVo.setUseRatio(busDiscountRatio); | |||
| for (int i = 0; i < ratioList.size(); i++) { | |||
| BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(8, RoundingMode.HALF_EVEN); | |||
| @@ -316,7 +315,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | |||
| ratioVo.setRatio(ratio); | |||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio()+"\""+e+"\","); | |||
| break; | |||
| } | |||
| }else if(e.indexOf(">") >= 0){ | |||
| @@ -343,7 +341,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (revenue.compareTo(end) >= 0){ | |||
| ratioVo.setRatio(ratio); | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio()+"\""+e+"\","); | |||
| //计算超出部分 | |||
| BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); | |||
| @@ -375,9 +372,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| } | |||
| if(!"[".equals(ratioVo.getUseRatio())) { | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio().substring(0, ratioVo.getUseRatio().lastIndexOf(",")) + "]"); | |||
| } | |||
| return ratioVo; | |||
| } | |||
| @@ -810,7 +810,7 @@ | |||
| left join wx_business xb on(m.business_id = xb.id) | |||
| left join wx_rent_contract rc on(rc.merchant_id = m.id) | |||
| where m.status=1 | |||
| ) tt where tt.receivePay >0 and tt.payOut>0 | |||
| ) tt where 1=1 | |||
| <if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if> | |||
| <if test=" null != merchantId"> and tt.id = #{merchantId} </if> | |||
| @@ -51,9 +51,16 @@ | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> | |||
| select tt.*,(tt.receiveMoney-tt.payMoney- | |||
| (select IFNULL(sum(settle_money),0) from wx_bill_settle_record where settle_id = tt.id) | |||
| ) balance from ( | |||
| select tt.* | |||
| <if test="0 == filterSettleRecord"> | |||
| ,(tt.receiveMoney-tt.payMoney- | |||
| (select IFNULL(sum(settle_money),0) from wx_bill_settle_record where settle_id = tt.id) | |||
| ) balance | |||
| </if> | |||
| <if test="1 == filterSettleRecord"> | |||
| ,(tt.receiveMoney-tt.payMoney) balance | |||
| </if> | |||
| from ( | |||
| select s.*,m.name merchantName, | |||
| (select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||
| @@ -141,5 +148,6 @@ | |||
| </select> | |||
| </mapper> | |||