| @@ -149,7 +149,7 @@ public class WxAgileContractController extends WxContractBaseController { | |||
| } | |||
| List<Long> shopList = Lists.newArrayList(); | |||
| //查询rent_info 包括 shopId | |||
| String shopName = ""; | |||
| String shopIdStr = ""; | |||
| BigDecimal rentAreaDecimal = new BigDecimal(0); | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| @@ -158,7 +158,7 @@ public class WxAgileContractController extends WxContractBaseController { | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (!shopList.contains(shopId)) { | |||
| shopList.add(shopId); | |||
| shopName = shopName +","+ shopNumber; | |||
| shopIdStr = shopIdStr +","+ shopId; | |||
| } | |||
| String rentArea = rentInfoObject.getString("rentArea"); | |||
| if (StringUtils.isNotBlank(rentArea)) { | |||
| @@ -166,7 +166,7 @@ public class WxAgileContractController extends WxContractBaseController { | |||
| } | |||
| } | |||
| wxRentContract.setRentArea(rentAreaDecimal.toPlainString()); | |||
| wxRentContract.setShopName(shopName); | |||
| wxRentContract.setShopIdStr(shopIdStr); | |||
| return wxAgileContractService.saveOrUpdate(wxRentContract, user); | |||
| } | |||
| @@ -6,11 +6,14 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.UserDataRuleAnnotation; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxPropertyContractUpdateDto; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxContractCustomers; | |||
| import com.iformall.domain.po.WxContractShop; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| @@ -19,6 +22,8 @@ import com.iformall.domain.po.WxUserDataRule; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxContractCustomersMapper; | |||
| import com.iformall.mapper.WxContractShopMapper; | |||
| import com.iformall.mapper.WxPropertyContractMapper; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -52,6 +57,10 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| @Autowired | |||
| private WxPropertyContractMapper wxPropertyContractMapper; | |||
| @Autowired | |||
| private WxContractCustomersMapper wxContractCustomersMapper; | |||
| @Autowired | |||
| private WxContractShopMapper wxContractShopMapper; | |||
| @Autowired | |||
| private WxRentPropertyContractService wxRentPropertyContractService; | |||
| @Autowired | |||
| WxMallBuildingService buildingService; | |||
| @@ -62,7 +71,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| @Autowired | |||
| private WxRentContractService rentContractService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| private WxAgileContractService wxAgileContractService; | |||
| @GetMapping("/list") | |||
| @ApiImplicitParams({ | |||
| @@ -82,20 +91,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| wxPropertyContract.setBusinessForRule(dataRule.getBussinessIds()); | |||
| wxPropertyContract.setShopTypeForRule(dataRule.getShopTypes()); | |||
| } | |||
| if (null == wxPropertyContract.getIsPrivateMerchant()) { | |||
| wxPropertyContract.setIsPrivateMerchant(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| //如果是已售,则查询虚拟商户,并且店铺类型是商业的 | |||
| if (wxPropertyContract.getIsPrivateMerchant()==2) { | |||
| wxPropertyContract.setIsPrivateMerchant(EnumYesOrNo.YES.getCode()); | |||
| List<Integer> rentShopTypeList = new ArrayList<Integer>(); | |||
| rentShopTypeList.add(EnumRentShopType.SHOP.getCode()); | |||
| rentShopTypeList.add(EnumRentShopType.POINT.getCode()); | |||
| wxPropertyContract.setPrivateRentShopTypeList(rentShopTypeList); | |||
| }else if (wxPropertyContract.getIsPrivateMerchant()==1) { | |||
| wxPropertyContract.setIsPrivateMerchant(EnumYesOrNo.YES.getCode()); | |||
| wxPropertyContract.setPrivateRentShopType(EnumRentShopType.XIZILOU.getCode()); | |||
| } | |||
| PageInfo<WxPropertyContract> pageInfo = wxPropertyContractService.listAsPage(wxPropertyContract, pageNum, pageSize); | |||
| Integer hasFlow = null; | |||
| if (null != pageInfo && null != pageInfo.getList()) { | |||
| @@ -108,21 +103,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| } | |||
| } | |||
| wpc.setFlowHas(hasFlow); | |||
| String renInfo = wpc.getRentInfo(); | |||
| if (!StringUtils.isBlank(renInfo)) { | |||
| JSONArray arrays = JSONArray.parseArray(renInfo); | |||
| if ( null != arrays) { | |||
| String floorName = ""; | |||
| String buildingName = ""; | |||
| String shopNumber = ""; | |||
| wpc.setFloorName(floorName); | |||
| wpc.setBuildingName(buildingName); | |||
| wpc.setShopNumber(shopNumber); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -130,6 +110,56 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| return new ResultData(result); | |||
| } | |||
| public void setCustomers(WxPropertyContract record) { | |||
| WxContractCustomers cq = new WxContractCustomers(); | |||
| cq.updateTenantInfo(record); | |||
| cq.setPrincipalType(record.getCustomerType()); | |||
| cq.setNameEqal(record.getCustomerName()); | |||
| cq.setPhoneEqal(record.getCustomerPhone()); | |||
| List<WxContractCustomers> list = wxContractCustomersMapper.findList(cq); | |||
| WxContractCustomers cus = null; | |||
| if (null != list && list.size() > 0 ){ | |||
| cus = list.get(0); | |||
| } | |||
| if (null == cus) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| cus = new WxContractCustomers(); | |||
| cus.updateTenantInfo(record); | |||
| cus.setId(idWorker.nextId()); | |||
| cus.setPrincipalType(record.getCustomerType()); | |||
| cus.setName(record.getCustomerName()); | |||
| cus.setPhone(record.getCustomerPhone()); | |||
| cus.setLegalPerson(record.getCustomerLegalPerson()); | |||
| cus.setLinkPerson(record.getCustomerLinkPerson()); | |||
| cus.setCreateDate(new Date()); | |||
| cus.setUpdateDate(new Date()); | |||
| cus.setStatus(EnumContractCustomersStatus.TEMP.getCode()); | |||
| wxContractCustomersMapper.insert(cus); | |||
| } | |||
| record.setCustomersId(cus.getId()); | |||
| } | |||
| public void setShops(WxPropertyContract record,List<Long> shopIdList) { | |||
| WxContractShop sdel = new WxContractShop(); | |||
| sdel.updateTenantInfo(record); | |||
| sdel.setContractId(record.getId()); | |||
| wxContractShopMapper.deleteByCondition(sdel); | |||
| if (null != shopIdList && shopIdList.size() > 0 ) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| for ( int i = 0 ; i < shopIdList.size(); i ++) { | |||
| WxContractShop s = new WxContractShop(); | |||
| s.updateTenantInfo(record); | |||
| s.setContractId(record.getId()); | |||
| s.setShopId(shopIdList.get(i)); | |||
| s.setCreateDate(new Date()); | |||
| s.setUpdateDate(new Date()); | |||
| s.setId(idWorker.nextId()); | |||
| wxContractShopMapper.insert(s); | |||
| } | |||
| } | |||
| } | |||
| //第一步 | |||
| @PostMapping("addBasic") | |||
| @@ -155,9 +185,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| if (null == wxPropertyContract.getStartDate()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "计租日不能为空"); | |||
| } | |||
| if (null == wxPropertyContract.getMerchantId() && wxPropertyContract.getOperationType().equals(EnumContractOperationType.PART.getCode())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空"); | |||
| } | |||
| if (null == wxPropertyContract.getLease()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "lease不能为空"); | |||
| } | |||
| @@ -167,28 +194,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| if (null == wxPropertyContract.getAdjustPeriod()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "adjustPeriod不能为空"); | |||
| } | |||
| wxPropertyContract.setShopIds(","+wxPropertyContract.getShopIds()+","); | |||
| if (StringUtils.isNotBlank(wxPropertyContract.getShopIds())) { | |||
| String[] sids = wxPropertyContract.getShopIds().split(","); | |||
| if (null != sids && sids.length > 0 ) { | |||
| List<Long> shopIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < sids.length ; i++) { | |||
| if (StringUtils.isNotBlank(sids[i])) { | |||
| shopIdList.add(Long.parseLong(sids[i])); } | |||
| } | |||
| if (shopIdList.size() > 0) { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.updateTenantInfo(wxPropertyContract); | |||
| wxShop.setIds(shopIdList); | |||
| List<String> sunumbers = wxShopService.getShopNumberList(wxShop); | |||
| if (null != sunumbers && sunumbers.size() > 0 ) { | |||
| wxPropertyContract.setShopNumbers(StringUtils.join(sunumbers,",")); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| wxPropertyContract.setShopIdStr(","+wxPropertyContract.getShopIds()+","); | |||
| }else { | |||
| WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId()); | |||
| if (null == rentContract) { | |||
| @@ -207,25 +213,14 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| wxPropertyContract.setRentalEndDate(rentContract.getRentalEndDate()); | |||
| wxPropertyContract.setStartDate(rentContract.getStartDate()); | |||
| wxPropertyContract.setEndDate(rentContract.getEndDate()); | |||
| wxPropertyContract.setMerchantId(rentContract.getMerchantId()); | |||
| wxPropertyContract.setSignDate(rentContract.getSignDate()); | |||
| wxPropertyContract.setRentInfo(rentContract.getRentInfo()); | |||
| wxPropertyContract.setShopNumbers(rentContract.getRentInfoShopNumber()); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.selectById(wxPropertyContract.getMerchantId()); | |||
| if (merchant == null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| wxPropertyContract.setShopIdStr(rentContract.getShopIdStr()); | |||
| wxPropertyContract.setCustomersId(rentContract.getCustomersId()); | |||
| } | |||
| wxPropertyContract.setBusinessId(merchant.getBusinessId()); | |||
| wxPropertyContract.setBrand(merchant.getBrand()); | |||
| wxPropertyContract.setMerchantName(merchant.getName()); | |||
| wxPropertyContract.setShopType(merchant.getShopType()); | |||
| wxPropertyContract.setLinkPerson(merchant.getLinkPerson()); | |||
| wxPropertyContract.setLinkPhone(merchant.getLinkPhone()); | |||
| //wxPropertyContract.setRentShopType(merchant.getType()); | |||
| wxPropertyContract.setIsPrivateMerchant(merchant.getIsPrivate()); | |||
| wxPropertyContract.setPrivateRentShopType(merchant.getCreateShopType()); | |||
| setShops(wxPropertyContract,wxPropertyContract.shopIdsByShop()); | |||
| //关联客户 | |||
| setCustomers(wxPropertyContract); | |||
| wxPropertyContract.setRentStartType(EnumRentStartType.RENTTIME.getCode()); | |||
| return wxPropertyContractService.save(wxPropertyContract, user, user.getName(),false); | |||
| @@ -241,9 +236,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| wxPropertyContract.updateTenantInfo(user); | |||
| wxPropertyContract.setAdjustPeriodHandle(); | |||
| //第一步已经设置过了,无需再设置 | |||
| wxPropertyContract.setMerchantName(null); | |||
| wxPropertyContract.setBrand(null); | |||
| wxPropertyContract.setShopType(null); | |||
| wxPropertyContract.setLinkPerson(null); | |||
| wxPropertyContract.setLinkPhone(null); | |||
| if (null != wxPropertyContract.getFeeStandards() && wxPropertyContract.getFeeStandards().size() > 0 ) { | |||
| @@ -419,18 +411,17 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| } | |||
| private boolean shopHasValidProperty(WxPropertyContract contract) { | |||
| WxPropertyContract wpc = new WxPropertyContract(); | |||
| String[] shopIds = contract.getShopIds().split(","); | |||
| List<Long> sidl = new ArrayList<Long>(); | |||
| for (String sid : shopIds) { | |||
| if (StringUtils.isNotBlank(sid)) { | |||
| sidl.add(Long.parseLong(sid)); | |||
| } | |||
| List<Long> shopIds = contract.shopIdsByShop(); | |||
| if (null == shopIds || shopIds.size() <= 0 ) { | |||
| return false; | |||
| } | |||
| if (sidl.size() == 0 ) { | |||
| List<Long> contractIdList = wxAgileContractService.findShopContractIds(contract, shopIds); | |||
| if (null == contractIdList || contractIdList.size() <= 0 ) { | |||
| return false; | |||
| } | |||
| wpc.setShopIdsQuery(sidl); | |||
| WxPropertyContract wpc = new WxPropertyContract(); | |||
| wpc.setIds(contractIdList); | |||
| List<Integer> statuss = EnumRentContractStatus.getValidStatus(); | |||
| statuss.add(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| wpc.setStatuss(statuss); | |||
| @@ -484,11 +475,11 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| remark = (String) map.get("remark"); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.selectById(contract.getMerchantId()); | |||
| WxContractCustomers customers = wxAgileContractService.findCustomers(contract, contract.getCustomersId()); | |||
| if(contract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) { | |||
| contract.setFlowParams(generateFlowParams(merchant,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.PROPERTY,null, remark, contract.getId(),null)); | |||
| contract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.PROPERTY,null, remark, contract.getId(),null)); | |||
| }else { | |||
| contract.setFlowParams(generateFlowParams(merchant,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.WHOLE_SHOP,null, remark, contract.getId(),null)); | |||
| contract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.WHOLE_SHOP,null, remark, contract.getId(),null)); | |||
| } | |||
| return wxPropertyContractService.apply(contract,user); | |||
| } | |||
| @@ -457,7 +457,7 @@ public class WxRentContractController extends WxContractBaseController { | |||
| } | |||
| private void validShop(WxRentContract rentContract) throws Exception { | |||
| //TODO 判断该合同的店铺是不是存在有效的合同,或者审批中的合同,要判断时间区间是否有重复 | |||
| //判断该合同的店铺是不是存在有效的合同,或者审批中的合同,要判断时间区间是否有重复 | |||
| List<Long> shopIdList = rentContract.shopIdsByRentInfo(); | |||
| List<Long> contractIds = wxAgileContractService.findShopContractIds(rentContract, shopIdList); | |||
| //查询是否有跟当前合同时间有冲突的合同 | |||
| @@ -531,7 +531,7 @@ public class WxRentContractController extends WxContractBaseController { | |||
| } | |||
| } | |||
| WxContractCustomers customers = wxAgileContractService.findCustomers(rentContract, rentContract.getId()); | |||
| WxContractCustomers customers = wxAgileContractService.findCustomers(rentContract, rentContract.getCustomersId()); | |||
| if(rentContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue() || | |||
| rentContract.getOperationType().intValue() == EnumContractOperationType.JINMAO.getCode().intValue()) { | |||
| @@ -697,12 +697,12 @@ public class WxRentContractController extends WxContractBaseController { | |||
| List<Long> shopIds = wrc.shopIdsByRentInfo(); | |||
| if (null != shopIds) { | |||
| List<WxShop> shops = wxShopService.getByIds(this.getTenantInfo(),shopIds); | |||
| String shopName = ""; | |||
| String shopIdstr = ""; | |||
| for (WxShop shop : shops) { | |||
| shopName = shopName +","+shop.getShopNumber(); | |||
| shopIdstr = shopIdstr +","+shop.getId(); | |||
| } | |||
| if(!StringUtils.isBlank(shopName)) { | |||
| wrc.setShopName(shopName); | |||
| if(!StringUtils.isBlank(shopIdstr)) { | |||
| wrc.setShopIdStr(shopIdstr); | |||
| wxRentContractService.updateRentContract(wrc); | |||
| } | |||
| } | |||
| @@ -23,6 +23,7 @@ alter table wx_rent_contract drop column opening_date; | |||
| alter table wx_rent_contract drop column business_hours; | |||
| alter table wx_rent_contract drop column scope_metre; | |||
| alter table wx_rent_contract drop column pay_date; | |||
| alter table wx_rent_contract drop column shop_name; | |||
| alter table wx_rent_contract_agile_deposit drop column merchant_id; | |||
| alter table wx_rent_contract_agile_un_deposit drop column merchant_id; | |||
| @@ -46,6 +47,9 @@ alter table wx_property_contract drop column pay_date; | |||
| #此处要把万星的合同,根据商户的刷成customers_id (商业和soho的) | |||
| alter table wx_rent_contract add column customers_id bigint(20) not null comment '客户ID'; | |||
| alter table wx_property_contract add column customers_id bigint(20) not null comment '客户ID'; | |||
| alter table wx_rent_contract add column shop_id_str varchar(300) not null comment '客户ID'; | |||
| alter table wx_property_contract add column shop_id_str varchar(300) not null comment '客户ID'; | |||
| alter table wx_shop_users change shop_id create_shop_id bigint(20) not null; | |||
| alter table wx_shop_users drop column status; | |||
| @@ -12,6 +12,7 @@ import com.iformall.enums.EnumPropertyCreateType; | |||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -21,6 +22,8 @@ import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -38,15 +41,23 @@ public class WxPropertyContract extends TenantEntity { | |||
| protected Long id; | |||
| private Long customersId; | |||
| @TableField(exist = false) | |||
| private Integer customerType; | |||
| @TableField(exist = false) | |||
| private String customerName; | |||
| @TableField(exist = false) | |||
| private String customerLinkPerson; | |||
| @TableField(exist = false) | |||
| private String customerPhone; | |||
| @TableField(exist = false) | |||
| private String customerLegalPerson; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核状态,0未审核 1审核中 2审核完成 3驳回 4合同作废",name="applyStatus") | |||
| private Integer applyStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="审批流1合同2账单3终止审批",name="businessType") | |||
| private Integer businessType; | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "shopNumber") | |||
| private String shopNumber; | |||
| @io.swagger.annotations.ApiModelProperty(value = "金额小数点位数", name = "decimalSize") | |||
| private Integer decimalSize = 2; | |||
| /*月租金/分成(分)**/ | |||
| @@ -85,7 +96,6 @@ public class WxPropertyContract extends TenantEntity { | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="是否固定价格",name="0:按面积计算,1:固定价格") | |||
| private Integer fixedPrice; | |||
| @@ -244,18 +254,13 @@ public class WxPropertyContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "首期账单收款截止日期", name = "firstBillReceiveDate") | |||
| private Date firstBillReceiveDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺编号串", name = "shopIdStr") | |||
| private String shopIdStr; | |||
| //查询过期提醒 | |||
| @TableField(exist = false) | |||
| private Integer outDateNofity; | |||
| // public Integer getAdjustPeriod() { | |||
| // if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ | |||
| // return EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); | |||
| // } | |||
| // return adjustPeriod; | |||
| // } | |||
| public void setAdjustPeriodHandle() { | |||
| if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ | |||
| this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); | |||
| @@ -273,6 +278,38 @@ public class WxPropertyContract extends TenantEntity { | |||
| } | |||
| } | |||
| public Map<Long,BigDecimal> getRentShopAreaRate() { | |||
| String rentInfo = this.getRentInfo(); | |||
| if (!StringUtils.isBlank(rentInfo)) { | |||
| Map<Long,BigDecimal> shopAreaMap = new HashMap<Long,BigDecimal>(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| BigDecimal total = new BigDecimal(0); | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| Long shopId = rentInfoObject.getLong("id"); | |||
| String rentArea = rentInfoObject.getString("rentArea"); | |||
| if (StringUtils.isBlank(rentArea)) { | |||
| shopAreaMap.put(shopId, new BigDecimal("0")); | |||
| }else { | |||
| shopAreaMap.put(shopId, new BigDecimal("rentArea")); | |||
| total = total.add(new BigDecimal("rentArea")); | |||
| } | |||
| } | |||
| if (total.compareTo(new BigDecimal(0)) <= 0 ) { | |||
| total = new BigDecimal(1); | |||
| } | |||
| Map<Long,BigDecimal> shopAreaRateMap = new HashMap<Long,BigDecimal>(); | |||
| for (Iterator<Long> it = shopAreaMap.keySet().iterator();it.hasNext();) { | |||
| Long sid = it.next(); | |||
| BigDecimal sa = shopAreaMap.get(sid); | |||
| shopAreaRateMap.put(sid, sa.divide(total,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| } | |||
| return shopAreaRateMap; | |||
| } | |||
| return null; | |||
| } | |||
| public List<WxEnergyFees> getFeesStardarsList() { | |||
| if (StringUtils.isNotBlank(feesStandardsInfo)) { | |||
| return JSON.parseArray(feesStandardsInfo, WxEnergyFees.class); | |||
| @@ -299,6 +336,27 @@ public class WxPropertyContract extends TenantEntity { | |||
| } | |||
| return null; | |||
| } | |||
| public List<Long> shopIdsByShop() { | |||
| if (StringUtils.isBlank(this.shopIdStr)) { | |||
| return null; | |||
| } | |||
| String[] sidss = this.shopIdStr.split(","); | |||
| if (null == sidss || sidss.length <= 0 ) { | |||
| return null; | |||
| } | |||
| List<Long> shopIds = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < sidss.length; i++) { | |||
| String s = sidss[i]; | |||
| if (StringUtils.isNotBlank(s)) { | |||
| shopIds.add(Long.parseLong(s)); | |||
| } | |||
| } | |||
| if (shopIds.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| return shopIds; | |||
| } | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIds; | |||
| @@ -306,6 +364,7 @@ public class WxPropertyContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| List<WxEnergyFees> feeStandards; | |||
| @TableField(exist = false) | |||
| private Long queryShopId; | |||
| } | |||
| @@ -55,10 +55,6 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "来源ID,针对续签,从哪个合同续签", name = "fromId") | |||
| private Long fromId; | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "shopNumber") | |||
| private String shopNumber; | |||
| @TableField(exist = false) | |||
| private String building; | |||
| @@ -170,8 +166,6 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") | |||
| private Integer isDel; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺名称", name = "shopName") | |||
| private String shopName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") | |||
| private Date updatetime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") | |||
| @@ -186,7 +180,8 @@ public class WxRentContract extends TenantEntity { | |||
| private String createByName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "计租面积", name = "rentArea") | |||
| private String rentArea; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺编号串", name = "shopIdStr") | |||
| private String shopIdStr; | |||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "filename") | |||
| private String filename; | |||
| @@ -327,10 +322,6 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayDay") | |||
| private Integer latePayDay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "查询店铺", name = "queryShopId") | |||
| @TableField(exist = false) | |||
| private Long queryShopId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否有工作流 1:有 0:无", name = "flowHas") | |||
| @TableField(exist = false) | |||
| private Integer flowHas; | |||
| @@ -579,8 +570,8 @@ public class WxRentContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Date yearsEnd; | |||
| @TableField(exist = false) | |||
| private String queryShopNumber; | |||
| @TableField(exist = false) | |||
| List<WxRentContractAgileDeposit> contractDepositList; | |||
| @TableField(exist = false) | |||
| private Long queryShopId; | |||
| } | |||
| @@ -184,33 +184,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| wxPropertyContract.setDeposit(StringUtils.isNotBlank(wxPropertyContract.getDeposit()) ? wxPropertyContract.getDeposit() : "0"); | |||
| result.put("wxPropertyContract", wxPropertyContract); | |||
| //关联的商户 | |||
| if (wxPropertyContract.getMerchantId() != null) { | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(wxPropertyContract.getMerchantId()); | |||
| result.put("wxMerchant", wxMerchant); | |||
| } else { | |||
| result.put("wxMerchant", null); | |||
| } | |||
| //租赁费用欠缴 | |||
| // WxRentContract wxRentContract = new WxRentContract(); | |||
| // wxRentContract.setId(wxPropertyContract.getRentContractId()); | |||
| // result.put("rentOweCount",wxRentContractMapper.queryOweCount(wxRentContract)); | |||
| // //物业费用欠缴 | |||
| // WxPropertyContract propertyContract = new WxPropertyContract(); | |||
| // propertyContract.setId(id); | |||
| // propertyContract.updateTenantInfo(wxPropertyContract); | |||
| // result.put("propertyOweCount",wxPropertyContractMapper.queryOweCount(propertyContract)); | |||
| // //押金欠缴 | |||
| // result.put("depositOweCount",wxBillPropertyDepositMapper.queryOweCount(propertyContract)); | |||
| // //押金状态 | |||
| // WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| // wxBillPropertyDeposit.setPropertyContractId(id); | |||
| // wxBillPropertyDeposit.updateTenantInfo(wxPropertyContract); | |||
| // List<WxBillPropertyDeposit> select = wxBillPropertyDepositMapper.findList(wxBillPropertyDeposit); | |||
| // if (!select.isEmpty()) { | |||
| // result.put("depositStatus", select.get(0).getStatus()); | |||
| // } | |||
| //关联的店铺 | |||
| WxShop record = new WxShop(); | |||
| @@ -437,10 +410,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| record.setEndDate(wxPropertyContract.getEndDate()); | |||
| record.setAdjustPeriod(wxPropertyContract.getAdjustPeriod()); | |||
| record.setCreateType(wxPropertyContract.getCreateType()); | |||
| record.setShopIds(wxPropertyContract.getShopIds()); | |||
| record.setShopIdStr(wxPropertyContract.getShopIdStr()); | |||
| record.setFeeStandards(wxPropertyContract.getFeesStardarsList()); | |||
| record.setShopNumbers(wxPropertyContract.getShopNumbers()); | |||
| record.setMerchantId(wxPropertyContract.getMerchantId()); | |||
| List<WxAllBill> billList = buildProperty(new WxMerchant(),user,record,EnumIsPreview.YES.getCode(),true); | |||
| record.setPreviewBillRentList(billList); | |||
| } | |||
| @@ -508,8 +479,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| wxPropertyContractMapper.updateById(wxPropertyContract); | |||
| //建立账单 | |||
| if (record.getMerchantId() != null && record.getReceivePeriod() != null | |||
| && new BigDecimal(record.getPrice()).compareTo(new BigDecimal(0)) > 0) { | |||
| if (record.getReceivePeriod() != null && new BigDecimal(record.getPrice()).compareTo(new BigDecimal(0)) > 0) { | |||
| //预览账单改为正式,并写入商户id | |||
| updatePropertyPreviewBill(record); | |||
| } | |||
| @@ -521,7 +491,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| WxAllBill billProperty = new WxAllBill(); | |||
| billProperty.setPropertyContractId(record.getId()); | |||
| billProperty.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| billProperty.setMerchantId(record.getMerchantId()); | |||
| billProperty.updateTenantInfo(record); | |||
| wxAllBillMapper.updatePreviewStatus(billProperty); | |||
| if(new BigDecimal(record.getDeposit()).compareTo(new BigDecimal(0)) > 0) { | |||
| @@ -537,53 +506,64 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //找到计租方式 | |||
| int dayType = wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxAllBill wxBillDeposit = new WxAllBill(); | |||
| wxBillDeposit.setId(idWorker.nextId()); | |||
| wxBillDeposit.setBillType(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); | |||
| wxBillDeposit.setPropertyContractId(wxPropertyContract.getId()); | |||
| wxBillDeposit.setPay("0"); | |||
| String needpay = wxPropertyContract.getDeposit(); | |||
| wxBillDeposit.setNeedPay(needpay); | |||
| wxBillDeposit.setReceivePay(needpay); | |||
| wxBillDeposit.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); | |||
| //wxBillDeposit.setOwe(needpay); | |||
| Date date = new Date(); | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(wxPropertyContract.getRentalStartDate()); | |||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| // Date time = instance.getTime(); | |||
| // //账单开始时间 | |||
| // instance.clear(); | |||
| // instance.setTime(time); | |||
| // instance.add(Calendar.DAY_OF_MONTH, 1); | |||
| // wxBillDeposit.setStarttime(instance.getTime()); | |||
| wxBillDeposit.setStarttime(record.getFirstBillDateStart()); | |||
| // //账单结束时间 | |||
| // instance.clear(); | |||
| // instance.setTime(time); | |||
| // instance.add(dayType, wxPropertyContract.getLease()); | |||
| // wxBillDeposit.setEndtime(instance.getTime()); | |||
| wxBillDeposit.setEndtime(record.getFirstBillDateEnd()); | |||
| wxBillDeposit.setReceiveDate(record.getFirstBillReceiveDate()); | |||
| wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(record.getFirstBillReceiveDate())); | |||
| wxBillDeposit.updateTenantInfo(wxPropertyContract); | |||
| wxBillDeposit.setMerchantId(record.getMerchantId()); | |||
| wxBillDeposit.setCreatetime(date); | |||
| //wxBillDeposit.setCreateBy(user.getId()); | |||
| //wxBillDeposit.setCreateByName(user.getName()); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| //wxBillDeposit.setUpdateBy(user.getId()); | |||
| //wxBillDeposit.setUpdateByName(user.getName()); | |||
| wxBillDeposit.setShopInfo(getShopInfoStr(wxPropertyContract)); | |||
| wxBillDeposit.setShopNumber(wxPropertyContract.getShopNumbers()); | |||
| wxBillDeposit.setRentArea(wxPropertyContract.getRentArea()); | |||
| wxBillDeposit.setEnergyFeesId(EnumBillAllType.PROPERTY_DEPOSIT.getEnergyFeesId()); | |||
| try { | |||
| wxAllBillMapper.insert(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("添加物业押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| List<Long> shopIds = wxPropertyContract.shopIdsByShop(); | |||
| Map<Long, BigDecimal> shopAreaRateMap = wxPropertyContract.getRentShopAreaRate(); | |||
| if (null == shopAreaRateMap) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); | |||
| } | |||
| for (int i = 0 ; i < shopIds.size(); i++) { | |||
| Long shopId = shopIds.get(i); | |||
| BigDecimal shoprate = shopAreaRateMap.get(shopId); | |||
| WxAllBill wxBillDeposit = new WxAllBill(); | |||
| wxBillDeposit.setId(idWorker.nextId()); | |||
| wxBillDeposit.setBillType(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); | |||
| wxBillDeposit.setPropertyContractId(wxPropertyContract.getId()); | |||
| wxBillDeposit.setPay("0"); | |||
| String needpay = wxPropertyContract.getDeposit(); | |||
| wxBillDeposit.setNeedPay(new BigDecimal(needpay).multiply(shoprate).toPlainString()); | |||
| wxBillDeposit.setReceivePay(wxBillDeposit.getNeedPay()); | |||
| wxBillDeposit.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); | |||
| //wxBillDeposit.setOwe(needpay); | |||
| Date date = new Date(); | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(wxPropertyContract.getRentalStartDate()); | |||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| // Date time = instance.getTime(); | |||
| // //账单开始时间 | |||
| // instance.clear(); | |||
| // instance.setTime(time); | |||
| // instance.add(Calendar.DAY_OF_MONTH, 1); | |||
| // wxBillDeposit.setStarttime(instance.getTime()); | |||
| wxBillDeposit.setStarttime(record.getFirstBillDateStart()); | |||
| // //账单结束时间 | |||
| // instance.clear(); | |||
| // instance.setTime(time); | |||
| // instance.add(dayType, wxPropertyContract.getLease()); | |||
| // wxBillDeposit.setEndtime(instance.getTime()); | |||
| wxBillDeposit.setEndtime(record.getFirstBillDateEnd()); | |||
| wxBillDeposit.setReceiveDate(record.getFirstBillReceiveDate()); | |||
| wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(record.getFirstBillReceiveDate())); | |||
| wxBillDeposit.updateTenantInfo(wxPropertyContract); | |||
| wxBillDeposit.setShopId(shopId); | |||
| wxBillDeposit.setCreatetime(date); | |||
| //wxBillDeposit.setCreateBy(user.getId()); | |||
| //wxBillDeposit.setCreateByName(user.getName()); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| //wxBillDeposit.setUpdateBy(user.getId()); | |||
| //wxBillDeposit.setUpdateByName(user.getName()); | |||
| wxBillDeposit.setShopInfo(getShopInfoStr(wxPropertyContract)); | |||
| wxBillDeposit.setRentArea(wxPropertyContract.getRentArea()); | |||
| wxBillDeposit.setEnergyFeesId(EnumBillAllType.PROPERTY_DEPOSIT.getEnergyFeesId()); | |||
| try { | |||
| wxAllBillMapper.insert(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("添加物业押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -416,7 +416,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| String shopName = ""; | |||
| String shopIdStr = ""; | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| @@ -426,7 +426,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (!shopList.contains(shopId)) { | |||
| shopList.add(shopId); | |||
| shopName = shopName +","+ shopNumber; | |||
| shopIdStr = shopIdStr +","+ shopId; | |||
| } | |||
| } | |||
| setShops(record,shopList); | |||
| @@ -437,7 +437,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); | |||
| Date tempDate = record.getRentalStartDate(); | |||
| record.setRentalStartDate(oldRentStartDate); | |||
| record.setShopName(shopName); | |||
| record.setShopIdStr(shopIdStr); | |||
| record.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); | |||
| wxRentContractMapper.insert(record); | |||
| record.setRentalStartDate(tempDate); | |||
| @@ -813,7 +813,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| String shopName = ""; | |||
| String shopIdStr = ""; | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| @@ -826,14 +826,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractQuery.setId(record.getId()); | |||
| if (!shopList.contains(shopId)) { | |||
| shopList.add(shopId); | |||
| shopName = shopName +","+shopNumber; | |||
| shopIdStr = shopIdStr +","+shopId; | |||
| } | |||
| } | |||
| setShops(record,shopList); | |||
| try { | |||
| Date tempDate = record.getRentalStartDate(); | |||
| record.setRentalStartDate(oldRentStartDate); | |||
| record.setShopName(shopName); | |||
| record.setShopIdStr(shopIdStr); | |||
| if (writeFinal) { | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| }else { | |||
| @@ -315,7 +315,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| Long shopId = (Long)shop.get("id"); | |||
| if (null != shopId) { | |||
| Long merchantId = shopMerchantIdMap.get(shopId); | |||
| boolean isSetRentName = false; | |||
| if (null != merchantId && null != merchantMap) { | |||
| WxMerchant m = merchantMap.get(merchantId); | |||
| if (null != m) { | |||
| @@ -323,25 +322,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| shop.put("merchantId", m.getId()); | |||
| shop.put("linkPerson", m.getLinkPerson()); | |||
| shop.put("linkPhone", m.getLinkPhone()); | |||
| //如果不是虚拟商户,则取商户的名称 | |||
| if (m.getIsPrivate() == EnumYesOrNo.NO.getCode()) { | |||
| shop.put("rentName",m.getName()); | |||
| shop.put("rentType", 3); | |||
| isSetRentName = true; | |||
| } | |||
| } | |||
| } | |||
| if (!isSetRentName) { | |||
| //查询租户和业主 | |||
| WxShopUsersInfo suq = new WxShopUsersInfo(); | |||
| suq.updateTenantInfo(record); | |||
| suq.setShopId(shopId); | |||
| suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); | |||
| suq.setSortColumns("type desc"); | |||
| WxShopUsersInfo wsu = this.getOneShopUsers(suq); | |||
| if (null != wsu) { | |||
| shop.put("rentName",wsu.getName()); | |||
| shop.put("rentType", wsu.getType()); | |||
| } | |||
| } | |||
| } | |||
| @@ -431,12 +411,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| record.setOperationArea(record.getBuildArea()); | |||
| } | |||
| record.setShopNumber(StringUtils.trimToNull(record.getShopNumber())); | |||
| //如果是写字楼住宅,则自动新增虚拟商户 | |||
| if (record.getType() == EnumRentShopType.XIZILOU.getCode()) { | |||
| createPrivateMerchant(record); | |||
| record.setStatus(EnumShopStatus.NOT_RENT.getCode()); | |||
| } | |||
| wxShopMapper.insert(record); | |||
| return new ResultData(Result.SUCCESS,"添加成功"); | |||
| } else { | |||
| @@ -446,92 +420,16 @@ public class WxShopServiceImpl implements WxShopService { | |||
| } | |||
| } | |||
| public void createPrivateMerchant(WxShop record) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxMerchant merchant = new WxMerchant(); | |||
| merchant.updateTenantInfo(record); | |||
| merchant.setName("[系统铺位号]"+record.getShopNumber()); | |||
| merchant.setCreateShopNumber(record.getShopNumber()); | |||
| merchant.setCreateFrom(EnumMerchantCreateFrom.SYS_SHOP_CREATE.getCode()); | |||
| List<Long> ids = wxMerchantMapper.findIdList(merchant); | |||
| if (null == ids || ids.size() <= 0 ) { | |||
| merchant.setId(idWorker.nextId()); | |||
| merchant.setLinkPerson("虚拟"); | |||
| merchant.setLinkPhone("11111111111"); | |||
| merchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| merchant.setImgUrl("https://formall.oss-accelerate.aliyuncs.com/234/WechatIMG5071.png"); | |||
| merchant.setCoverPicture("[\"https://formall.oss-accelerate.aliyuncs.com/234/WechatIMG5071.png\"]"); | |||
| merchant.setCreateDate(new Date()); | |||
| merchant.setUpdateDate(new Date()); | |||
| merchant.setIsPublic(EnumMerchantPublic.PRIVATE.getCode()); | |||
| merchant.setIsPrivate(EnumYesOrNo.YES.getCode()); | |||
| merchant.setCreateShopType(record.getType()); | |||
| merchant.setBillSetting(3); | |||
| merchant.setCreateFromId(String.valueOf(record.getId())); | |||
| merchant.setCarVendorType(0); | |||
| merchant.setBusinessId(com.iformall.utils.Constant.default_business); | |||
| //merchant.setType(); | |||
| merchant.setIsAdmin(EnumYesOrNo.NO.getCode()); | |||
| merchant.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| merchant.setSearchCardByPhone(EnumYesOrNo.NO.getCode()); | |||
| merchant.setCreditLocked(EnumYesOrNo.NO.getCode()); | |||
| wxMerchantMapper.insert(merchant); | |||
| } | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData setSelled(WxShop record) { | |||
| WxShop wxShop = wxShopMapper.selectById(record.getId()); | |||
| if (wxShop == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); | |||
| } | |||
| //如果是写字楼住宅,直接更改状态即可 | |||
| if(wxShop.getType() == EnumRentShopType.XIZILOU.getCode()) { | |||
| wxShop.setSellStatus(EnumShopSellStatus.SELLED.getCode()); | |||
| wxShop.setUpdateDate(new Date()); | |||
| wxShopMapper.updateById(wxShop); | |||
| return new ResultData(Result.SUCCESS, "更新成功"); | |||
| }else { | |||
| //2、如果该店铺还存在品牌商户,则不允许 | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(wxShop.getId()); | |||
| wxMerchantShop.updateTenantInfo(wxShop); | |||
| wxMerchantShop.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| if (null != wxMerchantShops && wxMerchantShops.size() > 0 ) { | |||
| return new ResultData(Result.ERROR,"店铺还存在关联的品牌商户,请先删除店铺关联"); | |||
| } | |||
| //如果存在有效的合同,则不允许删除 | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxShop); | |||
| rcq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| List<Integer> status = EnumRentContractStatus.getValidStatus(); | |||
| status.add(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| rcq.setStatuss(status); | |||
| List<WxRentContract> list = wxRentContractMapper.findList(rcq); | |||
| if (null != list && list.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "店铺存在有效或者审批中的租金合同,请先终止该合同或者审批退回作废合同"); | |||
| } | |||
| WxPropertyContract pcq = new WxPropertyContract(); | |||
| pcq.updateTenantInfo(wxShop); | |||
| pcq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| pcq.setStatuss(status); | |||
| List<WxPropertyContract> plist = wxPropertyContractMapper.findList(pcq); | |||
| if (null != plist && plist.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,请先终止该合同或者审批退回作废合同"); | |||
| } | |||
| wxShop.setSellStatus(EnumShopSellStatus.SELLED.getCode()); | |||
| wxShop.setUpdateDate(new Date()); | |||
| wxShopMapper.updateById(wxShop); | |||
| //创建虚拟商户 | |||
| createPrivateMerchant(wxShop); | |||
| return new ResultData(Result.SUCCESS, "更新成功"); | |||
| } | |||
| wxShop.setSellStatus(EnumShopSellStatus.SELLED.getCode()); | |||
| wxShop.setUpdateDate(new Date()); | |||
| wxShopMapper.updateById(wxShop); | |||
| return new ResultData(Result.SUCCESS, "更新成功"); | |||
| } | |||
| @Override | |||
| @@ -543,7 +441,7 @@ public class WxShopServiceImpl implements WxShopService { | |||
| //如果存在有效的合同,则不允许删除 | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxShop); | |||
| rcq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| rcq.setQueryShopId(wxShop.getId()); | |||
| List<Integer> status = EnumRentContractStatus.getValidStatus(); | |||
| status.add(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| rcq.setStatuss(status); | |||
| @@ -554,7 +452,7 @@ public class WxShopServiceImpl implements WxShopService { | |||
| WxPropertyContract pcq = new WxPropertyContract(); | |||
| pcq.updateTenantInfo(wxShop); | |||
| pcq.setQueryShopNumber(wxShop.getShopNumber()); | |||
| pcq.setQueryShopId(wxShop.getId()); | |||
| pcq.setStatuss(status); | |||
| List<WxPropertyContract> plist = wxPropertyContractMapper.findList(pcq); | |||
| if (null != plist && plist.size() > 0 ) { | |||
| @@ -5,6 +5,7 @@ | |||
| <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="customers_id" jdbcType="BIGINT" property="customersId"/> | |||
| <result column="decimal_size" jdbcType="INTEGER" property="decimalSize"/> | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/> | |||
| @@ -62,21 +63,24 @@ | |||
| <result column="first_bill_date_start" jdbcType="TIMESTAMP" property="firstBillDateStart"/> | |||
| <result column="first_bill_date_end" jdbcType="TIMESTAMP" property="firstBillDateEnd"/> | |||
| <result column="first_bill_receive_date" jdbcType="TIMESTAMP" property="firstBillReceiveDate"/> | |||
| <result column="shop_id_str" jdbcType="VARCHAR" property="shopIdStr"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`, | |||
| `id`,`tenant_id`,`parent_tenant_id`,`customers_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`, | |||
| `sign_date`,`receive_period`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by_name`,`update_by_name`, | |||
| `deposit`,`is_del`,`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`, | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`,fixed_price,`pay_period_rate`, | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`,fixed_price,`pay_period_rate`,shop_id_str, | |||
| `file_names`,price_unit,rent_price,subject_name,rent_start_type,`operation_type`,late_pay_ratio,late_pay_day,end_contract_time,out_date_notify_days,out_date_notify_phone | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != customersId ">and `customers_id` = #{customersId}</if> | |||
| <if test=" null != price ">and `price` = #{price}</if> | |||
| <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if> | |||
| <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | |||
| @@ -112,6 +116,9 @@ | |||
| <if test=" null != createType ">and `create_type` = #{createType}</if> | |||
| <if test=" null != dayPriceCalcute ">and `day_price_calcute` = #{dayPriceCalcute}</if> | |||
| <if test=" null != monthAverageDays ">and `month_average_days` = #{monthAverageDays}</if> | |||
| <if test=" null != queryShopId"> | |||
| and concat(',',shop_id_str,',') like concat('%,',#{queryShopId},',%') | |||
| </if> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and business_id in (${businessForRule}) | |||
| </if> | |||
| @@ -56,7 +56,6 @@ | |||
| <result column="other_rent_price_info" jdbcType="VARCHAR" property="otherRentPriceInfo"/> | |||
| <result column="subject_name" property="subjectName"/> | |||
| <result column="rent_start_type" property="rentStartType"/> | |||
| <result column="shop_name" property="shopName"/> | |||
| <result column="from_id" property="fromId"/> | |||
| <result column="rent_input_way" property="rentInputWay"/> | |||
| <result column="adjust_ratio_way" property="adjustRatioWay"/> | |||
| @@ -83,6 +82,7 @@ | |||
| <result column="first_bill_date_start" jdbcType="TIMESTAMP" property="firstBillDateStart"/> | |||
| <result column="first_bill_date_end" jdbcType="TIMESTAMP" property="firstBillDateEnd"/> | |||
| <result column="first_bill_receive_date" jdbcType="TIMESTAMP" property="firstBillReceiveDate"/> | |||
| <result column="shop_id_str" jdbcType="VARCHAR" property="shopIdStr"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -93,11 +93,11 @@ | |||
| `deposit`,cashtype_content_lsit,cashtype_lsit,`is_del`,`revenue_jumps_remark`, | |||
| `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`, | |||
| `start_date`,`end_date`,`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`,`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, | |||
| bussiness_management_fee,bussiness_management_fee_ratio_way,bussiness_management_fee_ratio,shop_id_str, | |||
| operating_management_fee,operating_management_fee_ratio_way,operating_management_fee_ratio,out_date_notify_days,out_date_notify_phone,design_file | |||
| </sql> | |||
| @@ -143,11 +143,8 @@ | |||
| <if test=" null != dayPriceCalcute ">and `day_price_calcute` = #{dayPriceCalcute}</if> | |||
| <if test=" null != monthAverageDays ">and `month_average_days` = #{monthAverageDays}</if> | |||
| <if test=" null != revenueFixedRentPrice ">and `revenue_fixed_rent_price` = #{revenueFixedRentPrice}</if> | |||
| <if test=" null != shopNumber and shopNumber!=''"> | |||
| and shop_name like concat('%',#{shopNumber},'%') | |||
| </if> | |||
| <if test=" null != queryShopNumber and queryShopNumber!=''"> | |||
| and concat(',',shop_name,',') like concat('%,',#{queryShopNumber},',%') | |||
| <if test=" null != queryShopId"> | |||
| and concat(',',shop_id_str,',') like concat('%,',#{queryShopId},',%') | |||
| </if> | |||
| <if test=" null != statuss "> | |||
| @@ -255,7 +252,6 @@ | |||
| <result column="parent_tenant_id" property="parentTenantId"/> | |||
| <result column="rent_id" property="rentId"/> | |||
| <result column="property_id" property="propertyId"/> | |||
| <result column="shop_name" property="shopName"/> | |||
| <result column="rent_info" property="rentInfo"/> | |||
| <result column="rental_start_date" property="rentalStartDate"/> | |||
| <result column="rental_end_date" property="rentalEndDate"/> | |||
| @@ -282,7 +278,7 @@ | |||
| <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap"> | |||
| select rc.id,rc.tenant_id,rc.parent_tenant_id,rc.id as rent_id, pc.id as property_id, rc.rental_start_date,rc.rental_end_date,rc.`status`, | |||
| rc.price as rent_price,rc.contract_number,rc.shop_name,rc.type,rc.apply_status,rc.price_detail,rc.revenue_fixed_rent_price,rc.revenue_rent_price, | |||
| rc.price as rent_price,rc.contract_number,rc.type,rc.apply_status,rc.price_detail,rc.revenue_fixed_rent_price,rc.revenue_rent_price, | |||
| rc.rent_info,pc.price as property_price,pc.`status` as property_status, | |||
| rc.price_unit as rent_price_unit,pc.price_unit as property_price_unit,rc.day_price_calcute,rc.free_period_remark, | |||
| rc.business_type businessType,rc.month_average_days,rc.revenue_jumps_remark,rc.first_bill_date_start,rc.first_bill_date_end | |||
| @@ -303,11 +299,8 @@ | |||
| <if test=" null != propertyId and '' != propertyId"> | |||
| and pc.`id` = #{propertyId} | |||
| </if> | |||
| <if test=" null != shopNumber and shopNumber!=''"> | |||
| and (json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%') or rc.shop_name like concat('%',#{shopNumber},'%') ) | |||
| </if> | |||
| <if test=" null != queryShopNumber and queryShopNumber!=''"> | |||
| and concat(',',rc.shop_name,',') like concat('%,',#{queryShopNumber},',%') | |||
| <if test=" null != queryShopId"> | |||
| and concat(',',rc.shop_id_str,',') like concat('%,',#{queryShopId},',%') | |||
| </if> | |||
| <!-- <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1"> | |||
| and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%') | |||