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