| @@ -121,8 +121,8 @@ public class WxRentContractController extends WxContractBaseController { | |||
| wxRentContract = new WxRentContract(); | |||
| } | |||
| wxRentContract.updateTenantInfo(getTenantInfo()); | |||
| Map<String, Object> result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| //Map<String, Object> result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); | |||
| } | |||
| /** | |||
| @@ -140,7 +140,7 @@ public class WxRentContractController extends WxContractBaseController { | |||
| if(dbRent.getRentStartType()!=null && dbRent.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| dbRent.setRentalStartDate(dbRent.getStartDate()); | |||
| } | |||
| List<WxBillRent> result = wxRentContractService.buildRent(new WxMerchant(),getUserId(),dbRent, EnumIsPreview.YES.getCode(), false); | |||
| List<WxBillRent> result = wxRentContractService.buildRent(getUserId(),dbRent, EnumIsPreview.YES.getCode(), false); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -173,6 +173,49 @@ public class WxRentContractController extends WxContractBaseController { | |||
| return wxRentContractService.save(wxRentContract, user.getId(),user.getName(),oldDate); | |||
| } | |||
| /** | |||
| * 防止前端3秒重复提交 | |||
| * @param wxRentContract | |||
| * @return | |||
| */ | |||
| @PostMapping("updateMoney") | |||
| @SystemControllerLog(description = "租赁合同-更新金额") | |||
| public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| wxRentContract.setRentPriceHandle(); | |||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||
| if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | |||
| } | |||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),EnumFromType.OTHER.getCode(),oldDate); | |||
| } | |||
| @PostMapping("updateFile") | |||
| @SystemControllerLog(description = "租赁合同-更新文件") | |||
| public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| wxRentContract.setRentPriceHandle(); | |||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | |||
| } | |||
| return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName(),oldDate); | |||
| } | |||
| @PostMapping("updateRentStartTime") | |||
| @SystemControllerLog(description = "租赁合同-更新租赁开始日期") | |||
| public ResultData updateRentStartTime(@RequestBody WxRentContract wxRentContract) { | |||
| @@ -215,46 +258,9 @@ public class WxRentContractController extends WxContractBaseController { | |||
| return update; | |||
| } | |||
| /** | |||
| * 防止前端3秒重复提交 | |||
| * @param wxRentContract | |||
| * @return | |||
| */ | |||
| @PostMapping("updateMoney") | |||
| @SystemControllerLog(description = "租赁合同-更新金额") | |||
| public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| wxRentContract.setRentPriceHandle(); | |||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||
| if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | |||
| } | |||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),EnumFromType.OTHER.getCode(),oldDate); | |||
| } | |||
| @PostMapping("updateFile") | |||
| @SystemControllerLog(description = "租赁合同-更新文件") | |||
| public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| wxRentContract.setRentPriceHandle(); | |||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | |||
| } | |||
| return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName(),oldDate); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| @@ -288,13 +294,13 @@ public class WxRentContractController extends WxContractBaseController { | |||
| wxRentContractService.download(request,response); | |||
| } | |||
| @GetMapping("/getRentContractStatusInfo") | |||
| @SystemControllerLog(description = "租赁合同-获取合同状态信息") | |||
| public ResultData getRentContractStatusInfo(@ModelAttribute WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractStatusInfo"); | |||
| wxRentContract.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(wxRentContract)); | |||
| } | |||
| // @GetMapping("/getRentContractStatusInfo") | |||
| // @SystemControllerLog(description = "租赁合同-获取合同状态信息") | |||
| // public ResultData getRentContractStatusInfo(@ModelAttribute WxRentContract wxRentContract) { | |||
| // logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractStatusInfo"); | |||
| // wxRentContract.updateTenantInfo(getTenantInfo()); | |||
| // return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(wxRentContract)); | |||
| // } | |||
| @GetMapping("/endRentContract") | |||
| @ApiImplicitParams({ | |||
| @@ -51,4 +51,15 @@ ALTER TABLE `wx_profit_sharing_receiver` | |||
| ADD COLUMN `plat` SMALLINT(3) NOT NULL DEFAULT 1 COMMENT '平台 1:微信 2:阿里 3:头条'; | |||
| ALTER TABLE wx_rent_contract DROP COLUMN shop_id; | |||
| CREATE TABLE `wx_rent_contract_shop` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `rent_contract_id` bigint(20) NOT NULL COMMENT '租金合同编码', | |||
| `shop_id` bigint(20) NOT NULL COMMENT '店铺编码', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='租金合同关联的店铺'; | |||
| ALTER TABLE `wx_rent_contract` ADD COLUMN `shop_name` VARCHAR(30) COMMENT '店铺名称'; | |||
| @@ -39,22 +39,40 @@ public class ContractSchedule { | |||
| */ | |||
| @Scheduled(cron = "0 5 0 * * ?") | |||
| public void updateContractStatus() { | |||
| log.info("合同状态更新开始"); | |||
| List<WxMall> wxMalls = wxMallMapper.findList(null); | |||
| for (WxMall wxMall : wxMalls) { | |||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| //更新合同状态,正常到期 | |||
| //查询计租中的合同,找到商户,然后根据商户,如果商户有到期的(租金、物业)合同,则合同状态更新为到期。 | |||
| //如果店铺没有有效合同,则释放店铺,不停用商户 | |||
| List<WxMall> wxMalls = wxMallMapper.findList(null); | |||
| for (WxMall wxMall : wxMalls) { | |||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(tenantEntity); | |||
| log.info("租赁合同状态更新开始"); | |||
| wxRentContractService.updateStatus(wxRentContract); | |||
| log.info("租赁合同状态更新结束"); | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.updateTenantInfo(tenantEntity); | |||
| log.info("物业合同状态更新开始"); | |||
| wxPropertyContractService.updateStatus(wxPropertyContract); | |||
| log.info("物业合同状态更新结束"); | |||
| } | |||
| wxRentContractService.outDateContract(wxRentContract); | |||
| } | |||
| // log.info("合同状态更新开始"); | |||
| // List<WxMall> wxMalls = wxMallMapper.findList(null); | |||
| // for (WxMall wxMall : wxMalls) { | |||
| // TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| // WxRentContract wxRentContract = new WxRentContract(); | |||
| // wxRentContract.updateTenantInfo(tenantEntity); | |||
| // log.info("租赁合同状态更新开始"); | |||
| // wxRentContractService.updateStatus(wxRentContract); | |||
| // log.info("租赁合同状态更新结束"); | |||
| // | |||
| // WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| // wxPropertyContract.updateTenantInfo(tenantEntity); | |||
| // log.info("物业合同状态更新开始"); | |||
| // wxPropertyContractService.updateStatus(wxPropertyContract); | |||
| // log.info("物业合同状态更新结束"); | |||
| // } | |||
| log.info("合同状态更新结束"); | |||
| } | |||
| @@ -114,8 +114,8 @@ public class WxRentContract extends TenantEntity { | |||
| private Integer businessId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopType") | |||
| private Integer shopType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "商铺ID", name = "shopId") | |||
| private Long shopId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopName") | |||
| private String shopName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") | |||
| private Date updatetime; | |||
| @@ -155,10 +155,10 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") | |||
| private Long revenue; | |||
| @io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "rentalStartDate") | |||
| @io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "startDate") | |||
| private Date startDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "起租结束时间", name = "rentalEndDate") | |||
| @io.swagger.annotations.ApiModelProperty(value = "起租结束时间", name = "endDate") | |||
| private Date endDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "审核状态, 0未审核 1审核中 2审核通过 3驳回", name = "applyStatus") | |||
| @@ -191,6 +191,11 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList") | |||
| private List<WxBillProperty> reviewBillPropertyPList; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺列表", name = "shopIdList") | |||
| private List<Long> shopIdList; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批说明", name = "remark") | |||
| private String remark; | |||
| @@ -0,0 +1,25 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @TableName(value = "wx_rent_contract_shop") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxRentContractShop extends BaseEntity { | |||
| private static final long serialVersionUID = 6159346068143408562L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="合同编号",name="rentContractId") | |||
| private Long rentContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value="店铺编号",name="shopId") | |||
| private Long shopId; | |||
| } | |||
| @@ -6,6 +6,7 @@ import com.iformall.domain.po.WxBusiness; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.vo.WxRentPropertyContractVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.junit.jupiter.params.ParameterizedTest; | |||
| import java.util.Collection; | |||
| import java.util.List; | |||
| @@ -18,33 +19,35 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| List<WxRentContract> findList(WxRentContract wxRentContract); | |||
| List<Map<String,Object>> queryRentContractData(WxRentContract wxRentContract); | |||
| //List<Map<String,Object>> queryRentContractData(WxRentContract wxRentContract); | |||
| int queryRentContractWaitSignStatus(WxRentContract wxRentContract); | |||
| //int queryRentContractWaitSignStatus(WxRentContract wxRentContract); | |||
| int queryRentContractEndSoonStatus(WxRentContract wxRentContract); | |||
| //int queryRentContractEndSoonStatus(WxRentContract wxRentContract); | |||
| int queryRentContractPaidStatus(WxRentContract wxRentContract); | |||
| //int queryRentContractPaidStatus(WxRentContract wxRentContract); | |||
| int queryRentContractEndStatus(WxRentContract wxRentContract); | |||
| int queryRentContractCountByStatus(WxRentContract wxRentContract); | |||
| //int queryRentContractEndStatus(WxRentContract wxRentContract); | |||
| int updateRentContractEndSoonStatus(WxRentContract wxRentContract); | |||
| //int updateRentContractEndSoonStatus(WxRentContract wxRentContract); | |||
| int updateRentContractPaidStatus(WxRentContract wxRentContract); | |||
| //int updateRentContractPaidStatus(WxRentContract wxRentContract); | |||
| int updateRentContractEndStatus(WxRentContract wxRentContract); | |||
| //int updateRentContractEndStatus(WxRentContract wxRentContract); | |||
| void updateRentWaitSignStatus(WxRentContract wxRentContract); | |||
| //void updateRentWaitSignStatus(WxRentContract wxRentContract); | |||
| void updateRentInvalidStatus(WxRentContract wxRentContract); | |||
| //void updateRentInvalidStatus(WxRentContract wxRentContract); | |||
| List<WxRentContract> getRentContractList(WxRentContract tenantId); | |||
| //List<WxRentContract> getRentContractList(WxRentContract wxRentContract); | |||
| void updateStatusForUnsign(WxRentContract wxRentContract); | |||
| void updateApplyStatus(WxRentContract wxRentContract); | |||
| List<WxRentContract> getRentInvalidList(WxRentContract wxRentContract); | |||
| //List<WxRentContract> getRentInvalidList(WxRentContract wxRentContract); | |||
| void updateStatus(WxRentContract wxRentContract); | |||
| @@ -52,7 +55,7 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| List<WxRentContract> getMerchants(WxRentContract wxRentContract); | |||
| int selectRentContractCountByShopId(WxRentContract wxRentContract); | |||
| int selectRentContractCountByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("id") Long id); | |||
| void updateInvalidContract(WxRentContract record); | |||
| @@ -60,20 +63,17 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| List<WxRentContract> selectRentContractByShopId(WxRentContract record); | |||
| List<WxRentContract> selectRentContractByShopIds(@Param("shopIds") Collection<Long> shopIds, | |||
| @Param("shopIdsRegexp") String shopIdsRegexp, | |||
| @Param("tenantId") String tenantId, | |||
| @Param("parentTenantId") String parentTenantId); | |||
| //List<WxRentContract> selectRentContractByShopIds(@Param("shopIds") Collection<Long> shopIds,@Param("shopIdsRegexp") String shopIdsRegexp,@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId); | |||
| int hasContractNumber(WxRentContract wxRentContract); | |||
| Integer getShopType(WxRentContract wxRentContract); | |||
| //Integer getShopType(WxRentContract wxRentContract); | |||
| List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | |||
| //List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | |||
| WxRentContract getByBill(WxBillRent billRent); | |||
| int selectContractCountByShopId(WxRentContract wxRentContract); | |||
| //int selectContractCountByShopId(WxRentContract wxRentContract); | |||
| int getShopCountMax(); | |||
| List<Map<String,Object>> queryContractByBus(WxBusiness wxBusiness); | |||
| @@ -0,0 +1,14 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRentContractShop; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxRentContractShopMapper extends CommonMapper<WxRentContractShop, Long> { | |||
| List<WxRentContractShop> findList(WxRentContractShop record); | |||
| void deleteShops(@Param("contractId") Long contractId); | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -24,7 +25,7 @@ public interface WxRentContractService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize); | |||
| //Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -55,13 +56,13 @@ public interface WxRentContractService { | |||
| void download(HttpServletRequest request, HttpServletResponse response); | |||
| Object getRentContractStatusInfo(WxRentContract record); | |||
| //Object getRentContractStatusInfo(WxRentContract record); | |||
| ResultData endRentContract(Long id, Integer status); | |||
| ResultData updateMerchant(WxRentContract wxRentContract); | |||
| Object getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); | |||
| PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); | |||
| void exportContract(HttpServletRequest request, HttpServletResponse response, Long id); | |||
| @@ -73,31 +74,31 @@ public interface WxRentContractService { | |||
| void updateApplyStatus(WxRentContract wxRentContract); | |||
| List<WxBillRent> buildRent(WxMerchant wxMerchant, Long userId,WxRentContract rentContract,Integer isPreview,boolean saveDb); | |||
| List<WxBillRent> buildRent(Long userId,WxRentContract rentContract,Integer isPreview,boolean saveDb); | |||
| void buildDeposit(WxMerchant wxMerchant, Long userId,Long rentContractId); | |||
| void buildDeposit(Long userId,Long rentContractId); | |||
| Object getMerchants(WxRentContract wxRentContract); | |||
| void updateInvalidContract(Long rentContractId); | |||
| //void updateInvalidContract(Long rentContractId); | |||
| ResultData hasRentStatus(WxRentContract wxRentContract); | |||
| ResultData hasContractNumber(WxRentContract wxRentContract); | |||
| Integer getShopType(WxRentContract wxRentContract); | |||
| //Integer getShopType(WxRentContract wxRentContract); | |||
| void endContract(WxRentContract wxRentContract); | |||
| void updatePropertyPreviewBill(WxRentContract record); | |||
| Map<String, Object> updateStatus(WxRentContract record); | |||
| //Map<String, Object> updateStatus(WxRentContract record); | |||
| WxRentContract getByBill(WxBillRent billRent); | |||
| Map<Long,WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp, TenantEntity tenantEntity); | |||
| //Map<Long,WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp, TenantEntity tenantEntity); | |||
| int selectContractCountByShopId(WxRentContract wxRentContract); | |||
| //int selectContractCountByShopId(WxRentContract wxRentContract); | |||
| ResultData getContractByContractNumber(WxRentContract wxRentContract); | |||
| @@ -116,4 +117,11 @@ public interface WxRentContractService { | |||
| ResultData apply(WxRentContract wxRentContract,MallUserInfo user); | |||
| boolean hasContract(WxRentContract wxRentContract); | |||
| /** | |||
| * 合同正常到期 | |||
| * @param wxRentContract | |||
| */ | |||
| void outDateContract(WxRentContract wxRentContract); | |||
| } | |||
| @@ -10,7 +10,7 @@ import com.iformall.domain.vo.WxRentPropertyContractVo; | |||
| */ | |||
| public interface WxRentPropertyContractService { | |||
| PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize); | |||
| //PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize); | |||
| ResultData getContractInfo(Long id); | |||
| @@ -297,7 +297,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| //计租中 | |||
| wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| int rendPaidCount = wxRentContractMapper.queryRentContractPaidStatus(wxRentContract); | |||
| int rendPaidCount = wxRentContractMapper.queryRentContractCountByStatus(wxRentContract); | |||
| contractMap.put("rendPaidCount", rendPaidCount); | |||
| //将到期 | |||
| @@ -308,7 +308,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| //到期 | |||
| wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| int endCount = wxRentContractMapper.queryRentContractEndStatus(wxRentContract); | |||
| int endCount = wxRentContractMapper.queryRentContractCountByStatus(wxRentContract); | |||
| contractMap.put("endCount", endCount); | |||
| return contractMap; | |||
| @@ -203,7 +203,6 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| //如果审批完成 | |||
| }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxRentContractService.updateRentContractStatus(businessId); | |||
| return; | |||
| } | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| @@ -219,9 +218,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| // 审批完成 | |||
| }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxPropertyContractService.updatePropertyContractStatus(businessId); | |||
| return; | |||
| } | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| } | |||
| @@ -383,39 +383,39 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchantMapper.insert(wxMerchant); | |||
| //关联合同 | |||
| if (wxMerchant.getRentContractId() != null) { | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(wxMerchant.getRentContractId()); | |||
| if (wxRentContract == null) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| if (wxRentContract.getStatus().equals(EnumRentContractStatus.TERMINATE)) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED); | |||
| } | |||
| wxRentContract.setMerchantId(merchantId); | |||
| wxRentContract.setUpdatetime(new Date()); | |||
| if (wxRentContract.getRentalStartDate().before(new Date())) { | |||
| wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| } else { | |||
| wxRentContract.setStatus(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||
| } | |||
| wxRentContractMapper.updateById(wxRentContract); | |||
| EventUtil.publistRentEvent(wxRentContractService,wxRentContract); | |||
| //预览账单改为正式,并写入商户id(租赁合同需要绑定商户才变成已签约) | |||
| WxBillRent billRent = new WxBillRent(); | |||
| billRent.setRentContractId(wxMerchant.getRentContractId()); | |||
| billRent.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| billRent.setMerchantId(merchantId); | |||
| wxBillRentMapper.updatePreviewStatus(billRent); | |||
| //创建押金 | |||
| wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | |||
| //作废合同 | |||
| wxRentContractService.updateInvalidContract(wxMerchant.getRentContractId()); | |||
| //合并合同-更新物业账单 | |||
| if (wxRentContract.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { | |||
| wxRentContractService.updatePropertyPreviewBill(wxRentContract); | |||
| } | |||
| } | |||
| // if (wxMerchant.getRentContractId() != null) { | |||
| // WxRentContract wxRentContract = wxRentContractMapper.selectById(wxMerchant.getRentContractId()); | |||
| // if (wxRentContract == null) { | |||
| // return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| // } | |||
| // if (wxRentContract.getStatus().equals(EnumRentContractStatus.TERMINATE)) { | |||
| // return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED); | |||
| // } | |||
| // wxRentContract.setMerchantId(merchantId); | |||
| // wxRentContract.setUpdatetime(new Date()); | |||
| // if (wxRentContract.getRentalStartDate().before(new Date())) { | |||
| // wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| // } else { | |||
| // wxRentContract.setStatus(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||
| // } | |||
| // wxRentContractMapper.updateById(wxRentContract); | |||
| // | |||
| // EventUtil.publistRentEvent(wxRentContractService,wxRentContract); | |||
| // //预览账单改为正式,并写入商户id(租赁合同需要绑定商户才变成已签约) | |||
| // WxBillRent billRent = new WxBillRent(); | |||
| // billRent.setRentContractId(wxMerchant.getRentContractId()); | |||
| // billRent.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| // billRent.setMerchantId(merchantId); | |||
| // wxBillRentMapper.updatePreviewStatus(billRent); | |||
| // //创建押金 | |||
| // wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | |||
| // //作废合同 | |||
| // wxRentContractService.updateInvalidContract(wxMerchant.getRentContractId()); | |||
| // //合并合同-更新物业账单 | |||
| // if (wxRentContract.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { | |||
| // wxRentContractService.updatePropertyPreviewBill(wxRentContract); | |||
| // } | |||
| // } | |||
| return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| @@ -113,18 +113,22 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @Override | |||
| public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| //Object rentContractStatusInfo = getRentContractStatusInfo(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData); | |||
| Map<String, Object> result = new HashMap<>(); | |||
| //result.put("rentContractStatusInfo", rentContractStatusInfo); | |||
| result.put("pageInfo", pageInfo); | |||
| return result; | |||
| } | |||
| @Autowired | |||
| WxRentContractShopMapper wxRentContractShopMapper; | |||
| // @Override | |||
| // public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| // //Object rentContractStatusInfo = getRentContractStatusInfo(record); | |||
| // PageHelper.startPage(pageIndex, pageSize); | |||
| // //List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(record); | |||
| // //PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData); | |||
| // //Map<String, Object> result = new HashMap<>(); | |||
| // //result.put("rentContractStatusInfo", rentContractStatusInfo); | |||
| // result.put("pageInfo", pageInfo); | |||
| // this. | |||
| // return result; | |||
| // } | |||
| @Override | |||
| public Map<String, Object> getById(Long id) { | |||
| @@ -157,7 +161,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| Double rentPrice = rentInfoObject.getDouble("rentPrice"); | |||
| wxRentContract.setShopId(rentInfoObject.getLong("shopId")); | |||
| //wxRentContract.setShopId(rentInfoObject.getLong("shopId")); | |||
| Long price = wxRentContract.getPrice()/100; | |||
| if(rentPrice == null){ | |||
| if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { | |||
| @@ -434,63 +438,46 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setUpdatetime(date); | |||
| List<Long> shopList = Lists.newArrayList(); | |||
| if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = record.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| if (size == 0) { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| String rentInfo = record.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| if (size == 0) { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(record); | |||
| Long shopId = rentInfoObject.getLong("shopId"); | |||
| //wxRentContract.setShopId(shopId); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(record); | |||
| Long shopId = rentInfoObject.getLong("shopId"); | |||
| wxRentContract.setShopId(shopId); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (count > 0) { | |||
| if (record.getMerchantId() != null) { | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(shopId); | |||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| long total = wxMerchantShopList.parallelStream(). | |||
| filter(ms -> !ms.getMerchantId().equals(record.getMerchantId())).count(); | |||
| if (total > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| if (record.getMerchantId() != null) { | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(shopId); | |||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| long total = wxMerchantShopList.parallelStream(). | |||
| filter(ms -> !ms.getMerchantId().equals(record.getMerchantId())).count(); | |||
| if (total > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| } else { | |||
| WxShop wxShop = wxShopMapper.selectById(shopId); | |||
| if (wxShop == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | |||
| } | |||
| if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); | |||
| } | |||
| } else { | |||
| WxShop wxShop = wxShopMapper.selectById(shopId); | |||
| if (wxShop == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 不存在"); | |||
| } | |||
| if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); | |||
| } | |||
| shopList.add(shopId); | |||
| } | |||
| } else { | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(record); | |||
| wxRentContract.setShopId(record.getShopId()); | |||
| // long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| // filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| // || rc.get("status").equals(EnumRentContractStatus.PAING.getCode()) | |||
| // || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.PAING.getCode())).count(); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| if (!shopList.contains(shopId)) { | |||
| shopList.add(shopId); | |||
| } | |||
| shopList.add(record.getShopId()); | |||
| } | |||
| try { | |||
| @@ -499,21 +486,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| Date tempDate = record.getRentalStartDate(); | |||
| record.setRentalStartDate(oldRentStartDate); | |||
| wxRentContractMapper.insert(record); | |||
| wxRentContractShopMapper.deleteShops(record.getId()); | |||
| record.setShopIdList(shopList); | |||
| for (Long shopId: shopList) { | |||
| WxRentContractShop rentShop = new WxRentContractShop(); | |||
| rentShop.setShopId(shopId); | |||
| rentShop.setRentContractId(record.getId()); | |||
| wxRentContractShopMapper.insert(rentShop); | |||
| } | |||
| record.setRentalStartDate(tempDate); | |||
| } catch (Exception e) { | |||
| logger.error("保存租赁合同信息失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //生成预览账单(补录第二步,第三步走编辑) | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) { | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| //重新生成 | |||
| List<WxBillRent> resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true); | |||
| record.setPreviewBillRentList(resultList); | |||
| } | |||
| // //生成预览账单(补录第二步,第三步走编辑) | |||
| // if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| // && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) { | |||
| // wxBillRentMapper.deletePreviewBill(record); | |||
| // //重新生成 | |||
| // List<WxBillRent> resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true); | |||
| // record.setPreviewBillRentList(resultList); | |||
| // } | |||
| //创建预览账单 | |||
| List<WxBillRent> resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); | |||
| record.setPreviewBillRentList(resultList); | |||
| EventUtil.publistRentEvent(this, record); | |||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); | |||
| @@ -564,7 +562,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { | |||
| //删除预账单,重新生成 | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode(),true); | |||
| resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); | |||
| } | |||
| } | |||
| @@ -662,8 +660,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| record.setUpdatetime(new Date()); | |||
| if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| // if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = record.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| @@ -680,9 +677,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (shopId == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | |||
| } | |||
| wxRentContractQuery.setShopId(shopId); | |||
| wxRentContractQuery.setId(record.getId()); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery.getTenantId(),wxRentContractQuery.getParentTenantId(),shopId,wxRentContractQuery.getId()); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| @@ -706,21 +702,21 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| wxRentContractQuery.updateTenantInfo(record); | |||
| wxRentContractQuery.setShopId(record.getShopId()); | |||
| // long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| // filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| // || rc.get("status").equals(EnumRentContractStatus.PAING.getCode()) | |||
| // || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.PAING.getCode())).count(); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| } | |||
| } | |||
| // } else { | |||
| // WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| // wxRentContractQuery.updateTenantInfo(record); | |||
| // wxRentContractQuery.setShopId(record.getShopId()); | |||
| //// long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| //// filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| //// || rc.get("status").equals(EnumRentContractStatus.PAING.getCode()) | |||
| //// || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| // long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| // filter(rc -> rc.get("status").equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) | |||
| // || rc.get("status").equals(EnumRentContractStatus.PAING.getCode())).count(); | |||
| // if (count > 0) { | |||
| // return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| // } | |||
| // } | |||
| try { | |||
| Date tempDate = record.getRentalStartDate(); | |||
| @@ -737,7 +733,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void buildDeposit(WxMerchant wxMerchant, Long userId,Long rentContractId) { | |||
| public void buildDeposit( Long userId,Long rentContractId) { | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | |||
| if (wxRentContract != null && wxRentContract.getDeposit() > 0) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -772,9 +768,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); | |||
| wxBillDeposit.setExpiredDay(0L); | |||
| wxBillDeposit.setReceiveDate(time); | |||
| wxBillDeposit.updateTenantInfo(wxMerchant); | |||
| wxBillDeposit.updateTenantInfo(wxRentContract); | |||
| wxBillDeposit.setIsDel(0); | |||
| wxBillDeposit.setMerchantId(wxMerchant.getId()); | |||
| wxBillDeposit.setMerchantId(wxRentContract.getMerchantId()); | |||
| wxBillDeposit.setUserId(userId); | |||
| wxBillDeposit.setShopId(wxRentContract.getShopId()); | |||
| wxBillDeposit.setCreatetime(date); | |||
| @@ -808,38 +804,38 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return rentContractList; | |||
| } | |||
| @Override | |||
| public void updateInvalidContract(Long rentContractId) { | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | |||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| WxRentContract record = new WxRentContract(); | |||
| for (int i = 0, size = rentInfoArray.size(); i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| Long shopId = rentInfoObject.getLong("shopId"); | |||
| record.setShopId(shopId); | |||
| record.updateTenantInfo(wxRentContract); | |||
| record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| wxRentContractMapper.updateInvalidContract(record); | |||
| List<WxRentContract> rentContractList = wxRentContractMapper.selectRentContractByShopId(record); | |||
| for (WxRentContract updateContract : rentContractList) { | |||
| updateInvalidStatus(updateContract); | |||
| } | |||
| } | |||
| } else { | |||
| WxRentContract record = new WxRentContract(); | |||
| record.updateTenantInfo(wxRentContract); | |||
| record.setRentShopType(wxRentContract.getRentShopType()); | |||
| record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| wxRentContractMapper.updateRentInvalidStatus(record); | |||
| List<WxRentContract> rentContractList = wxRentContractMapper.selectList(new QueryWrapper(record)); | |||
| for (WxRentContract updateContract : rentContractList) { | |||
| updateInvalidStatus(updateContract); | |||
| } | |||
| } | |||
| } | |||
| // @Override | |||
| // public void updateInvalidContract(Long rentContractId) { | |||
| // WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | |||
| // if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| // String rentInfo = wxRentContract.getRentInfo(); | |||
| // JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| // WxRentContract record = new WxRentContract(); | |||
| // for (int i = 0, size = rentInfoArray.size(); i < size; i++) { | |||
| // JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| // Long shopId = rentInfoObject.getLong("shopId"); | |||
| // record.setShopId(shopId); | |||
| // record.updateTenantInfo(wxRentContract); | |||
| // record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| // wxRentContractMapper.updateInvalidContract(record); | |||
| // List<WxRentContract> rentContractList = wxRentContractMapper.selectRentContractByShopId(record); | |||
| // for (WxRentContract updateContract : rentContractList) { | |||
| // updateInvalidStatus(updateContract); | |||
| // } | |||
| // } | |||
| // } else { | |||
| // WxRentContract record = new WxRentContract(); | |||
| // record.updateTenantInfo(wxRentContract); | |||
| // record.setRentShopType(wxRentContract.getRentShopType()); | |||
| // record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| // wxRentContractMapper.updateRentInvalidStatus(record); | |||
| // List<WxRentContract> rentContractList = wxRentContractMapper.selectList(new QueryWrapper(record)); | |||
| // for (WxRentContract updateContract : rentContractList) { | |||
| // updateInvalidStatus(updateContract); | |||
| // } | |||
| // } | |||
| // | |||
| // } | |||
| @Override | |||
| public ResultData hasRentStatus(WxRentContract record) { | |||
| @@ -948,24 +944,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public List<WxBillRent> buildRent(WxMerchant wxMerchant, Long userId,WxRentContract rentContract,Integer isPreview,boolean saveDb) { | |||
| public List<WxBillRent> buildRent( Long userId,WxRentContract wxRentContract,Integer isPreview,boolean saveDb) { | |||
| List<WxBillRent> rentList = new ArrayList<>(); | |||
| //根据商户ID找出合同 | |||
| WxRentContract wxRentContract; | |||
| if(rentContract == null){ | |||
| wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(wxMerchant.getId()); | |||
| List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | |||
| if (list.size() > 0) { | |||
| wxRentContract = list.get(0); | |||
| } | |||
| }else{ | |||
| wxRentContract = rentContract; | |||
| } | |||
| if (wxRentContract != null) { | |||
| int receivePeriod = wxRentContract.getReceivePeriod().intValue(); | |||
| Integer lease = wxRentContract.getLease(); | |||
| Date rentalStartDate = wxRentContract.getRentalStartDate(); | |||
| Long price = wxRentContract.getPrice(); | |||
| @@ -977,7 +960,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // //如果按日 | |||
| // List<Date> yearList = new ArrayList<>(); | |||
| // yearList.add(rentalStartDate); | |||
| // Map<String, Object> resultMap = buildRent(receivePeriod, new long[]{price}, yearList, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant, 0, isPreview,null); | |||
| // Map<String, Object> resultMap = buildRent(receivePeriod, new long[]{price}, yearList, Calendar.DAY_OF_MONTH, wxRentContract, userId, 0, isPreview,null,saveDb); | |||
| // rentList = ( List<WxBillRent>)resultMap.get("billList"); | |||
| // } | |||
| } | |||
| @@ -1278,7 +1261,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setIsDel(0); | |||
| wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | |||
| wxBillRent.setUserId(userId); | |||
| wxBillRent.setShopId(wxRentContract.getShopId()); | |||
| if (null != wxRentContract.getShopIdList() && wxRentContract.getShopIdList().size() == 1) { | |||
| wxBillRent.setShopId(wxRentContract.getShopIdList().get(0)); | |||
| } | |||
| wxBillRent.setCreatetime(date); | |||
| wxBillRent.setUpdatetime(date); | |||
| wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| @@ -1451,32 +1436,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public Object getRentContractStatusInfo(WxRentContract rentContract) { | |||
| Map<String, Object> resultData = new HashMap(); | |||
| //商铺信息 | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.updateTenantInfo(rentContract); | |||
| wxShop.setType(rentContract.getRentShopType()); | |||
| wxShop.setStatus(EnumShopStatus.RENT.getCode()); | |||
| List<WxShop> rentedList = wxShopMapper.findList(wxShop); | |||
| wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); | |||
| List<WxShop> unrentedList = wxShopMapper.findList(wxShop); | |||
| HashMap<String, Object> shopMap = new HashMap<>(3); | |||
| int rentedCount = rentedList.size(); | |||
| int unrentedCount = unrentedList.size(); | |||
| shopMap.put("rentedCount", rentedCount); | |||
| shopMap.put("unrentedCount", unrentedCount); | |||
| shopMap.put("allCount", rentedCount + unrentedCount); | |||
| resultData.put("shopCountInfo", shopMap); | |||
| //需要更新的状态 | |||
| resultData.putAll(updateStatus(rentContract)); | |||
| return resultData; | |||
| } | |||
| // @Transactional(rollbackFor = {Exception.class}) | |||
| // @Override | |||
| // public Object getRentContractStatusInfo(WxRentContract rentContract) { | |||
| // | |||
| // Map<String, Object> resultData = new HashMap(); | |||
| // //商铺信息 | |||
| // WxShop wxShop = new WxShop(); | |||
| // wxShop.updateTenantInfo(rentContract); | |||
| // wxShop.setType(rentContract.getRentShopType()); | |||
| // wxShop.setStatus(EnumShopStatus.RENT.getCode()); | |||
| // List<WxShop> rentedList = wxShopMapper.findList(wxShop); | |||
| // wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); | |||
| // List<WxShop> unrentedList = wxShopMapper.findList(wxShop); | |||
| // | |||
| // HashMap<String, Object> shopMap = new HashMap<>(3); | |||
| // int rentedCount = rentedList.size(); | |||
| // int unrentedCount = unrentedList.size(); | |||
| // shopMap.put("rentedCount", rentedCount); | |||
| // shopMap.put("unrentedCount", unrentedCount); | |||
| // shopMap.put("allCount", rentedCount + unrentedCount); | |||
| // resultData.put("shopCountInfo", shopMap); | |||
| // | |||
| // //需要更新的状态 | |||
| // resultData.putAll(updateStatus(rentContract)); | |||
| // return resultData; | |||
| // } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| @@ -1535,69 +1520,51 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Override | |||
| public PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { | |||
| PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract)); | |||
| //PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract)); | |||
| PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract)); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public Map<String, Object> updateStatus(WxRentContract record) { | |||
| Map<String, Object> resultData = new HashMap(); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(record); | |||
| wxRentContract.setRentShopType(record.getRentShopType()); | |||
| int allCount = wxRentContractMapper.selectCount(new QueryWrapper(wxRentContract)); | |||
| resultData.put("allCount", allCount); | |||
| //待签约 | |||
| //wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| //int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); | |||
| //resultData.put("waitSignCount", waitSignCount); | |||
| resultData.put("waitSignCount", 0); | |||
| //计租中 | |||
| wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| wxRentContractMapper.updateRentContractPaidStatus(wxRentContract); | |||
| int rendPaidCount = wxRentContractMapper.queryRentContractPaidStatus(wxRentContract); | |||
| resultData.put("rendPaidCount", rendPaidCount); | |||
| //将到期 | |||
| //wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode()); | |||
| //wxRentContractMapper.updateRentContractEndSoonStatus(wxRentContract); | |||
| //int endSoonCount = wxRentContractMapper.queryRentContractEndSoonStatus(wxRentContract); | |||
| //resultData.put("endSoonCount", endSoonCount); | |||
| resultData.put("endSoonCount", 0); | |||
| //到期 | |||
| wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| wxRentContractMapper.updateRentContractEndStatus(wxRentContract); | |||
| int endCount = wxRentContractMapper.queryRentContractEndStatus(wxRentContract); | |||
| resultData.put("endCount", endCount); | |||
| //合同到期 | |||
| contractEnd(record.getTenantId()); | |||
| return resultData; | |||
| } | |||
| private void contractEnd(String tenantId) { | |||
| //查询状态为合同正常到期的数据 | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(tenantId); | |||
| wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(wxRentContract); | |||
| for (int i = 0, size = rentContractData.size(); i < size; i++) { | |||
| Map<String, Object> contract = rentContractData.get(i); | |||
| Object merchantId = contract.get("merchantId"); | |||
| if (merchantId != null) { | |||
| WxMerchant merchant = wxMerchantMapper.selectById((Long) merchantId); | |||
| Integer status = merchant.getStatus(); | |||
| if (status.equals(EnumMerchantStatus.VALID.getCode())) { | |||
| wxMerchantService.disableMerchat((Long) merchantId); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| // @Override | |||
| // public Map<String, Object> updateStatus(WxRentContract record) { | |||
| // Map<String, Object> resultData = new HashMap(); | |||
| // WxRentContract wxRentContract = new WxRentContract(); | |||
| // wxRentContract.updateTenantInfo(record); | |||
| // wxRentContract.setRentShopType(record.getRentShopType()); | |||
| // | |||
| // int allCount = wxRentContractMapper.selectCount(new QueryWrapper(wxRentContract)); | |||
| // resultData.put("allCount", allCount); | |||
| // | |||
| // //待签约 | |||
| // //wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| // //int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); | |||
| // //resultData.put("waitSignCount", waitSignCount); | |||
| // resultData.put("waitSignCount", 0); | |||
| // | |||
| // //计租中 | |||
| // wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| // wxRentContractMapper.updateRentContractPaidStatus(wxRentContract); | |||
| // int rendPaidCount = wxRentContractMapper.queryRentContractPaidStatus(wxRentContract); | |||
| // resultData.put("rendPaidCount", rendPaidCount); | |||
| // | |||
| // //将到期 | |||
| // //wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode()); | |||
| // //wxRentContractMapper.updateRentContractEndSoonStatus(wxRentContract); | |||
| // //int endSoonCount = wxRentContractMapper.queryRentContractEndSoonStatus(wxRentContract); | |||
| // //resultData.put("endSoonCount", endSoonCount); | |||
| // resultData.put("endSoonCount", 0); | |||
| // | |||
| // //到期 | |||
| // wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| // wxRentContractMapper.updateRentContractEndStatus(wxRentContract); | |||
| // int endCount = wxRentContractMapper.queryRentContractEndStatus(wxRentContract); | |||
| // resultData.put("endCount", endCount); | |||
| // | |||
| // //合同到期 | |||
| // contractEnd(record.getTenantId()); | |||
| // | |||
| // return resultData; | |||
| // } | |||
| @Override | |||
| public void exportContract(HttpServletRequest request, HttpServletResponse response, Long id) { | |||
| @@ -1670,16 +1637,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| billRent.setIsPreview(EnumIsPreview.NO.getCode()); | |||
| billRent.setMerchantId(record.getMerchantId()); | |||
| wxBillRentMapper.updatePreviewStatus(billRent); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setId(record.getMerchantId()); | |||
| wxMerchant.updateTenantInfo(record); | |||
| // WxMerchant wxMerchant = new WxMerchant(); | |||
| // wxMerchant.setId(record.getMerchantId()); | |||
| // wxMerchant.updateTenantInfo(record); | |||
| if(record.getDeposit() > 0) { | |||
| //押金 | |||
| buildDeposit(wxMerchant, null, id); | |||
| buildDeposit( null, id); | |||
| } | |||
| updatePropertyPreviewBill(record); | |||
| //作废合同 | |||
| updateInvalidContract(id); | |||
| //updateInvalidContract(id); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| @@ -2200,10 +2167,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractMapper.updateApplyStatus(wxRentContract); | |||
| } | |||
| @Override | |||
| public Integer getShopType(WxRentContract wxRentContract) { | |||
| return wxRentContractMapper.getShopType(wxRentContract); | |||
| } | |||
| // @Override | |||
| // public Integer getShopType(WxRentContract wxRentContract) { | |||
| // return wxRentContractMapper.getShopType(wxRentContract); | |||
| // } | |||
| public static double getMonthNeedPay(Double price,Date start,Date end,int dayType,int receivePeriod,boolean part){ | |||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||
| @@ -2433,42 +2400,42 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return wxRentContractMapper.getByBill(billRent); | |||
| } | |||
| @Override | |||
| public Map<Long, WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp, TenantEntity tenantEntity) { | |||
| List<WxRentContract> list = wxRentContractMapper.selectRentContractByShopIds(shopIds, shopIdsRegexp, tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | |||
| List<String> shopIdArr = Arrays.asList(StringUtils.split(shopIdsRegexp,"|")) ; | |||
| Map<Long, WxRentContract> allShopContract = new HashMap<>(); | |||
| for (WxRentContract wxRentContract : list) { | |||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| Long shopId = rentInfoObject.getLong("shopId"); | |||
| if (!shopIdArr.contains(String.valueOf(shopId))) { | |||
| continue; | |||
| } | |||
| WxRentContract rentContract = new WxRentContract(); | |||
| BeanUtils.copyProperties(wxRentContract,rentContract); | |||
| rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||
| rentContract.setRentalEndDate(wxRentContract.getRentalEndDate()); | |||
| rentContract.setShopId(shopId); | |||
| allShopContract.put(shopId, rentContract); | |||
| } | |||
| } | |||
| if (shopIds.contains(wxRentContract.getShopId())) { | |||
| allShopContract.put(wxRentContract.getShopId(), wxRentContract); | |||
| } | |||
| } | |||
| return allShopContract; | |||
| } | |||
| // @Override | |||
| // public Map<Long, WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp, TenantEntity tenantEntity) { | |||
| // List<WxRentContract> list = wxRentContractMapper.selectRentContractByShopIds(shopIds, shopIdsRegexp, tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | |||
| // List<String> shopIdArr = Arrays.asList(StringUtils.split(shopIdsRegexp,"|")) ; | |||
| // Map<Long, WxRentContract> allShopContract = new HashMap<>(); | |||
| // for (WxRentContract wxRentContract : list) { | |||
| // if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| // String rentInfo = wxRentContract.getRentInfo(); | |||
| // JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| // int size = rentInfoArray.size(); | |||
| // //查询rent_info 包括 shopId | |||
| // for (int i = 0; i < size; i++) { | |||
| // JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| // Long shopId = rentInfoObject.getLong("shopId"); | |||
| // if (!shopIdArr.contains(String.valueOf(shopId))) { | |||
| // continue; | |||
| // } | |||
| // WxRentContract rentContract = new WxRentContract(); | |||
| // BeanUtils.copyProperties(wxRentContract,rentContract); | |||
| // rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||
| // rentContract.setRentalEndDate(wxRentContract.getRentalEndDate()); | |||
| // rentContract.setShopId(shopId); | |||
| // allShopContract.put(shopId, rentContract); | |||
| // } | |||
| // } | |||
| // if (shopIds.contains(wxRentContract.getShopId())) { | |||
| // allShopContract.put(wxRentContract.getShopId(), wxRentContract); | |||
| // } | |||
| // } | |||
| // return allShopContract; | |||
| // } | |||
| @Override | |||
| public int selectContractCountByShopId(WxRentContract wxRentContract) { | |||
| return wxRentContractMapper.selectContractCountByShopId(wxRentContract) ; | |||
| } | |||
| // @Override | |||
| // public int selectContractCountByShopId(WxRentContract wxRentContract) { | |||
| // return wxRentContractMapper.selectContractCountByShopId(wxRentContract) ; | |||
| // } | |||
| @Override | |||
| public ResultData getContractByContractNumber(WxRentContract rentContract) { | |||
| @@ -2779,4 +2746,35 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| public void outDateContract(WxRentContract wxRentContract) { | |||
| //只有计租中的合同状态才能正常到期 | |||
| if (wxRentContract.getStatus().intValue()== EnumRentContractStatus.PAING.getCode().intValue()) { | |||
| if (wxRentContract.getRentalEndDate().before(new Date())) { | |||
| wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| //wxRentContractMapper.updateRentContractEndStatus(wxRentContract); | |||
| //TODO 11111111111111111111 | |||
| } | |||
| } | |||
| } | |||
| private void contractEnd(String tenantId) { | |||
| //查询状态为合同正常到期的数据 | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(tenantId); | |||
| wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); | |||
| List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(wxRentContract); | |||
| for (int i = 0, size = rentContractData.size(); i < size; i++) { | |||
| Map<String, Object> contract = rentContractData.get(i); | |||
| Object merchantId = contract.get("merchantId"); | |||
| if (merchantId != null) { | |||
| WxMerchant merchant = wxMerchantMapper.selectById((Long) merchantId); | |||
| Integer status = merchant.getStatus(); | |||
| if (status.equals(EnumMerchantStatus.VALID.getCode())) { | |||
| wxMerchantService.disableMerchat((Long) merchantId); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -46,10 +46,10 @@ public class WxRentPropertyContractServiceImpl implements WxRentPropertyContract | |||
| @Autowired | |||
| WxRentContractService wxRentContractService; | |||
| @Override | |||
| public PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record)); | |||
| } | |||
| // @Override | |||
| // public PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) { | |||
| // return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record)); | |||
| // } | |||
| @Override | |||
| public ResultData getContractInfo(Long id) { | |||
| @@ -1131,7 +1131,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| } else { | |||
| WxRentContract contractQuery = new WxRentContract(); | |||
| contractQuery.updateTenantInfo(InvestUserContext.getUser()); | |||
| contractQuery.setShopId(investTaskEntity.getTargetId()); | |||
| //contractQuery.setShopId(investTaskEntity.getTargetId()); | |||
| //contractQuery.setStatus(EnumRentContractStatus.INTENTION.getCode()); | |||
| //获取意向合同 | |||
| //int count = rentContractService.selectContractCountByShopId(contractQuery); | |||
| @@ -21,7 +21,6 @@ | |||
| <result column="brand" jdbcType="VARCHAR" property="brand"/> | |||
| <result column="business_id" jdbcType="INTEGER" property="businessId"/> | |||
| <result column="shop_type" jdbcType="INTEGER" property="shopType"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/> | |||
| @@ -68,6 +67,7 @@ | |||
| <result column="rent_price" property="rentPrice"/> | |||
| <result column="subject_name" property="subjectName"/> | |||
| <result column="rent_start_type" property="rentStartType"/> | |||
| <result column="shop_name" property="shopName"/> | |||
| <result column="rent_input_way" property="rentInputWay"/> | |||
| <result column="adjust_ratio_way" property="adjustRatioWay"/> | |||
| @@ -82,9 +82,9 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`, | |||
| `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`, | |||
| `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`, | |||
| `brand`,`business_id`,`shop_type`,`updatetime`,`createtime`,`link_person`,`link_phone`, | |||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | |||
| `start_date`,`end_date`, | |||
| `start_date`,`end_date`,`shop_name`, | |||
| `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | |||
| `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type, | |||
| `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,bus_discount_ratio,bus_discount_time | |||
| @@ -116,7 +116,6 @@ | |||
| <if test=" null != brand ">and `brand` = #{brand}</if> | |||
| <if test=" null != businessId ">and `business_id` = #{businessId}</if> | |||
| <if test=" null != shopType ">and `shop_type` = #{shopType}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != linkPerson ">and `link_person` = #{linkPerson}</if> | |||
| @@ -146,7 +145,8 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- 需要修改 --> | |||
| <!-- <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`, | |||
| rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName, | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | |||
| @@ -222,9 +222,21 @@ | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by rc.createtime desc,rc.id desc </if> | |||
| </select> --> | |||
| <select id="queryRentContractCountByStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(1) from wx_rent_contract where status=#{status} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where status=#{status} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -235,9 +247,9 @@ | |||
| <if test=" null != rentShopType "> | |||
| and rent_shop_type = #{rentShopType} | |||
| </if> | |||
| </select> | |||
| </select> --> | |||
| <select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where status=4 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -246,9 +258,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| </select> --> | |||
| <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where status in (2,3,4) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -257,9 +269,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| </select> --> | |||
| <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select count(id) from wx_rent_contract where status!=0 and status!=1 and status!=6 and status!=7 and rental_end_date <now() | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -269,9 +281,9 @@ | |||
| </if> | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| </select> --> | |||
| <update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} where status not in(0,1,5,6,7,8) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -280,9 +292,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and DATEDIFF(rental_end_date,now()) <= 30 and rental_end_date > now() | |||
| </update> | |||
| </update> --> | |||
| <update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} where status not in(0,1,5,6,7,8) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -291,9 +303,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and rental_start_date <= now() and rental_end_date >= now() | |||
| </update> | |||
| </update> --> | |||
| <update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} where status not in(0,1,5,6,7,8) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -302,9 +314,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and rental_end_date <now() | |||
| </update> | |||
| </update> --> | |||
| <update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} where status not in(0,5,6,7) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -313,7 +325,7 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and merchant_id is null | |||
| </update> | |||
| </update> --> | |||
| <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract | |||
| @@ -327,7 +339,7 @@ | |||
| update wx_rent_contract set status=#{status} where id=#{id} | |||
| </update> | |||
| <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=#{status} where shop_id in ( | |||
| select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE status in(2,3,4) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -337,15 +349,10 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| )s) and status in(0,1) and status!=7 and rent_shop_type=2 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| </update> --> | |||
| <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract" | |||
| <!-- <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select s.shop_id,s.shop_number,s.building_name building, s.floor_name floor,s.build_area,rc.* from ( | |||
| select s.id shop_id,ms.merchant_id,s.shop_number,b.building_name,f.floor_name,s.build_area,s.floor,s.building | |||
| @@ -370,10 +377,9 @@ | |||
| </if> | |||
| <if test=" null != building and ''!=building"> | |||
| and s.building = #{building} | |||
| </if> | |||
| order by rc.id desc | |||
| </select> | |||
| </select> --> | |||
| <select id="updateStatusForUnsign" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| update wx_rent_contract set status=1 where status=2 and merchant_id is null | |||
| @@ -385,7 +391,7 @@ | |||
| </if> | |||
| </select> | |||
| <select id="getRentInvalidList" parameterType="com.iformall.domain.po.WxRentContract" | |||
| <!-- <select id="getRentInvalidList" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select id from wx_rent_contract where shop_id in ( | |||
| select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE status in(2,3,4) | |||
| @@ -402,22 +408,22 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| </select> --> | |||
| <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long"> | |||
| select count(*) from wx_rent_contract r,wx_bill_rent b | |||
| select count(1) from wx_rent_contract r,wx_bill_rent b | |||
| where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id} | |||
| </select> | |||
| <select id="getMerchants" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract where status in(2,3,4) | |||
| select <include refid="allColumns"/> from wx_rent_contract where status in(2,3,4) | |||
| and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4)) | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| <select id="selectRentContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| select count(*) from wx_rent_contract where 1=1 | |||
| <select id="selectRentContractCountByShopId" parameterType="java.util.Map" resultType="int"> | |||
| select count(1) from wx_rent_contract where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -432,7 +438,7 @@ | |||
| <select id="selectRentContractByShopId" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract | |||
| select <include refid="allColumns"/> from wx_rent_contract | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -460,14 +466,14 @@ | |||
| <select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract | |||
| select <include refid="allColumns"/> from wx_rent_contract | |||
| where status in(2,3,4) | |||
| and merchant_id = #{merchantId} | |||
| </select> | |||
| <select id="hasContractNumber" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="int"> | |||
| select count(*) from ( | |||
| select count(1) from ( | |||
| select * from wx_rent_contract where contract_number=#{contractNumber} | |||
| and status not in(5,6,7) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -493,12 +499,12 @@ | |||
| </where> | |||
| </select> | |||
| <select id="getShopType" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| <!-- <select id="getShopType" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| select s.type | |||
| from wx_rent_contract r | |||
| left join wx_shop s on(s.id = r.`shop_id`) | |||
| where r.id = #{id} | |||
| </select> | |||
| </select> --> | |||
| <resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo"> | |||
| <id column="id" property="id"/> | |||
| @@ -523,7 +529,8 @@ | |||
| <result column="bus_discount_ratio" property="busDiscountRatio"/> | |||
| </resultMap> | |||
| <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap"> | |||
| <!-- <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap"> | |||
| select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`, | |||
| rc.price as rent_price,rc.contract_number,s.shop_number,rc.type,rc.apply_status, | |||
| rc.rent_shop_type,rc.rent_info,pc.price as property_price,rc.merchant_id,pc.`status` as property_status, | |||
| @@ -594,10 +601,10 @@ | |||
| </where> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if> | |||
| </select> | |||
| </select> --> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select * from wx_rent_contract | |||
| select <include refid="allColumns"/> from wx_rent_contract | |||
| where id in( | |||
| select rent_contract_id from wx_bill_rent id = #{id} | |||
| ) | |||
| @@ -614,7 +621,8 @@ | |||
| select 2 type,c.`rental_start_date`,c.`rental_end_date`,c.id id from wx_merchant m left join wx_property_contract c on(m.id = c.merchant_id) | |||
| where m.business_id = #{id} and c.price is not null and c.`rental_start_date` is not null and c.`rental_end_date` is not null | |||
| </select> | |||
| <select id="selectRentContractByShopIds" resultType="com.iformall.domain.po.WxRentContract"> | |||
| <!-- <select id="selectRentContractByShopIds" resultType="com.iformall.domain.po.WxRentContract"> | |||
| SELECT rc.id,rc.rental_start_date,rc.rental_end_date,rc.`shop_id`,rc.`rent_shop_type`,rc.`rent_info` FROM | |||
| `wx_rent_contract` rc | |||
| WHERE rc.`status` IN (2,3,4) AND status!=7 | |||
| @@ -631,9 +639,9 @@ | |||
| ) | |||
| OR (rc.`rent_shop_type`=1 AND rc.`rent_info` REGEXP #{shopIdsRegexp}) | |||
| ) | |||
| </select> | |||
| </select> --> | |||
| <select id="selectContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| <!-- <select id="selectContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| SELECT count(*) | |||
| FROM wx_rent_contract | |||
| WHERE `status` = #{status} AND status!=7 | |||
| @@ -649,7 +657,7 @@ | |||
| OR | |||
| `rent_shop_type` = 2 AND `shop_id` = #{shopId} | |||
| ) | |||
| </select> | |||
| </select> --> | |||
| <select id="searchMerchantByname" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select merchant_id,merchant_name from wx_rent_contract where tenant_id = #{tenantId} and merchant_name like concat('%',#{merchantName},'%') and rent_shop_type = #{rentShopType} and status in (3,5) and merchant_id not in (select merchant_id from wx_rent_contract where status=9) ORDER BY merchant_name | |||
| @@ -0,0 +1,34 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxRentContractShopMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractShop"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`rent_contract_id`,`shop_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxRentContractShop" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_rent_contract_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <delete id="deleteShops" parameterType="Long"> | |||
| delete from wx_rent_contract_shop where rent_contract_id = #{contractId} | |||
| </delete> | |||
| </mapper> | |||