diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java new file mode 100644 index 000000000..13d42ec81 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java @@ -0,0 +1,233 @@ +package com.iformall.controller.contract; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.iformall.annotation.SystemControllerLog; +import com.iformall.annotation.TenantIgnore; +import com.iformall.common.ErrorCode; +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.BaseEntity; +import com.iformall.domain.po.base.BaseEntity.SortField; +import com.iformall.domain.vo.WxRentContractYearsVo; +import com.iformall.enums.*; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxRentContractMapper; +import com.iformall.service.*; +import com.iformall.utils.Constant; +import com.iformall.utils.DateUtils; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; + +import org.apache.commons.compress.utils.Lists; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + */ +@RestController +@RequestMapping("wxAgileContract") +public class WxAgileContractController extends WxContractBaseController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxAgileContractService wxAgileContractService; + @Autowired + private WxAllBillService wxAllBillService; + @Autowired + private WxPayAccountBillService payAccountBillService; + @Autowired + private WxMerchantService wxMerchantService; + @Autowired + private WxRentContractMapper wxRentContractMapper; + @Autowired + private WxRentPropertyContractService wxRentPropertyContractService; + @Autowired + private WxShopService wxShopService; + @Autowired + WxPropertyContractService wxPropertyContractService; + @Autowired + WxMallBuildingService buildingService; + @Autowired + WxMallFloorService floorService; + + @Autowired + WxEnergyService wxEnergyService; + + @GetMapping("/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData list(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxRentContractController::list"); + if (null == wxRentContract) { + wxRentContract = new WxRentContract(); + } + wxRentContract.updateTenantInfo(getTenantInfo()); + wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); + wxRentContract.setSortColumns(" updatetime desc"); + //Map result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); + WxUserDataRule dataRule = this.getCurrentDataFloors(); + if (null != dataRule) { + wxRentContract.setFloorForRule(dataRule.getFloorIds()); + wxRentContract.setBusinessForRule(dataRule.getBussinessIds()); + wxRentContract.setShopTypeForRule(dataRule.getShopTypes()); + } + if (null == wxRentContract.getIsPrivateMerchant()) { + wxRentContract.setIsPrivateMerchant(EnumYesOrNo.NO.getCode()); + } + PageInfo page = wxAgileContractService.getRentContractList(wxRentContract, pageNum, pageSize); + Integer hasFlow = null; + if (null != page && null != page.getList()) { + for (WxRentContract wrc: page.getList()) { + if (null == hasFlow) { + if(rentContractHasWorkFlow(wrc)) { + hasFlow = 1; + }else { + hasFlow = 0; + } + } + wrc.setFlowHas(hasFlow); + } + } + + return new ResultData(page); + } + + /** + * 新增/修改第一步 + * @param wxRentContract + * @return + */ + @PostMapping("saveOrUpdate") + public ResultData saveOrUpdate(@RequestBody WxRentContract wxRentContract) { + MallUserInfo user = getUser(); + wxRentContract.updateTenantInfo(user); + wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); + if (null == wxRentContract.getMerchantId()) { + return new ResultData(Result.ERROR,"请选择商户"); + } + if (null == wxRentContract.getDayPriceCalcute()) { + return new ResultData(Result.ERROR,"请选择日均单价计费规则"); + } + //以前合同必填的数据初始化 + wxRentContract.setDecimalSize(2); + wxRentContract.setReceivePeriodUnit(EnumContractReceivePeriodUnit.MONTH.getCode()); + wxRentContract.setRevenueRatio(EnumYesOrNo.NO.getCode()); + wxRentContract.setRevenueFixedRentPrice(EnumYesOrNo.NO.getCode()); + wxRentContract.setOutDateNotifyDays(0); + wxRentContract.setPayPeriodRate(1); + wxRentContract.setOperationType(EnumContractOperationType.PART.getCode()); + if (null == wxRentContract.getRentalStartDate()) { + return new ResultData(Result.ERROR,"请选择合同开始日期"); + } + if (null == wxRentContract.getRentalEndDate()) { + return new ResultData(Result.ERROR,"请选择合同结束日期"); + } + int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()); + wxRentContract.setLease(array[0]); + if (null == wxRentContract.getSignDate()) { + return new ResultData(Result.ERROR,"请选择合同签约日期"); + } + wxRentContract.setStartDate(wxRentContract.getRentalStartDate()); + wxRentContract.setEndDate(wxRentContract.getRentalEndDate()); + String rentInfo = wxRentContract.getRentInfo(); + if (StringUtils.isBlank(rentInfo)) { + return new ResultData(Result.ERROR,"请选择铺位"); + } + + JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); + int size = rentInfoArray.size(); + if (size == 0) { + return new ResultData(ErrorCode.SHOP_NOT_SELECTED); + } + List shopList = Lists.newArrayList(); + //查询rent_info 包括 shopId + String shopName = ""; + BigDecimal rentAreaDecimal = new BigDecimal(0); + for (int i = 0; i < size; i++) { + JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); + Long shopId = rentInfoObject.getLong("id"); + //wxRentContract.setShopId(shopId); + String shopNumber = rentInfoObject.getString("shopNumber"); + if (!shopList.contains(shopId)) { + shopList.add(shopId); + shopName = shopName +","+ shopNumber; + } + String rentArea = rentInfoObject.getString("rentArea"); + if (StringUtils.isNotBlank(rentArea)) { + rentAreaDecimal = rentAreaDecimal.add(new BigDecimal(rentArea)); + } + } + wxRentContract.setRentArea(rentAreaDecimal.toPlainString()); + wxRentContract.setShopName(shopName); + return wxAgileContractService.saveOrUpdate(wxRentContract, user); + } + + /** + * 押金科目 + * @return + */ + @GetMapping("depositFeesList") + public ResultData depositFeesList() { + WxEnergyFees dt = new WxEnergyFees(); + dt.updateTenantInfo(getTenantInfo()); + dt.setIsDel(EnumYesOrNo.NO.getCode()); + List billTypeList = new ArrayList(); + billTypeList.add(EnumBillAllType.RENT_DEPOSIT.getCode()); + billTypeList.add(EnumBillAllType.PROPERTY.getCode()); + billTypeList.add(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); + dt.setBillTypeList(billTypeList); + dt.setIsDespoit(EnumYesOrNo.YES.getCode()); + dt.setSortColumns(BaseEntity.SortField.CreateTime_DESC); + PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); + if (null == page) { + return new ResultData(); + } + return new ResultData(page.getList()); + } + + /** + * 添加押金 + */ + @PostMapping("addDeposits") + public ResultData addDepositFees(@RequestBody WxRentContract wxRentContract) { + if (null == wxRentContract.getContractDepositList() || wxRentContract.getContractDepositList().size() <= 0 ) { + return new ResultData(Result.ERROR,"请至少增加一个"); + } + wxRentContract.updateTenantInfo(getTenantInfo()); + return wxAgileContractService.saveDeposit(wxRentContract); + } + + /** + * 查询押金 + */ + @GetMapping("getDeposits") + public ResultData getDeposits(@ModelAttribute WxRentContract wxRentContract) { + //查询 + return new ResultData(wxAgileContractService.findShopFeesDeposit(wxRentContract)); + } + + /** + * 添加非押金项 + */ + @PostMapping("addUnDeposits") + public ResultData addUnDeposits(@RequestBody WxRentContractAgileUnDeposit unDeposit) { + return null; + } + + +} + + 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 cd4316a0e..eb0606400 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java @@ -199,6 +199,10 @@ public class WxFinanceController extends BaseController { if (null == record.getBillType()) { return new ResultData(Result.ERROR,"请选择绑定账单类型"); } + if (record.getBillType() == EnumBillAllType.RENT_DEPOSIT.getCode()) { + record.setIsDespoit(EnumYesOrNo.YES.getCode()); + record.setFixedPrice(EnumYesOrNo.YES.getCode()); + } wxEnergyService.saveOrUpdateFees(record); return new ResultData(); } diff --git a/mallinkAdmin/src/main/resources/db/migration/V202409000000003.sql b/mallinkAdmin/src/main/resources/db/migration/V202409000000003.sql new file mode 100644 index 000000000..53a7979e5 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202409000000003.sql @@ -0,0 +1,76 @@ +ALTER TABLE wx_rent_contract ADD COLUMN agile_type INT(1) NOT NULL DEFAULT 1 COMMENT '合同类型'; + +ALTER TABLE wx_rent_contract ADD COLUMN create_by_name VARCHAR(100) COMMENT '创建人姓名' AFTER create_by; +ALTER TABLE wx_rent_contract ADD COLUMN update_by_name VARCHAR(100) COMMENT '修改人姓名' AFTER update_by; +ALTER TABLE wx_property_contract ADD COLUMN create_by_name VARCHAR(100) COMMENT '创建人姓名' AFTER create_by; +ALTER TABLE wx_property_contract ADD COLUMN update_by_name VARCHAR(100) COMMENT '修改人姓名' AFTER update_by; + +CREATE TABLE `wx_rent_contract_agile_deposit` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', + `fees_id` bigint(20) NOT NULL COMMENT '科目编号', + `price` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '金额', + `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', + `updatetime` datetime DEFAULT NULL COMMENT '更新时间', + `createtime` datetime DEFAULT NULL COMMENT '创建时间', + `merchant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `U_R_S` (`rent_contract_id`,`fees_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; + +CREATE TABLE `wx_rent_contract_agile_deposit_shop` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `rent_deposit_id` bigint(20) NOT NULL COMMENT '押金项编号', + `shop_id` bigint(20) NOT NULL COMMENT '店铺编号', + `shop_number` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '店铺号', + `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', + `updatetime` datetime DEFAULT NULL COMMENT '更新时间', + `createtime` datetime DEFAULT NULL COMMENT '创建时间', + `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', + PRIMARY KEY (`id`), + UNIQUE KEY `U_R_S_E` (`rent_deposit_id`,`shop_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; + +CREATE TABLE `wx_rent_contract_agile_un_deposit` ( + `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', + `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', + `merchant_id` bigint(20) DEFAULT NULL, + `setting_method` int(1) NOT NULL DEFAULT '1' COMMENT '费用设置方式', + `fees_id` bigint(20) NOT NULL COMMENT '科目编号', + `price` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '单价', + `price_unit` int(1) NOT NULL COMMENT '单价单位', + `time_unit` int(1) NOT NULL COMMENT '计费周期', + `calcute_time_unit` int(11) NOT NULL COMMENT '收费周期', + `fees_create_rule` int(1) NOT NULL COMMENT '费用生成规则', + `updatetime` datetime DEFAULT NULL COMMENT '更新时间', + `createtime` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `U_R_S` (`rent_contract_id`,`fees_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; + +CREATE TABLE `wx_rent_contract_agile_un_deposit_item` ( + `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', + `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', + `un_deposit_id` bigint(20) NOT NULL COMMENT '费用编号', + `merchant_id` bigint(20) NOT NULL COMMENT '商户编号', + `shop_id` bigint(20) DEFAULT NULL COMMENT '店铺编号', + `shop_number` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '店铺号', + `fees_id` bigint(20) NOT NULL COMMENT '科目编号', + `begin_time` datetime NOT NULL COMMENT '开始日期', + `end_time` datetime NOT NULL COMMENT '结束日期', + `price` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '单价', + `price_unit` int(1) NOT NULL COMMENT '单价单位', + `updatetime` datetime DEFAULT NULL COMMENT '更新时间', + `createtime` datetime DEFAULT NULL COMMENT '创建时间', + `is_free` int(1) NOT NULL DEFAULT '0' COMMENT '是否免租期', + `rent_area` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '计租面积', + PRIMARY KEY (`id`), + UNIQUE KEY `U_R_S` (`rent_contract_id`,`fees_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/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index 29b74507b..fc445e9f1 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -127,10 +127,14 @@ public class WxPropertyContract extends TenantEntity { private Date updatetime; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") private Long updateBy; + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") + private String updateByName; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") private Date createtime; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") private Long createBy; + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") + private String createByName; @io.swagger.annotations.ApiModelProperty(value="计租面积",name="rentArea") private String rentArea; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 99964a314..840a018a7 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -8,6 +8,7 @@ import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.RentContractFreePeriodVo; import com.iformall.enums.EnumPriceUnit; +import com.iformall.enums.EnumRentAgileType; import com.iformall.enums.EnumRentContractAdjustPeriod; import com.iformall.enums.EnumRentContractStatus; import com.iformall.enums.EnumRentContractType; @@ -291,10 +292,14 @@ public class WxRentContract extends TenantEntity { private Date updatetime; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") private Long updateBy; + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") + private String updateByName; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") private Date createtime; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") private Long createBy; + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") + private String createByName; @io.swagger.annotations.ApiModelProperty(value = "计租面积", name = "rentArea") private String rentArea; @@ -533,6 +538,17 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "免租期说明", name = "freePeriodRemark") private String freePeriodRemark; + @io.swagger.annotations.ApiModelProperty(value = "合同类型EnumRentAgileType", name = "agileType") + private Integer agileType; + @TableField(exist = false) + private String agileTypeName; + public String getAgileTypeName() { + if (null != agileType) { + return EnumRentAgileType.getEnum(agileType).getMessage(); + } + return null; + } + public List shopIdsByRentInfo() { List shopList = Lists.newArrayList(); @@ -635,5 +651,7 @@ public class WxRentContract extends TenantEntity { private String queryShopNumber; @TableField(exist = false) private List privateRentShopTypeList; + @TableField(exist = false) + List contractDepositList; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDeposit.java new file mode 100644 index 000000000..f50476bcc --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDeposit.java @@ -0,0 +1,46 @@ +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 lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; +import java.util.List; + +/** + */ +@TableName(value = "wx_rent_contract_agile_deposit") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxRentContractAgileDeposit extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="合同编号",name="rentContractId") + private Long rentContractId; + + @io.swagger.annotations.ApiModelProperty(value="商户编号",name="merchantId") + private Long merchantId; + + @io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId") + private Long feesId; + + @io.swagger.annotations.ApiModelProperty(value="金额",name="price") + private String price; + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + + @TableField(exist = false) + private List shopList; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDepositShop.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDepositShop.java new file mode 100644 index 000000000..a33d75b7f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileDepositShop.java @@ -0,0 +1,41 @@ +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; + +/** + */ +@TableName(value = "wx_rent_contract_agile_deposit_shop") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxRentContractAgileDepositShop extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="合同编号",name="rentContractId") + private Long rentContractId; + + @io.swagger.annotations.ApiModelProperty(value="押金项编号",name="rentDepositId") + private Long rentDepositId; + + @io.swagger.annotations.ApiModelProperty(value="店铺编号",name="shopId") + private Long shopId; + + @io.swagger.annotations.ApiModelProperty(value="金额",name="price") + private String shopNumber; + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java new file mode 100644 index 000000000..db6570c03 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDeposit.java @@ -0,0 +1,96 @@ +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.EnumFeesShopTimeType; +import com.iformall.enums.EnumRentContractAgilPriceUnit; +import com.iformall.enums.EnumRentContractAgilSettingMethod; +import com.iformall.enums.EnumRentContractAgilTimeUnit; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; +import java.util.List; + +/** + */ +@TableName(value = "wx_rent_contract_agile_un_deposit") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxRentContractAgileUnDeposit extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="合同编号",name="rentContractId") + private Long rentContractId; + + @io.swagger.annotations.ApiModelProperty(value="商户编号",name="merchantId") + private Long merchantId; + + @io.swagger.annotations.ApiModelProperty(value="费用设置方式EnumRentContractAgilSettingMethod",name="settingMethod") + private Integer settingMethod; + @TableField(exist = false) + private String settingMethodName; + public String getSettingMethodName() { + if (null != settingMethod) { + return EnumRentContractAgilSettingMethod.getEnum(settingMethod).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId") + private Long feesId; + + @io.swagger.annotations.ApiModelProperty(value="单价",name="price") + private String price; + + @io.swagger.annotations.ApiModelProperty(value="单价单位EnumRentContractAgilPriceUnit",name="priceUnit") + private Integer priceUnit; + @TableField(exist = false) + private String priceUnitName; + public String getPriceUnitName() { + if (null != priceUnit) { + return EnumRentContractAgilPriceUnit.getEnum(priceUnit).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value="计费周期EnumRentContractAgilTimeUnit",name="timeUnit") + private Integer timeUnit; + @TableField(exist = false) + private String timeUnitName; + public String getTimeUnitName() { + if (null != timeUnit) { + return EnumRentContractAgilTimeUnit.getEnum(timeUnit).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value="收费周期",name="calcuteTime") + private Integer calcuteTime; + + @io.swagger.annotations.ApiModelProperty(value="费用生成规则EnumFeesShopTimeType",name="feesCreateRule") + private Integer feesCreateRule; + @TableField(exist = false) + private String feesCreateRuleName; + public String getFeesCreateRule() { + if (null != feesCreateRule) { + return EnumFeesShopTimeType.getEnum(feesCreateRule).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java new file mode 100644 index 000000000..e9d24b8bc --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractAgileUnDepositItem.java @@ -0,0 +1,81 @@ +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.EnumFeesShopTimeType; +import com.iformall.enums.EnumRentContractAgilPriceUnit; +import com.iformall.enums.EnumRentContractAgilSettingMethod; +import com.iformall.enums.EnumRentContractAgilTimeUnit; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; +import java.util.List; + +/** + */ +@TableName(value = "wx_rent_contract_agile_un_deposit_item") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxRentContractAgileUnDepositItem extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="合同编号",name="rentContractId") + private Long rentContractId; + + @io.swagger.annotations.ApiModelProperty(value="费用编号",name="unDepositId") + private Long unDepositId; + + @io.swagger.annotations.ApiModelProperty(value="商户编号",name="merchantId") + private Long merchantId; + + @io.swagger.annotations.ApiModelProperty(value="铺位编号",name="shopId") + private Long shopId; + + @io.swagger.annotations.ApiModelProperty(value="铺位号",name="shopNumber") + private String shopNumber; + + @io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId") + private Long feesId; + + @io.swagger.annotations.ApiModelProperty(value="beginTime",name="beginTime") + private Date beginTime; + + @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") + private Date endTime; + + + @io.swagger.annotations.ApiModelProperty(value="单价",name="price") + private String price; + + @io.swagger.annotations.ApiModelProperty(value="单价单位EnumRentContractAgilPriceUnit",name="priceUnit") + private Integer priceUnit; + @TableField(exist = false) + private String priceUnitName; + public String getPriceUnitName() { + if (null != priceUnit) { + return EnumRentContractAgilPriceUnit.getEnum(priceUnit).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + + @io.swagger.annotations.ApiModelProperty(value="是否免租期",name="isFree") + private Integer isFree; + + @io.swagger.annotations.ApiModelProperty(value="计租面积",name="rentArea") + private String rentArea; + +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRentAgileType.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentAgileType.java new file mode 100644 index 000000000..207b49ae1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentAgileType.java @@ -0,0 +1,36 @@ +package com.iformall.enums; + + +/** + */ + +public enum EnumRentAgileType { + + STANDARDS_YEAR(1, "年计费基数合同"), + AGILE(2, "自定义合同"); + + public static EnumRentAgileType getEnum(Integer code) { + for (EnumRentAgileType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentAgileType(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/enums/EnumRentContractAgilPriceUnit.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilPriceUnit.java new file mode 100644 index 000000000..0a892eebe --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilPriceUnit.java @@ -0,0 +1,42 @@ +package com.iformall.enums; + + +/** + */ +public enum EnumRentContractAgilPriceUnit { + + MM_DAY(1, "㎡/天"), + MM_MONTH(2, "㎡/月"), + DAY(3,"天"), + MONTH(4,"月"), + QUATOR(5,"季度"), + HALF_YEAR(6,"半年"), + YEAR(7,"年"), + RENT_PERIOD(8,"租赁期"), + ; + + public static EnumRentContractAgilPriceUnit getEnum(Integer code) { + for (EnumRentContractAgilPriceUnit value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentContractAgilPriceUnit(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/enums/EnumRentContractAgilSettingMethod.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilSettingMethod.java new file mode 100644 index 000000000..6ab437174 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilSettingMethod.java @@ -0,0 +1,36 @@ +package com.iformall.enums; + + +/** + */ +public enum EnumRentContractAgilSettingMethod { + + BY_CONTRACT(1, "按合同设置费用"), + BY_SHOP(2, "按铺位设置费用") + ; + + public static EnumRentContractAgilSettingMethod getEnum(Integer code) { + for (EnumRentContractAgilSettingMethod value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentContractAgilSettingMethod(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/enums/EnumRentContractAgilTimeUnit.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilTimeUnit.java new file mode 100644 index 000000000..3d60f3e69 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAgilTimeUnit.java @@ -0,0 +1,39 @@ +package com.iformall.enums; + + +/** + */ +public enum EnumRentContractAgilTimeUnit { + + MONTH(1, "月"), + QUATOR(2,"季度"), + HALF_YEAR(3,"半年"), + YEAR(4,"年"), + RENT_PERIOD(5,"租赁期"), + ; + + public static EnumRentContractAgilTimeUnit getEnum(Integer code) { + for (EnumRentContractAgilTimeUnit value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumRentContractAgilTimeUnit(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/WxRentContractAgileDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileDepositMapper.java new file mode 100644 index 000000000..a102d1184 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileDepositMapper.java @@ -0,0 +1,20 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxRentContractAgileDeposit; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxRentContractAgileDepositMapper extends CommonMapper { + + List findList(WxRentContractAgileDeposit wxBillRent); + + WxRentContractAgileDeposit selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + List findIdList(WxRentContractAgileDeposit wxBillRent); + + void deleteByContractId(WxRentContractAgileDeposit wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileDepositShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileDepositShopMapper.java new file mode 100644 index 000000000..88dadc77b --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileDepositShopMapper.java @@ -0,0 +1,21 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxRentContractAgileDepositShop; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxRentContractAgileDepositShopMapper extends CommonMapper { + + List findList(WxRentContractAgileDepositShop wxBillRent); + + WxRentContractAgileDepositShop selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + List findIdList(WxRentContractAgileDepositShop wxBillRent); + + void deleteByContractId(WxRentContractAgileDepositShop wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java new file mode 100644 index 000000000..44acd3a34 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositItemMapper.java @@ -0,0 +1,19 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxRentContractAgileUnDepositItem; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxRentContractAgileUnDepositItemMapper extends CommonMapper { + + List findList(WxRentContractAgileUnDepositItem wxBillRent); + + WxRentContractAgileUnDepositItem selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + List findIdList(WxRentContractAgileUnDepositItem wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositMapper.java new file mode 100644 index 000000000..dec85939e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractAgileUnDepositMapper.java @@ -0,0 +1,19 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxRentContractAgileUnDeposit; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxRentContractAgileUnDepositMapper extends CommonMapper { + + List findList(WxRentContractAgileUnDeposit wxBillRent); + + WxRentContractAgileUnDeposit selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + List findIdList(WxRentContractAgileUnDeposit wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java b/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java new file mode 100644 index 000000000..37748750d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java @@ -0,0 +1,24 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.ResultData; +import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxRentContractAgileDeposit; + +import java.util.List; + +/** + */ +public interface WxAgileContractService { + + PageInfo getRentContractList(WxRentContract record, Integer pageIndex, Integer pageSize); + + WxRentContract selectById(Long id); + + ResultData saveOrUpdate(WxRentContract record,MallUserInfo user); + + ResultData saveDeposit(WxRentContract wxRentContract); + + List findShopFeesDeposit(WxRentContract wxRentContract); +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java new file mode 100644 index 000000000..37e400833 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java @@ -0,0 +1,232 @@ +package com.iformall.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; +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.WxMerchant; +import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxRentContractAgileDeposit; +import com.iformall.domain.po.WxRentContractAgileDepositShop; +import com.iformall.domain.po.WxShop; +import com.iformall.enums.EnumRentContractAppStatus; +import com.iformall.enums.EnumRentContractStatus; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxBusinessMapper; +import com.iformall.mapper.WxMerchantMapper; +import com.iformall.mapper.WxRentContractAgileDepositMapper; +import com.iformall.mapper.WxRentContractAgileDepositShopMapper; +import com.iformall.mapper.WxRentContractAgileUnDepositItemMapper; +import com.iformall.mapper.WxRentContractAgileUnDepositMapper; +import com.iformall.mapper.WxRentContractFreePeriodMapper; +import com.iformall.mapper.WxRentContractMapper; +import com.iformall.mapper.WxShopMapper; +import com.iformall.service.SysConfigService; +import com.iformall.service.WxAgileContractService; +import com.iformall.service.WxFlowRecordService; +import com.iformall.service.WxMallService; +import com.iformall.service.WxMerchantService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + */ +@Service +public class WxAgileContractServiceImpl implements WxAgileContractService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private String fmUploadDir; + + @Autowired + WxRentContractMapper wxRentContractMapper; + + @Autowired + WxRentContractAgileDepositMapper wxRentContractAgileDepositMapper; + + @Autowired + WxRentContractAgileDepositShopMapper wxRentContractAgileDepositShopMapper; + + @Autowired + WxRentContractAgileUnDepositMapper wxRentContractAgileUnDepositMapper; + + @Autowired + WxRentContractAgileUnDepositItemMapper wxRentContractAgileUnDepositItemMapper; + + @Autowired + WxRentContractFreePeriodMapper wxRentContractFreePeriodMapper; + + @Autowired + WxShopMapper wxShopMapper; + + @Lazy + @Autowired + WxMerchantService wxMerchantService; + + @Autowired + WxMerchantMapper wxMerchantMapper; + + @Autowired + WxBusinessMapper wxBusinessMapper; + + @Lazy + @Autowired + WxMallService wxMallService; + + @Lazy + @Autowired + WxFlowRecordService wxFlowRecordService; + + @Lazy + @Autowired + SysConfigService sysConfigService; + + @Override + public PageInfo getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { + if (StringUtils.isNoneBlank(rentContract.getFloorForRule())) { + List mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null); + if (null == mids || mids.size() <= 0 ) { + rentContract.setId(-1L); + } else { + rentContract.setMerchantIds(mids); + } + } + PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract)); + return pageInfo; + } + + + @Override + public WxRentContract selectById(Long id) { + return wxRentContractMapper.selectById(id); + } + + @Override + public ResultData saveOrUpdate(WxRentContract record,MallUserInfo user) { + boolean isCreate = false; + if (null == record.getId()) { + //保存租赁合同信息 + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + isCreate = true; + record.setCreatetime(new Date()); + record.setCreateBy(user.getId()); + record.setCreateByName(user.getName()); + } + WxMerchant merchant = wxMerchantMapper.selectById(record.getMerchantId()); + record.setIsPrivateMerchant(merchant.getIsPrivate()); + record.setPrivateRentShopType(merchant.getCreateShopType()); + record.setMerchantName(merchant.getName()); + record.setUpdatetime(new Date()); + record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); + if (StringUtils.isEmpty(record.getPrice())) { + record.setPrice("0"); + } + if (StringUtils.isEmpty(record.getDeposit())) { + record.setDeposit("0"); + } + try { + record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); + record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); + if (isCreate) { + wxRentContractMapper.insert(record); + }else { + wxRentContractMapper.updateById(record); + } + } catch (Exception e) { + logger.error("保存合同信息失败,e:" + e.getMessage(),e); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + + return new ResultData(Result.SUCCESS, "保存合同信息成功", record); + } + + @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) + @Override + public ResultData saveDeposit(WxRentContract wxRentContract) { + WxRentContract contract = this.selectById(wxRentContract.getId()); + WxRentContractAgileDeposit cdq = new WxRentContractAgileDeposit(); + cdq.updateTenantInfo(wxRentContract); + cdq.setRentContractId(wxRentContract.getId()); + wxRentContractAgileDepositMapper.deleteByContractId(cdq); + + WxRentContractAgileDepositShop cadsq = new WxRentContractAgileDepositShop(); + cadsq.updateTenantInfo(wxRentContract); + cadsq.setRentContractId(wxRentContract.getId()); + wxRentContractAgileDepositShopMapper.deleteByContractId(cadsq); + final IdWorker idWorker = IdWorker.get(); + for (int i = 0 ; i < wxRentContract.getContractDepositList().size(); i++) { + WxRentContractAgileDeposit deposit = wxRentContract.getContractDepositList().get(i); + if (null != deposit.getShopList() && deposit.getShopList().size() > 0 ) { + WxRentContractAgileDeposit rca = new WxRentContractAgileDeposit(); + rca.setRentContractId(wxRentContract.getId()); + rca.setMerchantId(contract.getMerchantId()); + rca.updateTenantInfo(wxRentContract); + rca.setId(idWorker.nextId()); + rca.setFeesId(deposit.getFeesId()); + rca.setPrice(deposit.getPrice()); + rca.setCreateTime(new Date()); + rca.setUpdateTime(new Date()); + wxRentContractAgileDepositMapper.insert(rca); + for (int j = 0 ; j < deposit.getShopList().size(); j ++) { + WxShop s = deposit.getShopList().get(j); + WxRentContractAgileDepositShop ds = new WxRentContractAgileDepositShop(); + ds.setRentContractId(wxRentContract.getId()); + ds.updateTenantInfo(wxRentContract); + ds.setId(idWorker.nextId()); + ds.setCreateTime(new Date()); + ds.setUpdateTime(new Date()); + ds.setShopId(s.getId()); + ds.setShopNumber(s.getShopNumber()); + wxRentContractAgileDepositShopMapper.insert(ds); + } + } + } + return new ResultData(); + } + + + @Override + public List findShopFeesDeposit(WxRentContract wxRentContract) { + WxRentContractAgileDeposit adq = new WxRentContractAgileDeposit(); + adq.updateTenantInfo(wxRentContract); + adq.setRentContractId(wxRentContract.getId()); + List depositList = wxRentContractAgileDepositMapper.findList(adq); + if (null != depositList && depositList.size() > 0 ) { + for (int i = 0 ; i < depositList.size(); i++ ) { + WxRentContractAgileDeposit d = depositList.get(i); + WxRentContractAgileDepositShop ds = new WxRentContractAgileDepositShop(); + ds.setRentContractId(wxRentContract.getId()); + ds.updateTenantInfo(wxRentContract); + ds.setRentDepositId(d.getId()); + List dslist = wxRentContractAgileDepositShopMapper.findList(ds); + if (null != dslist && dslist.size() > 0 ) { + List shopList = new ArrayList(); + for (int j = 0 ; j < dslist.size(); j++ ) { + WxRentContractAgileDepositShop ads = dslist.get(j); + WxShop sp = new WxShop(); + sp.setId(ads.getShopId()); + sp.setShopNumber(ads.getShopNumber()); + shopList.add(sp); + } + d.setShopList(shopList);; + } + } + } + return depositList; + } + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java index f9e0bd0bf..05099db5a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java @@ -718,6 +718,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { }else { fees.setFixedPrice(EnumYesOrNo.NO.getCode()); } + if (t.isDeposit()) { + fees.setIsDespoit(EnumYesOrNo.YES.getCode()); + }else { + fees.setIsDespoit(EnumYesOrNo.NO.getCode()); + } Date date = new Date(); fees.setCreateTime(date); fees.setUpdateTime(date); 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 280c49439..9905201a0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -349,8 +349,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService record.setId(idWorker.nextId()); record.setCreatetime(date); record.setCreateBy(user.getId()); + record.setCreateByName(user.getName()); record.setUpdatetime(date); record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); wxPropertyContractMapper.insert(record); @@ -358,6 +360,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService }else { record.setUpdatetime(date); record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); wxPropertyContractMapper.updateById(record); } } catch (Exception e) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index d86ad86c0..8db5a9515 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -48,6 +48,7 @@ import com.iformall.enums.EnumGetRatioFrom; import com.iformall.enums.EnumIsPreview; import com.iformall.enums.EnumMissTimeType; import com.iformall.enums.EnumPriceUnit; +import com.iformall.enums.EnumRentAgileType; import com.iformall.enums.EnumRentContractAdjustPeriod; import com.iformall.enums.EnumRentContractAdjustRatioWay; import com.iformall.enums.EnumRentContractAppStatus; @@ -405,8 +406,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { Date date = new Date(); record.setCreatetime(date); record.setCreateBy(user.getId()); + record.setCreateByName(user.getName()); record.setUpdatetime(date); record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); List shopList = Lists.newArrayList(); String rentInfo = record.getRentInfo(); @@ -439,6 +442,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { Date tempDate = record.getRentalStartDate(); record.setRentalStartDate(oldRentStartDate); record.setShopName(shopName); + record.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); wxRentContractMapper.insert(record); record.setRentalStartDate(tempDate); } catch (Exception e) { @@ -717,7 +721,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { } List shopList = Lists.newArrayList(); record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId());; + record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); String rentInfo = record.getRentInfo(); JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); int size = rentInfoArray.size(); diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 86006aeb7..ba57a19a5 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -49,7 +49,9 @@ + + @@ -74,7 +76,7 @@ `id`,`merchant_id`,`is_private_merchant`,`private_rent_shop_type`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`,`shop_ids`,`shop_numbers`, - `sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`, + `sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by_name`,`update_by_name`, `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`receive_period_unit`,`create_by`,`update_by`,`first_bill_receive_date`, `shop_type`,`updatetime`,`createtime`,`rent_area`,`fees_standards_info`,`first_bill_date_start`,`first_bill_date_end`, `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`,`day_price_calcute`,`month_average_days`, diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositMapper.xml new file mode 100644 index 000000000..6ad31417f --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositMapper.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`merchant_id`,`fees_id`,`price` + + + + where 1=1 + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and `rent_contract_id` = #{rentContractId} + and `merchant_id` = #{merchantId} + and `fees_id` = #{feesId} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + delete from wx_rent_contract_agile_deposit where `rent_contract_id` = #{rentContractId} + + + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositShopMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositShopMapper.xml new file mode 100644 index 000000000..dfecf1faa --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileDepositShopMapper.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`rent_deposit_id`,`shop_id`,`shop_number` + + + + where 1=1 + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and `rent_contract_id` = #{rentContractId} + and `rent_deposit_id` = #{rentDepositId} + and `shop_id` = #{shopId} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + delete from wx_rent_contract_agile_deposit_shop where `rent_contract_id` = #{rentContractId} + + + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml new file mode 100644 index 000000000..02681d5f2 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositItemMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + `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` + + + + where 1=1 + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and `rent_contract_id` = #{rentContractId} + and `merchant_id` = #{merchantId} + and `fees_id` = #{feesId} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml new file mode 100644 index 000000000..456b95690 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxRentContractAgileUnDepositMapper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + `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` + + + + where 1=1 + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and `rent_contract_id` = #{rentContractId} + and `merchant_id` = #{merchantId} + and `fees_id` = #{feesId} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 83b4d7692..5701a68ae 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -29,7 +29,9 @@ + + @@ -130,10 +132,12 @@ + + - `id`,`merchant_id`,`is_private_merchant`,`private_rent_shop_type`, + `id`,`merchant_id`,`is_private_merchant`,`private_rent_shop_type`,`agile_type`, `shop_type_sub`,`lease_purpose`,`contractual_rules`,`delivery_date`,`delivery_grace_period`,`opening_date`,`business_hours`,`scope_metre`, `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`receive_period_unit`, `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by`,`update_by`, @@ -143,7 +147,7 @@ `brand`,`business_id`,`shop_type`,`shop_type_str`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, `pay_account`,`filename`,`lease`,`type`,`revenue`,`revenue_ratio`,`revenue_ratio_way`,`revenue_ratio_set`,`adjust_ratio`,`adjust_period`,`pay_ratio`, `start_date`,`end_date`,`shop_name`,`from_id`,`end_contract_time`,`revenue_fixed_rent_price`,`revenue_rent_price`, - `apply_status`,`bank_name`,`fix_start_date`,`fix_end_date`,`pay_period_rate`, + `apply_status`,`bank_name`,`fix_start_date`,`fix_end_date`,`pay_period_rate`,`create_by_name`,`update_by_name`, `business_type`,`rent_info`, `file_names`,price_unit,rent_price,other_rent_price_info,`subject_name`,rent_start_type, `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,first_bill_receive_date, bussiness_management_fee,bussiness_management_fee_ratio_way,bussiness_management_fee_ratio, @@ -158,6 +162,7 @@ and `merchant_id` = #{merchantId} and `is_private_merchant` = #{isPrivateMerchant} and `private_rent_shop_type` = #{privateRentShopType} + and `agile_type` = #{agileType} and `price` = #{price} and `rental_start_date` = #{rentalStartDate} and `rental_end_date` = #{rentalEndDate}