| @@ -63,6 +63,20 @@ public class WxRentContractController extends WxContractBaseController { | |||
| @Autowired | |||
| private WxRentPropertyContractService wxRentPropertyContractService; | |||
| @GetMapping("getMerchantList") | |||
| @SystemControllerLog(description = "获取商户列表") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData getMerchantList(Integer shopType) throws Exception{ | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setRentShopType(shopType); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.getMerchantList(wxMerchant)); | |||
| } | |||
| @GetMapping("autolatePay") | |||
| @SystemControllerLog(description = "autolatePay") | |||
| public ResultData autolatePay(String startDate, String endDate) throws Exception{ | |||
| @@ -139,13 +153,16 @@ public class WxRentContractController extends WxContractBaseController { | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| //WxMerchant wxMerchant = new WxMerchant(); | |||
| //wxMerchant.setName(wxRentContract.getMerchantName()); | |||
| wxMerchant.setId(wxRentContract.getMerchantId()); | |||
| if (wxMerchantService.hasMerchant(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); | |||
| //wxMerchant.setId(wxRentContract.getMerchantId()); | |||
| // if (wxMerchantService.hasMerchant(wxMerchant)) { | |||
| // return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); | |||
| // } | |||
| //查询商户是否存在计租中合同 | |||
| if (!wxRentContractService.hasContract(wxRentContract)){ | |||
| return new ResultData(ErrorCode.MERCHANT_HASRENTCONTRACT); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| @@ -1,59 +0,0 @@ | |||
| package com.iformall.controller.contractv2; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.enums.EnumContractType; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxRentPropertyContractService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * @author: furunxin | |||
| * @Date: 2020/8/5 10:13 | |||
| * @Description: | |||
| */ | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("wxRentContract_V2") | |||
| @Api(description = "租赁合同V2版本") | |||
| public class WxRentContractv2Controller extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxRentPropertyContractService wxRentPropertyContractService; | |||
| @GetMapping("getMerchantList") | |||
| @SystemControllerLog(description = "获取商户列表") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData getMerchantList(Integer shopType) throws Exception{ | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setRentShopType(shopType); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.getMerchantList(wxMerchant)); | |||
| } | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "租赁合同-添加") | |||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | |||
| log.debug("[" + getIpAddr() + "] WxRentContractv2Controller::add"); | |||
| //查询合同类型 | |||
| Integer contractType = wxRentPropertyContractService.getContractType(wxRentContract.getRentShopType(), wxRentContract.getOperationType(), EnumContractType.RENT.getCode()); | |||
| wxRentContract.setContractType(contractType); | |||
| return null; | |||
| } | |||
| } | |||
| @@ -102,6 +102,7 @@ public enum ErrorCode{ | |||
| MERCHANT_NAME_IS_FOUND(2014, "商户名称已存在"), | |||
| MERCHANT_CAR_NOT_DEL(2015, "停车商户不能被删除"), | |||
| MERCHANT_BUSER_NOT_VALID(2016, "商户用户不存在或已被禁用"), | |||
| MERCHANT_HASRENTCONTRACT(2017,"该商户存在计租中合同"), | |||
| /** | |||
| * 券 | |||
| */ | |||
| @@ -83,4 +83,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| WxRentContract getByMerchantId(WxRentContract wxRentContract); | |||
| List<WxRentContract> getAllContractBymerchantId(WxRentContract wxRentContract); | |||
| List<WxRentContract> getContractByMerchant(WxRentContract wxRentContract); | |||
| } | |||
| @@ -112,6 +112,8 @@ public interface WxRentContractService { | |||
| ResultData extensionUpdate(WxRentContract record, Long userId,String userName,int from,Date oldRentStartDate); | |||
| ResultData extensionUpdateFile(WxRentContract wxRentContract, Long userId,String userName,Date oldRentStartDate); | |||
| ResultData apply(WxRentContract wxRentContract,MallUserInfo user); | |||
| boolean hasContract(WxRentContract wxRentContract); | |||
| } | |||
| @@ -343,6 +343,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| // } else { | |||
| // record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| // } | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| try { | |||
| wxPropertyContractMapper.insert(record); | |||
| @@ -411,8 +412,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| message = "更新物业合同信息成功"; | |||
| } | |||
| 111111111111111 | |||
| return new ResultData(Result.SUCCESS, message, record); | |||
| } | |||
| @@ -502,7 +501,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| Date date = new Date(); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| record.setStatus(EnumRentContractStatus.EXTENSION.getCode()); | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| try { | |||
| wxPropertyContractMapper.insert(record); | |||
| @@ -553,7 +552,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //如果是合并合同 物业合同的状态为 意向 | |||
| if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { | |||
| record.setStatus(EnumRentContractStatus.EXTENSION.getCode()); | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| } | |||
| if (CollectionUtils.isEmpty(record.getFlowParams())) { | |||
| @@ -569,9 +568,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| message = "更新物业合同信息成功"; | |||
| } | |||
| 22222222222222222222222222222 | |||
| return new ResultData(Result.SUCCESS, message, record); | |||
| } | |||
| @@ -495,7 +495,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| try { | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| Date tempDate = record.getRentalStartDate(); | |||
| record.setRentalStartDate(oldRentStartDate); | |||
| wxRentContractMapper.insert(record); | |||
| @@ -2570,7 +2570,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| try { | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| Date tempDate = record.getRentalStartDate(); | |||
| record.setRentalStartDate(oldRentStartDate); | |||
| wxRentContractMapper.insert(record); | |||
| @@ -2770,4 +2770,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]租金合同状态不能提交审批.允许提交的状态为 [草稿+未提交审批],[履约中+审批驳回]"); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean hasContract(WxRentContract wxRentContract) { | |||
| List<WxRentContract> list = wxRentContractMapper.getContractByMerchant(wxRentContract); | |||
| if (list.isEmpty()){ | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -662,5 +662,9 @@ | |||
| <select id="getAllContractBymerchantId" resultType="com.iformall.domain.po.WxRentContract" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract where merchant_id = #{merchantId} ORDER BY rental_end_date | |||
| </select> | |||
| <select id="getContractByMerchant" resultType="com.iformall.domain.po.WxRentContract" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract where merchant_id = #{merchantId} and status=3 | |||
| </select> | |||
| </mapper> | |||