| @@ -180,41 +180,21 @@ public class WxFinanceController extends BaseController { | |||||
| if (null == record.getMerchantId()) { | if (null == record.getMerchantId()) { | ||||
| return new ResultData(Result.ERROR,"请选择商户"); | return new ResultData(Result.ERROR,"请选择商户"); | ||||
| } | } | ||||
| List<WxFinanceReceive> advanceList = wxFinanceService.getMerchantAdvanceGroupSumList(record); | |||||
| BigDecimal total = new BigDecimal(0); | |||||
| Map retMap = new HashMap(); | |||||
| if (null != advanceList && advanceList.size() > 0 ) { | |||||
| WxEnergyFees fat = new WxEnergyFees(); | |||||
| fat.updateTenantInfo(record); | |||||
| Map<Long, WxEnergyFees> advanceTypMap = wxEnergyService.getFeesMap(fat); | |||||
| for (int i = 0 ; i < advanceList.size() ; i++) { | |||||
| WxFinanceReceive at = advanceList.get(i); | |||||
| if (null != at.getFeesId() && null != advanceTypMap) { | |||||
| WxEnergyFees wfat = advanceTypMap.get(at.getFeesId()); | |||||
| if (null != wfat) { | |||||
| at.setFeesName(wfat.getName()); | |||||
| } | |||||
| total.add(new BigDecimal(at.getTotalMoney())); | |||||
| } | |||||
| } | |||||
| } | |||||
| retMap.put("total", total); | |||||
| retMap.put("details", advanceList); | |||||
| return new ResultData(retMap); | |||||
| return new ResultData(wxFinanceService.getBillSetoffSum(record)); | |||||
| } | } | ||||
| @ApiOperation("查询冲抵列表") | @ApiOperation("查询冲抵列表") | ||||
| @GetMapping("setoffList") | |||||
| @PostMapping("setoffList") | |||||
| public ResultData setoffList(@ModelAttribute FinanceSetOffDTO dto) { | public ResultData setoffList(@ModelAttribute FinanceSetOffDTO dto) { | ||||
| dto.updateTenantInfo(getTenantInfo()); | dto.updateTenantInfo(getTenantInfo()); | ||||
| return new ResultData(wxFinanceService.getSetOffList(dto)); | return new ResultData(wxFinanceService.getSetOffList(dto)); | ||||
| } | } | ||||
| @ApiOperation("冲抵") | |||||
| @PostMapping("setoff") | |||||
| public ResultData setoff(@RequestBody FinanceSetOffDTO dto) { | |||||
| @ApiOperation("计算冲抵") | |||||
| @PostMapping("calcueteSetoff") | |||||
| public ResultData calcueteSetoff(@RequestBody FinanceSetOffDTO dto) { | |||||
| dto.updateTenantInfo(getTenantInfo()); | dto.updateTenantInfo(getTenantInfo()); | ||||
| WxBillBaseEntity bill = wxFinanceService.setOff(dto,this.getUser()); | |||||
| WxBillBaseEntity bill = wxFinanceService.calcuetSetOff(dto,this.getUser()); | |||||
| if (null == bill) { | if (null == bill) { | ||||
| return new ResultData(Result.ERROR,"未冲抵"); | return new ResultData(Result.ERROR,"未冲抵"); | ||||
| } | } | ||||
| @@ -1,6 +1,9 @@ | |||||
| package com.iformall.domain.dto; | package com.iformall.domain.dto; | ||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.base.WxBillBaseEntity; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -9,7 +12,6 @@ import lombok.Data; | |||||
| @Data | @Data | ||||
| public class FinanceSetOffDTO extends TenantEntity{ | public class FinanceSetOffDTO extends TenantEntity{ | ||||
| private static final long serialVersionUID = 3024690696283760441L; | private static final long serialVersionUID = 3024690696283760441L; | ||||
| private Long billId; | |||||
| private Integer billType; | |||||
| private Long financeAdvanceId; | |||||
| private List<WxBillBaseEntity> bills; | |||||
| private List<Long> feesIdList; | |||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| @@ -10,6 +11,8 @@ import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| /** | /** | ||||
| @@ -45,6 +48,16 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "收款总金额", name = "totalMoney") | @io.swagger.annotations.ApiModelProperty(value = "收款总金额", name = "totalMoney") | ||||
| private String totalMoney; | private String totalMoney; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "已使用金额(预充值用)", name = "useMoney") | |||||
| private String useMoney; | |||||
| public String getRemain() { | |||||
| if (StringUtils.isBlank(useMoney)) { | |||||
| useMoney = "0"; | |||||
| } | |||||
| return new BigDecimal(totalMoney).subtract(new BigDecimal(useMoney)).toPlainString(); | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceReceiveStatus", name = "status") | @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceReceiveStatus", name = "status") | ||||
| private Integer status; | private Integer status; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -97,5 +110,7 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| private Long floor; | private Long floor; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String shopIds; | private String shopIds; | ||||
| @TableField(exist = false) | |||||
| private String rate; | |||||
| } | } | ||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxFinanceReceive; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.List; | |||||
| @Data | |||||
| public class FinanceBillSetoffSum implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private BigDecimal total; | |||||
| private List<WxFinanceReceive> advanceList; //feesId,totalMoney,userMoney | |||||
| } | |||||
| @@ -8,7 +8,7 @@ public enum EnumFinanceReceiveStatus { | |||||
| NORMAL(1,"正常"), | NORMAL(1,"正常"), | ||||
| INVALID(2,"作废"), | INVALID(2,"作废"), | ||||
| SETOFF(3, "红冲"), | |||||
| RED_SETOFF(3, "红冲"), | |||||
| FINISH(4,"已审核过账") | FINISH(4,"已审核过账") | ||||
| ; | ; | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxFinanceReceive; | |||||
| import com.iformall.domain.po.WxFinanceReceiveBill; | import com.iformall.domain.po.WxFinanceReceiveBill; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.base.WxBillBaseEntity; | import com.iformall.domain.po.base.WxBillBaseEntity; | ||||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||||
| /** | /** | ||||
| */ | */ | ||||
| public interface WxFinanceService { | public interface WxFinanceService { | ||||
| @@ -22,9 +23,6 @@ public interface WxFinanceService { | |||||
| Map<Long,WxBillPayWay> getPayWayMap(WxBillPayWay record); | Map<Long,WxBillPayWay> getPayWayMap(WxBillPayWay record); | ||||
| void payWayInit(TenantEntity tenantInfo); | void payWayInit(TenantEntity tenantInfo); | ||||
| //预收款 | |||||
| List<Map> getSetOffList(FinanceSetOffDTO dto); | |||||
| //收款 | //收款 | ||||
| PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | PageInfo<WxFinanceReceive> receiveListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | ||||
| List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user); | List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user); | ||||
| @@ -33,8 +31,9 @@ public interface WxFinanceService { | |||||
| WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | ||||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user); | void invalidReceive(WxFinanceReceive record,MallUserInfo user); | ||||
| List<WxBillBaseEntity> getBills(TenantEntity tenantEntity,List<WxBillBaseEntity> bills); | List<WxBillBaseEntity> getBills(TenantEntity tenantEntity,List<WxBillBaseEntity> bills); | ||||
| List<WxFinanceReceive> getMerchantAdvanceGroupSumList(WxFinanceReceive record); | |||||
| //冲抵 | |||||
| WxBillBaseEntity setOff(FinanceSetOffDTO dto,MallUserInfo user); | |||||
| //预收款 | |||||
| WxBillBaseEntity calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | |||||
| FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); | |||||
| List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto); | |||||
| } | } | ||||
| @@ -6,6 +6,8 @@ import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.FinanceSetOffDTO; | import com.iformall.domain.dto.FinanceSetOffDTO; | ||||
| import com.iformall.domain.dto.WxBillPayDTO; | import com.iformall.domain.dto.WxBillPayDTO; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| @@ -19,6 +21,7 @@ import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.base.WxBillBaseEntity; | import com.iformall.domain.po.base.WxBillBaseEntity; | ||||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumBillStatus; | import com.iformall.enums.EnumBillStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| @@ -172,11 +175,34 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxFinanceReceive> getMerchantAdvanceGroupSumList(WxFinanceReceive record){ | |||||
| return wxFinanceReceiveMapper.getMerchantAdvanceGroupSumList(record); | |||||
| public FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record) { | |||||
| record.setType(EnumFinanceReceiveType.ADVANCE.getCode()); | |||||
| record.setStatus(EnumFinanceReceiveStatus.NORMAL.getCode()); | |||||
| List<WxFinanceReceive> advanceList = wxFinanceReceiveMapper.getMerchantAdvanceGroupSumList(record); | |||||
| BigDecimal total = new BigDecimal(0); | |||||
| FinanceBillSetoffSum retMap = new FinanceBillSetoffSum(); | |||||
| if (null != advanceList && advanceList.size() > 0 ) { | |||||
| WxEnergyFees fat = new WxEnergyFees(); | |||||
| fat.updateTenantInfo(record); | |||||
| Map<Long, WxEnergyFees> advanceTypMap = wxEnergyService.getFeesMap(fat); | |||||
| for (int i = 0 ; i < advanceList.size() ; i++) { | |||||
| WxFinanceReceive at = advanceList.get(i); | |||||
| if (null != at.getFeesId() && null != advanceTypMap) { | |||||
| WxEnergyFees wfat = advanceTypMap.get(at.getFeesId()); | |||||
| if (null != wfat) { | |||||
| at.setFeesName(wfat.getName()); | |||||
| at.setRate(wfat.getRate()); | |||||
| } | |||||
| total.add(new BigDecimal(at.getRemain())); | |||||
| } | |||||
| } | |||||
| } | |||||
| retMap.setTotal(total); | |||||
| retMap.setAdvanceList(advanceList); | |||||
| return retMap; | |||||
| } | } | ||||
| private List<WxFinanceReceive> getAdvanceListByFeesId(TenantEntity tenantEntity,Long feesId) { | |||||
| private FinanceBillSetoffSum getAdvanceListByFeesId(TenantEntity tenantEntity,Long feesId) { | |||||
| WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); | WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); | ||||
| tf.updateTenantInfo(tenantEntity); | tf.updateTenantInfo(tenantEntity); | ||||
| tf.setFeesId(feesId); | tf.setFeesId(feesId); | ||||
| @@ -185,48 +211,36 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| WxFinanceReceive faq = new WxFinanceReceive(); | WxFinanceReceive faq = new WxFinanceReceive(); | ||||
| faq.updateTenantInfo(tenantEntity); | faq.updateTenantInfo(tenantEntity); | ||||
| faq.setFeesIdList(feesIdList); | faq.setFeesIdList(feesIdList); | ||||
| return wxFinanceReceiveMapper.findList(faq); | |||||
| return getBillSetoffSum(faq); | |||||
| }else { | }else { | ||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public List<Map> getSetOffList(FinanceSetOffDTO dto) { | |||||
| //根据账单的科目查询可抵扣的预充值 | |||||
| WxMerchant merchant = new WxMerchant(); | |||||
| merchant.updateTenantInfo(dto); | |||||
| WxBillBaseEntity be = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(dto.getBillType()), merchant, dto.getBillId()); | |||||
| if (null == be) { | |||||
| return null; | |||||
| public List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto) { | |||||
| if (null == dto.getBills() || dto.getBills().size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择账单"); | |||||
| } | } | ||||
| //通过科目去查询可以抵扣的预充费用 | |||||
| List<WxFinanceReceive> advanceList = getAdvanceListByFeesId(dto, be.getEnergyFeesId()); | |||||
| if (null != advanceList && advanceList.size() > 0 ) { | |||||
| WxEnergyFees atq = new WxEnergyFees(); | |||||
| atq.updateTenantInfo(dto); | |||||
| Map<Long, WxEnergyFees> typeMap = wxEnergyService.getFeesMap(atq); | |||||
| List retList = new ArrayList(); | |||||
| for (int i = 0 ; i < advanceList.size() ; i ++) { | |||||
| WxFinanceReceive a = advanceList.get(i); | |||||
| Map m = new HashMap(); | |||||
| m.put("id", a.getId()); | |||||
| if (null != typeMap && null != a.getFeesId()) { | |||||
| WxEnergyFees fat = typeMap.get(a.getFeesId()); | |||||
| if (null != fat) { | |||||
| m.put("name", fat.getName()); | |||||
| m.put("rate", fat.getRate()); | |||||
| m.put("money", calcuteSetOffMoney(fat.getRate(),be.getOwe())); | |||||
| } | |||||
| } | |||||
| retList.add(m); | |||||
| Long billFeesId = null; | |||||
| for (int i = 0 ; i < dto.getBills().size(); i++) { | |||||
| WxBillBaseEntity b = dto.getBills().get(i); | |||||
| if (null == billFeesId) { | |||||
| billFeesId = b.getEnergyFeesId(); | |||||
| }else if (billFeesId.equals(b.getEnergyFeesId())) { | |||||
| }else if (!billFeesId.equals(b.getEnergyFeesId())) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择相同科目"); | |||||
| } | } | ||||
| return retList; | |||||
| } | } | ||||
| return null; | |||||
| //通过账单科目去查询可以抵扣的预充费用 | |||||
| FinanceBillSetoffSum sum = getAdvanceListByFeesId(dto, billFeesId); | |||||
| if (null == sum) { | |||||
| return null; | |||||
| } | |||||
| return sum.getAdvanceList(); | |||||
| } | } | ||||
| private String calcuteSetOffMoney(String rate,String money) { | private String calcuteSetOffMoney(String rate,String money) { | ||||
| if (new BigDecimal(money).compareTo(new BigDecimal(0)) <= 0) { | if (new BigDecimal(money).compareTo(new BigDecimal(0)) <= 0) { | ||||
| return "0"; | return "0"; | ||||
| @@ -235,10 +249,22 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxBillBaseEntity setOff(FinanceSetOffDTO dto,MallUserInfo user) { | |||||
| public WxBillBaseEntity calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user) { | |||||
| //多个账单类型和科目必须一致 | |||||
| //优先冲抵时间早的账单,优先用时间早的预充费用来冲抵 | |||||
| if (null == dto.getBills() || dto.getBills().size() <= 0 || null == dto.getFeesIdList() || dto.getFeesIdList().size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择账单和抵扣科目"); | |||||
| } | |||||
| //查询出账单可以抵扣的科目预收项 | |||||
| List<WxFinanceReceive> advanceList = getSetOffList(dto); | |||||
| WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId()); | |||||
| if (new BigDecimal(bill.getOwe()).compareTo(b0) <= 0 ) { | |||||
| }else { | |||||
| billList.add(bill); | |||||
| } | |||||
| //根据预充规则计算冲抵费用 | //根据预充规则计算冲抵费用 | ||||
| WxMerchant merchant = new WxMerchant(); | |||||
| merchant.updateTenantInfo(dto); | |||||
| WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(dto.getBillType()), merchant, dto.getBillId()); | WxBillBaseEntity bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(dto.getBillType()), merchant, dto.getBillId()); | ||||
| if (new BigDecimal(bill.getOwe()).compareTo(new BigDecimal(0)) <= 0) { | if (new BigDecimal(bill.getOwe()).compareTo(new BigDecimal(0)) <= 0) { | ||||
| return null; | return null; | ||||
| @@ -370,7 +396,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| return page; | return page; | ||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| @Override | @Override | ||||
| public void saveOrUpdateReceive(WxFinanceReceive record, MallUserInfo user) { | public void saveOrUpdateReceive(WxFinanceReceive record, MallUserInfo user) { | ||||
| Date date = new Date(); | Date date = new Date(); | ||||
| @@ -432,6 +458,27 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| } | } | ||||
| private void sortBills(List<WxBillBaseEntity> billList) { | |||||
| Collections.sort(billList, new Comparator<WxBillBaseEntity>() { | |||||
| @Override | |||||
| public int compare(WxBillBaseEntity o1, WxBillBaseEntity o2) { | |||||
| if (o1.getStarttime().before(o2.getStarttime())) { | |||||
| return -1; | |||||
| }else if (o1.getStarttime().equals(o2.getStarttime())) { | |||||
| if (o1.getEndtime().before(o2.getEndtime())) { | |||||
| return -1; | |||||
| }else if (o1.getEndtime().equals(o2.getEndtime())) { | |||||
| return 0; | |||||
| }else { | |||||
| return 1; | |||||
| } | |||||
| }else { | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| }); | |||||
| } | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user) { | public List<WxBillBaseEntity> createReceive(WxFinanceReceive record,MallUserInfo user) { | ||||
| @@ -451,24 +498,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| if (billList.size() <= 0 ) { | if (billList.size() <= 0 ) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| Collections.sort(billList, new Comparator<WxBillBaseEntity>() { | |||||
| @Override | |||||
| public int compare(WxBillBaseEntity o1, WxBillBaseEntity o2) { | |||||
| if (o1.getStarttime().before(o2.getStarttime())) { | |||||
| return -1; | |||||
| }else if (o1.getStarttime().equals(o2.getStarttime())) { | |||||
| if (o1.getEndtime().before(o2.getEndtime())) { | |||||
| return -1; | |||||
| }else if (o1.getEndtime().equals(o2.getEndtime())) { | |||||
| return 0; | |||||
| }else { | |||||
| return 1; | |||||
| } | |||||
| }else { | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| }); | |||||
| sortBills(billList); | |||||
| //增加一条收款记录。关联账单,账单更新收款信息 | //增加一条收款记录。关联账单,账单更新收款信息 | ||||
| BigDecimal total = new BigDecimal(0); | BigDecimal total = new BigDecimal(0); | ||||
| for (int i = 0 ; i < record.getPayWays().size() ; i ++) { | for (int i = 0 ; i < record.getPayWays().size() ; i ++) { | ||||
| @@ -8,6 +8,7 @@ | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | ||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | ||||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney"/> | <result column="total_money" jdbcType="VARCHAR" property="totalMoney"/> | ||||
| <result column="use_money" jdbcType="VARCHAR" property="useMoney"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| <result column="type" jdbcType="INTEGER" property="type"/> | <result column="type" jdbcType="INTEGER" property="type"/> | ||||
| <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/> | <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/> | ||||
| @@ -21,7 +22,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`total_money`,`status`,`type`,`money_detail`, | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`total_money`,`use_money`,`status`,`type`,`money_detail`, | |||||
| `create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`remark`,`feesId` | `create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`remark`,`feesId` | ||||
| </sql> | </sql> | ||||
| @@ -79,8 +80,11 @@ | |||||
| </update> | </update> | ||||
| <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap"> | <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap"> | ||||
| select fees_id,sum(CAST(money AS DECIMAL(20,4))) as total_money | |||||
| from wx_finance_receive where type = 2 and status group by fees_id | |||||
| select fees_id,sum(CAST(total_money AS DECIMAL(20,4))) as total_money,sum(CAST(use_money AS DECIMAL(20,4))) as use_money | |||||
| from wx_finance_receive | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| and money - use_money > 0 | |||||
| group by fees_id | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||