| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumContractOperationType { | |||||
| PART(1, "区分租赁物业"), | |||||
| WHOLE(2, "合并租赁物业"),; | |||||
| public static EnumContractOperationType getEnum(Integer code) { | |||||
| for (EnumContractOperationType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumContractOperationType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -1,15 +1,10 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxBillProperty; | |||||
| import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxPropertyContract; | import com.iformall.domain.po.WxPropertyContract; | ||||
| import com.iformall.domain.po.WxRentContract; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -21,8 +16,8 @@ public interface WxPropertyContractService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, Object> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize); | Map<String, Object> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize); | ||||
| @@ -67,4 +62,6 @@ public interface WxPropertyContractService { | |||||
| ResultData updatePropertyContractStatus(Long id); | ResultData updatePropertyContractStatus(Long id); | ||||
| void endContract(WxPropertyContract wxPropertyContract); | void endContract(WxPropertyContract wxPropertyContract); | ||||
| void updatePropertyPreviewBill(WxPropertyContract record); | |||||
| } | } | ||||
| @@ -89,4 +89,6 @@ public interface WxRentContractService { | |||||
| Integer getShopType(WxRentContract wxRentContract); | Integer getShopType(WxRentContract wxRentContract); | ||||
| void endContract(WxRentContract wxRentContract); | void endContract(WxRentContract wxRentContract); | ||||
| void updatePropertyPreviewBill(WxRentContract record); | |||||
| } | } | ||||
| @@ -70,32 +70,14 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| @Autowired | @Autowired | ||||
| private MallUserInfoService mallUserInfoService; | private MallUserInfoService mallUserInfoService; | ||||
| @Autowired | @Autowired | ||||
| private WxRentContractMapper wxRentContractMapper; | |||||
| @Autowired | |||||
| private WxPropertyContractMapper wxPropertyContractMapper; | private WxPropertyContractMapper wxPropertyContractMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxPropertyContractService wxPropertyContractService; | private WxPropertyContractService wxPropertyContractService; | ||||
| @Autowired | @Autowired | ||||
| private WxFlowRecordMapper wxFlowRecordMapper; | private WxFlowRecordMapper wxFlowRecordMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxBillRentMapper wxBillRentMapper; | |||||
| @Autowired | |||||
| private WxBillPropertyMapper wxBillPropertyMapper; | |||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | private MqBaseProducer mqBaseProducer; | ||||
| @Autowired | @Autowired | ||||
| private WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||||
| @Autowired | |||||
| private WxBillDepositMapper wxBillDepositMapper; | |||||
| @Autowired | |||||
| private WxBillDailyMapper wxBillDailyMapper; | |||||
| @Autowired | |||||
| private WxBillOtherMapper wxBillOtherMapper; | |||||
| @Autowired | |||||
| private WxBillOtherDepositMapper wxBillOtherDepositMapper; | |||||
| @Autowired | |||||
| private WxFlowModelMapper wxFlowModelMapper; | private WxFlowModelMapper wxFlowModelMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxFlowConfigMapper wxFlowConfigMapper; | private WxFlowConfigMapper wxFlowConfigMapper; | ||||
| @@ -94,6 +94,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | ||||
| @Autowired | |||||
| WxPropertyContractService wxPropertyContractService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -401,20 +403,18 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxRentContract.setUpdatetime(new Date()); | wxRentContract.setUpdatetime(new Date()); | ||||
| wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); | wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); | ||||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | ||||
| //预览账单改为正式,并写入商户id(租赁合同需要绑定商户才变成已签约) | //预览账单改为正式,并写入商户id(租赁合同需要绑定商户才变成已签约) | ||||
| WxBillRent billRent = new WxBillRent(); | WxBillRent billRent = new WxBillRent(); | ||||
| billRent.setRentContractId(wxMerchant.getRentContractId()); | billRent.setRentContractId(wxMerchant.getRentContractId()); | ||||
| billRent.setIsPreview(EnumIsPreview.NO.getCode()); | billRent.setIsPreview(EnumIsPreview.NO.getCode()); | ||||
| billRent.setMerchantId(merchantId); | billRent.setMerchantId(merchantId); | ||||
| wxBillRentMapper.updatePreviewStatus(billRent); | wxBillRentMapper.updatePreviewStatus(billRent); | ||||
| //创建账单 | |||||
| //wxRentContractService.buildRent(wxMerchant, userId,null,EnumIsPreview.NO.getCode()); | |||||
| //创建押金 | //创建押金 | ||||
| wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | ||||
| //作废合同 | //作废合同 | ||||
| wxRentContractService.updateInvalidContract(wxMerchant.getRentContractId()); | wxRentContractService.updateInvalidContract(wxMerchant.getRentContractId()); | ||||
| //合并合同-更新物业账单 | |||||
| wxRentContractService.updatePropertyPreviewBill(wxRentContract); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -363,31 +363,25 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| WxPropertyContract record = wxPropertyContractMapper.selectByPrimaryKey(id); | WxPropertyContract record = wxPropertyContractMapper.selectByPrimaryKey(id); | ||||
| if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | ||||
| && record.getReceivePeriod() != null && record.getPrice() > 0) { | && record.getReceivePeriod() != null && record.getPrice() > 0) { | ||||
| //WxBillProperty wxBillProperty = new WxBillProperty(); | |||||
| //wxBillProperty.setMerchantId(record.getMerchantId()); | |||||
| //List<Map<String, Object>> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); | |||||
| //if (billPropertyList.size() == 0) { | |||||
| //预览账单改为正式,并写入商户id | //预览账单改为正式,并写入商户id | ||||
| WxBillProperty billProperty = new WxBillProperty(); | |||||
| billProperty.setPropertyContractId(id); | |||||
| billProperty.setIsPreview(EnumIsPreview.NO.getCode()); | |||||
| billProperty.setMerchantId(record.getMerchantId()); | |||||
| wxBillPropertyMapper.updatePreviewStatus(billProperty); | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setId(record.getMerchantId()); | |||||
| wxMerchant.setTenantId(record.getTenantId()); | |||||
| //物业账单 | |||||
| //buildProperty(wxMerchant,null); | |||||
| //物业押金账单 | |||||
| buildDeposit(wxMerchant,id); | |||||
| //} | |||||
| updatePropertyPreviewBill(record); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @Override | |||||
| public void updatePropertyPreviewBill(WxPropertyContract record) { | |||||
| WxBillProperty billProperty = new WxBillProperty(); | |||||
| billProperty.setPropertyContractId(record.getId()); | |||||
| billProperty.setIsPreview(EnumIsPreview.NO.getCode()); | |||||
| billProperty.setMerchantId(record.getMerchantId()); | |||||
| wxBillPropertyMapper.updatePreviewStatus(billProperty); | |||||
| buildDeposit(record); | |||||
| } | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildDeposit(WxMerchant wxMerchant,Long propertyContractId) { | |||||
| public void buildDeposit(WxPropertyContract record) { | |||||
| Long propertyContractId = record.getId(); | |||||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(propertyContractId); | WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(propertyContractId); | ||||
| if (wxPropertyContract != null) { | if (wxPropertyContract != null) { | ||||
| //找到计租方式 | //找到计租方式 | ||||
| @@ -419,9 +413,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxBillDeposit.setEndtime(instance.getTime()); | wxBillDeposit.setEndtime(instance.getTime()); | ||||
| wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); | wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); | ||||
| wxBillDeposit.setExpiredDay(0L); | wxBillDeposit.setExpiredDay(0L); | ||||
| wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | |||||
| wxBillDeposit.setTenantId(record.getTenantId()); | |||||
| wxBillDeposit.setIsDel(0); | wxBillDeposit.setIsDel(0); | ||||
| wxBillDeposit.setMerchantId(wxMerchant.getId()); | |||||
| wxBillDeposit.setMerchantId(record.getMerchantId()); | |||||
| wxBillDeposit.setShopId(wxPropertyContract.getShopId()); | wxBillDeposit.setShopId(wxPropertyContract.getShopId()); | ||||
| wxBillDeposit.setCreatetime(date); | wxBillDeposit.setCreatetime(date); | ||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| @@ -105,6 +105,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxBillPropertyMapper wxBillPropertyMapper; | WxBillPropertyMapper wxBillPropertyMapper; | ||||
| @Autowired | |||||
| WxPropertyContractService wxPropertyContractService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | ||||
| Object rentContractStatusInfo = getRentContractStatusInfo(record); | Object rentContractStatusInfo = getRentContractStatusInfo(record); | ||||
| @@ -1341,32 +1344,43 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) && | record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) && | ||||
| record.getReceivePeriod() != null && | record.getReceivePeriod() != null && | ||||
| record.getPrice() > 0) { | record.getPrice() > 0) { | ||||
| WxBillRent wxBillRent = new WxBillRent(); | |||||
| wxBillRent.setMerchantId(record.getMerchantId()); | |||||
| //预览账单改为正式,并写入商户id | //预览账单改为正式,并写入商户id | ||||
| WxBillRent billRent = new WxBillRent(); | WxBillRent billRent = new WxBillRent(); | ||||
| billRent.setRentContractId(id); | billRent.setRentContractId(id); | ||||
| billRent.setIsPreview(EnumIsPreview.NO.getCode()); | billRent.setIsPreview(EnumIsPreview.NO.getCode()); | ||||
| billRent.setMerchantId(record.getMerchantId()); | billRent.setMerchantId(record.getMerchantId()); | ||||
| wxBillRentMapper.updatePreviewStatus(billRent); | wxBillRentMapper.updatePreviewStatus(billRent); | ||||
| // List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||||
| // if (billRentList.size() == 0) { | |||||
| WxMerchant wxMerchant = new WxMerchant(); | WxMerchant wxMerchant = new WxMerchant(); | ||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //租金 | |||||
| // buildRent(wxMerchant, null,null); | |||||
| //押金 | //押金 | ||||
| buildDeposit(wxMerchant, null,id); | buildDeposit(wxMerchant, null,id); | ||||
| // } | |||||
| updatePropertyPreviewBill(record); | |||||
| } | } | ||||
| //作废合同 | //作废合同 | ||||
| updateInvalidContract(id); | updateInvalidContract(id); | ||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @Override | |||||
| public void updatePropertyPreviewBill(WxRentContract record) { | |||||
| //合并合同-更新物业账单 | |||||
| if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { | |||||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||||
| wxPropertyContract.setRentContractId(record.getId()); | |||||
| WxPropertyContract propertyContract = wxPropertyContractMapper.select(wxPropertyContract).parallelStream() | |||||
| .filter(p -> p.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) || | |||||
| p.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) || | |||||
| p.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())). | |||||
| findFirst().orElse(null); | |||||
| if (propertyContract != null) { | |||||
| wxPropertyContractService.updatePropertyPreviewBill(propertyContract); | |||||
| } | |||||
| } | |||||
| } | |||||
| public Map<String, Object> getRentAndPropertyInfo(Long id) { | public Map<String, Object> getRentAndPropertyInfo(Long id) { | ||||
| logger.info("获取租赁物业合同数据>>>>>>id:" + id); | logger.info("获取租赁物业合同数据>>>>>>id:" + id); | ||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||