From a58376ab73b9f29c543df45e7b4e44ebf8f57d52 Mon Sep 17 00:00:00 2001 From: winter Date: Tue, 23 Jul 2024 15:53:42 +0800 Subject: [PATCH] fix --- .../controller/market/WxEnergyController.java | 35 ++++ .../market/WxFeesStandardsController.java | 69 ++++---- .../market/WxFinanceController.java | 14 +- .../resources/db/migration/V202407018.sql | 3 + .../com/iformall/domain/po/WxEnergyFees.java | 120 +++++++++++++ .../iformall/domain/po/WxFeesStandards.java | 160 ------------------ .../domain/po/WxPropertyContract.java | 16 +- .../domain/vo/WxBillFeesStandardsListVo.java | 4 +- .../com/iformall/enums/EnumBillAllType.java | 65 +++++-- .../iformall/enums/EnumFeesStandardsType.java | 61 ------- .../mapper/WxFeesStandardsMapper.java | 16 -- .../service/WxFeesStandardsService.java | 31 ---- .../service/helper/WxRentContractHelper.java | 6 +- .../impl/WxFeesStandardsServiceImpl.java | 42 ----- .../impl/WxPropertyContractServiceImpl.java | 2 +- .../resources/mapper/WxEnergyFeesMapper.xml | 8 +- .../mapper/WxFeesStandardsMapper.xml | 58 ------- 17 files changed, 261 insertions(+), 449 deletions(-) delete mode 100644 mallinkService/src/main/java/com/iformall/domain/po/WxFeesStandards.java delete mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumFeesStandardsType.java delete mode 100644 mallinkService/src/main/java/com/iformall/mapper/WxFeesStandardsMapper.java delete mode 100644 mallinkService/src/main/java/com/iformall/service/WxFeesStandardsService.java delete mode 100644 mallinkService/src/main/java/com/iformall/service/impl/WxFeesStandardsServiceImpl.java delete mode 100644 mallinkService/src/main/resources/mapper/WxFeesStandardsMapper.xml diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java index 038243481..05f7cf322 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java @@ -15,6 +15,8 @@ import com.iformall.domain.po.base.BaseEntity; import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumEnergyMeterType; import com.iformall.enums.EnumEnergyPublicCalcuteRule; +import com.iformall.enums.EnumFeesStandardsCalcuteUnit; +import com.iformall.enums.EnumFeesStandardsTimeUnit; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; import com.iformall.service.WxEnergyService; @@ -192,6 +194,9 @@ public class WxEnergyController extends BaseController { if (null == record.getPublicCalcute()) { return new ResultData(Result.ERROR,"请选择分摊计费规则"); } + if (null == record.getFixedPrice()) { + return new ResultData(Result.ERROR,"请选择是否是一次性费用"); + } if (StringUtils.isNotBlank(record.getPrice())) { return new ResultData(Result.ERROR,"单价不能为空"); } @@ -206,6 +211,36 @@ public class WxEnergyController extends BaseController { return new ResultData(); } + @ApiOperation("查询科目计量单位列表") + @GetMapping("feesCalcuteUnitList") + public ResultData typeCalcuteUnitList(Integer billType) { + List enumList = EnumBillAllType.getCalucuteUnites(billType); + if (null != enumList) { + Map retMap = new HashMap(); + for (int i = 0 ; i < enumList.size(); i++) { + EnumFeesStandardsCalcuteUnit cu = enumList.get(i); + retMap.put(cu.getCode(), cu.getMessage()); + } + return new ResultData(retMap); + } + return new ResultData(); + } + + @ApiOperation("查询科目计算时间单位列表") + @GetMapping("feesTimeUnitList") + public ResultData typeTimeUnitList(Integer billType) { + List enumList = EnumBillAllType.getTimeUnites(billType); + if (null != enumList) { + Map retMap = new HashMap(); + 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(); + } + @ApiOperation("抄表数据分页列表接口") @GetMapping("readingList") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java index 95fc22120..f5c766929 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java @@ -1,20 +1,18 @@ package com.iformall.controller.market; import com.github.pagehelper.PageInfo; -import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxFeesStandards; +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.EnumFeesStandardsType; -import com.iformall.service.WxFeesStandardsService; +import com.iformall.enums.EnumYesOrNo; +import com.iformall.service.WxEnergyService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; - -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,13 +25,18 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +/** + * 物业合同的其他费用 + * @author Administrator + * + */ @RestController @RequestMapping("feesStandars") public class WxFeesStandardsController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - private WxFeesStandardsService wxFeesStandardsService; + private WxEnergyService wxEnergyService; @ApiOperation("分页列表接口") @GetMapping("list") @@ -41,45 +44,36 @@ public class WxFeesStandardsController extends BaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData list(@ModelAttribute WxFeesStandards record, Integer pageNum, Integer pageSize) { + public ResultData list(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { if (null == record) { - record = new WxFeesStandards(); + record = new WxEnergyFees(); } record.updateTenantInfo(getTenantInfo()); + record.setBillType(EnumBillAllType.PROPERTY.getCode()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxFeesStandardsService.listAsPage(record, pageNum, pageSize); + PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize); return new ResultData(page); } - @ApiOperation("详情接口") - @GetMapping("detail") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - }) - public ResultData detail(Long id) { - WxFeesStandards record = wxFeesStandardsService.getById(id,getTenantInfo().getTenantId()); - return new ResultData(record); - } - @ApiOperation("查询某一个类型费用标砖列表") + @ApiOperation("查询物业合同费用标准列表") @GetMapping("typeList") - public ResultData typeList(Integer type) { - if (null == type) { - return new ResultData(Result.ERROR,"参数错误"); - } - WxFeesStandards record = new WxFeesStandards(); + public ResultData typeList() { + WxEnergyFees record = new WxEnergyFees(); record.updateTenantInfo(getTenantInfo()); - record.setType(type); - return new ResultData(wxFeesStandardsService.list(record)); + record.setBillType(EnumBillAllType.PROPERTY.getCode()); + record.setIsDel(EnumYesOrNo.NO.getCode()); + PageInfo page = wxEnergyService.feesListAsPage(record, 1, 100); + if (null != page) { + return new ResultData(page.getList()); + } + return new ResultData(); } - @ApiOperation("查询某一个类型计量单位列表") + @ApiOperation("查询物业合同计量单位列表") @GetMapping("typeCalcuteUnitList") - public ResultData typeCalcuteUnitList(Integer type) { - if (null == type) { - return new ResultData(Result.ERROR,"参数错误"); - } - List enumList = EnumFeesStandardsType.getCalucuteUnites(type); + public ResultData typeCalcuteUnitList() { + List enumList = EnumBillAllType.getCalucuteUnites(EnumBillAllType.PROPERTY.getCode()); if (null != enumList) { Map retMap = new HashMap(); for (int i = 0 ; i < enumList.size(); i++) { @@ -91,13 +85,10 @@ public class WxFeesStandardsController extends BaseController { return new ResultData(); } - @ApiOperation("查询某一个类型时间单位列表") + @ApiOperation("查询物业合同时间单位列表") @GetMapping("typeTimeUnitList") - public ResultData typeTimeUnitList(Integer type) { - if (null == type) { - return new ResultData(Result.ERROR,"参数错误"); - } - List enumList = EnumFeesStandardsType.getTimeUnites(type); + public ResultData typeTimeUnitList() { + List enumList = EnumBillAllType.getTimeUnites(EnumBillAllType.PROPERTY.getCode()); if (null != enumList) { Map retMap = new HashMap(); for (int i = 0 ; i < enumList.size(); i++) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java index 5d3587af3..d008f8a30 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java @@ -59,19 +59,15 @@ public class WxFinanceController extends BaseController { @GetMapping("billTypes") public ResultData billTypes() { Map tmap = new HashMap(); - for (EnumBillAllType t : EnumBillAllType.getFinanceTypes()) { + for (EnumBillAllType t : EnumBillAllType.getOperateNotEnergyTypes()) { tmap.put(t.getCode(), t.getMessage()); } return new ResultData(tmap); } - //可以管理的类型 - @GetMapping("operateBillTypes") - public ResultData operateBillTypes() { - Map tmap = new HashMap(); - for (EnumBillAllType t : EnumBillAllType.getFinanceOperateTypes()) { - tmap.put(t.getCode(), t.getMessage()); - } - return new ResultData(tmap); + + @GetMapping("billTypeIsFixedPrice") + public ResultData billTypeIsFixedPrice(Integer billType) { + return new ResultData(EnumBillAllType.getEnum(billType).isFixedPrice()); } @ApiOperation("费用科目列表") diff --git a/mallinkAdmin/src/main/resources/db/migration/V202407018.sql b/mallinkAdmin/src/main/resources/db/migration/V202407018.sql index 336795ed6..b5c849a12 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202407018.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202407018.sql @@ -1480,6 +1480,9 @@ CREATE TABLE `wx_energy_fees` ( `type` int(1) DEFAULT NULL COMMENT '表类型', `bill_type` int(11) NOT NULL COMMENT '所属账单类型', `is_system` int(1) NOT NULL DEFAULT '0' COMMENT '是否系统内置', + `fixed_price` int(1) NOT NULL COMMENT '是否一次性费用', + `calcute_unit` int(1) COMMENT '计量单位', + `time_unit` int(1) COMMENT '时间单位', PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java index 23e9831c7..3757e7556 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java @@ -1,13 +1,25 @@ 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.EnumBillAllType; +import com.iformall.enums.EnumEnergyPublicCalcuteRule; +import com.iformall.enums.EnumFeesStandardsCalcuteUnit; +import com.iformall.enums.EnumFeesStandardsTimeUnit; +import com.iformall.enums.EnumYesOrNo; +import com.iformall.service.helper.WxRentContractHelper; +import com.iformall.utils.Constant; +import com.iformall.utils.DateUtils; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; /** @@ -40,6 +52,14 @@ public class WxEnergyFees extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "公摊计算规则EnumEnergyPublicCalcuteRule", name = "publicCalcute") private Integer publicCalcute; + @TableField(exist = false) + private String publicCalcuteName; + public String getPublicCalcuteName() { + if (null != publicCalcute) { + return EnumEnergyPublicCalcuteRule.getEnum(publicCalcute).getMessage(); + } + return null; + } @io.swagger.annotations.ApiModelProperty(value = "表类型EnumEnergyMeterType", name = "type") private Integer type; @@ -58,7 +78,107 @@ public class WxEnergyFees extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "是否系统内置", name = "isSystem") private Integer isSystem; + @io.swagger.annotations.ApiModelProperty(value = "是否一次性费用EnumYesOrNo", name = "fixedPrice") + private Integer fixedPrice; + @TableField(exist = false) + private String fixedPriceName; + public String getFixedPriceName() { + if (null != fixedPrice) { + if (fixedPrice.intValue() == EnumYesOrNo.YES.getCode().intValue()) { + return "一次性费用"; + }else { + return "非一次性费用"; + } + } + return ""; + } + + @io.swagger.annotations.ApiModelProperty(value = "计量单位EnumFeesStandardsCalcuteUnit【非固定费用使用】", name = "calcuteUnit") + private Integer calcuteUnit; + @TableField(exist = false) + private String calcuteUnitName; + public String getCalcuteUnitName() { + if (null != calcuteUnit) { + return EnumFeesStandardsCalcuteUnit.getEnum(calcuteUnit).getMessage(); + } + return ""; + } + + @io.swagger.annotations.ApiModelProperty(value = "时间单位EnumFeesStandardsTimeUnit【非固定费用使用】", name = "timeUnit") + private Integer timeUnit; + @TableField(exist = false) + private String timeUnitName; + public String getTimeUnitName() { + if (null != timeUnit) { + return EnumFeesStandardsTimeUnit.getEnum(timeUnit).getMessage(); + } + return ""; + } + + public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed) { + if (isFixed) { + return this.price; + } + if (StringUtils.isBlank(count)) { + count = "1"; + } + if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { + BigDecimal priceD = new BigDecimal(this.price); + priceD = priceD.multiply(new BigDecimal(count)); + return WxRentContractHelper.getNeedPay(decimalSize,new BigDecimal(0),priceD,start,end); + }else { + //按月计算 + BigDecimal priceMonth = new BigDecimal(this.price); + if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.YEAR.getCode().intValue()) { + priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); + } + priceMonth = priceMonth.multiply(new BigDecimal(count)); + + //如果开始时间是1号,结束时间是当月最后一天,则是整月,*月数。 + //如果不是整月,跨月了的,则计算: 开始时间到当月底+ 中间整月 + 结束时间月1号到结束时间 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); + Date startMonthFirstDay = DateUtils.getFirstDayForCurrMonth(start); + Date endMonthLastDay = DateUtils.getLastDayForMonth(end); + if(sd.format(start).equals(sd.format(startMonthFirstDay)) && sd.format(end).equals(sd.format(endMonthLastDay)) ){ + int months = WxRentContractHelper.getMonths(sd.format(start),sd.format(end)); + months++; + if (months > 0 ) { + return priceMonth.multiply(new BigDecimal(months)).toPlainString(); + }else { + return priceMonth.toPlainString(); + } + }else { + Date startMonthEndDay = DateUtils.getLastDayForMonth(start); + int startDays = DateUtils.daysBetween(start, startMonthEndDay); + int startMonthDays = DateUtils.daysBetween(startMonthFirstDay, startMonthEndDay); + + Date endMontFirstDay = DateUtils.getFirstDayForCurrMonth(end); + int endDays = DateUtils.daysBetween(endMontFirstDay, end); + int endMonthDays = DateUtils.daysBetween(endMontFirstDay, endMonthLastDay); + + int months = WxRentContractHelper.getMonths(sd.format(DateUtils.getDaySet(startMonthEndDay, Calendar.DATE, 1)),sd.format(DateUtils.getDaySet(endMontFirstDay, Calendar.DATE, -1))); + months++; + + if (startDays > 0 ) { + priceMonth = priceMonth.multiply(new BigDecimal(startDays)).divide(new BigDecimal(startMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); + } + + if (endDays > 0 ) { + priceMonth = priceMonth.multiply(new BigDecimal(endDays)).divide(new BigDecimal(endMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); + } + + if (months > 0 ) { + priceMonth = priceMonth.multiply(new BigDecimal(months)); + } + + return priceMonth.toPlainString(); + + } + } + } + @TableField(exist = false) private Integer notEnergy; + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFeesStandards.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFeesStandards.java deleted file mode 100644 index cee685dbe..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFeesStandards.java +++ /dev/null @@ -1,160 +0,0 @@ -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.EnumContractReceivePeriodUnit; -import com.iformall.enums.EnumFeesStandardsCalcuteUnit; -import com.iformall.enums.EnumFeesStandardsTimeUnit; -import com.iformall.enums.EnumFeesStandardsType; -import com.iformall.enums.EnumRentContractAdjustPeriod; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.helper.WxRentContractHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -/** - * @author gongbiao - */ -@TableName(value = "wx_fees_standards") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxFeesStandards extends TenantEntity { - - private static final long serialVersionUID = -2034956838395479510L; - - protected Long id; - - @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") - private Date updateTime; - @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") - private Date createTime; - @io.swagger.annotations.ApiModelProperty(value = "名称", name = "createtime") - private String name; - @io.swagger.annotations.ApiModelProperty(value = "单价", name = "price") - private String price; - - @io.swagger.annotations.ApiModelProperty(value = "类型EnumFeesStandardsType", name = "type") - private Integer type; - @TableField(exist = false) - private String typeName; - public String getTypeName() { - if (null != type) { - return EnumFeesStandardsType.getEnum(type).getMessage(); - } - return ""; - } - - @io.swagger.annotations.ApiModelProperty(value = "是否一次性费用EnumYesOrNo", name = "fixedPrice") - private Integer fixedPrice; - @TableField(exist = false) - private String fixedPriceName; - public String getFixedPriceName() { - if (null != fixedPrice) { - if (fixedPrice.intValue() == EnumYesOrNo.YES.getCode().intValue()) { - return "一次性费用"; - }else { - return "非一次性费用"; - } - } - return ""; - } - - @io.swagger.annotations.ApiModelProperty(value = "计量单位EnumFeesStandardsCalcuteUnit【非固定费用使用】", name = "calcuteUnit") - private Integer calcuteUnit; - @TableField(exist = false) - private String calcuteUnitName; - public String getCalcuteUnitName() { - if (null != calcuteUnit) { - return EnumFeesStandardsCalcuteUnit.getEnum(calcuteUnit).getMessage(); - } - return ""; - } - - @io.swagger.annotations.ApiModelProperty(value = "时间单位EnumFeesStandardsTimeUnit【非固定费用使用】", name = "timeUnit") - private Integer timeUnit; - @TableField(exist = false) - private String timeUnitName; - public String getTimeUnitName() { - if (null != timeUnit) { - return EnumFeesStandardsTimeUnit.getEnum(timeUnit).getMessage(); - } - return ""; - } - - public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed) { - if (isFixed) { - return this.price; - } - if (StringUtils.isBlank(count)) { - count = "1"; - } - if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { - BigDecimal priceD = new BigDecimal(this.price); - priceD = priceD.multiply(new BigDecimal(count)); - return WxRentContractHelper.getNeedPay(decimalSize,new BigDecimal(0),priceD,start,end); - }else { - //按月计算 - BigDecimal priceMonth = new BigDecimal(this.price); - if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.YEAR.getCode().intValue()) { - priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - priceMonth = priceMonth.multiply(new BigDecimal(count)); - - //如果开始时间是1号,结束时间是当月最后一天,则是整月,*月数。 - //如果不是整月,跨月了的,则计算: 开始时间到当月底+ 中间整月 + 结束时间月1号到结束时间 - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - Date startMonthFirstDay = DateUtils.getFirstDayForCurrMonth(start); - Date endMonthLastDay = DateUtils.getLastDayForMonth(end); - if(sd.format(start).equals(sd.format(startMonthFirstDay)) && sd.format(end).equals(sd.format(endMonthLastDay)) ){ - int months = WxRentContractHelper.getMonths(sd.format(start),sd.format(end)); - months++; - if (months > 0 ) { - return priceMonth.multiply(new BigDecimal(months)).toPlainString(); - }else { - return priceMonth.toPlainString(); - } - }else { - Date startMonthEndDay = DateUtils.getLastDayForMonth(start); - int startDays = DateUtils.daysBetween(start, startMonthEndDay); - int startMonthDays = DateUtils.daysBetween(startMonthFirstDay, startMonthEndDay); - - Date endMontFirstDay = DateUtils.getFirstDayForCurrMonth(end); - int endDays = DateUtils.daysBetween(endMontFirstDay, end); - int endMonthDays = DateUtils.daysBetween(endMontFirstDay, endMonthLastDay); - - int months = WxRentContractHelper.getMonths(sd.format(DateUtils.getDaySet(startMonthEndDay, Calendar.DATE, 1)),sd.format(DateUtils.getDaySet(endMontFirstDay, Calendar.DATE, -1))); - months++; - - if (startDays > 0 ) { - priceMonth = priceMonth.multiply(new BigDecimal(startDays)).divide(new BigDecimal(startMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - - if (endDays > 0 ) { - priceMonth = priceMonth.multiply(new BigDecimal(endDays)).divide(new BigDecimal(endMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - - if (months > 0 ) { - priceMonth = priceMonth.multiply(new BigDecimal(months)); - } - - return priceMonth.toPlainString(); - - } - } - } - -} - diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index 1d72d5c24..043ff5e71 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -307,21 +307,21 @@ public class WxPropertyContract extends TenantEntity { return shopList; } - public List getFeesStardarsList() { + public List getFeesStardarsList() { if (StringUtils.isNotBlank(feesStandardsInfo)) { - return JSON.parseArray(feesStandardsInfo, WxFeesStandards.class); + return JSON.parseArray(feesStandardsInfo, WxEnergyFees.class); } return null; } @TableField(exist = false) - List unFixedfeeStandards; - public List getUnFixedfeeStandards() { - List fees = this.getFeesStardarsList(); + List unFixedfeeStandards; + public List getUnFixedfeeStandards() { + List fees = this.getFeesStardarsList(); if (null != fees && fees.size() > 0 ) { - List unfixed = new ArrayList(); + List unfixed = new ArrayList(); for (int i = 0 ; i < fees.size() ; i++ ) { - WxFeesStandards fs = fees.get(i); + WxEnergyFees fs = fees.get(i); if (fs.getFixedPrice().intValue() == EnumYesOrNo.NO.getCode().intValue()) { unfixed.add(fs); } @@ -342,7 +342,7 @@ public class WxPropertyContract extends TenantEntity { private List merchantIds; @TableField(exist = false) - List feeStandards; + List feeStandards; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java index a4498c105..ff0da3d61 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java @@ -4,7 +4,7 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; -import com.iformall.domain.po.WxFeesStandards; +import com.iformall.domain.po.WxEnergyFees; @Data public class WxBillFeesStandardsListVo implements Serializable { @@ -14,7 +14,7 @@ public class WxBillFeesStandardsListVo implements Serializable { private Date start; private Date end; private Date receiveDate; - private WxFeesStandards feeStandards; + private WxEnergyFees feeStandards; private Long parentBillId; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java b/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java index fdb46b80d..402ad1f90 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java @@ -1,16 +1,19 @@ package com.iformall.enums; +import java.util.ArrayList; +import java.util.List; + public enum EnumBillAllType { - RENT(1,"租金",1L), - RENT_BUSSINESS_MANAGE(11,"商业管理费",2L), - RENT_OPERATION_MANAGE(12,"运营管理费",3L), - RENT_DEPOSIT(13,"租赁押金",4L), - PROPERTY(2,"物业费",5L), - PROPERTY_DEPOSIT(21,"物业押金",6L), - DAILY(3, "日常(水电空调)费",null), - OTHER(4, "其他费用",null), - OTHER_DEPOSIT(5, "其他押金",null) + RENT(1,"租金",1L,false), + RENT_BUSSINESS_MANAGE(11,"商业管理费",2L,false), + RENT_OPERATION_MANAGE(12,"运营管理费",3L,false), + RENT_DEPOSIT(13,"租赁押金",4L,true), + PROPERTY(2,"物业费",5L,false), + PROPERTY_DEPOSIT(21,"物业押金",6L,true), + DAILY(3, "日常(水电空调)费",null,false), + OTHER(4, "其他费用",null,false), + OTHER_DEPOSIT(5, "其他押金",null,true) ; public static EnumBillAllType getEnum(Integer code) { @@ -24,12 +27,14 @@ public enum EnumBillAllType { private Integer code; private String message; - private Long energyFeesId;//wx_energy_fees里的id,系统内置的有这个 + private Long energyFeesId;//wx_energy_fees(费用科目)里的id,系统内置的有这个 + private boolean isFixedPrice;//是否强制为一次性费用 - EnumBillAllType(Integer code, String message,Long energyFeesId) { + EnumBillAllType(Integer code, String message,Long energyFeesId,boolean isFixedPrice) { this.code = code; this.message = message; this.energyFeesId = energyFeesId; + this.isFixedPrice = isFixedPrice; } public Integer getCode() { @@ -43,21 +48,45 @@ public enum EnumBillAllType { public Long getEnergyFeesId() { return energyFeesId; } + + public boolean isFixedPrice() { + return isFixedPrice; + } public static EnumBillAllType[] getSystemTypes() { EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE,RENT_DEPOSIT, PROPERTY,PROPERTY_DEPOSIT}; return ret; } - - public static EnumBillAllType[] getFinanceTypes() { - EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE,RENT_DEPOSIT, - PROPERTY,PROPERTY_DEPOSIT,OTHER,OTHER_DEPOSIT}; + + //可以自定义科目的非能源类型 + public static EnumBillAllType[] getOperateNotEnergyTypes() { + EnumBillAllType[] ret = new EnumBillAllType[] {RENT_DEPOSIT,PROPERTY,OTHER,OTHER_DEPOSIT}; return ret; } - public static EnumBillAllType[] getFinanceOperateTypes() { - EnumBillAllType[] ret = new EnumBillAllType[] {OTHER,OTHER_DEPOSIT}; - return ret; + public static List getCalucuteUnites(Integer type) { + //需要计算的费用,非一次性费用 + List retList = new ArrayList(); + if (type.intValue() == RENT.getCode().intValue() || type.intValue() == RENT_BUSSINESS_MANAGE.getCode().intValue() + || type.intValue() == RENT_OPERATION_MANAGE.getCode().intValue() || type.intValue() == PROPERTY.getCode().intValue()) { + retList.add(EnumFeesStandardsCalcuteUnit.MM); + retList.add(EnumFeesStandardsCalcuteUnit.HU); + }else if (type.intValue() == DAILY.getCode().intValue()) { + retList.add(EnumFeesStandardsCalcuteUnit.DIAN_DU); + retList.add(EnumFeesStandardsCalcuteUnit.SHUI_DUN); + } + if (retList.size() > 0 ) { + return retList; + } + return null; + } + + public static List getTimeUnites(Integer type) { + List retList = new ArrayList(); + retList.add(EnumFeesStandardsTimeUnit.DAY); + retList.add(EnumFeesStandardsTimeUnit.MONTH); + retList.add(EnumFeesStandardsTimeUnit.YEAR); + return retList; } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumFeesStandardsType.java b/mallinkService/src/main/java/com/iformall/enums/EnumFeesStandardsType.java deleted file mode 100644 index a045859c9..000000000 --- a/mallinkService/src/main/java/com/iformall/enums/EnumFeesStandardsType.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.iformall.enums; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author gongbiao - */ - -public enum EnumFeesStandardsType { - PROPERTY_CONTRACT(1, "物业合同费用标准"), - DAILY_BILL(2, "日常费用标准"); - - public static EnumFeesStandardsType getEnum(Integer code) { - for (EnumFeesStandardsType value : values()) { - if (value.getCode().equals(code)) { - return value; - } - } - return null; - } - - private Integer code; - private String message; - - EnumFeesStandardsType(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getMessage() { - return message; - } - - public static List getCalucuteUnites(Integer type) { - List retList = new ArrayList(); - if (type.intValue() == PROPERTY_CONTRACT.getCode().intValue()) { - retList.add(EnumFeesStandardsCalcuteUnit.MM); - retList.add(EnumFeesStandardsCalcuteUnit.HU); - return retList; - }else if (type.intValue() == DAILY_BILL.getCode().intValue()) { - retList.add(EnumFeesStandardsCalcuteUnit.DIAN_DU); - retList.add(EnumFeesStandardsCalcuteUnit.SHUI_DUN); - return retList; - } - return null; - } - - public static List getTimeUnites(Integer type) { - List retList = new ArrayList(); - retList.add(EnumFeesStandardsTimeUnit.DAY); - retList.add(EnumFeesStandardsTimeUnit.MONTH); - retList.add(EnumFeesStandardsTimeUnit.YEAR); - return retList; - } - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFeesStandardsMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFeesStandardsMapper.java deleted file mode 100644 index 3fb49406f..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxFeesStandardsMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxFeesStandards; -import java.util.List; - - -/** - */ -public interface WxFeesStandardsMapper extends CommonMapper { - - List findList(WxFeesStandards record); - - - WxFeesStandards getById(WxFeesStandards recordQ); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxFeesStandardsService.java b/mallinkService/src/main/java/com/iformall/service/WxFeesStandardsService.java deleted file mode 100644 index 793f74fc1..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxFeesStandardsService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.iformall.service; - -import java.util.List; - -import com.github.pagehelper.PageInfo; -import com.iformall.domain.po.WxFeesStandards; - -public interface WxFeesStandardsService { - - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxFeesStandards record, Integer pageIndex, Integer pageSize); - - List list(WxFeesStandards record); - - /** - * id+tenantId - * @param - * @return - */ - WxFeesStandards getById(Long id, String tenantId); - - -} diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index 2bb2d7807..6b61de1fb 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -2,7 +2,7 @@ package com.iformall.service.helper; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.iformall.domain.po.WxFeesStandards; +import com.iformall.domain.po.WxEnergyFees; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.WxBillFeesStandardsListVo; import com.iformall.enums.*; @@ -477,14 +477,14 @@ public class WxRentContractHelper { } //其他标准计费项 - public static List getStandardsBillList(Integer decimalSize,List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { + public static List getStandardsBillList(Integer decimalSize,List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { if (null == feesStandarsList || feesStandarsList.size() <= 0 ) { return null; } List retList = new ArrayList(); for (int i = 0 ; i < feesStandarsList.size() ; i ++) { WxBillFeesStandardsListVo vo = new WxBillFeesStandardsListVo(); - WxFeesStandards fees = feesStandarsList.get(i); + WxEnergyFees fees = feesStandarsList.get(i); vo.setBillName(fees.getName()); //如果是一次性的,账单只有一个 if (isFixed) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFeesStandardsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFeesStandardsServiceImpl.java deleted file mode 100644 index b23ea87e3..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFeesStandardsServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.iformall.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.domain.po.*; -import com.iformall.mapper.WxFeesStandardsMapper; -import com.iformall.service.*; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class WxFeesStandardsServiceImpl implements WxFeesStandardsService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxFeesStandardsMapper wxFeesStandardsMapper; - - @Override - public PageInfo listAsPage(WxFeesStandards record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFeesStandardsMapper.findList(record)); - } - - @Override - public WxFeesStandards getById(Long id, String tenantId) { - WxFeesStandards recordQ = new WxFeesStandards(); - recordQ.setId(id); - recordQ.setTenantId(tenantId); - return wxFeesStandardsMapper.getById(recordQ); - } - - @Override - public List list(WxFeesStandards record) { - return wxFeesStandardsMapper.findList(record); - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 191440d20..0fb0ed8d0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -880,7 +880,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService BigDecimal total = new BigDecimal(0); for (int j = 0 ; j < unFixedList.size(); j ++) { WxBillFeesStandardsListVo bfsvo = unFixedList.get(j); - WxFeesStandards feeStandars = bfsvo.getFeeStandards(); + WxEnergyFees feeStandars = bfsvo.getFeeStandards(); if(EnumFeesStandardsCalcuteUnit.MM.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,wxPropertyContract.getRentArea(),false)); }else if (EnumFeesStandardsCalcuteUnit.HU.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { diff --git a/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml b/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml index f230a1ce5..e0cd2b9e4 100644 --- a/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml @@ -14,10 +14,13 @@ + + + - `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`public_calcute`,`type`,`bill_type`,`is_system` + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`public_calcute`,`type`,`bill_type`,`is_system`,`fixed_price`,`calcute_unit`,`time_unit` @@ -35,6 +38,9 @@ and `bill_type` = #{billType} and `bill_type` != 3 and `is_system` = #{isSystem} + and `fixed_price` = #{fixedPrice} + and `calcute_unit` = #{calcuteUnit} + and `time_unit` = #{timeUnit} and name like concat('%', #{name},'%') and id in diff --git a/mallinkService/src/main/resources/mapper/WxFeesStandardsMapper.xml b/mallinkService/src/main/resources/mapper/WxFeesStandardsMapper.xml deleted file mode 100644 index a16c792a7..000000000 --- a/mallinkService/src/main/resources/mapper/WxFeesStandardsMapper.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`is_del`,`name`,`update_time`,`create_time`,`price`,`type`,`fixed_price`,`calcute_unit`,`time_unit` - - - - - where 1 = 1 - and `id` = #{id} - and `tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} - and `is_del` = #{isDel} - and `name` like concat('%', #{name},'%') - and `type` = #{type} - and `fixed_price` = #{fixedPrice} - and `calcute_unit` = #{calcuteUnit} - and `time_unit` = #{timeUnit} - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - -