| @@ -6,6 +6,7 @@ import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | |||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.*; | |||
| @@ -62,6 +63,21 @@ public class WxRentContractDepositTypeController extends WxContractBaseControlle | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("查询物业合同时间单位列表") | |||
| @GetMapping("typeTimeUnitList") | |||
| public ResultData typeTimeUnitList() { | |||
| List<EnumFeesStandardsTimeUnit> enumList = EnumBillAllType.getTimeUnites(EnumBillAllType.RENT_DEPOSIT.getCode()); | |||
| if (null != enumList) { | |||
| Map<Integer,String> retMap = new HashMap<Integer,String>(); | |||
| for (int i = 0 ; i < enumList.size(); i++) { | |||
| EnumFeesStandardsTimeUnit cu = enumList.get(i); | |||
| retMap.put(cu.getCode(), cu.getMessage()); | |||
| } | |||
| return new ResultData(retMap); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -5,8 +5,10 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.FinanceSetOffDTO; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxBillPayWay; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| @@ -17,6 +19,7 @@ import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| @@ -24,6 +27,7 @@ import com.iformall.enums.EnumFinanceFinishStatus; | |||
| import com.iformall.enums.EnumFinanceReceiveStatus; | |||
| import com.iformall.enums.EnumFinanceReceiveType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFinanceService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -57,6 +61,8 @@ public class WxFinanceController extends BaseController { | |||
| private WxFinanceService wxFinanceService; | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| /** | |||
| * 账单类型(非能源) | |||
| @@ -302,7 +308,7 @@ public class WxFinanceController extends BaseController { | |||
| @PostMapping("receiveRedSet") | |||
| public ResultData receiveRedSet(@RequestBody WxFinanceReceive record) { | |||
| WxFinanceReceive receive = wxFinanceService.getReceiveById(this.getTenantInfo(), record.getId()); | |||
| if (receive.getStatus().intValue() != EnumFinanceReceiveStatus.FINISH.getCode().intValue()) { | |||
| if (receive.getIsFinish().intValue() == EnumYesOrNo.NO.getCode().intValue()) { | |||
| return new ResultData(Result.ERROR,"该状态不允许操作"); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getRemark())) { | |||
| @@ -356,7 +362,7 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("过账列表") | |||
| @ApiOperation("结账列表") | |||
| @GetMapping("finishList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -369,7 +375,15 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("过账列表") | |||
| @ApiOperation("结账") | |||
| @PostMapping("saveFinish") | |||
| public ResultData saveFinish(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxFinanceService.saveOrUpdateFinish(record, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("结账列表") | |||
| @GetMapping("finishReceiveList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -380,17 +394,70 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| WxFinanceFinish finish = wxFinanceService.getFinishById(record, record.getFinishId()); | |||
| record.setCreateTimeBegin(finish.getStartDate()); | |||
| record.setCreateTimeEnd(finish.getEndDate()); | |||
| record.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| record.setSortColumns("status asc,create_time asc"); | |||
| PageInfo<WxFinanceReceiveVo> page = wxFinanceService.receiveVoListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("过账") | |||
| @ApiOperation("结账列表") | |||
| @GetMapping("finishReceiveSum") | |||
| public ResultData finishReceiveSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxFinanceFinish finish = wxFinanceService.getFinishById(record, record.getFinishId()); | |||
| record.setCreateTimeBegin(finish.getStartDate()); | |||
| record.setCreateTimeEnd(finish.getEndDate()); | |||
| record.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| WxFinanceReceiveSumVo page = wxFinanceService.getReceiveSum(record); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("结账") | |||
| @PostMapping("receiveFinish") | |||
| public ResultData receiveFinish(@RequestBody WxFinanceReceive record) { | |||
| public ResultData receiveFinish(@RequestBody WxFinanceFinish record) { | |||
| if (null == record.getId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxFinanceService.finishReceive(record, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("批次结账") | |||
| @PostMapping("batchReceiveFinish") | |||
| public ResultData batchReceiveFinish(@RequestBody WxFinanceFinish record) { | |||
| if (null == record.getId() || null == record.getReceiveIds() || record.getReceiveIds().size() <= 0 ) { | |||
| return new ResultData(Result.ERROR,"请选择"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxFinanceFinish finish = wxFinanceService.getFinishById(record, record.getId()); | |||
| WxFinanceReceive rq = new WxFinanceReceive(); | |||
| rq.setCreateTimeBegin(finish.getStartDate()); | |||
| rq.setCreateTimeEnd(finish.getEndDate()); | |||
| rq.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| rq.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| rq.updateTenantInfo(record); | |||
| Integer count = wxFinanceService.getReceiveUnFinisedCount(rq); | |||
| boolean isAll = false; | |||
| if (null != count && count > record.getReceiveIds().size()) { | |||
| }else { | |||
| isAll = true; | |||
| } | |||
| wxFinanceService.batchFinishReceive(record, getUser(),isAll); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("截止时间") | |||
| @GetMapping("getReceiveEndTime") | |||
| public ResultData getReceiveEndTime() { | |||
| SysConfig config = sysConfigService.getByKey(SysConfigConstant.finance_receive_end_date, getTenantInfo()); | |||
| return new ResultData(config.getConfigItemValue()); | |||
| } | |||
| } | |||
| @@ -798,3 +798,105 @@ CREATE TABLE `wx_finance_print_template` ( | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; | |||
| alter table wx_finance_receive_0 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_1 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_2 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_3 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_4 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_5 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_6 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_7 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_8 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_9 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_10 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_11 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_12 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_13 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_14 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_15 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_16 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_17 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_18 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_19 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_20 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_21 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_22 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_23 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_24 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_25 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_26 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_27 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_28 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_29 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_30 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_31 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_32 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_33 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_34 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_35 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_36 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_37 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_38 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_39 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_40 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_41 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_42 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_43 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_44 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_45 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_46 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_47 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_48 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_49 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_50 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_51 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_52 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_53 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_54 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_55 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_56 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_57 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_58 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_59 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_60 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_61 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_62 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_63 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_64 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_65 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_66 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_67 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_68 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_69 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_70 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_71 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_72 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_73 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_74 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_75 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_76 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_77 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_78 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_79 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_80 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_81 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_82 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_83 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_84 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_85 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_86 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_87 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_88 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_89 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_90 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_91 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_92 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_93 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_94 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_95 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_96 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_97 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_98 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| alter table wx_finance_receive_99 add column is_finish int(1) not null default 0 comment '是否已经结账完成'; | |||
| @@ -12,4 +12,5 @@ public class SysConfigConstant { | |||
| public static final String merchant_Login_CheckPhone = "merchantLoginCheckPhone"; | |||
| public static final String bill_before_days = "billBeforeDays"; | |||
| public static final String bill_near_days = "billNearDays"; | |||
| public static final String finance_receive_end_date = "financeReceiveEndDate"; | |||
| } | |||
| @@ -72,4 +72,10 @@ public class WxFinanceFinish extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "name", name = "name") | |||
| private String name; | |||
| @TableField(exist = false) | |||
| private List<Long> receiveIds; | |||
| @TableField(exist = false) | |||
| private Date receiveEndTime; | |||
| } | |||
| @@ -69,18 +69,6 @@ public class WxFinanceReceive extends TenantEntity { | |||
| return new BigDecimal(receiveMoney).subtract(new BigDecimal(useMoney)).toPlainString(); | |||
| } | |||
| @TableField(exist = false) | |||
| private String totalMoney; | |||
| public String getTotalMoney() { | |||
| if (StringUtils.isBlank(setOffMoney)) { | |||
| setOffMoney = "0"; | |||
| } | |||
| if (StringUtils.isBlank(receiveMoney)) { | |||
| receiveMoney = "0"; | |||
| } | |||
| return new BigDecimal(receiveMoney).add(new BigDecimal(setOffMoney)).toPlainString(); | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceReceiveStatus", name = "status") | |||
| private Integer status; | |||
| @TableField(exist = false) | |||
| @@ -92,6 +80,9 @@ public class WxFinanceReceive extends TenantEntity { | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否已结账完成", name = "isFinish") | |||
| private Integer isFinish; | |||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceCashierType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| @@ -106,7 +97,7 @@ public class WxFinanceReceive extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceReceiveType", name = "type") | |||
| private Integer receiveType; | |||
| @TableField(exist = false) | |||
| private String receivetypeName; | |||
| private String receiveTypeName; | |||
| public String getReceiveTypeName() { | |||
| if (null != receiveType) { | |||
| return EnumFinanceReceiveType.getEnum(receiveType).getMessage(); | |||
| @@ -33,6 +33,8 @@ public class WxFinanceReceivePayway extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="支付方式",name="payWay") | |||
| private Long payWay; | |||
| @TableField(exist = false) | |||
| private String payWayName; | |||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="receive") | |||
| private String receive; | |||
| @@ -0,0 +1,18 @@ | |||
| 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 { | |||
| private static final long serialVersionUID = 1L; | |||
| String totalReceive; | |||
| String totalSetoff; | |||
| String totalPay; | |||
| List<WxFinanceReceivePayway> payWays; | |||
| } | |||
| @@ -8,7 +8,7 @@ public enum EnumBillAllType { | |||
| RENT(1,"租金",1L,false), | |||
| RENT_BUSSINESS_MANAGE(11,"商业管理费",2L,false), | |||
| RENT_OPERATION_MANAGE(12,"运营管理费",3L,false), | |||
| RENT_DEPOSIT(13,"租赁押金",null,true), | |||
| RENT_DEPOSIT(13,"租赁押金",null,false), | |||
| PROPERTY(2,"物业",5L,false), | |||
| PROPERTY_DEPOSIT(21,"物业押金",6L,true), | |||
| DAILY(3, "能耗(水电空调)费",null,false), | |||
| @@ -10,8 +10,7 @@ public enum EnumFinanceReceiveStatus { | |||
| NORMAL(1,"正常"), | |||
| INVALID(2,"作废"), | |||
| RED_SETOFF(3, "红冲"), | |||
| FINISH(4,"已审核过账") | |||
| RED_SETOFF(3, "红冲") | |||
| ; | |||
| public static EnumFinanceReceiveStatus getEnum(Integer code) { | |||
| @@ -42,7 +41,7 @@ public enum EnumFinanceReceiveStatus { | |||
| public static List<EnumFinanceReceiveStatus> getFinishStatus() { | |||
| List<EnumFinanceReceiveStatus> list = new ArrayList<EnumFinanceReceiveStatus>(); | |||
| list.add(NORMAL); | |||
| list.add(FINISH); | |||
| list.add(RED_SETOFF); | |||
| return list; | |||
| } | |||
| } | |||
| @@ -2,6 +2,9 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceivePayway; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| @@ -18,5 +21,9 @@ public interface WxFinanceReceiveMapper extends CommonMapper<WxFinanceReceive, L | |||
| List<WxFinanceReceive> getMerchantAdvanceGroupSumList(WxFinanceReceive record); | |||
| void finish(WxFinanceReceive wxBillRent); | |||
| WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | |||
| List<WxFinanceReceivePayway> getReceivePayWaySum(WxFinanceReceive record); | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| /** | |||
| */ | |||
| @@ -32,7 +33,6 @@ public interface WxFinanceService { | |||
| WxFinanceReceive getReceiveById(TenantEntity tenantEntity,Long id); | |||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user,String remark); | |||
| void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); | |||
| void finishReceive(WxFinanceReceive record,MallUserInfo user); | |||
| //预收款 | |||
| List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | |||
| FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); | |||
| @@ -42,4 +42,10 @@ public interface WxFinanceService { | |||
| //结账 | |||
| PageInfo<WxFinanceFinish> finishListAsPage(WxFinanceFinish record, Integer pageIndex, Integer pageSize); | |||
| WxFinanceFinish getFinishById(TenantEntity tenantEntity,Long id); | |||
| void saveOrUpdateFinish(WxFinanceFinish record,MallUserInfo user); | |||
| WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | |||
| void finishReceive(WxFinanceFinish record,MallUserInfo user); | |||
| Integer getReceiveUnFinisedCount(WxFinanceReceive record); | |||
| void batchFinishReceive(WxFinanceFinish record,MallUserInfo user,boolean isAll); | |||
| } | |||
| @@ -28,10 +28,12 @@ import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.FinanceSetOffDetailVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.enums.EnumFinanceFinishStatus; | |||
| import com.iformall.enums.EnumFinanceReceiveStatus; | |||
| import com.iformall.enums.EnumFinanceReceiveType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| @@ -969,11 +971,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| wxFinanceReceiveMapper.insert(record); | |||
| } | |||
| @Override | |||
| public void finishReceive(WxFinanceReceive record, MallUserInfo user) { | |||
| wxFinanceReceiveMapper.finish(record); | |||
| } | |||
| @Override | |||
| public PageInfo<WxFinanceReceiveSetoff> receiveSetoffListAsPage(WxFinanceReceive record, Integer pageIndex, | |||
| Integer pageSize) { | |||
| @@ -1004,5 +1001,109 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return page; | |||
| } | |||
| @Override | |||
| public WxFinanceFinish getFinishById(TenantEntity tenantEntity, Long id) { | |||
| return wxFinanceFinishMapper.selectById(id, tenantEntity.getTenantId()); | |||
| } | |||
| @Override | |||
| public void saveOrUpdateFinish(WxFinanceFinish record,MallUserInfo user) { | |||
| Date date = new Date(); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateTime(date); | |||
| record.setCreateBy(user.getId()); | |||
| record.setCreateByName(user.getName()); | |||
| record.setUpdateTime(date); | |||
| record.setUpdateBy(user.getId()); | |||
| record.setUpdateByName(user.getName()); | |||
| try { | |||
| wxFinanceFinishMapper.insert(record); | |||
| } catch (Exception e) { | |||
| logger.error("保存失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } else { | |||
| record.setUpdateTime(date); | |||
| record.setUpdateBy(user.getId()); | |||
| record.setUpdateByName(user.getName()); | |||
| wxFinanceFinishMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| 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()); | |||
| } | |||
| } | |||
| } | |||
| vo.setPayWays(pays); | |||
| } | |||
| } | |||
| return vo; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void finishReceive(WxFinanceFinish record, MallUserInfo user) { | |||
| WxFinanceFinish finish = this.getFinishById(record, record.getId()); | |||
| //更新批次, | |||
| WxFinanceFinish ff = new WxFinanceFinish(); | |||
| ff.updateTenantInfo(record); | |||
| ff.setId(finish.getId()); | |||
| ff.setStatus(EnumFinanceFinishStatus.COMPLETE.getCode()); | |||
| ff.setUpdateTime(new Date()); | |||
| ff.setUpdateBy(user.getId()); | |||
| ff.setUpdateByName(user.getName()); | |||
| wxFinanceFinishMapper.updateById(ff); | |||
| //更新收付款记录 | |||
| WxFinanceReceive fr = new WxFinanceReceive(); | |||
| fr.updateTenantInfo(record); | |||
| fr.setCreateTimeBegin(finish.getStartDate()); | |||
| fr.setCreateTimeEnd(finish.getEndDate()); | |||
| fr.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| fr.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| wxFinanceReceiveMapper.finish(fr); | |||
| } | |||
| @Override | |||
| public Integer getReceiveUnFinisedCount(WxFinanceReceive record) { | |||
| return null; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void batchFinishReceive(WxFinanceFinish record, MallUserInfo user,boolean isAll) { | |||
| //更新收付款记录 | |||
| WxFinanceReceive fr = new WxFinanceReceive(); | |||
| fr.updateTenantInfo(record); | |||
| fr.setIds(record.getReceiveIds()); | |||
| wxFinanceReceiveMapper.finish(fr); | |||
| //如果主 | |||
| if (isAll) { | |||
| WxFinanceFinish ff = new WxFinanceFinish(); | |||
| ff.updateTenantInfo(record); | |||
| ff.setId(record.getId()); | |||
| ff.setStatus(EnumFinanceFinishStatus.COMPLETE.getCode()); | |||
| ff.setUpdateTime(new Date()); | |||
| ff.setUpdateBy(user.getId()); | |||
| ff.setUpdateByName(user.getName()); | |||
| wxFinanceFinishMapper.updateById(ff); | |||
| } | |||
| } | |||
| } | |||
| @@ -58,5 +58,6 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_finance_finish where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| </mapper> | |||
| @@ -24,12 +24,13 @@ | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| <result column="is_print" jdbcType="INTEGER" property="isPrint"/> | |||
| <result column="is_finish" jdbcType="INTEGER" property="isFinish"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_money`,`pay_money`,`set_off_money`,`use_money`,`status`,`type`, | |||
| `receive_type`,`money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`, | |||
| `fees_id`,`is_print` | |||
| `fees_id`,`is_print`,`is_finish` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -51,7 +52,8 @@ | |||
| <if test=" null != feesId ">and `fees_id` = #{feesId}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != isPrint ">and `is_print` = #{isPrint}</if> | |||
| <if test=" null != finishStatus ">and `status` in (1,4)</if> | |||
| <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if> | |||
| <if test=" null != finishStatus ">and `status` in (1,3)</if> | |||
| <if test=" null != merchantIdList "> | |||
| and merchant_id in | |||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||
| @@ -98,12 +100,36 @@ | |||
| group by fees_id | |||
| </select> | |||
| <update id="finish"> | |||
| update wx_finance_receive set status = 4 where status = 1 | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| <resultMap id="SumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveSumVo"> | |||
| <result column="total_receive" jdbcType="VARCHAR" property="totalReceive"/> | |||
| <result column="total_setoff" jdbcType="VARCHAR" property="totalSetoff" /> | |||
| <result column="total_pay" jdbcType="VARCHAR" property="totalPay"/> | |||
| </resultMap> | |||
| <select id="getReceiveSum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(ifnull(receive_money,'0') AS DECIMAL(20,2))) total_receive , | |||
| sum(CAST(ifnull(set_off_money,'0') AS DECIMAL(20,2))) total_setoff, | |||
| sum(CAST(ifnull(pay_money,'0') AS DECIMAL(20,2))) total_pay | |||
| 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"/> | |||
| </resultMap> | |||
| <select id="getReceivePayWaySum" 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> | |||
| <update id="finish" parameterType="com.iformall.domain.po.WxFinanceReceive"> | |||
| update wx_finance_receive set is_finish = 1 | |||
| <include refid="dynamicWhereConditions"/> | |||
| </update> | |||
| </mapper> | |||