| @@ -84,4 +84,10 @@ public class WxBillSettleController extends BaseController { | |||
| wxBillSettleService.exportBill(request, response, wxBillSettle); | |||
| } | |||
| @GetMapping("downloadSettle") | |||
| @SystemControllerLog(description = "账单管理-结算单-下载") | |||
| public void downloadSettle(@ModelAttribute WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillSettle.setTenantId(getTenantId()); | |||
| wxBillSettleService.exportBill(request, response, wxBillSettle); | |||
| } | |||
| } | |||
| @@ -0,0 +1,3 @@ | |||
| alter table wx_merchant_subsidy | |||
| add column `freeze` SMALLINT (1) NULL DEFAULT 0 COMMENT '0正常1冻结'; | |||
| @@ -77,5 +77,7 @@ public class WxBillDeposit extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "支付方式:见枚举EnumBillPayWay", name = "payWay") | |||
| private Integer payWay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | |||
| private Integer freeze; | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -28,6 +29,7 @@ public class WxBillSettle extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算单号",name="settleNumber") | |||
| @Excel(name="结算单号",width = 20,orderNum = "1") | |||
| private String settleNumber; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| @@ -51,11 +53,17 @@ public class WxBillSettle extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||
| private Map<String, Object> flowParams; | |||
| //结余金额 | |||
| @Transient | |||
| private Long balance; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "收款账单列表", name = "receiveBillIds") | |||
| private List<WxBillSettleBill> receiveBillIds; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "承付账单列表", name = "payBillIds") | |||
| private List<WxBillSettleBill> payBillIds; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "结单记录", name = "settleRecordList") | |||
| private List<WxBillSettleRecord> settleRecordList; | |||
| } | |||
| @@ -42,6 +42,8 @@ public class WxBillSettleRecord extends BaseEntity { | |||
| private Long balance; | |||
| @io.swagger.annotations.ApiModelProperty(value="明细",name="detail") | |||
| private String detail; | |||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="desc") | |||
| private String desc; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | |||
| private Date createtime; | |||
| @@ -105,6 +105,9 @@ public class WxMerchantSubsidy extends BaseEntity { | |||
| @Transient | |||
| protected String statusStr; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否冻结",name="freeze") | |||
| private Integer freeze; | |||
| public String getOrderPaymentStr() { | |||
| if(getOrderPayment()!=null) { | |||
| @@ -40,5 +40,7 @@ public interface WxBillSettleService { | |||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | |||
| void downloadBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | |||
| void updateFreeze(List<WxBillSettleBill> billList, int status); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillSettleRecord; | |||
| @@ -26,8 +27,13 @@ public class WxBillSettleRecordServiceImpl implements WxBillSettleRecordService | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillSettleRecord record,MallUserInfo mallUserInfo) { | |||
| return null; | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| if (record.getId() == null) { | |||
| record.setId(idWorker.nextId()); | |||
| wxBillSettleRecordMapper.insertSelective(record); | |||
| }else{ | |||
| wxBillSettleRecordMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import com.iformall.enums.EnumBillType; | |||
| import com.iformall.enums.EnumFreezeType; | |||
| import com.iformall.enums.EnumSettleBillType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| import com.iformall.service.WxFlowService; | |||
| import org.checkerframework.checker.units.qual.A; | |||
| @@ -46,6 +47,12 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| private WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||
| @Autowired | |||
| private WxBillOtherDepositMapper wxBillOtherDepositMapper; | |||
| @Autowired | |||
| private WxBillSettleRecordMapper wxBillSettleRecordMapper; | |||
| @Autowired | |||
| private WxMerchantSubsidyMapper wxMerchantSubsidyMapper; | |||
| @Autowired | |||
| private ExcelService excelService; | |||
| @Override | |||
| public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | |||
| @@ -65,6 +72,15 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillSettleBill.setType(EnumSettleBillType.P.getCode()); | |||
| billSettle.setPayBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); | |||
| WxBillSettleRecord wxBillSettleRecord = new WxBillSettleRecord(); | |||
| wxBillSettleRecord.setTenantId(billSettle.getTenantId()); | |||
| wxBillSettleRecord.setSettleId(billSettle.getId()); | |||
| billSettle.setSettleRecordList(wxBillSettleRecordMapper.findList(wxBillSettleRecord)); | |||
| //计算结余金额 | |||
| //todo: | |||
| } | |||
| return billSettle; | |||
| @@ -76,38 +92,48 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if(EnumBillType.RENT.getCode().equals(bill.getBillType())) { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { | |||
| WxBillDeposit wxBillRent = new WxBillDeposit(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillDepositMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { | |||
| WxBillProperty wxBillRent = new WxBillProperty(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | |||
| propertyDeposit.setId(bill.getBillId()); | |||
| propertyDeposit.setStatus(status); | |||
| propertyDeposit.setFreeze(status); | |||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); | |||
| }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { | |||
| WxBillOther wxBillRent = new WxBillOther(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { | |||
| WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { | |||
| WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else{ | |||
| WxBillDaily wxBillRent = new WxBillDaily(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setFreeze(status); | |||
| wxBillDailyMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| WxMerchantSubsidy wxMerchantSubsidy = new WxMerchantSubsidy(); | |||
| wxMerchantSubsidy.setId(bill.getBillId()); | |||
| wxMerchantSubsidy.setFreeze(status); | |||
| wxMerchantSubsidyMapper.updateByPrimaryKeySelective(wxMerchantSubsidy); | |||
| } | |||
| } | |||
| } | |||
| @@ -129,6 +155,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| bill.setId(idWorker.nextId()); | |||
| bill.setSettleId(record.getId()); | |||
| bill.setTenantId(record.getTenantId()); | |||
| bill.setType(EnumSettleBillType.R.getCode()); | |||
| wxBillSettleBillMapper.insertSelective(bill); | |||
| } | |||
| for (WxBillSettleBill bill:record.getPayBillIds()) { | |||
| bill.setId(idWorker.nextId()); | |||
| bill.setSettleId(record.getId()); | |||
| bill.setTenantId(record.getTenantId()); | |||
| bill.setType(EnumSettleBillType.P.getCode()); | |||
| wxBillSettleBillMapper.insertSelective(bill); | |||
| } | |||
| @@ -136,18 +170,24 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||
| updateFreeze(record.getReceiveBillIds(), EnumFreezeType.YES.getCode()); | |||
| updateFreeze(record.getPayBillIds(),EnumFreezeType.YES.getCode()); | |||
| } | |||
| //启动审批流 | |||
| record.getFlowParams().put("businessId",record.getId()); | |||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||
| wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record.getTenantId()); | |||
| //启动审批流 | |||
| record.getFlowParams().put("businessId",record.getId()); | |||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||
| wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record.getTenantId()); | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle) { | |||
| List<WxBillSettle> list = wxBillSettleMapper.findList(wxBillSettle); | |||
| excelService.exportExcel(list, null, "补贴记录", WxBillSettle.class, "补贴记录.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public void downloadBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle) { | |||
| } | |||
| } | |||
| @@ -679,11 +679,11 @@ | |||
| left join wx_c_user cu on cu.id = cs.owner_id | |||
| where ms.order_type in(3,0) and ms.status = 0 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_rent_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_property_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_property_deposit where status = 3 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_other_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | |||
| )ss where ss.id = m.id | |||
| )/100,2) payOut, | |||
| @@ -715,11 +715,11 @@ | |||
| left join wx_c_user cu on cu.id = cs.owner_id | |||
| where ms.order_type in(3,0) and ms.status = 0 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_rent_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_rent_deposit where status = 3 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_property_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_property_deposit where status = 3 | |||
| union all | |||
| select merchant_id id,receive_pay money from wx_bill_other_deposit where status = 3 | |||
| select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | |||
| )ss where ss.id = m.id | |||
| )/100,2)) balance | |||
| @@ -79,6 +79,7 @@ | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | |||
| ) bill | |||
| on(bl.bill_id = bill.id) | |||
| where 1=1 | |||
| <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> | |||
| @@ -12,7 +12,7 @@ | |||
| <result column="settle_way" property="settleWay"/> | |||
| <result column="balance" property="balance"/> | |||
| <result column="detail" property="detail"/> | |||
| <result column="desc" property="desc"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| @@ -20,13 +20,14 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`settle_id`,`userid`,`user_name`,`settle_money`, | |||
| `settle_time`,`settle_way`,`balance`,detail,`createtime`,`updatetime` | |||
| `settle_time`,`settle_way`,`balance`,detail,`createtime`,`updatetime`,`desc` | |||
| </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 != settleId ">and `settle_id` = #{settleId}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -16,10 +16,12 @@ | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="freeze" property="freeze" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`order_id`,`order_type`,`merchant_id`,`coupon_order_id`,`coupon_type`,`order_payment`,`receiver_payment`,`real_payment`,`subsidy`,`real_subsidy`,`status`,`create_date`,`update_date` | |||
| `id`,`order_id`,`order_type`,`merchant_id`,`coupon_order_id`,`coupon_type`,`order_payment`,`receiver_payment`,`real_payment`,`subsidy`,`real_subsidy`,`status`,`create_date`,`update_date`,freeze | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||