| @@ -1,17 +1,18 @@ | |||
| package com.iformall.controller.contract; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.*; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxRentContractDepositType") | |||
| @@ -19,7 +20,7 @@ public class WxRentContractDepositTypeController extends WxContractBaseControlle | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| WxEnergyService wxEnergyService; | |||
| /** | |||
| * 押金类型 | |||
| @@ -27,19 +28,17 @@ public class WxRentContractDepositTypeController extends WxContractBaseControlle | |||
| */ | |||
| @GetMapping("list") | |||
| public ResultData billTypes() { | |||
| WxRentContractDepositType dt = new WxRentContractDepositType(); | |||
| WxEnergyFees dt = new WxEnergyFees(); | |||
| dt.updateTenantInfo(getTenantInfo()); | |||
| dt.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| List<WxRentContractDepositType> types = wxRentContractService.findDepositTypes(dt); | |||
| return new ResultData(types); | |||
| dt.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); | |||
| dt.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(dt, 1, 100); | |||
| if (null == page) { | |||
| return new ResultData(); | |||
| } | |||
| return new ResultData(page.getList()); | |||
| } | |||
| @PostMapping("save") | |||
| public ResultData add(@RequestBody WxRentContractDepositType wxRentContract) { | |||
| wxRentContract.updateTenantInfo(getTenantInfo()); | |||
| wxRentContractService.saveOrUpdateDepositType(wxRentContract); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxEnergyMeterReading; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcute; | |||
| import com.iformall.domain.po.WxUserDataRule; | |||
| 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.EnumYesOrNo; | |||
| @@ -166,7 +167,7 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("费用科目列表") | |||
| @ApiOperation("能源科目列表") | |||
| @GetMapping("feesList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -175,6 +176,7 @@ public class WxEnergyController extends BaseController { | |||
| public ResultData feesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| record.setBillType(EnumBillAllType.DAILY.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -183,6 +185,16 @@ public class WxEnergyController extends BaseController { | |||
| @PostMapping("saveFees") | |||
| public ResultData saveFees(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setBillType(EnumBillAllType.DAILY.getCode()); | |||
| if (null == record.getType()) { | |||
| return new ResultData(Result.ERROR,"请选择能源表类型"); | |||
| } | |||
| if (null == record.getPublicCalcute()) { | |||
| return new ResultData(Result.ERROR,"请选择分摊计费规则"); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getPrice())) { | |||
| return new ResultData(Result.ERROR,"单价不能为空"); | |||
| } | |||
| wxEnergyService.saveOrUpdateFees(record); | |||
| return new ResultData(); | |||
| } | |||
| @@ -6,9 +6,13 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxBillPayWay; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxFinanceAdvanceType; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumFinanceType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFinanceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -35,6 +39,8 @@ public class WxFinanceController extends BaseController { | |||
| @Autowired | |||
| private WxFinanceService wxFinanceService; | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| @ApiOperation("财务类型") | |||
| @GetMapping("financeTypeList") | |||
| @@ -46,6 +52,61 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(retMap); | |||
| } | |||
| /** | |||
| * 账单类型(非能源) | |||
| * @return | |||
| */ | |||
| @GetMapping("billTypes") | |||
| public ResultData billTypes() { | |||
| Map<Integer,String> tmap = new HashMap<Integer,String>(); | |||
| for (EnumBillAllType t : EnumBillAllType.getFinanceTypes()) { | |||
| tmap.put(t.getCode(), t.getMessage()); | |||
| } | |||
| return new ResultData(tmap); | |||
| } | |||
| //可以管理的类型 | |||
| @GetMapping("operateBillTypes") | |||
| public ResultData operateBillTypes() { | |||
| Map<Integer,String> tmap = new HashMap<Integer,String>(); | |||
| for (EnumBillAllType t : EnumBillAllType.getFinanceOperateTypes()) { | |||
| tmap.put(t.getCode(), t.getMessage()); | |||
| } | |||
| return new ResultData(tmap); | |||
| } | |||
| @ApiOperation("费用科目列表") | |||
| @GetMapping("feesList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData feesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| //查询非能源费用科目 | |||
| record.setNotEnergy(EnumYesOrNo.YES.getCode()); | |||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @PostMapping("saveFees") | |||
| public ResultData saveFees(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| if (null == record.getBillType()) { | |||
| return new ResultData(Result.ERROR,"请选择绑定账单类型"); | |||
| } | |||
| wxEnergyService.saveOrUpdateFees(record); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("feesUpdateIsDel") | |||
| public ResultData feesUpdateIsDel(@RequestBody WxEnergyFees record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxEnergyService.setFeesIsDel(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("支付方式列表") | |||
| @GetMapping("payWayList") | |||
| @@ -66,21 +66,6 @@ CREATE TABLE `wx_energy_fees_time` ( | |||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| CREATE TABLE `wx_energy_fees` ( | |||
| `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, | |||
| `is_del` int(1) NOT NULL DEFAULT '0', | |||
| `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', | |||
| `price` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '单价', | |||
| `public_calcute` int(1) NOT NULL COMMENT '公摊计费规则', | |||
| `type` int(1) NOT NULL COMMENT '表类型', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| CREATE TABLE `wx_energy_reading_calcute` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| @@ -1482,6 +1467,126 @@ INSERT INTO wx_bill_pay_way_89 (id,tenant_id,parent_tenant_id,create_time,update | |||
| VALUES (1,'789',NULL,NOW(),NOW(),0,'商户小程序',1), (2,'789',NULL,NOW(),NOW(),0,'系统自动结清',1); | |||
| CREATE TABLE `wx_energy_fees` ( | |||
| `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, | |||
| `is_del` int(1) NOT NULL DEFAULT '0', | |||
| `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', | |||
| `price` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单价', | |||
| `public_calcute` int(1) DEFAULT NULL COMMENT '公摊计费规则', | |||
| `type` int(1) DEFAULT NULL COMMENT '表类型', | |||
| `bill_type` int(11) NOT NULL COMMENT '所属账单类型', | |||
| `is_system` int(1) NOT NULL DEFAULT '0' COMMENT '是否系统内置', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| create table wx_energy_fees_0 like wx_energy_fees; | |||
| create table wx_energy_fees_1 like wx_energy_fees; | |||
| create table wx_energy_fees_2 like wx_energy_fees; | |||
| create table wx_energy_fees_3 like wx_energy_fees; | |||
| create table wx_energy_fees_4 like wx_energy_fees; | |||
| create table wx_energy_fees_5 like wx_energy_fees; | |||
| create table wx_energy_fees_6 like wx_energy_fees; | |||
| create table wx_energy_fees_7 like wx_energy_fees; | |||
| create table wx_energy_fees_8 like wx_energy_fees; | |||
| create table wx_energy_fees_9 like wx_energy_fees; | |||
| create table wx_energy_fees_10 like wx_energy_fees; | |||
| create table wx_energy_fees_11 like wx_energy_fees; | |||
| create table wx_energy_fees_12 like wx_energy_fees; | |||
| create table wx_energy_fees_13 like wx_energy_fees; | |||
| create table wx_energy_fees_14 like wx_energy_fees; | |||
| create table wx_energy_fees_15 like wx_energy_fees; | |||
| create table wx_energy_fees_16 like wx_energy_fees; | |||
| create table wx_energy_fees_17 like wx_energy_fees; | |||
| create table wx_energy_fees_18 like wx_energy_fees; | |||
| create table wx_energy_fees_19 like wx_energy_fees; | |||
| create table wx_energy_fees_20 like wx_energy_fees; | |||
| create table wx_energy_fees_21 like wx_energy_fees; | |||
| create table wx_energy_fees_22 like wx_energy_fees; | |||
| create table wx_energy_fees_23 like wx_energy_fees; | |||
| create table wx_energy_fees_24 like wx_energy_fees; | |||
| create table wx_energy_fees_25 like wx_energy_fees; | |||
| create table wx_energy_fees_26 like wx_energy_fees; | |||
| create table wx_energy_fees_27 like wx_energy_fees; | |||
| create table wx_energy_fees_28 like wx_energy_fees; | |||
| create table wx_energy_fees_29 like wx_energy_fees; | |||
| create table wx_energy_fees_30 like wx_energy_fees; | |||
| create table wx_energy_fees_31 like wx_energy_fees; | |||
| create table wx_energy_fees_32 like wx_energy_fees; | |||
| create table wx_energy_fees_33 like wx_energy_fees; | |||
| create table wx_energy_fees_34 like wx_energy_fees; | |||
| create table wx_energy_fees_35 like wx_energy_fees; | |||
| create table wx_energy_fees_36 like wx_energy_fees; | |||
| create table wx_energy_fees_37 like wx_energy_fees; | |||
| create table wx_energy_fees_38 like wx_energy_fees; | |||
| create table wx_energy_fees_39 like wx_energy_fees; | |||
| create table wx_energy_fees_40 like wx_energy_fees; | |||
| create table wx_energy_fees_41 like wx_energy_fees; | |||
| create table wx_energy_fees_42 like wx_energy_fees; | |||
| create table wx_energy_fees_43 like wx_energy_fees; | |||
| create table wx_energy_fees_44 like wx_energy_fees; | |||
| create table wx_energy_fees_45 like wx_energy_fees; | |||
| create table wx_energy_fees_46 like wx_energy_fees; | |||
| create table wx_energy_fees_47 like wx_energy_fees; | |||
| create table wx_energy_fees_48 like wx_energy_fees; | |||
| create table wx_energy_fees_49 like wx_energy_fees; | |||
| create table wx_energy_fees_50 like wx_energy_fees; | |||
| create table wx_energy_fees_51 like wx_energy_fees; | |||
| create table wx_energy_fees_52 like wx_energy_fees; | |||
| create table wx_energy_fees_53 like wx_energy_fees; | |||
| create table wx_energy_fees_54 like wx_energy_fees; | |||
| create table wx_energy_fees_55 like wx_energy_fees; | |||
| create table wx_energy_fees_56 like wx_energy_fees; | |||
| create table wx_energy_fees_57 like wx_energy_fees; | |||
| create table wx_energy_fees_58 like wx_energy_fees; | |||
| create table wx_energy_fees_59 like wx_energy_fees; | |||
| create table wx_energy_fees_60 like wx_energy_fees; | |||
| create table wx_energy_fees_61 like wx_energy_fees; | |||
| create table wx_energy_fees_62 like wx_energy_fees; | |||
| create table wx_energy_fees_63 like wx_energy_fees; | |||
| create table wx_energy_fees_64 like wx_energy_fees; | |||
| create table wx_energy_fees_65 like wx_energy_fees; | |||
| create table wx_energy_fees_66 like wx_energy_fees; | |||
| create table wx_energy_fees_67 like wx_energy_fees; | |||
| create table wx_energy_fees_68 like wx_energy_fees; | |||
| create table wx_energy_fees_69 like wx_energy_fees; | |||
| create table wx_energy_fees_70 like wx_energy_fees; | |||
| create table wx_energy_fees_71 like wx_energy_fees; | |||
| create table wx_energy_fees_72 like wx_energy_fees; | |||
| create table wx_energy_fees_73 like wx_energy_fees; | |||
| create table wx_energy_fees_74 like wx_energy_fees; | |||
| create table wx_energy_fees_75 like wx_energy_fees; | |||
| create table wx_energy_fees_76 like wx_energy_fees; | |||
| create table wx_energy_fees_77 like wx_energy_fees; | |||
| create table wx_energy_fees_78 like wx_energy_fees; | |||
| create table wx_energy_fees_79 like wx_energy_fees; | |||
| create table wx_energy_fees_80 like wx_energy_fees; | |||
| create table wx_energy_fees_81 like wx_energy_fees; | |||
| create table wx_energy_fees_82 like wx_energy_fees; | |||
| create table wx_energy_fees_83 like wx_energy_fees; | |||
| create table wx_energy_fees_84 like wx_energy_fees; | |||
| create table wx_energy_fees_85 like wx_energy_fees; | |||
| create table wx_energy_fees_86 like wx_energy_fees; | |||
| create table wx_energy_fees_87 like wx_energy_fees; | |||
| create table wx_energy_fees_88 like wx_energy_fees; | |||
| create table wx_energy_fees_89 like wx_energy_fees; | |||
| create table wx_energy_fees_90 like wx_energy_fees; | |||
| create table wx_energy_fees_91 like wx_energy_fees; | |||
| create table wx_energy_fees_92 like wx_energy_fees; | |||
| create table wx_energy_fees_93 like wx_energy_fees; | |||
| create table wx_energy_fees_94 like wx_energy_fees; | |||
| create table wx_energy_fees_95 like wx_energy_fees; | |||
| create table wx_energy_fees_96 like wx_energy_fees; | |||
| create table wx_energy_fees_97 like wx_energy_fees; | |||
| create table wx_energy_fees_98 like wx_energy_fees; | |||
| create table wx_energy_fees_99 like wx_energy_fees; | |||
| drop table wx_energy_fees; | |||
| CREATE TABLE `wx_finance_advance_type` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| @@ -1497,3 +1602,6 @@ CREATE TABLE `wx_finance_advance_type` ( | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| @@ -442,6 +442,13 @@ public class BaseMyBatisConfiguration { | |||
| wxBillPayWaySharding.setRule(EnumShardingRule.HASH.getCode()); | |||
| shardingList.add(wxBillPayWaySharding); | |||
| ShardingSphere wxEnergyFeesSharding = new ShardingSphere(); | |||
| wxEnergyFeesSharding.setColumn("tenant_id"); | |||
| wxEnergyFeesSharding.setTableName("wx_energy_fees"); | |||
| wxEnergyFeesSharding.setCount(100); | |||
| wxEnergyFeesSharding.setRule(EnumShardingRule.HASH.getCode()); | |||
| shardingList.add(wxEnergyFeesSharding); | |||
| //初始化 | |||
| shardingSpherePlugin.setShardingSpheres(shardingList); | |||
| Properties properties = new Properties(); | |||
| @@ -1,7 +1,10 @@ | |||
| package com.iformall.domain.po; | |||
| 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 lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @@ -41,4 +44,21 @@ public class WxEnergyFees extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "表类型EnumEnergyMeterType", name = "type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value = "所属账单类型EnumBillAllType", name = "billType") | |||
| private Integer billType; | |||
| @TableField(exist = false) | |||
| private String billTypeName; | |||
| public String getBillTypeName() { | |||
| if (null != billType) { | |||
| return EnumBillAllType.getEnum(billType).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否系统内置", name = "isSystem") | |||
| private Integer isSystem; | |||
| @TableField(exist = false) | |||
| private Integer notEnergy; | |||
| } | |||
| @@ -521,7 +521,7 @@ public class WxRentContract extends TenantEntity { | |||
| return sb.toString(); | |||
| } | |||
| public String getDepositDetail(Map<Long,WxRentContractDepositType> typeMap) { | |||
| public String getDepositDetail(Map<Long,WxEnergyFees> typeMap) { | |||
| StringBuffer sb = new StringBuffer(""); | |||
| String dsdstr = this.getCashtypeContentLsit(); | |||
| if (!StringUtils.isBlank(dsdstr) && null != typeMap) { | |||
| @@ -532,7 +532,7 @@ public class WxRentContract extends TenantEntity { | |||
| String depositType = rentInfoObject.getString("value"); | |||
| String deposit = rentInfoObject.getString("deposit"); | |||
| Long dt = Long.parseLong(depositType); | |||
| WxRentContractDepositType dtt = typeMap.get(dt); | |||
| WxEnergyFees dtt = typeMap.get(dt); | |||
| if (null != dtt) { | |||
| sb.append(dtt.getName()).append(":").append(deposit).append(","); | |||
| } | |||
| @@ -1,33 +0,0 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @TableName(value = "wx_rent_contract_deposit_type") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxRentContractDepositType 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; | |||
| } | |||
| @@ -1,17 +1,16 @@ | |||
| package com.iformall.enums; | |||
| public enum EnumBillAllType { | |||
| RENT(1,"租金"), | |||
| RENT_BUSSINESS_MANAGE(11,"商业管理费"), | |||
| RENT_OPERATION_MANAGE(12,"运营管理费"), | |||
| RENT_DEPOSIT(13,"租赁押金"), | |||
| PROPERTY(2,"物业费"), | |||
| PROPERTY_DEPOSIT(21,"物业押金"), | |||
| DAILY(3, "日常(水电空调)费"), | |||
| OTHER(4, "其他费用"), | |||
| OTHER_DEPOSIT(5, "其他押金") | |||
| 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) | |||
| ; | |||
| public static EnumBillAllType getEnum(Integer code) { | |||
| @@ -25,10 +24,12 @@ public enum EnumBillAllType { | |||
| private Integer code; | |||
| private String message; | |||
| private Long energyFeesId;//wx_energy_fees里的id,系统内置的有这个 | |||
| EnumBillAllType(Integer code, String message) { | |||
| EnumBillAllType(Integer code, String message,Long energyFeesId) { | |||
| this.code = code; | |||
| this.message = message; | |||
| this.energyFeesId = energyFeesId; | |||
| } | |||
| public Integer getCode() { | |||
| @@ -38,4 +39,25 @@ public enum EnumBillAllType { | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| public Long getEnergyFeesId() { | |||
| return energyFeesId; | |||
| } | |||
| 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}; | |||
| return ret; | |||
| } | |||
| public static EnumBillAllType[] getFinanceOperateTypes() { | |||
| EnumBillAllType[] ret = new EnumBillAllType[] {OTHER,OTHER_DEPOSIT}; | |||
| return ret; | |||
| } | |||
| } | |||
| @@ -1,14 +0,0 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRentContractDepositType; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxRentContractDepositTypeMapper extends CommonMapper<WxRentContractDepositType, Long> { | |||
| List<WxRentContractDepositType> findList(WxRentContractDepositType wxRentContract); | |||
| } | |||
| @@ -43,6 +43,7 @@ public interface WxEnergyService { | |||
| WxEnergyFees getFeesById(WxEnergyFees record); | |||
| void setFeesIsDel(WxEnergyFees record); | |||
| Map<Long,WxEnergyFees> getFeesMap(WxEnergyFees record); | |||
| void initEnergyFees(TenantEntity tenantEntity); | |||
| //抄表数据 | |||
| PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, Integer pageSize); | |||
| @@ -6,7 +6,6 @@ import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.WxRentContractDepositType; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @@ -146,8 +145,4 @@ public interface WxRentContractService { | |||
| void calcuteByTradeDaily(WxRentContract wxRentContract); | |||
| List<WxRentContractDepositType> findDepositTypes(WxRentContractDepositType rentContract); | |||
| void saveOrUpdateDepositType(WxRentContractDepositType rentContract); | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumEnergyPublicCalcuteRule; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -255,6 +256,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateTime(date); | |||
| record.setUpdateTime(date); | |||
| record.setIsSystem(EnumYesOrNo.NO.getCode()); | |||
| try { | |||
| wxEnergyFeesMapper.insert(record); | |||
| } catch (Exception e) { | |||
| @@ -262,6 +264,13 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } else { | |||
| WxEnergyFees fees = this.getFeesById(record); | |||
| if (null == fees) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); | |||
| } | |||
| if (fees.getIsSystem().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "系统内置不能修改"); | |||
| } | |||
| record.setUpdateTime(date); | |||
| wxEnergyFeesMapper.updateById(record); | |||
| } | |||
| @@ -274,6 +283,13 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public void setFeesIsDel(WxEnergyFees record) { | |||
| WxEnergyFees fees = this.getFeesById(record); | |||
| if (null == fees) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); | |||
| } | |||
| if (fees.getIsSystem().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "系统内置不能修改"); | |||
| } | |||
| wxEnergyFeesMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||
| } | |||
| @@ -290,6 +306,22 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public void initEnergyFees(TenantEntity tenantEntity) { | |||
| for (EnumBillAllType t : EnumBillAllType.getSystemTypes()) { | |||
| WxEnergyFees fees = new WxEnergyFees(); | |||
| fees.setId(t.getEnergyFeesId()); | |||
| fees.setName(t.getMessage()); | |||
| fees.setIsSystem(EnumYesOrNo.YES.getCode()); | |||
| fees.setBillType(t.getCode()); | |||
| fees.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| Date date = new Date(); | |||
| fees.setCreateTime(date); | |||
| fees.setUpdateTime(date); | |||
| wxEnergyFeesMapper.insert(fees); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -875,4 +907,6 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| } | |||
| } | |||
| @@ -70,7 +70,8 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| WxBusinessService wxBusinessService; | |||
| @Autowired | |||
| WxFinanceService wxFinanceService; | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @@ -163,6 +164,8 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| wxPayAccountBillService.payAccountBillInit(wxMall.getTenantInfo()); | |||
| //wx_bill_pay_way | |||
| wxFinanceService.payWayInit(wxMall.getTenantInfo()); | |||
| //wx_energy_fees | |||
| wxEnergyService.initEnergyFees(wxMall.getTenantInfo()); | |||
| } | |||
| wxMallService.update(wxMall); | |||
| } | |||
| @@ -130,13 +130,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; | |||
| @Autowired | |||
| WxRentContractDepositTypeMapper wxRentContractDepositTypeMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxBillAllHelper wxBillAllHelper; | |||
| @Lazy | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| // @Override | |||
| // public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| // //Object rentContractStatusInfo = getRentContractStatusInfo(record); | |||
| @@ -939,9 +940,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) | |||
| && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { | |||
| WxRentContractDepositType dt = new WxRentContractDepositType(); | |||
| dt.updateTenantInfo(wxRentContract); | |||
| Map<Long,WxRentContractDepositType> typeMap = findDepositTypesMap(dt); | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(fq); | |||
| fq.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); | |||
| Map<Long,WxEnergyFees> typeMap = wxEnergyService.getFeesMap(fq); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxBillDeposit wxBillDeposit = new WxBillDeposit(); | |||
| @@ -3446,36 +3448,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return new BigDecimal(sumMoney); | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxRentContractDepositType> findDepositTypes(WxRentContractDepositType rentContract) { | |||
| return wxRentContractDepositTypeMapper.findList(rentContract); | |||
| } | |||
| private Map<Long,WxRentContractDepositType> findDepositTypesMap(WxRentContractDepositType rentContract) { | |||
| List<WxRentContractDepositType> types = findDepositTypes(rentContract); | |||
| if (null != types && types.size() > 0 ) { | |||
| Map<Long,WxRentContractDepositType> tmap = new HashMap<Long,WxRentContractDepositType>(); | |||
| for (int i = 0 ; i < types.size(); i++ ) { | |||
| WxRentContractDepositType dt = types.get(i); | |||
| tmap.put(dt.getId(), dt); | |||
| } | |||
| return tmap; | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public void saveOrUpdateDepositType(WxRentContractDepositType rentContract) { | |||
| if (null == rentContract.getId()) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| rentContract.setId(idWorker.nextId()); | |||
| rentContract.setCreateTime(new Date()); | |||
| rentContract.setUpdateTime(new Date()); | |||
| wxRentContractDepositTypeMapper.insert(rentContract); | |||
| }else { | |||
| rentContract.setUpdateTime(new Date()); | |||
| wxRentContractDepositTypeMapper.updateById(rentContract); | |||
| } | |||
| } | |||
| } | |||
| @@ -12,10 +12,12 @@ | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="public_calcute" jdbcType="INTEGER" property="publicCalcute"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="is_system" jdbcType="INTEGER" property="isSystem"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`public_calcute`,`type` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`public_calcute`,`type`,`bill_type`,`is_system` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -30,6 +32,9 @@ | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != publicCalcute ">and `public_calcute` = #{publicCalcute}</if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != billType ">and `bill_type` = #{billType}</if> | |||
| <if test=" null != notEnergy ">and `bill_type` != 3</if> | |||
| <if test=" null != isSystem ">and `is_system` = #{isSystem}</if> | |||
| <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -1,42 +0,0 @@ | |||
| <?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.WxRentContractDepositTypeMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractDepositType"> | |||
| <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="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`is_del`,`name`,`update_time`,`create_time` | |||
| </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 != isDel">and `is_del` = #{isDel}</if> | |||
| <if test=" null != name and '' != name">and `name` like concat('%', #{name},'%') </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.WxRentContractDepositType" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_rent_contract_deposit_type | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||