| @@ -100,57 +100,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| String floorName = ""; | String floorName = ""; | ||||
| String buildingName = ""; | String buildingName = ""; | ||||
| String shopNumber = ""; | String shopNumber = ""; | ||||
| // List<Long> floorIds = new ArrayList<Long>(); | |||||
| // List<Long> buildIds = new ArrayList<Long>(); | |||||
| // List<Long> shopIds = new ArrayList<Long>(); | |||||
| // for (int i = 0 ; i < arrays.size(); i ++) { | |||||
| // JSONObject o = arrays.getJSONObject(i); | |||||
| // try { | |||||
| // floorIds.add(Long.parseLong(o.getString("floor"))); | |||||
| // }catch(Exception e) { | |||||
| // floorName = floorName +","+o.getString("floor"); | |||||
| // } | |||||
| // try { | |||||
| // buildIds.add(Long.parseLong(o.getString("building"))); | |||||
| // }catch(Exception e) { | |||||
| // buildingName = buildingName + ","+ o.getString("building"); | |||||
| // } | |||||
| // try { | |||||
| // shopIds.add(Long.parseLong(o.getString("id"))); | |||||
| // }catch(Exception e) { | |||||
| // shopNumber = shopNumber +","+o.getString("id"); | |||||
| // } | |||||
| // | |||||
| // | |||||
| // } | |||||
| // | |||||
| // WxMallBuilding bq = new WxMallBuilding(); | |||||
| // bq.setIds(buildIds); | |||||
| // PageInfo<WxMallBuilding> bpage = buildingService.listAsPage(bq, 1, 1000); | |||||
| // if (null != bpage && null != bpage.getList()) { | |||||
| // for (WxMallBuilding wmb : bpage.getList()) { | |||||
| // buildingName = buildingName +"," + wmb.getBuildingName(); | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // WxMallFloor fq = new WxMallFloor(); | |||||
| // fq.setIds(floorIds); | |||||
| // PageInfo<WxMallFloor> fpage = floorService.listAsPage(fq, 1, 1000); | |||||
| // if (null != fpage && null != fpage.getList()) { | |||||
| // for (WxMallFloor wmf : fpage.getList()) { | |||||
| // floorName = floorName +"," + wmf.getFloorName(); | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // WxShop ws = new WxShop(); | |||||
| // ws.setIds(shopIds); | |||||
| // PageInfo<WxShop> spage = wxShopService.listAsPage(ws, 1, 1000); | |||||
| // if (null != spage && null != spage.getList()) { | |||||
| // for (WxShop shop : spage.getList()) { | |||||
| // shopNumber = shopNumber+","+shop.getShopNumber(); | |||||
| // } | |||||
| // } | |||||
| wpc.setFloorName(floorName); | wpc.setFloorName(floorName); | ||||
| wpc.setBuildingName(buildingName); | wpc.setBuildingName(buildingName); | ||||
| wpc.setShopNumber(shopNumber); | wpc.setShopNumber(shopNumber); | ||||
| @@ -810,52 +810,76 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| wxRentContract.setTypeList(typeList); | wxRentContract.setTypeList(typeList); | ||||
| List<Integer> statusList = new ArrayList<Integer>(); | List<Integer> statusList = new ArrayList<Integer>(); | ||||
| statusList.add(EnumRentContractStatus.PAING.getCode()); | statusList.add(EnumRentContractStatus.PAING.getCode()); | ||||
| statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||||
| //statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||||
| wxRentContract.setStatuss(statusList); | wxRentContract.setStatuss(statusList); | ||||
| wxRentContract.setSortColumns(SortField.Createtime_DESC); | wxRentContract.setSortColumns(SortField.Createtime_DESC); | ||||
| return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); | return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); | ||||
| } | } | ||||
| //查询联营扣点,联营取高的合同账单周期 | |||||
| @GetMapping("revenueBillTimes") | |||||
| public ResultData revenueBillTimes(@ModelAttribute WxRentContractRevenueSales sales) { | |||||
| if (null == sales) sales = new WxRentContractRevenueSales(); | |||||
| sales.updateTenantInfo(getTenantInfo()); | |||||
| WxAllBill bq = new WxAllBill(); | |||||
| bq.updateTenantInfo(sales); | |||||
| bq.setRentContractId(sales.getRentContractId()); | |||||
| bq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||||
| bq.setBillType(EnumBillAllType.RENT.getCode()); | |||||
| bq.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); | |||||
| bq.setSortColumn(" starttime asc"); | |||||
| List<WxAllBill> billList = wxAllBillService.list(bq); | |||||
| WxRentContract rc = new WxRentContract(); | |||||
| rc.updateTenantInfo(sales); | |||||
| rc.setId(sales.getRentContractId()); | |||||
| List<WxRentContractRevenueSales> salesList = wxRentContractService.getContractSales(rc); | |||||
| if (null != salesList && salesList.size() > 0 && null != billList && billList.size() > 0 ) { | |||||
| Map<Long,WxRentContractRevenueSales> billSalesMap = new HashMap<Long,WxRentContractRevenueSales>(); | |||||
| for (int i = 0 ; i < salesList.size() ; i ++ ) { | |||||
| WxRentContractRevenueSales rs = salesList.get(i); | |||||
| billSalesMap.put(rs.getBillId(), rs); | |||||
| } | |||||
| for (int i = 0 ; i < billList.size() ; i ++) { | |||||
| WxAllBill bill = billList.get(i); | |||||
| WxRentContractRevenueSales s = billSalesMap.get(bill.getId()); | |||||
| if (null != s) { | |||||
| bill.setSales(s.getSaleMoney()); | |||||
| bill.setSalesTime(s.getUpdateTime()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return new ResultData(billList); | |||||
| } | |||||
| //查询商户计租合同列表 | |||||
| @GetMapping("revenuePropertyContract") | |||||
| public ResultData revenuePropertyContract(@ModelAttribute WxRentContract rentContract) { | |||||
| if (null == rentContract) rentContract = new WxRentContract(); | |||||
| rentContract.updateTenantInfo(getTenantInfo()); | |||||
| WxRentContract contract = wxRentContractService.selectById(rentContract.getId()); | |||||
| WxPropertyContract bq = new WxPropertyContract(); | |||||
| bq.updateTenantInfo(rentContract); | |||||
| bq.setMerchantId(contract.getMerchantId()); | |||||
| bq.setRentContractId(rentContract.getId()); | |||||
| bq.setOperationType(EnumContractOperationType.WHOLE.getCode()); | |||||
| bq.setStatus(EnumRentContractStatus.PAING.getCode()); | |||||
| List<WxPropertyContract> propertyList = wxPropertyContractService.findList(bq); | |||||
| return new ResultData(propertyList); | |||||
| } | |||||
| @PostMapping("setRevenueSales") | @PostMapping("setRevenueSales") | ||||
| public ResultData setRevenueSales(@RequestBody WxRentContract wxRentContract) { | public ResultData setRevenueSales(@RequestBody WxRentContract wxRentContract) { | ||||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | ||||
| if (null == rentContract) { | if (null == rentContract) { | ||||
| return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | ||||
| } | } | ||||
| MallUserInfo user = getUser(); | |||||
| //查询是否有审批流程 | |||||
| if(!rentContractHasWorkFlow(rentContract)) { | |||||
| return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"租赁合同不存在工作流,不能提交审批。"); | |||||
| } | |||||
| try { | |||||
| validConfilit(rentContract); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| try { | |||||
| validShop(rentContract); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| //如果是租金+物业合同,如果没有物业合同或者物业合同不是草稿状态,不能提交审核 | |||||
| if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||||
| if (null == wxRentContract.getPropertyId()) { | |||||
| return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | |||||
| } | |||||
| WxPropertyContract property = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); | |||||
| if (null == property) { | |||||
| return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | |||||
| } | |||||
| if (property.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR,"物业合同未完善,请先完善。"); | |||||
| } | |||||
| if (property.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR,"物业合同当前状态不能提交审批。"); | |||||
| } | |||||
| } | |||||
| return wxRentContractService.apply(rentContract,user); | |||||
| return new ResultData(wxRentContractService.setRevenueSales(rentContract,wxRentContract.getSalesMoney(),wxRentContract.getBillId(),wxRentContract.getPropertyContractId())); | |||||
| } | } | ||||
| @@ -4,13 +4,13 @@ CREATE TABLE `wx_rent_contract_revenue_sales` ( | |||||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | ||||
| `update_time` datetime DEFAULT NULL COMMENT '更新时间', | `update_time` datetime DEFAULT NULL COMMENT '更新时间', | ||||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | `create_time` datetime DEFAULT NULL COMMENT '创建时间', | ||||
| `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', | |||||
| `rent_contract_id` bigint(20) NOT NULL COMMENT '租金合同编号', | |||||
| `bill_id` bigint(20) NOT NULL COMMENT '账单编号', | `bill_id` bigint(20) NOT NULL COMMENT '账单编号', | ||||
| `bill_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '账单应付金额', | `bill_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '账单应付金额', | ||||
| `sale_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '销售金额', | `sale_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '销售金额', | ||||
| `remark` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '备注', | `remark` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '备注', | ||||
| `calcute_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计算之后的金额', | `calcute_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计算之后的金额', | ||||
| `property_contract_id` bigint(20) DEFAULT NULL COMMENT '物业合同', | |||||
| PRIMARY KEY (`id`), | PRIMARY KEY (`id`), | ||||
| KEY `T_R_B` (`tenant_id`,`rent_contract_id`,`bill_id`) | KEY `T_R_B` (`tenant_id`,`rent_contract_id`,`bill_id`) | ||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; | |||||
| @@ -114,6 +114,8 @@ public class WxAllBill extends TenantEntity { | |||||
| } | } | ||||
| return starttimeStr; | return starttimeStr; | ||||
| } | } | ||||
| @TableField(exist = false) | |||||
| private Date starttimeEqual; | |||||
| @Excel(name = "周期结束时间", format = "yyyy-MM-dd", width = 20, orderNum = "5") | @Excel(name = "周期结束时间", format = "yyyy-MM-dd", width = 20, orderNum = "5") | ||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | ||||
| @@ -130,6 +132,8 @@ public class WxAllBill extends TenantEntity { | |||||
| } | } | ||||
| return endtimeStr; | return endtimeStr; | ||||
| } | } | ||||
| @TableField(exist = false) | |||||
| public Date endtimeEqual; | |||||
| @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") | @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -344,4 +348,10 @@ public class WxAllBill extends TenantEntity { | |||||
| private Long feesStandarsId; | private Long feesStandarsId; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| public Integer toPayMerchant; | public Integer toPayMerchant; | ||||
| @TableField(exist = false) | |||||
| public String sales; | |||||
| @TableField(exist = false) | |||||
| public Date salesTime; | |||||
| @TableField(exist = false) | |||||
| public String moneyChangeDetail; | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumPriceUnit; | import com.iformall.enums.EnumPriceUnit; | ||||
| import com.iformall.enums.EnumPropertyCreateType; | import com.iformall.enums.EnumPropertyCreateType; | ||||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | import com.iformall.enums.EnumRentContractAdjustPeriod; | ||||
| import com.iformall.enums.EnumRentContractStatus; | |||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -77,10 +78,19 @@ public class WxPropertyContract extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="filepath") | @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="filepath") | ||||
| private String filepath; | private String filepath; | ||||
| @io.swagger.annotations.ApiModelProperty(value="合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期",name="status") | |||||
| @io.swagger.annotations.ApiModelProperty(value="合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期EnumRentContractStatus",name="status") | |||||
| private Integer status; | private Integer status; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<Integer> statuss; | private List<Integer> statuss; | ||||
| @TableField(exist = false) | |||||
| private String statusName; | |||||
| public String getStatusName() { | |||||
| if (null != status) { | |||||
| return EnumRentContractStatus.getEnum(status).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否固定价格",name="0:按面积计算,1:固定价格") | @io.swagger.annotations.ApiModelProperty(value="是否固定价格",name="0:按面积计算,1:固定价格") | ||||
| private Integer fixedPrice; | private Integer fixedPrice; | ||||
| @@ -192,8 +202,16 @@ public class WxPropertyContract extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String buildingName; | private String buildingName; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年EnumPriceUnit", name = "priceUnit") | |||||
| private Integer priceUnit; | private Integer priceUnit; | ||||
| @TableField(exist = false) | |||||
| private String priceUnitName; | |||||
| public String getPriceUnitName() { | |||||
| if (null != priceUnit) { | |||||
| return EnumPriceUnit.getEnum(priceUnit).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | ||||
| private String rentPrice; | private String rentPrice; | ||||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | import com.iformall.domain.vo.RentContractFreePeriodVo; | ||||
| import com.iformall.enums.EnumPriceUnit; | import com.iformall.enums.EnumPriceUnit; | ||||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | import com.iformall.enums.EnumRentContractAdjustPeriod; | ||||
| import com.iformall.enums.EnumRentContractStatus; | |||||
| import com.iformall.enums.EnumRentContractType; | import com.iformall.enums.EnumRentContractType; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -243,10 +244,18 @@ public class WxRentContract extends TenantEntity { | |||||
| private Integer receivePeriodUnit; | private Integer receivePeriodUnit; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath") | @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath") | ||||
| private String filepath; | private String filepath; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期EnumRentContractStatus", name = "status") | |||||
| private Integer status; | private Integer status; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<Integer> statuss; | private List<Integer> statuss; | ||||
| @TableField(exist = false) | |||||
| private String statusName; | |||||
| public String getStatusName() { | |||||
| if (null != status) { | |||||
| return EnumRentContractStatus.getEnum(status).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") | @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") | ||||
| private String deposit; | private String deposit; | ||||
| @@ -374,8 +383,16 @@ public class WxRentContract extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") | @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") | ||||
| private String fileNames; | private String fileNames; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年", name = "priceUnit") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年EnumPriceUnit", name = "priceUnit") | |||||
| private Integer priceUnit; | private Integer priceUnit; | ||||
| @TableField(exist = false) | |||||
| private String priceUnitName; | |||||
| public String getPriceUnitName() { | |||||
| if (null != priceUnit) { | |||||
| return EnumPriceUnit.getEnum(priceUnit).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金租赁单价(其他放rentInfo)", name = "priceUnit") | @io.swagger.annotations.ApiModelProperty(value = "租金租赁单价(其他放rentInfo)", name = "priceUnit") | ||||
| private String rentPrice; | private String rentPrice; | ||||
| @@ -572,6 +589,7 @@ public class WxRentContract extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long propertyContractId; | private Long propertyContractId; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<RentContractFreePeriodVo> freePeriods; | private List<RentContractFreePeriodVo> freePeriods; | ||||
| public void setFreeVo(List<WxRentContractFreePeriod> freePeriods) { | public void setFreeVo(List<WxRentContractFreePeriod> freePeriods) { | ||||
| @@ -596,5 +614,9 @@ public class WxRentContract extends TenantEntity { | |||||
| } | } | ||||
| } | } | ||||
| @TableField(exist = false) | |||||
| private String salesMoney; | |||||
| @TableField(exist = false) | |||||
| private Long billId; | |||||
| } | } | ||||
| @@ -26,9 +26,12 @@ public class WxRentContractRevenueSales extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "rentContractId") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金合同编号", name = "rentContractId") | |||||
| private Long rentContractId; | private Long rentContractId; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "物业合同编号", name = "propertyContractId") | |||||
| private Long propertyContractId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") | @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") | ||||
| private Long billId; | private Long billId; | ||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.WxAllBill; | |||||
| @Data | |||||
| public class WxRentContractRevenueSetSalesVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private String total; | |||||
| private List<WxAllBill> billList; | |||||
| } | |||||
| @@ -13,7 +13,7 @@ public enum EnumBillStatus { | |||||
| PAID(3, "已结清"), | PAID(3, "已结清"), | ||||
| INVALID(6, "失效"), | INVALID(6, "失效"), | ||||
| BAD(7, "坏账"), | BAD(7, "坏账"), | ||||
| STOP_TO_SETTLE(8,"退租待结算"), | |||||
| STOP_TO_SETTLE(8,"待结算"), | |||||
| SET_OFF(9,"预收待抵扣") | SET_OFF(9,"预收待抵扣") | ||||
| ; | ; | ||||
| @@ -7,8 +7,10 @@ import com.iformall.domain.po.WxAllBill; | |||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxRentContractFreePeriod; | import com.iformall.domain.po.WxRentContractFreePeriod; | ||||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | import com.iformall.domain.vo.RentContractFreePeriodVo; | ||||
| import com.iformall.domain.vo.WxRentContractRevenueSetSalesVo; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -154,4 +156,8 @@ public interface WxRentContractService { | |||||
| void saveFreePeriods(WxRentContract wxRentContract); | void saveFreePeriods(WxRentContract wxRentContract); | ||||
| List<WxRentContractRevenueSales> getContractSales(WxRentContract wxRentContract); | |||||
| WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract,String sales,Long billId,Long propertyContractId); | |||||
| } | } | ||||
| @@ -22,11 +22,13 @@ import com.iformall.domain.po.WxPropertyContract; | |||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxRentContractFreePeriod; | import com.iformall.domain.po.WxRentContractFreePeriod; | ||||
| import com.iformall.domain.po.WxRentContractRevenueJump; | import com.iformall.domain.po.WxRentContractRevenueJump; | ||||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.BillTimeVo; | import com.iformall.domain.vo.BillTimeVo; | ||||
| import com.iformall.domain.vo.RatioVo; | import com.iformall.domain.vo.RatioVo; | ||||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | import com.iformall.domain.vo.RentContractFreePeriodVo; | ||||
| import com.iformall.domain.vo.WxRentContractRevenueSetSalesVo; | |||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumBillStatus; | import com.iformall.enums.EnumBillStatus; | ||||
| import com.iformall.enums.EnumContractOperationType; | import com.iformall.enums.EnumContractOperationType; | ||||
| @@ -146,6 +148,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxBusinessMapper wxBusinessMapper; | WxBusinessMapper wxBusinessMapper; | ||||
| @Lazy | |||||
| @Autowired | @Autowired | ||||
| WxMallService wxMallService; | WxMallService wxMallService; | ||||
| @@ -1057,7 +1060,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| resultList.addAll(billRentList); | resultList.addAll(billRentList); | ||||
| return resultList; | return resultList; | ||||
| } | } | ||||
| public List<WxAllBill> buildRentJinmao(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { | public List<WxAllBill> buildRentJinmao(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { | ||||
| int size = 0; | int size = 0; | ||||
| String[] priceArrs = null; | String[] priceArrs = null; | ||||
| @@ -1456,7 +1459,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| private WxAllBill setManageRent(Integer decimalSize,WxAllBill wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) { | private WxAllBill setManageRent(Integer decimalSize,WxAllBill wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) { | ||||
| WxAllBill manage = new WxAllBill(); | WxAllBill manage = new WxAllBill(); | ||||
| manage.setRentContractId(wxBillRent.getRentContractId()); | manage.setRentContractId(wxBillRent.getRentContractId()); | ||||
| @@ -2311,4 +2313,100 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public List<WxRentContractRevenueSales> getContractSales(WxRentContract wxRentContract) { | |||||
| WxRentContractRevenueSales sales = new WxRentContractRevenueSales(); | |||||
| sales.updateTenantInfo(wxRentContract); | |||||
| sales.setRentContractId(wxRentContract.getId()); | |||||
| return wxRentContractRevenueSalesMapper.findList(sales); | |||||
| } | |||||
| @Override | |||||
| public WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract, String sales, Long billId, Long propertyContractId) { | |||||
| WxAllBill rentBill = wxAllBillMapper.selectById(billId, rentcontract.getTenantId()); | |||||
| BigDecimal price = new BigDecimal(sales); | |||||
| //加上物业 | |||||
| WxAllBill propertyBill = null; | |||||
| if (null != propertyContractId) { | |||||
| WxAllBill propertyBillq = new WxAllBill(); | |||||
| propertyBillq.updateTenantInfo(rentcontract); | |||||
| propertyBillq.setPropertyContractId(propertyContractId); | |||||
| propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); | |||||
| propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); | |||||
| propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||||
| propertyBillq.setStarttimeEqual(rentBill.getStarttime()); | |||||
| propertyBillq.setStarttimeEqual(rentBill.getEndtime()); | |||||
| List<WxAllBill> propertyBillList = wxAllBillMapper.findList(propertyBillq); | |||||
| if (null != propertyBillList && propertyBillList.size() > 0) { | |||||
| propertyBill = propertyBillList.get(0); | |||||
| price = price.add(new BigDecimal(propertyBill.getReceivePay())); | |||||
| } | |||||
| } | |||||
| //免租期 | |||||
| List<Date> freePeriods = getFreeDays(rentcontract); | |||||
| String needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, price.toPlainString(),rentBill.getStarttime(), | |||||
| rentBill.getEndtime(),0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); | |||||
| //保存销售额 | |||||
| WxRentContractRevenueSales rs = new WxRentContractRevenueSales(); | |||||
| rs.updateTenantInfo(rentcontract); | |||||
| rs.setRentContractId(rentcontract.getId()); | |||||
| rs.setBillId(billId); | |||||
| List<WxRentContractRevenueSales> saleList = wxRentContractRevenueSalesMapper.findList(rs); | |||||
| if (null != saleList && saleList.size() > 0 ) { WxRentContractRevenueSales sale = saleList.get(0); | |||||
| sale.setSaleMoney(sales); | |||||
| sale.setUpdateTime(new Date()); | |||||
| wxRentContractRevenueSalesMapper.updateById(sale); | |||||
| }else { | |||||
| WxRentContractRevenueSales sale = new WxRentContractRevenueSales(); | |||||
| sale.updateTenantInfo(rentcontract); | |||||
| sale.setBillId(billId); | |||||
| sale.setRentContractId(rentcontract.getId()); | |||||
| sale.setBillMoney(rentBill.getReceivePay()); | |||||
| sale.setSaleMoney(sales); | |||||
| sale.setCalcuteMoney(needpay); | |||||
| sale.setPropertyContractId(propertyContractId); | |||||
| sale.setCreateTime(new Date()); | |||||
| sale.setUpdateTime(new Date()); | |||||
| wxRentContractRevenueSalesMapper.insert(sale); | |||||
| } | |||||
| //更新账单费用 | |||||
| rentBill.setMoneyChangeDetail("原合同租金金额:"+rentBill.getReceivePay()+"元,计算之后为:"+needpay+"元。"); | |||||
| rentBill.setReceivePay(needpay); | |||||
| rentBill.setBillRemark("设置销售额,自动计算"); | |||||
| rentBill.setUpdatetime(new Date()); | |||||
| if (new BigDecimal(rentBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { | |||||
| rentBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||||
| }else { | |||||
| rentBill.setStatus(EnumBillStatus.PAID.getCode()); | |||||
| } | |||||
| wxAllBillMapper.updateById(rentBill); | |||||
| //物业账单应收就改为0,因为金额已经合并了 | |||||
| if (null != propertyBill) { | |||||
| propertyBill.setMoneyChangeDetail("原合同物业金额:"+propertyBill.getReceivePay()+"元,已合并到租金,调整为:0元。"); | |||||
| propertyBill.setReceivePay("0"); | |||||
| propertyBill.setBillRemark("设置销售额,已自动计算合并到租金"); | |||||
| if (new BigDecimal(propertyBill.getOwe()).compareTo(new BigDecimal(0)) < 0 ) { | |||||
| propertyBill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); | |||||
| }else { | |||||
| propertyBill.setStatus(EnumBillStatus.PAID.getCode()); | |||||
| } | |||||
| propertyBill.setUpdatetime(new Date()); | |||||
| wxAllBillMapper.updateById(propertyBill); | |||||
| } | |||||
| WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); | |||||
| vo.setTotal(needpay); | |||||
| List<WxAllBill> blist = new ArrayList<WxAllBill>(); | |||||
| blist.add(rentBill); | |||||
| if (null != propertyBill) { | |||||
| blist.add(propertyBill); | |||||
| } | |||||
| vo.setBillList(blist);; | |||||
| return vo; | |||||
| } | |||||
| } | } | ||||
| @@ -69,6 +69,8 @@ | |||||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | ||||
| <if test=" null != starttime">and `starttime` >= #{starttime}</if> | <if test=" null != starttime">and `starttime` >= #{starttime}</if> | ||||
| <if test=" null != endtime">and `endtime` <= #{endtime}</if> | <if test=" null != endtime">and `endtime` <= #{endtime}</if> | ||||
| <if test=" null != starttimeEqual">and `starttime` = #{starttimeEqual}</if> | |||||
| <if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if> | |||||
| <if test=" null != month and '' != month"> | <if test=" null != month and '' != month"> | ||||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | ||||
| </if> | </if> | ||||
| @@ -8,6 +8,7 @@ | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | ||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | ||||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | ||||
| <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/> | |||||
| <result column="bill_id" jdbcType="BIGINT" property="billId"/> | <result column="bill_id" jdbcType="BIGINT" property="billId"/> | ||||
| <result column="bill_money" jdbcType="VARCHAR" property="billMoney"/> | <result column="bill_money" jdbcType="VARCHAR" property="billMoney"/> | ||||
| <result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/> | <result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/> | ||||
| @@ -16,7 +17,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`bill_id`,`bill_money`, | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`property_contract_id`,`bill_id`,`bill_money`, | |||||
| `sale_money`,`calcute_money`,`remark` | `sale_money`,`calcute_money`,`remark` | ||||
| </sql> | </sql> | ||||
| @@ -30,6 +31,7 @@ | |||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | ||||
| <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if> | |||||
| <if test=" null != billId ">and `bill_id` = #{billId}</if> | <if test=" null != billId ">and `bill_id` = #{billId}</if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||