| @@ -22,9 +22,12 @@ import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumFeesShopTimeType; | |||
| import com.iformall.enums.EnumFeesShopTimeUnit; | |||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | |||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| import com.iformall.enums.EnumFinanceCashierType; | |||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.enums.EnumeElectriType; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -390,6 +393,35 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("计算周期") | |||
| @GetMapping("feesShopTimeUnitList") | |||
| public ResultData feesShopTimeUnitList() { | |||
| Map<Integer,String> retMap = new HashMap<Integer,String>(); | |||
| for (EnumFeesShopTimeUnit mem : EnumFeesShopTimeUnit.values()) { | |||
| retMap.put(mem.getCode(), mem.getMessage()); | |||
| } | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("费用生成方式") | |||
| @GetMapping("feesShopTimeTypeList") | |||
| public ResultData feesShopTimeTypeList() { | |||
| Map<Integer,String> retMap = new HashMap<Integer,String>(); | |||
| for (EnumFeesShopTimeType mem : EnumFeesShopTimeType.values()) { | |||
| retMap.put(mem.getCode(), mem.getMessage()); | |||
| } | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("计费标准新增修改") | |||
| @PostMapping("calcuteFeesShopEndTime") | |||
| public ResultData calcuteFeesShopEndTime(@RequestBody WxEnergyFeesShop record) { | |||
| //TODO 待计算。 | |||
| Date endDate = new Date(); | |||
| return new ResultData(endDate); | |||
| } | |||
| @ApiOperation("计算公式组件") | |||
| @GetMapping("feesShopComponentList") | |||
| public ResultData shopFeesList(@ModelAttribute WxEnergyFeesShop record) { | |||
| @@ -274,6 +274,19 @@ ALTER TABLE wx_rent_contract ADD is_private_merchant INT(1) NOT NULL DEFAULT 0 C | |||
| ALTER TABLE wx_property_contract ADD is_private_merchant INT(1) NOT NULL DEFAULT 0 COMMENT '是否私密商户' AFTER merchant_id; | |||
| UPDATE mall_permission SET parent_id = 440,sort = 44002 WHERE id = 43907; | |||
| UPDATE mall_permission SET parent_id = 440,sort = 44003 WHERE id = 43905; | |||
| UPDATE mall_permission SET sort = 44009 WHERE id = 44002; | |||
| ALTER TABLE wx_energy_fees_shop ADD COLUMN time_unit INT(1) COMMENT '计费周期'; | |||
| ALTER TABLE wx_energy_fees_shop ADD COLUMN time_type INT(1) COMMENT '费用生成方式'; | |||
| ALTER TABLE wx_energy_fees_shop ADD COLUMN begin_time TIMESTAMP COMMENT '开始日期'; | |||
| ALTER TABLE wx_energy_fees_shop ADD COLUMN end_time TIMESTAMP COMMENT '终止日期'; | |||
| ALTER TABLE wx_energy_reading_calcute_result ADD COLUMN begin_time TIMESTAMP COMMENT '开始日期'; | |||
| ALTER TABLE wx_energy_reading_calcute_result ADD COLUMN end_time TIMESTAMP COMMENT '终止日期'; | |||
| @@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumFeesShopTimeType; | |||
| import com.iformall.enums.EnumFeesShopTimeUnit; | |||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| @@ -62,6 +65,36 @@ public class WxEnergyFeesShop extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String floorName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "计费周期EnumFeesShopTimeUnit", name = "timeUnit") | |||
| private Integer timeUnit; | |||
| @TableField(exist = false) | |||
| private String timeUnitName; | |||
| public String getTimeUnitName() { | |||
| if (null != timeUnit) { | |||
| return EnumFeesShopTimeUnit.getEnum(timeUnit).getMessage(); | |||
| } | |||
| return ""; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "费用生成方式EnumFeesShopTimeType", name = "timeType") | |||
| private Integer timeType; | |||
| @TableField(exist = false) | |||
| private String timeTypeName; | |||
| public String getTimeTypeName() { | |||
| if (null != timeType) { | |||
| return EnumFeesShopTimeType.getEnum(timeType).getMessage(); | |||
| } | |||
| return ""; | |||
| } | |||
| @Excel(name = "开始日期", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="beginTime",name="beginTime") | |||
| private Date beginTime; | |||
| @Excel(name = "终止日期", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") | |||
| private Date endTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "公摊计算公司", name = "formula") | |||
| private String formula; | |||
| @io.swagger.annotations.ApiModelProperty(value = "公摊计算公式数组字符串", name = "formula") | |||
| @@ -70,6 +70,14 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="费用标准ID",name="feesCalcuteId") | |||
| private Long feesShopId; | |||
| @Excel(name = "开始日期", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="beginTime",name="beginTime") | |||
| private Date beginTime; | |||
| @Excel(name = "终止日期", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") | |||
| private Date endTime; | |||
| @Excel(name = "金额", width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="金额",name="money") | |||
| private String money; | |||
| @@ -85,7 +93,7 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String feesIdsStr; | |||
| public WxAllBill generateBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,WxShop shop,MallUserInfo user,String needPay,String detail,String remark) { | |||
| public WxAllBill generateBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,WxShop shop,MallUserInfo user,Date starttime,Date endtime,String needPay,String detail,String remark) { | |||
| WxAllBill daily = new WxAllBill(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| daily.setId(idWorker.nextId()); | |||
| @@ -100,8 +108,9 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity { | |||
| daily.setReceivePay(needPay); | |||
| daily.setNeedPay(needPay); | |||
| daily.setPay("0"); | |||
| daily.setStarttime(DateUtils.getDayBegin(new Date())); | |||
| daily.setEndtime(DateUtils.getDayEnd(new Date())); | |||
| daily.setReceiveDate(starttime); | |||
| daily.setStarttime(starttime); | |||
| daily.setEndtime(endtime); | |||
| daily.setOwe(needPay); | |||
| daily.setShopId(this.shopId); | |||
| daily.setShopNumber(shop.getShopNumber()); | |||
| @@ -112,6 +121,7 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity { | |||
| daily.setBillRemark(remark); | |||
| daily.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| daily.setEnergyReadingCalcuteId(calcute.getId()); | |||
| daily.setCanEdit(EnumYesOrNo.NO.getCode()); | |||
| daily.setEnergyReadingId(id); | |||
| return daily; | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| */ | |||
| public enum EnumFeesShopTimeType { | |||
| PERIOD(1, "按顺延周期生成"), | |||
| NATURE_PERIOD(2, "按自然周期生成"); | |||
| public static EnumFeesShopTimeType getEnum(Integer code) { | |||
| for (EnumFeesShopTimeType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumFeesShopTimeType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.enums; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import com.iformall.utils.Constant; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumFeesShopTimeUnit { | |||
| DAY(1, "日"), | |||
| MONTH(2, "月"), | |||
| QUATOR(3, "季度"), | |||
| HALF_YEAR(4, "半年"), | |||
| YEAR(5,"年"); | |||
| public static EnumFeesShopTimeUnit getEnum(Integer code) { | |||
| for (EnumFeesShopTimeUnit value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumFeesShopTimeUnit(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -770,7 +770,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| msf.setShopId(shopId); | |||
| msf.setIsPublic(fees.getIsPublic()); | |||
| msf.setFeesId(fees.getId()); | |||
| msf.setPrice(fees.getPrice()); | |||
| msf.setPrice(record.getPrice()); | |||
| if (fees.getIsPublic() == EnumYesOrNo.YES.getCode()) { | |||
| if (null == record.getFormulaList() || record.getFormulaList().size() <= 0 || StringUtils.isBlank(record.getFormula())) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请设置公式"); | |||
| @@ -1229,7 +1229,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| * 计算 | |||
| * 如果是公摊,肯定是能源费用,则从抄表数据里面取读数,然后计算 | |||
| * 如果是用户能源费用,则从抄表数据中读取数 | |||
| * 如果是非能源科目数据,则从公式计算。 | |||
| * 如果是非能源科目数据,则从公式计算。按照费用标准的时间来设置账单的时间 | |||
| * | |||
| */ | |||
| public void generateCalcuteResult(WxEnergyFees fees,WxEnergyReadingCalcute record,List<Long> shopIds) { | |||
| @@ -1360,6 +1360,14 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| cs.setMoney(wxEnergyHelper.calcuteMoney(sb,totalArea,shop,time, fees, shopfee,meterList,summaryMeterMap,buildingAreaMap,floorAreaMap)); | |||
| cs.setPeriod(record.getPeriod()); | |||
| cs.setMoneyDeail(sb.toString()); | |||
| //如果是能源的,从抄表周期里面取 | |||
| if (null != time) { | |||
| cs.setBeginTime(time.getStartTime()); | |||
| cs.setEndTime(time.getEndTime()); | |||
| }else { | |||
| cs.setBeginTime(shopfee.getBeginTime()); | |||
| cs.setEndTime(shopfee.getEndTime()); | |||
| } | |||
| resultList.add(cs); | |||
| } | |||
| } | |||
| @@ -1568,7 +1576,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| if (null == merchant) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未绑定商户,请先绑定商户"); | |||
| } | |||
| WxAllBill bill = result.generateBill(calcute, merchant, shop, user, result.getMoney(), result.getMoneyDeail(), "能源计算自动生成"); | |||
| WxAllBill bill = result.generateBill(calcute, merchant, shop, user,result.getBeginTime(),result.getEndTime(), result.getMoney(), result.getMoneyDeail(), "能源计算自动生成"); | |||
| billList.add(bill); | |||
| } | |||
| try { | |||
| @@ -14,10 +14,15 @@ | |||
| <result column="formula_content" jdbcType="VARCHAR" property="formulaContent"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| <result column="time_unit" jdbcType="INTEGER" property="timeUnit"/> | |||
| <result column="time_type" jdbcType="INTEGER" property="timeType"/> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`price`,`is_public`,`formula`,`formula_list_str`,`formula_content`,`shop_id`,`fees_id` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`price`,`is_public`,`formula`,`formula_list_str`,`formula_content`, | |||
| `shop_id`,`fees_id`,`time_unit`,`time_type`,`begin_time`,`end_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -15,10 +15,12 @@ | |||
| <result column="money" jdbcType="VARCHAR" property="money" /> | |||
| <result column="period" jdbcType="VARCHAR" property="period" /> | |||
| <result column="money_deail" jdbcType="VARCHAR" property="moneyDeail" /> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`calcute_id`,`shop_id`,`fees_id`,`fees_price`,`fees_shop_id`,`money`,`period`,`money_deail` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`calcute_id`,`shop_id`,`fees_id`,`fees_price`,`fees_shop_id`,`money`,`period`,`money_deail`,`begin_time`,`end_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -91,7 +93,7 @@ | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime},#{item.calcuteId}, | |||
| #{item.shopId},#{item.feesId},#{item.feesPrice},#{item.feesShopId},#{item.money},#{item.period},#{item.moneyDeail} | |||
| #{item.shopId},#{item.feesId},#{item.feesPrice},#{item.feesShopId},#{item.money},#{item.period},#{item.moneyDeail},#{item.beginTime},#{item.endTime} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||