diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java index 13d42ec81..b5a8b4bf3 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java @@ -207,7 +207,12 @@ public class WxAgileContractController extends WxContractBaseController { return new ResultData(Result.ERROR,"请至少增加一个"); } wxRentContract.updateTenantInfo(getTenantInfo()); - return wxAgileContractService.saveDeposit(wxRentContract); + try { + wxAgileContractService.saveDeposit(wxRentContract,this.getUser()); + }catch(Exception e) { + return new ResultData(Result.ERROR,"保存信息失败:"+e.getMessage()); + } + return new ResultData(); } /** @@ -215,7 +220,7 @@ public class WxAgileContractController extends WxContractBaseController { */ @GetMapping("getDeposits") public ResultData getDeposits(@ModelAttribute WxRentContract wxRentContract) { - //查询 + wxRentContract.updateTenantInfo(getTenantInfo()); return new ResultData(wxAgileContractService.findShopFeesDeposit(wxRentContract)); } @@ -224,7 +229,30 @@ public class WxAgileContractController extends WxContractBaseController { */ @PostMapping("addUnDeposits") public ResultData addUnDeposits(@RequestBody WxRentContractAgileUnDeposit unDeposit) { - return null; + unDeposit.updateTenantInfo(getTenantInfo()); + if (null == unDeposit.getItems() || unDeposit.getItems().size() <= 0 ) { + return new ResultData(Result.ERROR,"无细项"); + } + try { + wxAgileContractService.saveUnDeposit(unDeposit); + }catch(Exception e) { + return new ResultData(Result.ERROR,"保存信息失败:"+e.getMessage()); + } + try { + wxAgileContractService.createUnDepositBill(unDeposit,this.getUser()); + }catch(Exception e) { + return new ResultData(Result.ERROR,"保存账单失败:"+e.getMessage()); + } + return new ResultData(); + } + + /** + * 查询非押金 + */ + @GetMapping("getUnDeposits") + public ResultData getUnDeposits(@ModelAttribute WxRentContractAgileUnDeposit unDeposit) { + unDeposit.updateTenantInfo(getTenantInfo()); + return new ResultData(wxAgileContractService.findUnDeposit(unDeposit)); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index d5f38f2f7..148db53ce 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -92,6 +92,7 @@ public class WxRentContractController extends WxContractBaseController { wxRentContract.setIsPrivateMerchant(EnumYesOrNo.YES.getCode()); wxRentContract.setPrivateRentShopType(EnumRentShopType.XIZILOU.getCode()); } + wxRentContract.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); PageInfo page = wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize); Integer hasFlow = null; if (null != page && null != page.getList()) { diff --git a/mallinkAdmin/src/main/resources/db/migration/V202409000000004.sql b/mallinkAdmin/src/main/resources/db/migration/V202409000000004.sql new file mode 100644 index 000000000..bcba33337 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202409000000004.sql @@ -0,0 +1,100 @@ +ALTER TABLE wx_all_bill_0 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_1 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_2 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_3 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_4 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_5 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_6 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_7 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_8 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_9 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_10 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_11 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_12 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_13 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_14 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_15 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_16 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_17 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_18 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_19 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_20 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_21 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_22 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_23 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_24 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_25 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_26 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_27 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_28 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_29 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_30 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_31 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_32 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_33 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_34 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_35 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_36 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_37 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_38 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_39 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_40 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_41 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_42 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_43 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_44 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_45 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_46 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_47 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_48 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_49 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_50 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_51 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_52 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_53 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_54 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_55 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_56 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_57 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_58 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_59 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_60 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_61 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_62 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_63 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_64 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_65 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_66 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_67 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_68 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_69 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_70 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_71 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_72 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_73 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_74 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_75 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_76 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_77 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_78 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_79 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_80 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_81 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_82 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_83 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_84 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_85 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_86 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_87 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_88 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_89 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_90 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_91 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_92 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_93 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_94 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_95 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_96 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_97 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_98 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; +ALTER TABLE wx_all_bill_99 ADD COLUMN rent_contract_agile_fees_type INT(1) COMMENT '自定义合同费用类型'; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java index 06286f91f..b192ecd1b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java @@ -263,6 +263,9 @@ public class WxAllBill extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") public Long rentContractId; + @io.swagger.annotations.ApiModelProperty(value="自定义合同费用类型EnumRentContractAgileFeesType",name="rentContractAgileFeesType") + public Integer rentContractAgileFeesType; + @io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId") public Long propertyContractId; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java index db6570c03..d7b84b18b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java @@ -87,10 +87,13 @@ public class WxRentContractAgileUnDeposit extends TenantEntity { } @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") - private Date createTime; + private Date createtime; @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") - private Date updateTime; + private Date updatetime; + + @TableField(exist = false) + private List items; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java index e9d24b8bc..4a0d79c07 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java @@ -67,10 +67,10 @@ public class WxRentContractAgileUnDepositItem extends TenantEntity { } @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") - private Date createTime; + private Date createtime; @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") - private Date updateTime; + private Date updatetime; @io.swagger.annotations.ApiModelProperty(value="是否免租期",name="isFree") private Integer isFree; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgileFeesType.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgileFeesType.java new file mode 100644 index 000000000..4206737e0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgileFeesType.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + + +/** + * 账单额外创建来源 + */ + +public enum EnumRentContractAgileFeesType { + DEPOSIT(1,"押金类型"), + UN_DEPOSIT(2,"非押金类型") + ; + + public static EnumRentContractAgileFeesType getEnum(Integer code) { + for (EnumRentContractAgileFeesType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentContractAgileFeesType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java index 44acd3a34..4274f4c3b 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java @@ -15,5 +15,7 @@ public interface WxRentContractAgileUnDepositItemMapper extends CommonMapper findIdList(WxRentContractAgileUnDepositItem wxBillRent); + + void deleteByUnDeposit(WxRentContractAgileUnDepositItem wxBillRent); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java b/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java index 37748750d..6b8b13086 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java @@ -5,6 +5,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxRentContractAgileDeposit; +import com.iformall.domain.po.WxRentContractAgileUnDeposit; import java.util.List; @@ -18,7 +19,15 @@ public interface WxAgileContractService { ResultData saveOrUpdate(WxRentContract record,MallUserInfo user); - ResultData saveDeposit(WxRentContract wxRentContract); + void saveDeposit(WxRentContract wxRentContract,MallUserInfo user); + + void createDepositBill(WxRentContract wxRentContract,List depositList,MallUserInfo user); List findShopFeesDeposit(WxRentContract wxRentContract); + + void saveUnDeposit(WxRentContractAgileUnDeposit unDeposit); + + WxRentContractAgileUnDeposit findUnDeposit(WxRentContractAgileUnDeposit unDeposit); + + void createUnDepositBill(WxRentContractAgileUnDeposit unDeposit,MallUserInfo user); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java index 37e400833..f57743954 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java @@ -1,5 +1,7 @@ package com.iformall.service.impl; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -7,14 +9,24 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxAllBill; +import com.iformall.domain.po.WxEnergyFees; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxRentContractAgileDeposit; import com.iformall.domain.po.WxRentContractAgileDepositShop; +import com.iformall.domain.po.WxRentContractAgileUnDeposit; +import com.iformall.domain.po.WxRentContractAgileUnDepositItem; import com.iformall.domain.po.WxShop; +import com.iformall.enums.EnumBillAllType; +import com.iformall.enums.EnumBillExtraCreateFrom; +import com.iformall.enums.EnumRentContractAdjustPeriod; +import com.iformall.enums.EnumRentContractAgileFeesType; import com.iformall.enums.EnumRentContractAppStatus; import com.iformall.enums.EnumRentContractStatus; +import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxAllBillMapper; import com.iformall.mapper.WxBusinessMapper; import com.iformall.mapper.WxMerchantMapper; import com.iformall.mapper.WxRentContractAgileDepositMapper; @@ -26,9 +38,13 @@ import com.iformall.mapper.WxRentContractMapper; import com.iformall.mapper.WxShopMapper; import com.iformall.service.SysConfigService; import com.iformall.service.WxAgileContractService; +import com.iformall.service.WxEnergyService; import com.iformall.service.WxFlowRecordService; import com.iformall.service.WxMallService; import com.iformall.service.WxMerchantService; +import com.iformall.service.helper.WxRentContractHelper; +import com.iformall.utils.DateUtils; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,8 +54,11 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** */ @@ -47,9 +66,6 @@ import java.util.List; public class WxAgileContractServiceImpl implements WxAgileContractService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private String fmUploadDir; - @Autowired WxRentContractMapper wxRentContractMapper; @@ -68,30 +84,16 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { @Autowired WxRentContractFreePeriodMapper wxRentContractFreePeriodMapper; - @Autowired - WxShopMapper wxShopMapper; - @Lazy @Autowired WxMerchantService wxMerchantService; - @Autowired - WxMerchantMapper wxMerchantMapper; - - @Autowired - WxBusinessMapper wxBusinessMapper; - @Lazy @Autowired - WxMallService wxMallService; - - @Lazy + WxEnergyService wxEnergyService; + @Autowired - WxFlowRecordService wxFlowRecordService; - - @Lazy - @Autowired - SysConfigService sysConfigService; + WxAllBillMapper wxAllBillMapper; @Override public PageInfo getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { @@ -125,7 +127,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { record.setCreateBy(user.getId()); record.setCreateByName(user.getName()); } - WxMerchant merchant = wxMerchantMapper.selectById(record.getMerchantId()); + WxMerchant merchant = wxMerchantService.selectById(record.getMerchantId()); record.setIsPrivateMerchant(merchant.getIsPrivate()); record.setPrivateRentShopType(merchant.getCreateShopType()); record.setMerchantName(merchant.getName()); @@ -156,7 +158,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Override - public ResultData saveDeposit(WxRentContract wxRentContract) { + public void saveDeposit(WxRentContract wxRentContract,MallUserInfo user) { WxRentContract contract = this.selectById(wxRentContract.getId()); WxRentContractAgileDeposit cdq = new WxRentContractAgileDeposit(); cdq.updateTenantInfo(wxRentContract); @@ -195,7 +197,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { } } } - return new ResultData(); + createDepositBill(contract,wxRentContract.getContractDepositList(),user); } @@ -228,5 +230,153 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { } return depositList; } + + @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) + @Override + public void saveUnDeposit(WxRentContractAgileUnDeposit unDeposit) { + WxRentContract contract = wxRentContractMapper.selectById(unDeposit.getRentContractId()); + boolean isCreate = false; + final IdWorker idWorker = IdWorker.get(); + if (null == unDeposit.getId()) { + //保存租赁合同信息 + unDeposit.setId(idWorker.nextId()); + isCreate = true; + unDeposit.setCreatetime(new Date()); + } + unDeposit.setUpdatetime(new Date()); + if (isCreate) { + wxRentContractAgileUnDepositMapper.insert(unDeposit); + }else { + wxRentContractAgileUnDepositMapper.updateById(unDeposit); + WxRentContractAgileUnDepositItem itemdel = new WxRentContractAgileUnDepositItem(); + itemdel.updateTenantInfo(unDeposit); + itemdel.setUnDepositId(unDeposit.getId()); + wxRentContractAgileUnDepositItemMapper.deleteByUnDeposit(itemdel); + } + Date lastEndDate = null; + for (int i = 0 ; i < unDeposit.getItems().size(); i++) { + WxRentContractAgileUnDepositItem item = unDeposit.getItems().get(i); + //判断时间是不是连这的 + if (i == 0) { + lastEndDate = item.getEndTime(); + if (!item.getBeginTime().equals(contract.getRentalStartDate())) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"开始时间需要和合同开始时间一致"); + } + }else { + Date _curr = DateUtils.getSecondsTimeAfter(1, lastEndDate); + if (!_curr.equals(item.getBeginTime())) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"时间区间需要严格连接"); + } + } + + if (i == unDeposit.getItems().size()-1) { + if (!item.getEndTime().equals(contract.getRentalEndDate())) { + throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"结尾时间需要和合同结束时间一致"); + } + } + item.setRentContractId(unDeposit.getRentContractId()); + item.setUnDepositId(unDeposit.getId()); + item.setMerchantId(unDeposit.getMerchantId()); + item.setFeesId(unDeposit.getFeesId()); + item.setId(idWorker.nextId()); + item.setCreatetime(new Date()); + item.setUpdatetime(new Date()); + wxRentContractAgileUnDepositItemMapper.insert(item); + } + + } + + @Override + public WxRentContractAgileUnDeposit findUnDeposit(WxRentContractAgileUnDeposit unDeposit) { + WxRentContractAgileUnDeposit ud = wxRentContractAgileUnDepositMapper.selectById(unDeposit.getId(), unDeposit.getTenantId()); + if (null == ud) { + return null; + } + WxRentContractAgileUnDepositItem itemq = new WxRentContractAgileUnDepositItem(); + itemq.updateTenantInfo(ud); + itemq.setUnDepositId(unDeposit.getId()); + ud.setItems(wxRentContractAgileUnDepositItemMapper.findList(itemq)); + return ud; + } + + + @Override + public void createDepositBill(WxRentContract wxRentContract,List depositList,MallUserInfo user) { + //删除未生效的账单。 + WxAllBill wxBillDel = new WxAllBill(); + wxBillDel.updateTenantInfo(wxRentContract); + wxBillDel.setRentContractId(wxRentContract.getId()); + wxBillDel.setIsPreview(EnumYesOrNo.YES.getCode()); + wxBillDel.setRentContractAgileFeesType(EnumRentContractAgileFeesType.DEPOSIT.getCode()); + wxAllBillMapper.deletePreviewBill(wxBillDel); + + if (null == depositList || depositList.size() <= 0 ) { + return; + } + WxEnergyFees fq = new WxEnergyFees(); + fq.updateTenantInfo(wxRentContract); + Map typeMap = wxEnergyService.getFeesMap(fq); + + List insertList = new ArrayList(); + final IdWorker idWorker = IdWorker.get(); + for (int i = 0 ; i < depositList.size(); i++) { + WxRentContractAgileDeposit deposit = depositList.get(i); + WxEnergyFees fees = typeMap.get(deposit.getFeesId()); + WxAllBill wxBillDeposit = new WxAllBill(); + wxBillDeposit.setId(idWorker.nextId()); + wxBillDeposit.updateTenantInfo(wxRentContract); + wxBillDeposit.setRentContractId(wxRentContract.getId()); + wxBillDeposit.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); + wxBillDeposit.setIsPreview(EnumYesOrNo.YES.getCode()); + wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); + wxBillDeposit.setPriceDetail(fees.getName()); + wxBillDeposit.setPay("0"); + wxBillDeposit.setReceivePay(deposit.getPrice()); + wxBillDeposit.setNeedPay(deposit.getPrice()); + wxBillDeposit.setStarttime(wxRentContract.getRentalStartDate()); + wxBillDeposit.setEndtime(wxRentContract.getRentalEndDate()); + wxBillDeposit.setReceiveDate(wxRentContract.getRentalStartDate()); + wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(wxRentContract.getRentalStartDate())); + wxBillDeposit.updateTenantInfo(wxRentContract); + wxBillDeposit.setMerchantId(wxRentContract.getMerchantId()); + + WxRentContractAgileDepositShop shopq = new WxRentContractAgileDepositShop(); + shopq.updateTenantInfo(wxRentContract); + shopq.setRentContractId(wxRentContract.getId()); + List shopList = wxRentContractAgileDepositShopMapper.findList(shopq); + StringBuffer snstr = new StringBuffer(); + for (int j = 0 ; j < shopList.size() ; j ++) { + WxRentContractAgileDepositShop ds = shopList.get(j); + snstr.append(ds.getShopNumber()).append(","); + } + wxBillDeposit.setShopNumber(snstr.toString()); + //wxBillDeposit.setShopId(); + + wxBillDeposit.setRentArea(wxRentContract.getRentArea()); + wxBillDeposit.setCreatetime(new Date()); + wxBillDeposit.setCreateBy(user.getId()); + wxBillDeposit.setCreateByName(user.getName()); + wxBillDeposit.setUpdatetime(new Date()); + wxBillDeposit.setUpdateBy(user.getId()); + wxBillDeposit.setUpdateByName(user.getName()); + wxBillDeposit.setEnergyFeesId(deposit.getFeesId()); + wxBillDeposit.setRentContractAgileFeesType(EnumRentContractAgileFeesType.DEPOSIT.getCode()); + insertList.add(wxBillDeposit); + } + try { + if (insertList.size() > 0 ) { + wxAllBillMapper.insertBills(wxRentContract.getTenantId(),insertList); + } + } catch (Exception e) { + logger.error("添加押金账单失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + } + + + @Override + public void createUnDepositBill(WxRentContractAgileUnDeposit unDeposit,MallUserInfo user) { + + } } diff --git a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml index 010a81fb8..f86bbe8f4 100644 --- a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml @@ -39,6 +39,7 @@ + @@ -52,7 +53,7 @@ `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`, `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`,`receive_date`,`period`, - `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`, + `is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`, `can_edit` @@ -68,6 +69,7 @@ and `status` = #{status} and `energy_fees_id` = #{energyFeesId} and `rent_contract_id` = #{rentContractId} + and `rent_contract_agile_fees_type` = #{rentContractAgileFeesType} and `property_contract_id` = #{propertyContractId} and `parent_bill_id` = #{parentBillId} and `is_preview` = #{isPreview} @@ -292,6 +294,9 @@ and property_contract_id = #{propertyContractId} + + and rent_contract_agile_fees_type = #{rentContractAgileFeesType} + @@ -355,7 +360,7 @@ #{item.needPay},#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff},#{item.useMoney}, #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, #{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay}, - #{item.shopId},#{item.shopNumber},#{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.propertyContractId}, + #{item.shopId},#{item.shopNumber},#{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.rentContractAgileFeesType},#{item.propertyContractId}, #{item.parentBillId},#{item.energyReadingCalcuteId},#{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit} ) diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml index 02681d5f2..ad87a568a 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml @@ -15,15 +15,15 @@ - - + + `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`un_deposit_id`,`merchant_id`,`shop_id`,`shop_number`, - `fees_id`,`begin_time`,`end_time`,`price`,`price_unit`,`create_time`,`update_time`,`is_free`,`rent_area` + `fees_id`,`begin_time`,`end_time`,`price`,`price_unit`,`createtime`,`updatetime`,`is_free`,`rent_area` @@ -38,6 +38,7 @@ and `rent_contract_id` = #{rentContractId} and `merchant_id` = #{merchantId} and `fees_id` = #{feesId} + and `un_deposit_id` = #{unDepositId} and id in @@ -66,5 +67,9 @@ from wx_rent_contract_agile_un_deposit_item where id = #{id} and `tenant_id` = #{tenantId} + + delete from wx_rent_contract_agile_un_deposit_item where `un_deposit_id` = #{unDepositId} + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml index 456b95690..4338250d7 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml @@ -14,13 +14,13 @@ - - + + `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`merchant_id`,`setting_method`,`fees_id`,`price`,`price_unit`, - `time_unit`,`calcute_time`,`fees_create_rule`,`create_time`,`update_time` + `time_unit`,`calcute_time`,`fees_create_rule`,`createtime`,`updatetime`