| @@ -39,6 +39,9 @@ public class WxFinanceReceive extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付时间",name="receiveDate") | |||
| private Date receiveDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="科目ID,预收的时候有",name="feesId") | |||
| private Long feesId; | |||
| @TableField(exist = false) | |||
| @@ -494,4 +494,6 @@ public class WxMerchant extends TenantEntity { | |||
| public String feesIdListStr; | |||
| @TableField(exist = false) | |||
| public Integer advanceHasMoney; | |||
| @TableField(exist = false) | |||
| public Date receiveDate; | |||
| } | |||
| @@ -104,6 +104,7 @@ public class WxBillAllHelper { | |||
| bill.setNeedPayNoDays(wxMerchant.getNeedPayNoDays()); | |||
| bill.setEnergyFeesIds(wxMerchant.getEnergyFeesIdList()); | |||
| bill.setAdvanceHasMoney(wxMerchant.getAdvanceHasMoney()); | |||
| bill.setReceiveDate(wxMerchant.getReceiveDate()); | |||
| } | |||
| public WxBillSum getBillSum(WxMerchant wxMerchant,Date starttime, Date enttime) { | |||
| @@ -433,11 +433,20 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| pageVo.setPages(page.getPages()); | |||
| pageVo.setTotal(page.getTotal()); | |||
| if (null != page && null != page.getList()) { | |||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < page.getList().size() ; i++) { | |||
| WxFinanceReceive fr = page.getList().get(i); | |||
| if (null != fr.getMerchantId()) { | |||
| merchantIdList.add(fr.getMerchantId()); | |||
| } | |||
| } | |||
| WxMerchant mq = new WxMerchant(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(merchantIdList); | |||
| Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(mq); | |||
| Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, null, null); | |||
| Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, merchantIdList, null); | |||
| WxBillPayWay pq = new WxBillPayWay(); | |||
| pq.updateTenantInfo(record); | |||
| @@ -523,11 +532,20 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| initReceiveBillQueryParam(record); | |||
| PageInfo<WxFinanceReceiveBill> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceReceiveBillMapper.findList(record)); | |||
| if (null != page && null != page.getList()) { | |||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < page.getList().size() ; i++) { | |||
| WxFinanceReceiveBill fr = page.getList().get(i); | |||
| if (null != fr.getMerchantId()) { | |||
| merchantIdList.add(fr.getMerchantId()); | |||
| } | |||
| } | |||
| WxMerchant mq = new WxMerchant(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(merchantIdList); | |||
| Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(mq); | |||
| Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, null, null); | |||
| Map<Long,String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, merchantIdList, null); | |||
| WxBillPayWay pq = new WxBillPayWay(); | |||
| pq.updateTenantInfo(record); | |||
| @@ -694,7 +712,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| sortBills(bills); | |||
| //创建主收款单 | |||
| WxFinanceReceive addreceive = generateReceive(receiveId,user, EnumFinanceCashierType.RECEIVE,receiveTotal.toPlainString(),null, record.getMerchantId(), null, record.getRemark()); | |||
| WxFinanceReceive addreceive = generateReceive(receiveId,user, EnumFinanceCashierType.RECEIVE,receiveTotal.toPlainString(),null, record.getMerchantId(), null, record.getRemark(),record.getReceiveDate()); | |||
| if (receiveTotal.compareTo(new BigDecimal(0)) > 0) { | |||
| addreceive.setMoneyDetail(moneyDetail.toString()); | |||
| wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | |||
| @@ -855,7 +873,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return noNeedCreate; | |||
| } | |||
| public WxFinanceReceive generateReceive(Long receiveId,MallUserInfo user,EnumFinanceCashierType cashierType,String receiveMoney,String payMoney,Long merchantId,Long feesId,String remark) { | |||
| public WxFinanceReceive generateReceive(Long receiveId,MallUserInfo user,EnumFinanceCashierType cashierType,String receiveMoney,String payMoney,Long merchantId,Long feesId,String remark,Date receiveDate) { | |||
| WxFinanceReceive addreceive = new WxFinanceReceive(); | |||
| addreceive.setId(receiveId); | |||
| addreceive.updateTenantInfo(user); | |||
| @@ -875,6 +893,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| addreceive.setUpdateByName(user.getName()); | |||
| addreceive.setRemark(remark); | |||
| addreceive.setFeesId(feesId); | |||
| addreceive.setReceiveDate(receiveDate); | |||
| return addreceive; | |||
| } | |||
| @@ -961,7 +980,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| List<WxAllBill> bills = record.getBills(); | |||
| sortBills(bills); | |||
| //创建主收款单 | |||
| WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY , "0",payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark()); | |||
| WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY , "0",payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark(),record.getReceiveDate()); | |||
| if (payTotal.compareTo(new BigDecimal(0)) > 0) { | |||
| addreceive.setMoneyDetail(moneyDetail.toString()); | |||
| wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | |||
| @@ -1084,11 +1103,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| record.setBillType(fees.getBillType()); | |||
| WxMerchant merchant = wxMerchantService.selectById(record.getMerchantId()); | |||
| if (fees.getBillType().intValue() == EnumBillAllType.ADVANCE.getCode().intValue()) { | |||
| generateTempBill(record, merchant, user,EnumBillAllType.ADVANCE,record.getReceivePay(),"0"); | |||
| generateTempBill(record, merchant, user,EnumBillAllType.ADVANCE,record.getReceivePay(),"0",record.getReceiveDate()); | |||
| }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER_DEPOSIT.getCode().intValue()) { | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER_DEPOSIT,record.getReceivePay(),"0"); | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER_DEPOSIT,record.getReceivePay(),"0",record.getReceiveDate()); | |||
| }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER.getCode().intValue()) { | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER,record.getReceivePay(),"0"); | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER,record.getReceivePay(),"0",record.getReceiveDate()); | |||
| } | |||
| } | |||
| @@ -1097,10 +1116,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| WxEnergyFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; | |||
| record.setBillType(fees.getBillType()); | |||
| WxMerchant merchant = wxMerchantService.selectById(record.getMerchantId()); | |||
| generateTempBill(record, merchant, user,EnumBillAllType.TEMP_TO_PAYMERCHANT,"0",record.getReceivePay()); | |||
| generateTempBill(record, merchant, user,EnumBillAllType.TEMP_TO_PAYMERCHANT,"0",record.getReceivePay(),record.getReceiveDate()); | |||
| } | |||
| public void generateTempBill(WxAllBill record,WxMerchant merchant,MallUserInfo user, EnumBillAllType billType,String receivePay,String pay) { | |||
| public void generateTempBill(WxAllBill record,WxMerchant merchant,MallUserInfo user, EnumBillAllType billType,String receivePay,String pay,Date receiveDate) { | |||
| WxAllBill advanceBill = new WxAllBill(); | |||
| advanceBill.updateTenantInfo(record); | |||
| advanceBill.setMerchantId(merchant.getId()); | |||
| @@ -1111,9 +1130,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| advanceBill.setUseMoney("0"); | |||
| advanceBill.setBillType(billType.getCode()); | |||
| //advanceBill.setPayWay(); | |||
| advanceBill.setPayDate(new Date()); | |||
| advanceBill.setStarttime(record.getStarttime()); | |||
| advanceBill.setEndtime(record.getEndtime()); | |||
| advanceBill.setPayDate(receiveDate); | |||
| advanceBill.setStarttime(DateUtils.getDayBegin(receiveDate)); | |||
| advanceBill.setEndtime(DateUtils.getDayEnd(receiveDate)); | |||
| advanceBill.setReceiveDate(advanceBill.getStarttime()); | |||
| //advanceBill.setStatus(billStatus.getCode()); | |||
| advanceBill.setEnergyFeesId(record.getEnergyFeesId()); | |||
| advanceBill.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| @@ -174,7 +174,23 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| Map<Long,WxRentContract> merchantRentMap = new HashMap<Long,WxRentContract>(); | |||
| initQueryParam(record,false, merchantRentMap); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| PageInfo<WxMerchant> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| if (null != page && null != page.getList()){ | |||
| List<Long> merchantIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| WxMerchant m = page.getList().get(i); | |||
| merchantIds.add(m.getId()); | |||
| } | |||
| Map<Long, String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, merchantIds, null); | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| WxMerchant m = page.getList().get(i); | |||
| if (null != shopNumberMap) { | |||
| String sn = shopNumberMap.get(m.getId()); | |||
| m.setShopNumber(sn); | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| @Override | |||
| @@ -1360,7 +1376,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| initQueryParam(record,hasRentContractInfo, merchantRentMap); | |||
| PageInfo<WxMerchant> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| if (null != pageInfo && null != pageInfo.getList()) { | |||
| Map<Long, String> merchantShopNumber = wxShopService.getMerchantShopNumberMap(record, null, record.getIsDel()); | |||
| List<Long> merchantIds = new ArrayList<Long>(); | |||
| for (WxMerchant merchant : pageInfo.getList()) { | |||
| merchantIds.add(merchant.getId()); | |||
| } | |||
| Map<Long, String> merchantShopNumber = wxShopService.getMerchantShopNumberMap(record, merchantIds, record.getIsDel()); | |||
| for (WxMerchant merchant : pageInfo.getList()) { | |||
| if (hasRentContractInfo) { | |||
| WxRentContract contract = merchantRentMap.get(merchant.getId()); | |||
| @@ -1373,34 +1393,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| String shopNumber = merchantShopNumber.get(merchant.getId()); | |||
| merchant.setShopNumber(shopNumber); | |||
| } | |||
| // if (record.getRentShopType() != null) { | |||
| // List<Map<String, Object>> shops = new ArrayList<>(); | |||
| // WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| // wxMerchantShop.setMerchantId(merchant.getId()); | |||
| // wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| // List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| // for (WxMerchantShop merchantShop : wxMerchantShopList) { | |||
| // WxShop shop = new WxShop(); | |||
| // shop.setId(merchantShop.getShopId()); | |||
| // shop.updateTenantInfo(merchant); | |||
| // PageInfo<Map<String, Object>> shopPageInfo = wxShopService.findListMap(shop,1,10000); | |||
| // List<Map<String, Object>> shoplist = shopPageInfo.getList(); | |||
| // if (shoplist.size() > 0) { | |||
| // shops.add(shoplist.get(0)); | |||
| // } | |||
| // } | |||
| // merchant.setShoplist(shops); | |||
| // } | |||
| // | |||
| // WxRentContract rc = new WxRentContract(); | |||
| // rc.setMerchantId(merchant.getId()); | |||
| // rc.setTenantId(merchant.getTenantId()); | |||
| // List<WxRentContract> rentContractList = wxRentContractMapper.findList(rc); | |||
| // if(CollectionUtils.isEmpty(rentContractList)){ | |||
| // merchant.setHasContract(EnumHasContract.NO.getCode()); | |||
| // }else{ | |||
| // merchant.setHasContract(EnumHasContract.HAS.getCode()); | |||
| // } | |||
| } | |||
| } | |||
| return pageInfo; | |||
| @@ -74,6 +74,7 @@ | |||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | |||
| <if test=" null != starttime">and `starttime` >= #{starttime}</if> | |||
| <if test=" null != endtime">and `endtime` <= #{endtime}</if> | |||
| <if test=" null != receiveDate">and `receive_date` <= #{receiveDate}</if> | |||
| <if test=" null != starttimeEqual">and `starttime` = #{starttimeEqual}</if> | |||
| <if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if> | |||
| <if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if> | |||
| @@ -85,23 +86,23 @@ | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and ( | |||
| (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| (`receive_date` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| (`receive_date` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and ( | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| (`receive_date` > #{oweBillLastTime} and `receive_date` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| (`receive_date` > #{oweBillLastTime} and `receive_date` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and ( | |||
| (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| (`receive_date` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| (`receive_date` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != needPayNoDays"> | |||
| @@ -7,6 +7,7 @@ | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="receive_money" jdbcType="VARCHAR" property="receiveMoney"/> | |||
| <result column="pay_money" jdbcType="VARCHAR" property="payMoney"/> | |||
| <result column="set_off_money" jdbcType="VARCHAR" property="setOffMoney"/> | |||
| @@ -26,7 +27,7 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_money`,`pay_money`,`set_off_money`,`status`,`type`, | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_date`,`receive_money`,`pay_money`,`set_off_money`,`status`,`type`, | |||
| `money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`, | |||
| `fees_id`,`is_print`,`is_finish` | |||
| </sql> | |||