| @@ -24,6 +24,7 @@ import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | |||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxEnergyService; | |||
| @@ -527,7 +528,7 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @ApiOperation("科目新增") | |||
| @PostMapping("saveFees") | |||
| public ResultData saveFees(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| @@ -545,6 +546,18 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("临时付款给商户科目新增") | |||
| @PostMapping("saveToPayMerchantFees") | |||
| public ResultData saveToPayMerchantFees(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setBillType(EnumBillAllType.TEMP_TO_PAYMERCHANT.getCode()); | |||
| record.setCashierType(EnumFinanceCashierType.PAY.getCode()); | |||
| record.setFixedPrice(EnumYesOrNo.YES.getCode()); | |||
| record.setIsDespoit(EnumYesOrNo.YES.getCode()); | |||
| wxEnergyService.saveOrUpdateFees(record); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("feesUpdateIsDel") | |||
| public ResultData feesUpdateIsDel(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| @@ -133,6 +133,7 @@ public class WxFinanceController extends BaseController { | |||
| billTypeList.add(EnumBillAllType.RENT_DEPOSIT.getCode()); | |||
| billTypeList.add(EnumBillAllType.PROPERTY.getCode()); | |||
| record.setBillTypeList(billTypeList); | |||
| record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -151,6 +152,7 @@ public class WxFinanceController extends BaseController { | |||
| billTypeList.add(EnumBillAllType.OTHER.getCode()); | |||
| billTypeList.add(EnumBillAllType.OTHER_DEPOSIT.getCode()); | |||
| record.setBillTypeList(billTypeList); | |||
| record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -165,6 +167,22 @@ public class WxFinanceController extends BaseController { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| record.setBillType(EnumBillAllType.ADVANCE.getCode()); | |||
| record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("临时付款科目列表") | |||
| @GetMapping("toPayMerchantFeesList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData toPayMerchantFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| record.setBillType(EnumBillAllType.TEMP_TO_PAYMERCHANT.getCode()); | |||
| record.setCashierType(EnumFinanceCashierType.PAY.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -307,6 +325,13 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getMerchantId()) { | |||
| return new ResultData(Result.ERROR,"请选择商户"); | |||
| } | |||
| wxFinanceService.createTempToPay(record,this.getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("deleteTemp") | |||
| public ResultData deleteTemp(@RequestBody WxAllBill record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxFinanceService.createTempFees(record,this.getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -280,6 +280,9 @@ public class WxAllBill extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "计费面积", name = "rentArea") | |||
| private String rentArea; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否可以编辑", name = "canEdit") | |||
| private Integer canEdit; | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座号",name="building") | |||
| @TableField(exist = false) | |||
| public Long building; | |||
| @@ -52,6 +52,9 @@ public class WxEnergyFees extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "isDel", name = "isDel") | |||
| private Integer isDel; | |||
| @io.swagger.annotations.ApiModelProperty(value = "收款还是付款EnumFinanceCashierType", name = "cashierType") | |||
| private Integer cashierType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "单价", name = "price") | |||
| private String price; | |||
| @@ -14,7 +14,8 @@ public enum EnumBillAllType { | |||
| DAILY(3, "能耗(水电空调)费",null,false,false), | |||
| OTHER(4, "临时费用",null,false,false), | |||
| OTHER_DEPOSIT(5, "临时押金",null,true,true), | |||
| ADVANCE(6,"预收",null,true,false)//没有形成真正的账单 | |||
| ADVANCE(6,"预收",null,true,false), | |||
| TEMP_TO_PAYMERCHANT(7,"临时付款给商户",null,false,false) | |||
| ; | |||
| public static EnumBillAllType getEnum(Integer code) { | |||
| @@ -6,8 +6,8 @@ package com.iformall.enums; | |||
| public enum EnumFinanceCashierType { | |||
| RECEIVE(1,"收款单"), | |||
| PAY(2,"付款单") | |||
| RECEIVE(1,"收款"), | |||
| PAY(2,"付款") | |||
| ; | |||
| public static EnumFinanceCashierType getEnum(Integer code) { | |||
| @@ -81,4 +81,6 @@ public interface WxAllBillService { | |||
| void deleteEnergyReadingBills(WxAllBill wxBillDaily); | |||
| void deleteById(Long id,TenantEntity tenantEntity); | |||
| } | |||
| @@ -51,6 +51,7 @@ public interface WxFinanceService { | |||
| //增加临时费用 | |||
| void createTempFees(WxAllBill record,MallUserInfo user); | |||
| void createTempToPay(WxAllBill record,MallUserInfo user); | |||
| void delteTemp(WxAllBill record); | |||
| //结账 | |||
| PageInfo<WxFinanceFinish> finishListAsPage(WxFinanceFinish record, Integer pageIndex, Integer pageSize); | |||
| @@ -858,6 +858,11 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||
| public void deleteEnergyReadingBills(WxAllBill wxBillDaily) { | |||
| wxAllBillMapper.deleteEnergyReadingBills(wxBillDaily.getEnergyReadingCalcuteId(), wxBillDaily.getTenantId()); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id, TenantEntity tenantEntity) { | |||
| wxAllBillMapper.deleteById(id, tenantEntity.getTenantId()); | |||
| } | |||
| } | |||
| @@ -17,6 +17,7 @@ import com.iformall.domain.vo.WxMerchantBillVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -505,6 +506,9 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public PageInfo<WxEnergyFees> feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize,boolean isSetOff) { | |||
| if (null == record.getCashierType()) { | |||
| record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); | |||
| } | |||
| PageInfo<WxEnergyFees> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesMapper.findList(record)); | |||
| //如果是预充费用,还需要查询可冲抵科目 | |||
| if (isSetOff) { | |||
| @@ -1097,11 +1097,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| WxEnergyFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; | |||
| record.setBillType(fees.getBillType()); | |||
| WxMerchant merchant = wxMerchantService.selectById(record.getMerchantId()); | |||
| if (fees.getBillType().intValue() == EnumBillAllType.OTHER_DEPOSIT.getCode().intValue()) { | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER_DEPOSIT,"0",record.getReceivePay()); | |||
| }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER.getCode().intValue()) { | |||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER,"0",record.getReceivePay()); | |||
| } | |||
| generateTempBill(record, merchant, user,EnumBillAllType.TEMP_TO_PAYMERCHANT,"0",record.getReceivePay()); | |||
| } | |||
| public void generateTempBill(WxAllBill record,WxMerchant merchant,MallUserInfo user, EnumBillAllType billType,String receivePay,String pay) { | |||
| @@ -1122,9 +1118,20 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| advanceBill.setEnergyFeesId(record.getEnergyFeesId()); | |||
| advanceBill.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| advanceBill.setBillRemark(record.getBillRemark()); | |||
| advanceBill.setCanEdit(EnumYesOrNo.YES.getCode()); | |||
| wxBillAllHelper.saveOrUpdateBill(advanceBill, user); | |||
| } | |||
| @Override | |||
| public void delteTemp(WxAllBill record) { | |||
| WxAllBill bill = wxAllBillService.getById(record,record.getId()); | |||
| if (bill.getCanEdit() == EnumYesOrNo.YES.getCode()) { | |||
| wxAllBillService.deleteById(record.getId(), record); | |||
| }else { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"该账单不允许删除"); | |||
| } | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user,String remark) { | |||
| @@ -45,13 +45,15 @@ | |||
| <result column="energy_reading_id" jdbcType="BIGINT" property="energyReadingId" /> | |||
| <result column="extra_create_from" jdbcType="INTEGER" property="extraCreateFrom" /> | |||
| <result column="rent_area" jdbcType="VARCHAR" property="rentArea" /> | |||
| <result column="can_edit" jdbcType="INTEGER" property="canEdit" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, | |||
| `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`, | |||
| `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`,`receive_date`, | |||
| `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area` | |||
| `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`, | |||
| `can_edit` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -77,49 +79,50 @@ | |||
| <if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if> | |||
| <if test=" null != noExtraCreateFrom">and `extra_create_from` is null</if> | |||
| <if test=" null != advanceHasMoney">and bill_type = 6 and IFNULL(`pay`,'0') - IFNULL(`use_money`,'0') > 0</if> | |||
| <if test=" null != canEdit">and `can_edit` = #{canEdit}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | |||
| </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)) | |||
| (`starttime` <= #{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)) | |||
| (`starttime` <= #{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)) | |||
| (`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)) | |||
| or | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5)) | |||
| (`starttime` > #{oweBillLastTime} and `starttime` <= #{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)) | |||
| (`starttime` <= #{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)) | |||
| (`starttime` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != needPayNoDays"> | |||
| and ( | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5)) | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5)) | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != toPayMerchant"> | |||
| and ( | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5)) | |||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| ( `pay` - IFNULL(`return_pay`,'0') > 0 and bill_type in (13,21,5)) | |||
| ( `pay` - IFNULL(`return_pay`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" 1 == notifyed "> | |||
| and ( | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5)) | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) | |||
| or | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5)) | |||
| (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) | |||
| ) | |||
| </if> | |||
| <if test=" null != hasMerchant ">and `merchant_id` is not null</if> | |||
| @@ -358,6 +361,7 @@ | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId} | |||
| and pay <= 0 and IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 and IFNULL(`use_money`,'0') <= 0 | |||
| </delete> | |||
| <delete id = "deleteEnergyReadingBills" parameterType="HashMap"> | |||
| @@ -10,6 +10,7 @@ | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="cashier_type" jdbcType="INTEGER" property="cashierType"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="is_system" jdbcType="INTEGER" property="isSystem"/> | |||
| @@ -22,7 +23,7 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`type`,`bill_type`,`is_system`, | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`cashier_type`,`type`,`bill_type`,`is_system`, | |||
| `fixed_price`,`calcute_unit`,`time_unit`,`tax_rate`,`is_despoit`,`is_public` | |||
| </sql> | |||
| @@ -36,6 +37,7 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != cashierType ">and `cashier_type` = #{cashierType}</if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != billType ">and `bill_type` = #{billType}</if> | |||
| <if test=" null != notSetOff ">and `bill_type` != 6</if> | |||