| @@ -20,6 +20,7 @@ import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveBillSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveCountVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| @@ -610,68 +611,97 @@ public class WxFinanceController extends BaseController { | |||
| public ResultData finishList(@ModelAttribute WxFinanceFinish record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| if (null != record.getIsMyCreate() && EnumYesOrNo.YES.getCode() == record.getIsMyCreate()) { | |||
| record.setCreateBy(this.getUser().getId()); | |||
| } | |||
| PageInfo<WxFinanceFinish> page = wxFinanceService.finishListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增交款") | |||
| @PostMapping("saveFinish") | |||
| public ResultData saveFinish(@RequestBody WxFinanceFinish record) { | |||
| @ApiOperation("交款单据数量统计") | |||
| @PostMapping("finishReceiveCount") | |||
| public ResultData finishReceiveCount(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxFinanceService.saveOrUpdateFinish(record, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("批次结账统计合计") | |||
| @GetMapping("finishReceiveSum") | |||
| public ResultData finishReceiveSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| List<WxFinanceReceiveCountVo> voList = null; | |||
| if (null != record.getId()) { | |||
| //从子表查询 | |||
| voList = wxFinanceService.getReceiveFinishCount(record); | |||
| }else { | |||
| //从收付款单里面查询 | |||
| voList = wxFinanceService.getReceiveCount(record); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxFinanceReceiveSumVo page = wxFinanceService.getReceiveSum(record); | |||
| return new ResultData(page); | |||
| Integer total = 0; | |||
| Integer receiveTotal = 0; | |||
| Integer payTotal = 0; | |||
| Integer redTotal = 0; | |||
| Map retMap = new HashMap(); | |||
| if (null != voList && voList.size() > 0 ) { | |||
| for (int i = 0 ; i < voList.size() ; i ++ ) { | |||
| WxFinanceReceiveCountVo vo = voList.get(i); | |||
| Integer count = vo.getNum(); | |||
| total = total + count; | |||
| if (vo.getType() == EnumFinanceCashierType.RECEIVE.getCode()) { | |||
| if (vo.getStatus() == EnumFinanceReceiveStatus.NORMAL.getCode()) { | |||
| receiveTotal = receiveTotal+count; | |||
| }else if (vo.getStatus() == EnumFinanceReceiveStatus.RED_SETOFF.getCode()) { | |||
| redTotal = redTotal+count; | |||
| } | |||
| }else if (vo.getType() == EnumFinanceCashierType.PAY.getCode()) { | |||
| if (vo.getStatus() == EnumFinanceReceiveStatus.NORMAL.getCode()) { | |||
| payTotal = payTotal+count; | |||
| }else if (vo.getStatus() == EnumFinanceReceiveStatus.RED_SETOFF.getCode()) { | |||
| redTotal = redTotal+count; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| retMap.put("total", total); | |||
| retMap.put("receiveTotal", receiveTotal); | |||
| retMap.put("payTotal", payTotal); | |||
| retMap.put("redTotal", redTotal); | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("批次结账支付方式统计") | |||
| @GetMapping("finishReceivePaywaysSum") | |||
| public ResultData finishReceivePaywaysSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| @ApiOperation("交款支付方式统计") | |||
| @PostMapping("finishReceivePaywaysSum") | |||
| public ResultData finishReceivePaywaysSum(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxFinanceReceivePayway> page = wxFinanceService.getReceivePaywaysSum(record); | |||
| return new ResultData(page); | |||
| List<WxFinanceReceivePayway> list = wxFinanceService.getReceivePaywaysSum(record); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("批次结账科目统计") | |||
| @GetMapping("finishReceiveFeesSum") | |||
| public ResultData finishReceiveFeesSum(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| @ApiOperation("交款科目统计") | |||
| @PostMapping("finishReceiveFeesSum") | |||
| public ResultData finishReceiveFeesSum(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxFinanceReceiveBill> page = wxFinanceService.getReceiveFeesSum(record); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("交款收付款单列表") | |||
| @GetMapping("finishReceiveList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData finishList(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| if (null == record.getFinishId()) { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| @ApiOperation("交款收付款总计") | |||
| @PostMapping("finishReceiveSum") | |||
| public ResultData finishReceiveSum(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns("status asc,create_time asc"); | |||
| PageInfo<WxFinanceReceiveVo> page = wxFinanceService.receiveVoListAsPage(record, pageNum, pageSize); | |||
| WxFinanceReceiveSumVo page = wxFinanceService.getReceiveSumByFinish(record); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("交款收付款总计") | |||
| @PostMapping("finishReceiveList") | |||
| public ResultData finishReceiveList(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxFinanceReceiveVo> list = wxFinanceService.getReceiveVoListByFinish(record); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("新增交款") | |||
| @PostMapping("saveFinish") | |||
| public ResultData saveFinish(@RequestBody WxFinanceFinish record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxFinanceService.saveOrUpdateFinish(record, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("结账") | |||
| @PostMapping("receiveFinish") | |||
| @@ -1 +1,17 @@ | |||
| ALTER TABLE wx_finance_finish DROP COLUMN NAME; | |||
| CREATE TABLE `wx_finance_finish_receive` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `create_time` timestamp NULL DEFAULT NULL, | |||
| `update_time` timestamp NULL DEFAULT NULL, | |||
| `status` int(3) NOT NULL COMMENT '状态', | |||
| `finish_id` bigint(20) NOT NULL COMMENT '交款ID', | |||
| `receive_id` bigint(20) NOT NULL COMMENT '收付款单号', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| @@ -58,10 +58,10 @@ public class WxFinanceFinish extends TenantEntity { | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "remark", name = "remark") | |||
| @io.swagger.annotations.ApiModelProperty(value = "审核备注", name = "remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "remark", name = "remark") | |||
| @io.swagger.annotations.ApiModelProperty(value = "反审核备注", name = "remark") | |||
| private String backRemark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "交款开始日期", name = "startDate") | |||
| @@ -151,4 +151,17 @@ public class WxFinanceFinish extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Date receiveEndTime; | |||
| @TableField(exist = false) | |||
| private Integer isMyCreate; | |||
| @TableField(exist = false) | |||
| private String idLike; | |||
| @TableField(exist = false) | |||
| private String receiveIdLike; | |||
| @TableField(exist = false) | |||
| private Integer isReceive; | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| package com.iformall.domain.po; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.enums.EnumFinanceFinishStatus; | |||
| import com.iformall.enums.EnumFinanceReceiveStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_finance_finish_receive") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxFinanceFinishReceive extends TenantEntity { | |||
| private static final long serialVersionUID = 7009117540201976664L; | |||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceFinishStatus", name = "status") | |||
| private Integer status; | |||
| @TableField(exist = false) | |||
| private String statusName; | |||
| public String getStatusName() { | |||
| if (null != status) { | |||
| return EnumFinanceFinishStatus.getEnum(status).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "交款ID", name = "finishId") | |||
| private Long finishId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "收付款单ID", name = "receiveId") | |||
| private Long receiveId; | |||
| @TableField(exist = false) | |||
| private String receiveIdLike; | |||
| } | |||
| @@ -128,6 +128,8 @@ public class WxFinanceReceive extends TenantEntity { | |||
| } | |||
| return null; | |||
| } | |||
| @TableField(exist = false) | |||
| private List<Integer> statusList; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否已结账完成", name = "isFinish") | |||
| private Integer isFinish; | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| @Data | |||
| public class WxFinanceReceiveCountVo implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| Integer type; | |||
| Integer status; | |||
| Integer num; | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxFinanceFinishReceive; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxFinanceFinishReceiveMapper extends CommonMapper<WxFinanceFinishReceive, Long> { | |||
| List<WxFinanceFinishReceive> findList(WxFinanceFinishReceive wxBillRent); | |||
| WxFinanceFinishReceive selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<Long> findReceiveIdList(WxFinanceFinishReceive wxBillRent); | |||
| List<Long> findFinishIdList(WxFinanceFinishReceive wxBillRent); | |||
| } | |||
| @@ -20,5 +20,7 @@ public interface WxFinanceReceiveBillMapper extends CommonMapper<WxFinanceReceiv | |||
| List<Long> findBillIdList(WxFinanceReceiveBill wxBillRent); | |||
| WxFinanceReceiveBillSum findSum(WxFinanceReceiveBill wxBillRent); | |||
| List<Long> findReceiveIdList(WxFinanceReceiveBill wxBillRent); | |||
| } | |||
| @@ -4,6 +4,7 @@ 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.WxFinanceReceiveCountVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| @@ -35,5 +36,7 @@ public interface WxFinanceReceiveMapper extends CommonMapper<WxFinanceReceive, L | |||
| void updatePrint(WxFinanceReceive record); | |||
| void updateStatus(WxFinanceReceive record); | |||
| List<WxFinanceReceiveCountVo> findCountVo(WxFinanceReceive record); | |||
| } | |||
| @@ -24,6 +24,7 @@ import com.iformall.domain.po.WxFinanceReceiveSetoff; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveBillSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveCountVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| /** | |||
| @@ -67,13 +68,17 @@ public interface WxFinanceService { | |||
| void createTempToPay(WxAllBill record,MallUserInfo user); | |||
| void delteTemp(WxAllBill record,MallUserInfo user); | |||
| //结账 | |||
| //交账 | |||
| 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); | |||
| List<WxFinanceReceivePayway> getReceivePaywaysSum(WxFinanceReceive record); | |||
| List<WxFinanceReceiveBill> getReceiveFeesSum(WxFinanceReceive record); | |||
| List<WxFinanceReceiveCountVo> getReceiveFinishCount(WxFinanceFinish record); | |||
| List<WxFinanceReceiveCountVo> getReceiveCount(WxFinanceFinish record); | |||
| List<WxFinanceReceivePayway> getReceivePaywaysSum(WxFinanceFinish record); | |||
| List<WxFinanceReceiveBill> getReceiveFeesSum(WxFinanceFinish record); | |||
| WxFinanceReceiveSumVo getReceiveSumByFinish(WxFinanceFinish record); | |||
| List<WxFinanceReceiveVo> getReceiveVoListByFinish(WxFinanceFinish record); | |||
| void finishReceive(WxFinanceFinish record,MallUserInfo user); | |||
| Integer getReceiveUnFinisedCount(WxFinanceReceive record); | |||
| @@ -19,12 +19,14 @@ import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxEnergyFeesSetoff; | |||
| import com.iformall.domain.po.WxEnergyFeesShop; | |||
| import com.iformall.domain.po.WxFinanceFinish; | |||
| import com.iformall.domain.po.WxFinanceFinishReceive; | |||
| import com.iformall.domain.po.WxFinancePrintData; | |||
| import com.iformall.domain.po.WxFinancePrintTemplate; | |||
| 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.WxMallFloor; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| @@ -33,6 +35,7 @@ import com.iformall.domain.vo.FinanceAdvanceBillVo; | |||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | |||
| import com.iformall.domain.vo.FinanceSetOffDetailVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveBillSum; | |||
| import com.iformall.domain.vo.WxFinanceReceiveCountVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | |||
| import com.iformall.domain.vo.WxFinanceReceiveVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| @@ -45,6 +48,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillPayWayMapper; | |||
| import com.iformall.mapper.WxEnergyFeesSetoffMapper; | |||
| import com.iformall.mapper.WxFinanceFinishMapper; | |||
| import com.iformall.mapper.WxFinanceFinishReceiveMapper; | |||
| import com.iformall.mapper.WxFinancePrintDataMapper; | |||
| import com.iformall.mapper.WxFinancePrintTemplateMapper; | |||
| import com.iformall.mapper.WxFinanceReceiveBillMapper; | |||
| @@ -56,6 +60,7 @@ import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxAllBillService; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFinanceService; | |||
| import com.iformall.service.WxMallFloorService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| @@ -107,18 +112,21 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| WxFinancePrintTemplateMapper wxFinancePrintTemplateMapper; | |||
| @Autowired | |||
| WxFinanceFinishMapper wxFinanceFinishMapper; | |||
| @Autowired | |||
| WxFinanceFinishReceiveMapper wxFinanceFinishReceiveMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| @Lazy | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Lazy | |||
| @Autowired | |||
| WxShopService wxShopService; | |||
| @Lazy | |||
| @Autowired | |||
| WxMallFloorService wxMallFloorService; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @@ -1476,7 +1484,13 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void redSetoffReceive(WxFinanceReceive record, MallUserInfo user) { | |||
| //invalidReceive(record, user , true); | |||
| record.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| if (null != user) { | |||
| record.setUpdateBy(user.getId()); | |||
| record.setUpdateByName(user.getName()); | |||
| } | |||
| wxFinanceReceiveMapper.updateById(record); | |||
| copyRedSetOffReceive(record); | |||
| } | |||
| @@ -1498,6 +1512,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| record.setParentId(oldRecordId); | |||
| record.setCreateTime(new Date()); | |||
| record.setUpdateTime(new Date()); | |||
| record.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| wxFinanceReceiveMapper.insert(record); | |||
| WxFinanceReceiveBill rbq = new WxFinanceReceiveBill(); | |||
| @@ -1572,6 +1587,18 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Override | |||
| public PageInfo<WxFinanceFinish> finishListAsPage(WxFinanceFinish record, Integer pageIndex, Integer pageSize) { | |||
| //根据收付款单查询 | |||
| if (StringUtils.isNotBlank(record.getReceiveIdLike())) { | |||
| WxFinanceFinishReceive ffr = new WxFinanceFinishReceive(); | |||
| ffr.updateTenantInfo(record); | |||
| ffr.setReceiveIdLike(record.getReceiveIdLike()); | |||
| List<Long> receiveIdList = wxFinanceFinishReceiveMapper.findFinishIdList(ffr); | |||
| if (null == receiveIdList || receiveIdList.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| record.setIds(receiveIdList);; | |||
| } | |||
| } | |||
| PageInfo<WxFinanceFinish> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceFinishMapper.findList(record)); | |||
| return page; | |||
| } | |||
| @@ -1615,64 +1642,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| 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()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| 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}) | |||
| @Override | |||
| public void finishReceive(WxFinanceFinish record, MallUserInfo user) { | |||
| @@ -1726,4 +1695,140 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return sysConfigService.getByKey(SysConfigConstant.finance_receive_end_date, tenantEntity); | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceiveCountVo> getReceiveFinishCount(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| return wxFinanceReceiveMapper.findCountVo(fr); | |||
| } | |||
| private WxFinanceReceive generateReceiveQueryByFinish(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = new WxFinanceReceive(); | |||
| fr.updateTenantInfo(record); | |||
| if (null != record.getId()) { | |||
| WxFinanceFinishReceive ffr = new WxFinanceFinishReceive(); | |||
| ffr.updateTenantInfo(record); | |||
| ffr.setFinishId(record.getId()); | |||
| List<Long> recevieIdList = wxFinanceFinishReceiveMapper.findReceiveIdList(ffr); | |||
| if (null != recevieIdList && recevieIdList.size() > 0 ) { | |||
| fr.setIds(recevieIdList); | |||
| }else { | |||
| fr.setId(-1L); | |||
| } | |||
| return fr; | |||
| } | |||
| fr.setReceiveDateBegin(record.getStartDate()); | |||
| fr.setReceiveDateEnd(record.getEndDate()); | |||
| List<Integer> statusList = new ArrayList<Integer>(); | |||
| statusList.add(EnumFinanceReceiveStatus.NORMAL.getCode()); | |||
| statusList.add(EnumFinanceReceiveStatus.RED_SETOFF.getCode()); | |||
| fr.setStatusList(statusList); | |||
| fr.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| //楼栋,科目,支付方式 | |||
| if (StringUtils.isNotBlank(record.getBuildings())){ | |||
| String floorForrule = null; | |||
| WxMallFloor fq = new WxMallFloor(); | |||
| fq.updateTenantInfo(record); | |||
| fq.setBuildingIdList(record.getBuildindIds()); | |||
| List<Long> flist = wxMallFloorService.getFloorIdList(fq); | |||
| if (null != flist && flist.size() > 0 ){ | |||
| floorForrule = StringUtils.join(flist, ","); | |||
| } | |||
| List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, floorForrule, null, null, null, EnumYesOrNo.NO.getCode(), EnumYesOrNo.NO.getCode(),null); | |||
| if (null != merchantIds && merchantIds.size() > 0 ) { | |||
| fr.setMerchantIdList(merchantIds); | |||
| } | |||
| } | |||
| if (StringUtils.isNotBlank(record.getFees()) || StringUtils.isNotBlank(record.getPayways())){ | |||
| WxFinanceReceiveBill rbq = new WxFinanceReceiveBill(); | |||
| rbq.updateTenantInfo(record); | |||
| rbq.setFeesIdList(record.getFeesIds()); | |||
| rbq.setPayWayList(record.getPaywaysIds()); | |||
| rbq.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| List<Long> receiveIdList = wxFinanceReceiveBillMapper.findReceiveIdList(rbq); | |||
| if (null != receiveIdList && receiveIdList.size() > 0 ){ | |||
| fr.setIds(receiveIdList); | |||
| } | |||
| } | |||
| return fr; | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceiveCountVo> getReceiveCount(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| return wxFinanceReceiveMapper.findCountVo(fr); | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceivePayway> getReceivePaywaysSum(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| List<WxFinanceReceivePayway> pays = null; | |||
| if (record.getIsReceive() == EnumYesOrNo.YES.getCode()) { | |||
| pays = wxFinanceReceiveMapper.getReceivePayWayReceiveSum(fr); | |||
| }else { | |||
| pays = wxFinanceReceiveMapper.getReceivePayWayPaySum(fr); | |||
| } | |||
| 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 pays; | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceiveBill> getReceiveFeesSum(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| List<WxFinanceReceiveBill> pays = null; | |||
| if (record.getIsReceive() == EnumYesOrNo.YES.getCode()) { | |||
| pays = wxFinanceReceiveMapper.getReceiveFeesReceiveSum(fr); | |||
| }else { | |||
| pays = wxFinanceReceiveMapper.getReceiveFeesPaySum(fr); | |||
| } | |||
| 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; | |||
| } | |||
| @Override | |||
| public WxFinanceReceiveSumVo getReceiveSumByFinish(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| return wxFinanceReceiveMapper.getReceiveSum(fr); | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceiveVo> getReceiveVoListByFinish(WxFinanceFinish record) { | |||
| WxFinanceReceive fr = generateReceiveQueryByFinish(record); | |||
| if (record.getIsReceive() == EnumYesOrNo.YES.getCode()) { | |||
| fr.setType(EnumFinanceCashierType.RECEIVE.getCode());; | |||
| }else { | |||
| fr.setType(EnumFinanceCashierType.PAY.getCode()); | |||
| } | |||
| PageInfo<WxFinanceReceiveVo> page = receiveVoListAsPage(fr, 1, 10000, true); | |||
| if (null != page && null != page.getList() && page.getList().size() > 0 ) { | |||
| return page.getList(); | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -38,7 +38,19 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != idLike and '' != idLike"> | |||
| and id like concat('%', #{idLike},'%') | |||
| </if> | |||
| <if test=" null != createByName and '' != createByName"> | |||
| and create_by_name concat('%', #{createByName},'%') | |||
| </if> | |||
| <if test=" null != auditByName and '' != auditByName"> | |||
| and audit_by_name concat('%', #{auditByName},'%') | |||
| </if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != createBy ">and `create_by` = #{createBy}</if> | |||
| <if test=" null != startDate ">and `start_date` >= #{startDate}</if> | |||
| <if test=" null != endDate ">and `end_date` <= #{endDate}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -0,0 +1,69 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxFinanceFinishReceiveMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFinanceFinishReceive"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <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="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="finish_id" jdbcType="BIGINT" property="finishId"/> | |||
| <result column="receive_id" jdbcType="BIGINT" property="receiveId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`status`,`finish_id`,`receive_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != finishId ">and `finish_id` = #{finishId}</if> | |||
| <if test=" null != receiveId ">and `receive_id` = #{receiveId}</if> | |||
| <if test=" null != receiveIdLike and '' != receiveIdLike"> | |||
| and receive_id like concat('%', #{receiveIdLike},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxFinanceFinishReceive" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_finance_finish_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findReceiveIdList" parameterType="com.iformall.domain.po.WxFinanceFinishReceive" resultType="Long"> | |||
| select distinct receive_id | |||
| from wx_finance_finish_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findFinishIdList" parameterType="com.iformall.domain.po.WxFinanceFinishReceive" resultType="Long"> | |||
| select distinct finish_id | |||
| from wx_finance_finish_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_finance_finish_receive where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| </mapper> | |||
| @@ -100,6 +100,12 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findReceiveIdList" parameterType="com.iformall.domain.po.WxFinanceReceiveBill" resultType="Long"> | |||
| select distinct receive_id | |||
| from wx_finance_receive_bill | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <resultMap id="sumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveBillSum"> | |||
| <result column="receive" jdbcType="VARCHAR" property="receive"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay" /> | |||
| @@ -52,12 +52,21 @@ | |||
| <if test=" null != isPrint ">and `is_print` = #{isPrint}</if> | |||
| <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if> | |||
| <if test=" null != parentId ">and `parent_id` = #{parentId}</if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="sItem" open="(" separator="," close=")"> | |||
| #{sItem} | |||
| </foreach> | |||
| </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=")"> | |||
| @@ -171,6 +180,17 @@ | |||
| </if> | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </update> | |||
| <resultMap id="countResultMap" type="com.iformall.domain.vo.WxFinanceReceiveCountVo"> | |||
| <result column="type" jdbcType="Integer" property="type"/> | |||
| <result column="status" jdbcType="Integer" property="status" /> | |||
| <result column="num" jdbcType="Integer" property="num"/> | |||
| </resultMap> | |||
| <select id="findCountVo" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="countResultMap"> | |||
| SELECT type,status,COUNT(1) num FROM wx_finance_receive | |||
| <include refid="dynamicWhereConditions"/> | |||
| GROUP BY TYPE,STATUS | |||
| </select> | |||
| </mapper> | |||