| @@ -16,6 +16,7 @@ import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxFinanceFinish; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceiveBill; | |||
| import com.iformall.domain.po.WxFinanceReceivePayway; | |||
| import com.iformall.domain.po.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| @@ -561,7 +562,7 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("结账列表") | |||
| @ApiOperation("批次结账统计合计") | |||
| @GetMapping("finishReceiveSum") | |||
| public ResultData finishReceiveSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| @@ -572,6 +573,28 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("批次结账支付方式统计") | |||
| @GetMapping("finishReceivePaywaysSum") | |||
| public ResultData finishReceivePaywaysSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxFinanceReceivePayway> page = wxFinanceService.getReceivePaywaysSum(record); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("批次结账科目统计") | |||
| @GetMapping("finishReceiveFeesSum") | |||
| public ResultData finishReceiveFeesSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxFinanceReceiveBill> page = wxFinanceService.getReceiveFeesSum(record); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("结账") | |||
| @PostMapping("receiveFinish") | |||
| public ResultData receiveFinish(@RequestBody WxFinanceFinish record) { | |||
| @@ -2,8 +2,6 @@ package com.iformall.domain.vo; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| import com.iformall.domain.po.WxFinanceReceivePayway; | |||
| @Data | |||
| public class WxFinanceReceiveSumVo implements Serializable { | |||
| @@ -13,6 +11,4 @@ public class WxFinanceReceiveSumVo implements Serializable { | |||
| String totalReceive; | |||
| String totalSetoff; | |||
| String totalPay; | |||
| List<WxFinanceReceivePayway> payWays; | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceiveBill; | |||
| import com.iformall.domain.po.WxFinanceReceivePayway; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| @@ -24,7 +25,12 @@ public interface WxFinanceReceiveMapper extends CommonMapper<WxFinanceReceive, L | |||
| WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | |||
| List<WxFinanceReceivePayway> getReceivePayWaySum(WxFinanceReceive record); | |||
| List<WxFinanceReceivePayway> getReceivePayWayReceiveSum(WxFinanceReceive record); | |||
| List<WxFinanceReceivePayway> getReceivePayWayPaySum(WxFinanceReceive record); | |||
| List<WxFinanceReceiveBill> getReceiveFeesReceiveSum(WxFinanceReceive record); | |||
| List<WxFinanceReceiveBill> getReceiveFeesPaySum(WxFinanceReceive record); | |||
| void updatePrint(WxFinanceReceive record); | |||
| @@ -15,6 +15,7 @@ import com.iformall.domain.po.WxBillPayWay; | |||
| import com.iformall.domain.po.WxFinanceFinish; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceiveBill; | |||
| import com.iformall.domain.po.WxFinanceReceivePayway; | |||
| import com.iformall.domain.po.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| @@ -62,6 +63,9 @@ public interface WxFinanceService { | |||
| WxFinanceFinish getFinishById(TenantEntity tenantEntity,Long id); | |||
| void saveOrUpdateFinish(WxFinanceFinish record,MallUserInfo user); | |||
| WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | |||
| List<WxFinanceReceivePayway> getReceivePaywaysSum(WxFinanceReceive record); | |||
| List<WxFinanceReceiveBill> getReceiveFeesSum(WxFinanceReceive record); | |||
| void finishReceive(WxFinanceFinish record,MallUserInfo user); | |||
| Integer getReceiveUnFinisedCount(WxFinanceReceive record); | |||
| void batchFinishReceive(WxFinanceFinish record,MallUserInfo user,boolean isAll); | |||
| @@ -1478,25 +1478,65 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| public WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record) { | |||
| initQueryParam(record); | |||
| WxFinanceReceiveSumVo vo = wxFinanceReceiveMapper.getReceiveSum(record); | |||
| if (null != vo ) { | |||
| List<WxFinanceReceivePayway> pays = wxFinanceReceiveMapper.getReceivePayWaySum(record); | |||
| if (null != pays) { | |||
| WxBillPayWay pq = new WxBillPayWay(); | |||
| pq.updateTenantInfo(record); | |||
| Map<Long,WxBillPayWay> paywayMap = this.getPayWayMap(pq); | |||
| for (int i = 0 ; i < pays.size() ; i ++) { | |||
| WxFinanceReceivePayway rpw = pays.get(i); | |||
| if (null != paywayMap && null != rpw.getPayWay()) { | |||
| WxBillPayWay pw = paywayMap.get(rpw.getPayWay()); | |||
| if (null != pw) { | |||
| rpw.setPayWayName(pw.getName()); | |||
| } | |||
| return vo; | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceivePayway> getReceivePaywaysSum(WxFinanceReceive record) { | |||
| initQueryParam(record); | |||
| if (null == record.getType()) { | |||
| record.setType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| } | |||
| List<WxFinanceReceivePayway> pays = null; | |||
| if (record.getType() == EnumFinanceCashierType.RECEIVE.getCode()) { | |||
| pays = wxFinanceReceiveMapper.getReceivePayWayReceiveSum(record); | |||
| }else { | |||
| pays = wxFinanceReceiveMapper.getReceivePayWayPaySum(record); | |||
| } | |||
| if (null != pays) { | |||
| WxBillPayWay pq = new WxBillPayWay(); | |||
| pq.updateTenantInfo(record); | |||
| Map<Long,WxBillPayWay> paywayMap = this.getPayWayMap(pq); | |||
| for (int i = 0 ; i < pays.size() ; i ++) { | |||
| WxFinanceReceivePayway rpw = pays.get(i); | |||
| if (null != paywayMap && null != rpw.getPayWay()) { | |||
| WxBillPayWay pw = paywayMap.get(rpw.getPayWay()); | |||
| if (null != pw) { | |||
| rpw.setPayWayName(pw.getName()); | |||
| } | |||
| } | |||
| vo.setPayWays(pays); | |||
| } | |||
| } | |||
| return vo; | |||
| return pays; | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceiveBill> getReceiveFeesSum(WxFinanceReceive record) { | |||
| initQueryParam(record); | |||
| if (null == record.getType()) { | |||
| record.setType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| } | |||
| List<WxFinanceReceiveBill> pays = null; | |||
| if (record.getType() == EnumFinanceCashierType.RECEIVE.getCode()) { | |||
| pays = wxFinanceReceiveMapper.getReceiveFeesReceiveSum(record); | |||
| }else { | |||
| pays = wxFinanceReceiveMapper.getReceiveFeesPaySum(record); | |||
| } | |||
| if (null != pays) { | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| Map<Long, WxEnergyFees> feesMap = wxEnergyService.getFeesMap(fq); | |||
| for (int i = 0 ; i < pays.size() ; i ++) { | |||
| WxFinanceReceiveBill rpw = pays.get(i); | |||
| if (null != feesMap && null != rpw.getFeesId()) { | |||
| WxEnergyFees pw = feesMap.get(rpw.getFeesId()); | |||
| if (null != pw) { | |||
| rpw.setFeesName(pw.getName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return pays; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @@ -111,18 +111,50 @@ | |||
| from wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <resultMap id="PayWaySumResultMap" type="com.iformall.domain.po.WxFinanceReceivePayway"> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="receive" jdbcType="VARCHAR" property="receive"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| </resultMap> | |||
| <select id="getReceivePayWaySum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="PayWaySumResultMap"> | |||
| <select id="getReceivePayWayReceiveSum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="PayWaySumResultMap"> | |||
| select pay_way, sum(CAST(ifnull(receive,'0') AS DECIMAL(20,2))) receive | |||
| from wx_finance_receive_payway where is_del = 0 and receive_id in ( | |||
| select id from wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| ) | |||
| group by pay_way | |||
| </select> | |||
| </select> | |||
| <select id="getReceivePayWayPaySum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="PayWaySumResultMap"> | |||
| select pay_way, sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) pay | |||
| from wx_finance_receive_payway where is_del = 0 and receive_id in ( | |||
| select id from wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| ) | |||
| group by pay_way | |||
| </select> | |||
| <resultMap id="feesSumReceiveResultMap" type="com.iformall.domain.po.WxFinanceReceiveBill"> | |||
| <result column="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| <result column="receive" jdbcType="VARCHAR" property="receive"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| </resultMap> | |||
| <select id="getReceiveFeesReceiveSum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="feesSumReceiveResultMap"> | |||
| select fees_id, sum(CAST(ifnull(receive,'0') AS DECIMAL(20,2))) receive | |||
| from wx_finance_receive_bill where is_del = 0 and receive_id in ( | |||
| select id from wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| ) | |||
| group by fees_id | |||
| </select> | |||
| <select id="getReceiveFeesPaySum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="feesSumReceiveResultMap"> | |||
| select fees_id, sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) pay | |||
| from wx_finance_receive_bill where is_del = 0 and receive_id in ( | |||
| select id from wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| ) | |||
| group by fees_id | |||
| </select> | |||
| <update id="finish" parameterType="com.iformall.domain.po.WxFinanceReceive"> | |||
| update wx_finance_receive set is_finish = 1 | |||