| @@ -14,6 +14,7 @@ import com.iformall.domain.po.WxBillPayWay; | |||
| 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.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| @@ -317,6 +318,19 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("收款记录子账单列表") | |||
| @GetMapping("receiveBillList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData receiveBillList(@ModelAttribute WxFinanceReceiveBill record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxFinanceReceiveBill> page = wxFinanceService.receiveBillListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("收款记录列表(收款列表页面,有子账单)") | |||
| @GetMapping("receiveList") | |||
| @ApiImplicitParams({ | |||
| @@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_finance_receive_bill") | |||
| @@ -26,6 +28,10 @@ public class WxFinanceReceiveBill extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||
| private Date createTime; | |||
| @TableField(exist = false) | |||
| private Date createTimeBegin; | |||
| @TableField(exist = false) | |||
| private Date createTimeEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @@ -54,6 +60,17 @@ public class WxFinanceReceiveBill extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String payWayName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceCashierType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| private String typeName; | |||
| public String getTypeName() { | |||
| if (null != type) { | |||
| return EnumFinanceCashierType.getEnum(type).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="receive") | |||
| private String receive; | |||
| @@ -89,8 +106,24 @@ public class WxFinanceReceiveBill extends TenantEntity { | |||
| return setOff; | |||
| } | |||
| @TableField(exist = false) | |||
| private String payWayStr; | |||
| @TableField(exist = false) | |||
| private String feesIdStr; | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| @TableField(exist = false) | |||
| private Long building; | |||
| @TableField(exist = false) | |||
| private Long floor; | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @TableField(exist = false) | |||
| private List<Long> payWayList; | |||
| @TableField(exist = false) | |||
| private List<Long> feesIdList; | |||
| @TableField(exist = false) | |||
| private Integer noReduce; | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIdList; | |||
| } | |||
| @@ -33,6 +33,7 @@ public interface WxFinanceService { | |||
| //收付款 | |||
| PageInfo<WxFinanceReceiveVo> receiveVoListWithBillsAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxFinanceReceiveBill> receiveBillListAsPage(WxFinanceReceiveBill record, Integer pageIndex, Integer pageSize); | |||
| List<WxFinanceReceive> findReceiveList(WxFinanceReceive record); | |||
| Map createReceive(WxFinanceReceive record,MallUserInfo user); | |||
| Map createPay(WxFinanceReceive record,MallUserInfo user); | |||
| @@ -55,6 +55,8 @@ import com.iformall.service.WxShopService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.StringContentUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -516,6 +518,114 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return receiveVoListAsPage(record, pageIndex, pageSize, false); | |||
| } | |||
| @Override | |||
| public PageInfo<WxFinanceReceiveBill> receiveBillListAsPage(WxFinanceReceiveBill record, Integer pageIndex, Integer pageSize) { | |||
| initReceiveBillQueryParam(record); | |||
| PageInfo<WxFinanceReceiveBill> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceReceiveBillMapper.findList(record)); | |||
| if (null != page && null != page.getList()) { | |||
| WxMerchant mq = new WxMerchant(); | |||
| mq.updateTenantInfo(record); | |||
| Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(mq); | |||
| Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, null, null); | |||
| WxBillPayWay pq = new WxBillPayWay(); | |||
| pq.updateTenantInfo(record); | |||
| Map<Long, WxBillPayWay> paywayMap = this.getPayWayMap(pq); | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| Map<Long, WxEnergyFees> fmap = wxEnergyService.getFeesMap(fq); | |||
| for (int i = 0 ; i < page.getList().size() ; i++) { | |||
| WxFinanceReceiveBill fr = page.getList().get(i); | |||
| if (null != merchantMap && null != fr.getMerchantId()) { | |||
| WxMerchant merchant = merchantMap.get(fr.getMerchantId()); | |||
| if (null != merchant) { | |||
| fr.setMerchantName(merchant.getName()); | |||
| } | |||
| String shopNumber = shopNumberMap.get(fr.getMerchantId()); | |||
| fr.setShopNumber(shopNumber); | |||
| } | |||
| if (null != paywayMap && null != fr.getPayWay()) { | |||
| WxBillPayWay p = paywayMap.get(fr.getPayWay()); | |||
| if (null != p) { | |||
| fr.setPayWayName(p.getName()); | |||
| } | |||
| } | |||
| if (null != fmap && null != fr.getFeesId()) { | |||
| WxEnergyFees ef = fmap.get(fr.getFeesId()); | |||
| if (null != ef) { | |||
| fr.setFeesName(ef.getName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| private void initReceiveBillQueryParam(WxFinanceReceiveBill record) { | |||
| if (StringUtils.isNotBlank(record.getMerchantName()) || StringUtils.isNotBlank(record.getShopNumber())) { | |||
| record.setMerchantName(StringContentUtils.unescapeHtml(record.getMerchantName())); | |||
| record.setShopNumber(StringContentUtils.unescapeHtml(record.getMerchantName())); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getPayWayStr())) { | |||
| String[] payways = record.getPayWayStr().split(","); | |||
| if (null != payways && payways.length > 0 ) { | |||
| List<Long> paywayList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < payways.length ; i ++) { | |||
| paywayList.add(Long.parseLong(payways[i])); | |||
| } | |||
| record.setPayWayList(paywayList); | |||
| } | |||
| } | |||
| if (StringUtils.isNotBlank(record.getFeesIdStr())) { | |||
| String[] feesIdss = record.getFeesIdStr().split(","); | |||
| if (null != feesIdss && feesIdss.length > 0 ) { | |||
| List<Long> feesIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < feesIdss.length ; i ++) { | |||
| feesIdList.add(Long.parseLong(feesIdss[i])); | |||
| } | |||
| record.setFeesIdList(feesIdList); | |||
| } | |||
| } | |||
| List<Long> queryMerchantIds = new ArrayList<Long>(); | |||
| if (StringUtils.isNotBlank(record.getShopNumber()) | |||
| || null != record.getBuilding() || null != record.getFloor()) { | |||
| //根据店铺去找到商户 | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| sq.setShopNumber(record.getShopNumber()); | |||
| sq.setBuilding(record.getBuilding()); | |||
| sq.setFloor(record.getFloor()); | |||
| List<Long> merchantIds = wxShopService.getMerchantIds(sq); | |||
| if (null == merchantIds || merchantIds.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| queryMerchantIds.addAll(merchantIds); | |||
| } | |||
| } | |||
| if (StringUtils.isNotBlank(record.getMerchantName())) { | |||
| WxMerchant mq = new WxMerchant(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setName(record.getMerchantName()); | |||
| List<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null == mids || mids.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| if (queryMerchantIds.size() > 0 ) { | |||
| queryMerchantIds.retainAll(mids); | |||
| }else { | |||
| queryMerchantIds.addAll(mids); | |||
| } | |||
| } | |||
| } | |||
| if (queryMerchantIds.size() > 0 ) { | |||
| record.setMerchantIdList(queryMerchantIds); | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceive> findReceiveList(WxFinanceReceive record) { | |||
| initQueryParam(record); | |||
| @@ -18,11 +18,12 @@ | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_type`,`fees_id`, | |||
| `pay_way`,`receive_id`,`receive`,`pay`,`merchant_id`,`starttime`,`endtime`,`is_del` | |||
| `pay_way`,`receive_id`,`receive`,`pay`,`merchant_id`,`starttime`,`endtime`,`is_del`,`type` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -41,6 +42,30 @@ | |||
| <if test=" null != receiveId ">and `receive_id` = #{receiveId}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if> | |||
| <if test=" null != createTimeEnd ">and `create_time` <= #{createTimeEnd}</if> | |||
| <if test=" null != starttime ">and `starttime` >= #{starttime}</if> | |||
| <if test=" null != endtime ">and `endtime` <= #{endtime}</if> | |||
| <if test=" 1 == noReduce ">and `pay_way` != 4 </if> | |||
| <if test=" null != type ">and type = #{type} </if> | |||
| <if test=" null != merchantIdList "> | |||
| and merchant_id in | |||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != feesIdList "> | |||
| and fees_id in | |||
| <foreach collection="feesIdList" index="index" item="fidItem" open="(" separator="," close=")"> | |||
| #{fidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != payWayList "> | |||
| and pay_way in | |||
| <foreach collection="payWayList" index="index" item="paidItem" open="(" separator="," close=")"> | |||
| #{paidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||