| @@ -100,57 +100,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| String floorName = ""; | |||
| String buildingName = ""; | |||
| 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.setBuildingName(buildingName); | |||
| wpc.setShopNumber(shopNumber); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.controller.contract; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| @@ -9,6 +10,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.vo.WxRentContractYearsVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxRentContractMapper; | |||
| @@ -24,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.math.BigDecimal; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| @@ -810,54 +814,137 @@ public class WxRentContractController extends WxContractBaseController { | |||
| wxRentContract.setTypeList(typeList); | |||
| List<Integer> statusList = new ArrayList<Integer>(); | |||
| statusList.add(EnumRentContractStatus.PAING.getCode()); | |||
| statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||
| //statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); | |||
| wxRentContract.setStatuss(statusList); | |||
| wxRentContract.setSortColumns(SortField.Createtime_DESC); | |||
| 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()); | |||
| //纯联营扣点方式,不能加物业费一起算 | |||
| if (contract.getType().intValue() == EnumRentContractType.RENT_BY_JOINT.getCode()) { | |||
| return new ResultData(); | |||
| } | |||
| 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); | |||
| if (null != propertyList && propertyList.size() > 0 ) { | |||
| return new ResultData(propertyList.get(0)); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 扣点设置销售额重新计算 | |||
| * @param wxRentContract | |||
| * @return | |||
| */ | |||
| @PostMapping("setRevenueSales") | |||
| public ResultData setRevenueSales(@RequestBody WxRentContract wxRentContract) { | |||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||
| if (null == rentContract) { | |||
| 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,"物业合同未完善,请先完善。"); | |||
| return new ResultData(wxRentContractService.setRevenueSales(rentContract,wxRentContract.getSalesMoney(),wxRentContract.getBillId(),wxRentContract.getPropertyContractId())); | |||
| } | |||
| //查询合同年限 | |||
| @GetMapping("getContractYears") | |||
| public ResultData getContractYears(@ModelAttribute WxRentContract wxRentContract) { | |||
| if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||
| String adjustRatio = rentContract.getAdjustRatio(); | |||
| List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); | |||
| integers.add(0, 0); | |||
| int years = integers.size(); | |||
| List<Date> yearList = wxRentContractService.getYearList(years, 12, rentContract.getRentalStartDate()); | |||
| if (null != yearList ) { | |||
| List<WxRentContractYearsVo> retList = new ArrayList<WxRentContractYearsVo>(); | |||
| Date begin = rentContract.getRentalStartDate(); | |||
| for (int i = 0 ; i < yearList.size() ; i ++) { | |||
| Date end = yearList.get(i); | |||
| Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); | |||
| WxRentContractYearsVo vo = new WxRentContractYearsVo(); | |||
| vo.setStart(begin); | |||
| vo.setEnd(realEnd); | |||
| vo.setRemark("第"+i+1+"年度"); | |||
| retList.add(vo); | |||
| begin = end; | |||
| } | |||
| if (property.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { | |||
| return new ResultData(Result.ERROR,"物业合同当前状态不能提交审批。"); | |||
| } | |||
| return new ResultData(retList); | |||
| } | |||
| return wxRentContractService.apply(rentContract,user); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 取高年度汇算计算 | |||
| * @param wxRentContract | |||
| * @return | |||
| */ | |||
| @PostMapping("calcuteYearsRevenueRentUp") | |||
| public ResultData calcuteYearsRevenueRentUp(@RequestBody WxRentContract wxRentContract) { | |||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | |||
| if (null == rentContract) { | |||
| return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | |||
| } | |||
| WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); | |||
| jq.updateTenantInfo(rentContract); | |||
| jq.setRentContractId(rentContract.getId()); | |||
| List<WxRentContractRevenueJump> jumpList = wxRentContractService.findJumpList(jq); | |||
| if (null == jumpList || jumpList.size() <= 0 ) { | |||
| return new ResultData(Result.ERROR, "合同未设置跳点,不用做汇算"); | |||
| } | |||
| return new ResultData(wxRentContractService.calcuteYearsRevenueRentUp(rentContract)); | |||
| } | |||
| } | |||
| @@ -273,7 +273,15 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("生成科目抄表计算数据") | |||
| @PostMapping("readingIsDel") | |||
| public ResultData readingIsDel(@RequestBody WxEnergyMeterReading record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setIsDel(EnumYesOrNo.YES.getCode()); | |||
| wxEnergyService.setReadingIsDel(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("新建科目抄表计算数据") | |||
| @PostMapping("createReadingCalcute") | |||
| public ResultData createReadingCalcute(@RequestBody WxEnergyReadingCalcute record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| @@ -333,4 +341,12 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(number); | |||
| } | |||
| @PostMapping("calcuteIsDel") | |||
| public ResultData calcuteIsDel(@RequestBody WxEnergyReadingCalcute record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setIsDel(EnumYesOrNo.YES.getCode()); | |||
| wxEnergyService.setReadingCalcuteIsDel(record); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -4,13 +4,13 @@ CREATE TABLE `wx_rent_contract_revenue_sales` ( | |||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `update_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_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 '备注', | |||
| `calcute_money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计算之后的金额', | |||
| `property_contract_id` bigint(20) DEFAULT NULL COMMENT '物业合同', | |||
| PRIMARY KEY (`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; | |||
| } | |||
| @TableField(exist = false) | |||
| private Date starttimeEqual; | |||
| @Excel(name = "周期结束时间", format = "yyyy-MM-dd", width = 20, orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | |||
| @@ -130,6 +132,8 @@ public class WxAllBill extends TenantEntity { | |||
| } | |||
| return endtimeStr; | |||
| } | |||
| @TableField(exist = false) | |||
| public Date endtimeEqual; | |||
| @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") | |||
| @TableField(exist = false) | |||
| @@ -344,4 +348,10 @@ public class WxAllBill extends TenantEntity { | |||
| private Long feesStandarsId; | |||
| @TableField(exist = false) | |||
| public Integer toPayMerchant; | |||
| @TableField(exist = false) | |||
| public String sales; | |||
| @TableField(exist = false) | |||
| public Date salesTime; | |||
| @TableField(exist = false) | |||
| public String moneyChangeDetail; | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillDailyBuildWay; | |||
| import com.iformall.enums.EnumBillRentApplyStatus; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| @@ -127,6 +128,9 @@ public class WxEnergyMeterReading extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="单价",name="price") | |||
| private String price; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否删除",name="isDel") | |||
| private Integer isDel; | |||
| @TableField(exist = false) | |||
| private List<WxEnergyMeterReading> meterReadingList; | |||
| @@ -199,6 +203,7 @@ public class WxEnergyMeterReading extends TenantEntity { | |||
| daily.setUpdateByName(user.getName()); | |||
| daily.setUpdatetime(new Date()); | |||
| daily.setReceivePay(needPay); | |||
| daily.setNeedPay(needPay); | |||
| daily.setPay("0"); | |||
| daily.setStarttime(this.startTime); | |||
| daily.setEndtime(this.endTime); | |||
| @@ -206,10 +211,12 @@ public class WxEnergyMeterReading extends TenantEntity { | |||
| daily.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| daily.setShopId(this.shopId); | |||
| daily.setShopNumber(this.shopNumber); | |||
| daily.setBillType(EnumEnergyMeterType.getEnum(meterType).getBillDailyType()); | |||
| daily.setBillType(EnumBillAllType.DAILY.getCode()); | |||
| daily.setEnergyFeesId(calcute.getFeesId()); | |||
| daily.setPriceDetail(detail); | |||
| daily.setServiceChargePay("0"); | |||
| daily.setBillRemark(remark); | |||
| daily.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| daily.setEnergyReadingCalcuteId(calcute.getId()); | |||
| daily.setEnergyReadingId(id); | |||
| return daily; | |||
| @@ -69,7 +69,7 @@ public class WxEnergyReadingCalcute extends TenantEntity { | |||
| if (null != importSuccess && importSuccess.intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| return "成功"; | |||
| }else { | |||
| return "部分失败"; | |||
| return "未完成导入"; | |||
| } | |||
| } | |||
| @@ -84,8 +84,11 @@ public class WxEnergyReadingCalcute extends TenantEntity { | |||
| if (null != calcuteSuccess && calcuteSuccess.intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| return "成功"; | |||
| }else { | |||
| return "部分失败"; | |||
| return "未完成计算"; | |||
| } | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除", name = "isDel") | |||
| private Integer isDel; | |||
| } | |||
| @@ -40,6 +40,8 @@ public class WxFinancePrintData extends BaseEntity { | |||
| private Integer isEdit; | |||
| @io.swagger.annotations.ApiModelProperty(value="默认值",name="defaultValue") | |||
| private String defaultValue; | |||
| @io.swagger.annotations.ApiModelProperty(value="默认值",name="defaultValue") | |||
| private String tenantId; | |||
| @TableField(exist = false) | |||
| private Object printComponents; | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumPriceUnit; | |||
| import com.iformall.enums.EnumPropertyCreateType; | |||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import lombok.Data; | |||
| @@ -77,10 +78,19 @@ public class WxPropertyContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="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; | |||
| @TableField(exist = false) | |||
| 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:固定价格") | |||
| private Integer fixedPrice; | |||
| @@ -192,8 +202,16 @@ public class WxPropertyContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| 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; | |||
| @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") | |||
| private String rentPrice; | |||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | |||
| import com.iformall.enums.EnumPriceUnit; | |||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.enums.EnumRentContractType; | |||
| import com.iformall.utils.Constant; | |||
| @@ -243,10 +244,18 @@ public class WxRentContract extends TenantEntity { | |||
| private Integer receivePeriodUnit; | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "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; | |||
| @TableField(exist = false) | |||
| 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") | |||
| private String deposit; | |||
| @@ -374,8 +383,16 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "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; | |||
| @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") | |||
| private String rentPrice; | |||
| @@ -572,6 +589,7 @@ public class WxRentContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Long propertyContractId; | |||
| @TableField(exist = false) | |||
| private List<RentContractFreePeriodVo> freePeriods; | |||
| public void setFreeVo(List<WxRentContractFreePeriod> freePeriods) { | |||
| @@ -596,5 +614,13 @@ public class WxRentContract extends TenantEntity { | |||
| } | |||
| } | |||
| @TableField(exist = false) | |||
| private String salesMoney; | |||
| @TableField(exist = false) | |||
| private Long billId; | |||
| @TableField(exist = false) | |||
| private Date yearsBegin; | |||
| @TableField(exist = false) | |||
| private Date yearsEnd; | |||
| } | |||
| @@ -26,9 +26,12 @@ public class WxRentContractRevenueSales extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "rentContractId") | |||
| @io.swagger.annotations.ApiModelProperty(value = "租金合同编号", name = "rentContractId") | |||
| private Long rentContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "物业合同编号", name = "propertyContractId") | |||
| private Long propertyContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "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; | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.domain.vo; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.utils.DateUtils; | |||
| @Data | |||
| public class WxRentContractYearsSumVo implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| //总计销售额 | |||
| private String totalSales; | |||
| //总计应扣点 | |||
| private String totalRevenue; | |||
| //账单总应收 | |||
| private String billReceivePay; | |||
| //差额 | |||
| private String owe; | |||
| public String getOwe() { | |||
| if (StringUtils.isBlank(totalRevenue)) { | |||
| totalRevenue = "0"; | |||
| } | |||
| if (StringUtils.isBlank(billReceivePay)) { | |||
| billReceivePay = "0"; | |||
| } | |||
| owe = new BigDecimal(totalRevenue).subtract(new BigDecimal(billReceivePay)).toPlainString(); | |||
| return owe; | |||
| } | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| @Data | |||
| public class WxRentContractYearsVo implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| private String remark; | |||
| private Date start; | |||
| private Date end; | |||
| } | |||
| @@ -91,6 +91,23 @@ public class WxRentPropertyContractVo extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "费用详细", name = "priceDetail") | |||
| private String priceDetail; | |||
| @io.swagger.annotations.ApiModelProperty(value = "每天价格计算规则EnumRentDayPriceCalcute", name = "dayPriceCalcute") | |||
| private Integer dayPriceCalcute; | |||
| @io.swagger.annotations.ApiModelProperty(value = "每月平均天数", name = "monthAverageDays") | |||
| private Integer monthAverageDays; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营扣点租金取高租金价格是否固定", name = "revenueFixedRentPrice") | |||
| private Integer revenueFixedRentPrice; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营扣点租金取高租金固定价格", name = "revenueRentPrice") | |||
| private String revenueRentPrice; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营跳点设置说明", name = "revenueJumpsRemark") | |||
| private String revenueJumpsRemark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "免租期说明", name = "freePeriodRemark") | |||
| private String freePeriodRemark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "首期账单开始时间", name = "firstBillDateStart") | |||
| private Date firstBillDateStart; | |||
| @io.swagger.annotations.ApiModelProperty(value = "首期账单结束时间", name = "firstBillDateEnd") | |||
| private Date firstBillDateEnd; | |||
| private List<Long> merchantIds; | |||
| } | |||
| @@ -13,7 +13,7 @@ public enum EnumBillStatus { | |||
| PAID(3, "已结清"), | |||
| INVALID(6, "失效"), | |||
| BAD(7, "坏账"), | |||
| STOP_TO_SETTLE(8,"退租待结算"), | |||
| STOP_TO_SETTLE(8,"待结算"), | |||
| SET_OFF(9,"预收待抵扣") | |||
| ; | |||
| @@ -20,4 +20,6 @@ public interface WxEnergyMeterReadingMapper extends CommonMapper<WxEnergyMeterRe | |||
| List<Map> findBuildingSumMoney(WxEnergyMeterReading wxBillRent); | |||
| List<Map> findFloorSumMoney(WxEnergyMeterReading wxBillRent); | |||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||
| } | |||
| @@ -13,4 +13,6 @@ public interface WxEnergyReadingCalcuteMapper extends CommonMapper<WxEnergyReadi | |||
| List<WxEnergyReadingCalcute> findList(WxEnergyReadingCalcute wxBillRent); | |||
| WxEnergyReadingCalcute selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||
| } | |||
| @@ -4,6 +4,8 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.math.BigDecimal; | |||
| import java.util.List; | |||
| /** | |||
| @@ -13,5 +15,9 @@ public interface WxRentContractRevenueSalesMapper extends CommonMapper<WxRentCon | |||
| List<WxRentContractRevenueSales> findList(WxRentContractRevenueSales wxBillRent); | |||
| WxRentContractRevenueSales selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| BigDecimal findSumSalesMoney(WxRentContractRevenueSales wxBillRent); | |||
| List<Long> findBillId(WxRentContractRevenueSales wxBillRent); | |||
| } | |||
| @@ -51,6 +51,7 @@ public interface WxEnergyService { | |||
| void updateReading(WxEnergyMeterReading record,MallUserInfo userInfo); | |||
| void commitReading(WxEnergyMeterReading record,MallUserInfo userInfo); | |||
| WxEnergyMeterReading getReadingById(WxEnergyMeterReading record); | |||
| void setReadingIsDel(WxEnergyMeterReading record); | |||
| //抄表科目计算数据 | |||
| PageInfo<WxEnergyReadingCalcute> readingCalcuteListAsPage(WxEnergyReadingCalcute record, Integer pageIndex, Integer pageSize); | |||
| @@ -59,4 +60,5 @@ public interface WxEnergyService { | |||
| void exportReadingCalcute(WxEnergyReadingCalcute record,HttpServletRequest request, HttpServletResponse response); | |||
| void importReadingCalcute(MultipartFile mFile, MallUserInfo user, HttpServletRequest request, HttpServletResponse response); | |||
| Integer calcuteReading(WxEnergyReadingCalcute record, MallUserInfo user); | |||
| void setReadingCalcuteIsDel(WxEnergyReadingCalcute record); | |||
| } | |||
| @@ -7,8 +7,12 @@ import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||
| import com.iformall.domain.po.WxRentContractRevenueJump; | |||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | |||
| import com.iformall.domain.vo.WxRentContractRevenueSetSalesVo; | |||
| import com.iformall.domain.vo.WxRentContractYearsSumVo; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -81,6 +85,7 @@ public interface WxRentContractService { | |||
| void updateApplyStatus(WxRentContract wxRentContract); | |||
| public List<Date> getYearList(int years,int month,Date rentalStartDate ); | |||
| List<WxAllBill> buildRent(MallUserInfo user,WxRentContract rentContract,Integer isPreview,boolean saveDb); | |||
| void buildDeposit( TenantEntity tenantEntity,MallUserInfo user,Long rentContractId); | |||
| @@ -154,4 +159,12 @@ public interface WxRentContractService { | |||
| void saveFreePeriods(WxRentContract wxRentContract); | |||
| List<WxRentContractRevenueSales> getContractSales(WxRentContract wxRentContract); | |||
| WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract,String sales,Long billId,Long propertyContractId); | |||
| WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract); | |||
| List<WxRentContractRevenueJump> findJumpList(WxRentContractRevenueJump jump); | |||
| } | |||
| @@ -552,6 +552,18 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| return wxEnergyMeterReadingMapper.selectById(record.getId(), record.getTenantId()); | |||
| } | |||
| @Override | |||
| public void setReadingIsDel(WxEnergyMeterReading record) { | |||
| WxEnergyMeterReading calcute = this.getReadingById(record); | |||
| if (null == calcute) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); | |||
| } | |||
| wxEnergyMeterReadingMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||
| } | |||
| @Override | |||
| public PageInfo<WxEnergyReadingCalcute> readingCalcuteListAsPage(WxEnergyReadingCalcute record, Integer pageIndex, | |||
| Integer pageSize) { | |||
| @@ -825,6 +837,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| WxEnergyMeterReading reading = new WxEnergyMeterReading(); | |||
| reading.updateTenantInfo(record); | |||
| reading.setTimeId(record.getTimeId()); | |||
| reading.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| reading.setIsPublic(EnumYesOrNo.NO.getCode()); | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| @@ -1018,7 +1031,13 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| return 0; | |||
| } | |||
| @Override | |||
| public void setReadingCalcuteIsDel(WxEnergyReadingCalcute record) { | |||
| WxEnergyReadingCalcute calcute = this.getReadingCalcuteById(record); | |||
| if (null == calcute) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); | |||
| } | |||
| wxEnergyReadingCalcuteMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||
| } | |||
| } | |||
| @@ -667,7 +667,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| addreceive.updateTenantInfo(user); | |||
| addreceive.setType(cashierType.getCode()); | |||
| addreceive.setStatus(EnumFinanceReceiveStatus.NORMAL.getCode()); | |||
| addreceive.setType(type.getCode()); | |||
| addreceive.setType(cashierType.getCode()); | |||
| addreceive.setReceiveMoney(receiveMoney); | |||
| addreceive.setPayMoney(payMoney); | |||
| addreceive.setMerchantId(merchantId); | |||
| @@ -681,6 +681,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| addreceive.setUpdateByName(user.getName()); | |||
| addreceive.setRemark(remark); | |||
| addreceive.setFeesId(feesId); | |||
| addreceive.setReceiveType(type.getCode()); | |||
| return addreceive; | |||
| } | |||
| @@ -22,11 +22,15 @@ import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.WxRentContractFreePeriod; | |||
| import com.iformall.domain.po.WxRentContractRevenueJump; | |||
| import com.iformall.domain.po.WxRentContractRevenueSales; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.BillTimeVo; | |||
| import com.iformall.domain.vo.RatioVo; | |||
| import com.iformall.domain.vo.RentContractFreePeriodVo; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import com.iformall.domain.vo.WxRentContractRevenueSetSalesVo; | |||
| import com.iformall.domain.vo.WxRentContractYearsSumVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| import com.iformall.enums.EnumContractOperationType; | |||
| @@ -46,6 +50,7 @@ import com.iformall.enums.EnumRentContractAppStatus; | |||
| import com.iformall.enums.EnumRentContractManageFeeType; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.enums.EnumRentContractType; | |||
| import com.iformall.enums.EnumRentDayPriceCalcute; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.enums.EnumTradeDailyDateType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| @@ -146,6 +151,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxBusinessMapper wxBusinessMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @@ -1016,20 +1022,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return rentList; | |||
| } | |||
| public List<WxAllBill> buildRentMonth(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview, boolean saveDb) { | |||
| int years = 0; | |||
| //计算租金每年的计费基数 | |||
| String[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); | |||
| //计算商业管理费 | |||
| String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); | |||
| //计算运营管理费 | |||
| String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); | |||
| int month = 12; | |||
| int billcount = 0; | |||
| List<WxAllBill> resultList = new ArrayList<WxAllBill>(); | |||
| years = priceArrs.length; | |||
| @Override | |||
| public List<Date> getYearList(int years,int month,Date rentalStartDate ) { | |||
| List<Date> yearList = new ArrayList<>(); | |||
| for (int i = 0; i < years; i++) { | |||
| Calendar instance = Calendar.getInstance(); | |||
| @@ -1050,6 +1044,22 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // } | |||
| yearList.add(startDate); | |||
| } | |||
| return yearList; | |||
| } | |||
| public List<WxAllBill> buildRentMonth(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview, boolean saveDb) { | |||
| int years = 0; | |||
| //计算租金每年的计费基数 | |||
| String[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); | |||
| //计算商业管理费 | |||
| String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); | |||
| //计算运营管理费 | |||
| String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); | |||
| int month = 12; | |||
| int billcount = 0; | |||
| List<WxAllBill> resultList = new ArrayList<WxAllBill>(); | |||
| years = priceArrs.length; | |||
| List<Date> yearList = getYearList(years,month,rentalStartDate); | |||
| String shopInfoStr = getShopInfoStr(wxRentContract); | |||
| Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, wxRentContract.getReceivePeriodUnit(), wxRentContract, user, billcount, isPreview, shopInfoStr,saveDb); | |||
| @@ -1057,7 +1067,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| resultList.addAll(billRentList); | |||
| return resultList; | |||
| } | |||
| public List<WxAllBill> buildRentJinmao(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { | |||
| int size = 0; | |||
| String[] priceArrs = null; | |||
| @@ -1456,7 +1466,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return resultMap; | |||
| } | |||
| private WxAllBill setManageRent(Integer decimalSize,WxAllBill wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) { | |||
| WxAllBill manage = new WxAllBill(); | |||
| manage.setRentContractId(wxBillRent.getRentContractId()); | |||
| @@ -2311,4 +2320,419 @@ 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); | |||
| } | |||
| private BigDecimal calcuteUnitPrice(Date startDate,Date endDate,BigDecimal salesDeciaml,Integer priceUnit, | |||
| Integer dayPriceCalcute,Integer mothAverageDays) { | |||
| BigDecimal unitPrice = new BigDecimal(0); | |||
| int[] diffs = DateUtils.getDiff(startDate, endDate); | |||
| if (priceUnit.equals(EnumPriceUnit.D.getCode())){ | |||
| int allDays = 0; | |||
| if (dayPriceCalcute.intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| allDays = diffs[0]*mothAverageDays + diffs[1]; | |||
| }else { | |||
| allDays = DateUtils.daysBetween(startDate, endDate)+1; | |||
| } | |||
| //每一天的单价 | |||
| unitPrice = salesDeciaml.divide(new BigDecimal(allDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else if(EnumPriceUnit.Y.getCode().equals(priceUnit)) { | |||
| //每一年的单价 | |||
| BigDecimal years = new BigDecimal(diffs[0]/12); | |||
| int extraMonths = diffs[0]%12; | |||
| if (dayPriceCalcute.intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| int days = extraMonths*mothAverageDays + diffs[1]; | |||
| years = years.add(new BigDecimal(days).divide(new BigDecimal(12*mothAverageDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| }else { | |||
| int days = DateUtils.daysBetween(startDate, endDate)+1; | |||
| years = years.add(new BigDecimal(days).divide(new BigDecimal(365),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| } | |||
| //每一天的单价 | |||
| unitPrice = salesDeciaml.divide(years,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else if(EnumPriceUnit.M.getCode().equals(priceUnit)) { | |||
| //每一月的单价 | |||
| BigDecimal months = new BigDecimal(diffs[0]); | |||
| if (dayPriceCalcute.intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| months = months.add(new BigDecimal(diffs[1]).divide(new BigDecimal(mothAverageDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| }else { | |||
| Date extraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate); | |||
| int extraDays = DateUtils.daysBetween(extraStartDay, endDate)+1; | |||
| Date extraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(extraStartDay); | |||
| Date extraStartDayMonthEnd = DateUtils.getLastDayForMonth(extraStartDay); | |||
| int monthDays = DateUtils.daysBetween(extraStartDayMonthStart, extraStartDayMonthEnd)+1; | |||
| months = months.add(new BigDecimal(extraDays).divide(new BigDecimal(monthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| } | |||
| //每一天的单价 | |||
| unitPrice = salesDeciaml.divide(months,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| return unitPrice; | |||
| } | |||
| //根据租金合同来计算附加物业费 | |||
| private BigDecimal calcuteRentPropertyPrice(WxRentContract rentcontract,WxPropertyContract propertyContract,Date startDate,Date endDate,BigDecimal money) { | |||
| //计算物业费的单价 | |||
| BigDecimal unitPropertyPrice = calcuteUnitPrice(startDate, endDate,money, | |||
| propertyContract.getPriceUnit(),propertyContract.getDayPriceCalcute(),propertyContract.getMonthAverageDays()); | |||
| //如果租金是按天计算 | |||
| if (rentcontract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | |||
| //物业也是按天 | |||
| if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { | |||
| return unitPropertyPrice; | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { | |||
| if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| return unitPropertyPrice.divide(new BigDecimal(12*propertyContract.getMonthAverageDays()), | |||
| Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else { | |||
| return unitPropertyPrice.divide(new BigDecimal(365),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { | |||
| if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| return unitPropertyPrice.divide(new BigDecimal(propertyContract.getMonthAverageDays()), | |||
| Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else { | |||
| int allDays = DateUtils.daysBetween(startDate, endDate)+1; | |||
| return money.divide(new BigDecimal(allDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| } | |||
| }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { | |||
| if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { | |||
| if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| return unitPropertyPrice.multiply(new BigDecimal(12*propertyContract.getMonthAverageDays())); | |||
| }else { | |||
| return unitPropertyPrice.multiply(new BigDecimal(365)); | |||
| } | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { | |||
| return unitPropertyPrice; | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { | |||
| return unitPropertyPrice.multiply(new BigDecimal(12)); | |||
| } | |||
| }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { | |||
| if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { | |||
| if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| return unitPropertyPrice.multiply(new BigDecimal(propertyContract.getMonthAverageDays())); | |||
| }else { | |||
| //此处就无法计算月了。 | |||
| //计算月份值。 | |||
| int[] diffs = DateUtils.getDiff(startDate, endDate); | |||
| BigDecimal months = new BigDecimal(diffs[0]); | |||
| Date extraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate); | |||
| int extraDays = DateUtils.daysBetween(extraStartDay, endDate)+1; | |||
| Date extraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(extraStartDay); | |||
| Date extraStartDayMonthEnd = DateUtils.getLastDayForMonth(extraStartDay); | |||
| int monthDays = DateUtils.daysBetween(extraStartDayMonthStart, extraStartDayMonthEnd)+1; | |||
| months = months.add(new BigDecimal(extraDays).divide(new BigDecimal(monthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); | |||
| return unitPropertyPrice.multiply(months); | |||
| } | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { | |||
| return unitPropertyPrice.divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { | |||
| return unitPropertyPrice; | |||
| } | |||
| } | |||
| return unitPropertyPrice; | |||
| } | |||
| private BigDecimal[] calcuteReveneuJump(BigDecimal sales,WxRentContract rentcontract,Date startDate,Date endDate,List<Date> freePeriods) { | |||
| WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); | |||
| jq.updateTenantInfo(rentcontract); | |||
| jq.setRentContractId(rentcontract.getId()); | |||
| jq.setSortColumn(" minMoney asc"); | |||
| BigDecimal revenueDecimal = new BigDecimal(0); | |||
| BigDecimal rentDecimal = new BigDecimal(0); | |||
| List<WxRentContractRevenueJump> jumpList = wxRentContractRevenueJumpMapper.findList(jq); | |||
| if (null != jumpList && jumpList.size() > 0 ) { | |||
| for (int i = 0 ; i< jumpList.size() ; i ++) { | |||
| WxRentContractRevenueJump rj = jumpList.get(i); | |||
| String minMoney = rj.getMinMoney(); | |||
| String maxMoney = rj.getMaxMoney(); | |||
| if (StringUtils.isNotBlank(maxMoney)) { | |||
| if (sales.compareTo(new BigDecimal(maxMoney)) <= 0 ) { | |||
| revenueDecimal = sales.multiply(new BigDecimal(rj.getRate())); | |||
| if (StringUtils.isNotBlank(rj.getRentMoney())) { | |||
| rentDecimal = new BigDecimal(rj.getRentMoney()); | |||
| } | |||
| break; | |||
| } | |||
| }else { | |||
| if (sales.compareTo(new BigDecimal(minMoney)) > 0 ) { | |||
| revenueDecimal = sales.multiply(new BigDecimal(rj.getRate())); | |||
| if (StringUtils.isNotBlank(rj.getRentMoney())) { | |||
| rentDecimal = new BigDecimal(rj.getRentMoney()); | |||
| } | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //根据时间区间计算 | |||
| //固定租金需要再计算,因为跳点设置的租金是单价 | |||
| String rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate, | |||
| endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); | |||
| rentDecimal = new BigDecimal(rentNeedpay); | |||
| BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal}; | |||
| return bs; | |||
| } | |||
| @Override | |||
| public WxRentContractRevenueSetSalesVo setRevenueSales(WxRentContract rentcontract, String sales, Long billId, Long propertyContractId) { | |||
| WxAllBill rentBill = wxAllBillMapper.selectById(billId, rentcontract.getTenantId()); | |||
| BigDecimal salesDeciaml = 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); | |||
| } | |||
| } | |||
| //根据销售额来计算价格均值 | |||
| BigDecimal unitRevenuePrice = calcuteUnitPrice(rentBill.getStarttime(), rentBill.getEndtime(),salesDeciaml, | |||
| rentcontract.getPriceUnit(),rentcontract.getDayPriceCalcute(),rentcontract.getMonthAverageDays()); | |||
| //设置保底营业额 | |||
| rentcontract.setRevenue(unitRevenuePrice.toPlainString()); | |||
| //联营扣点 | |||
| if (rentcontract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| rentcontract.setPrice(new BigDecimal(rentcontract.getPayRatio()).multiply(unitRevenuePrice).divide(new BigDecimal(100), | |||
| Constant.default_long_decimal_size,RoundingMode.HALF_UP).toPlainString()); | |||
| }else if (rentcontract.getType().intValue() == EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode()) { | |||
| //取高才能加上物业费 | |||
| if (null != propertyContractId && null != propertyBill) { | |||
| WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(propertyContractId); | |||
| BigDecimal rentPrice = new BigDecimal(rentcontract.getPrice()); | |||
| //有可能物业的单价时间跟租金的不一致,需要根据物业的单价重新计算 | |||
| BigDecimal propertyPrice = calcuteRentPropertyPrice(rentcontract, propertyContract, rentBill.getStarttime(), rentBill.getEndtime(), | |||
| new BigDecimal(propertyBill.getReceivePay())); | |||
| rentcontract.setPrice(rentPrice.add(propertyPrice).toPlainString());; | |||
| } | |||
| } | |||
| //计算每一年的基数 | |||
| String[] priceArrs = WxRentContractHelper.calcuteRentPrice(rentcontract); | |||
| List<Date> yearList = this.getYearList(priceArrs.length, 12, rentcontract.getRentalStartDate()); | |||
| int yearIndex = 0; | |||
| for( int i = 0 ; i < yearList.size() ; i ++) { | |||
| Date yearEndDate = yearList.get(i); | |||
| if (rentBill.getEndtime().before(yearEndDate) || rentBill.getEndtime().equals(yearEndDate)) { | |||
| yearIndex = i; | |||
| break; | |||
| } | |||
| } | |||
| //免租期 | |||
| List<Date> freePeriods = getFreeDays(rentcontract); | |||
| //根据租金和扣点来计算 | |||
| String needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, priceArrs[yearIndex],rentBill.getStarttime(), | |||
| rentBill.getEndtime(),0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); | |||
| //计算跳点。 | |||
| BigDecimal[] jumppays = calcuteReveneuJump(salesDeciaml, rentcontract,rentBill.getStarttime(), rentBill.getEndtime(),freePeriods); | |||
| BigDecimal jumpRevenuePay = jumppays[0]; | |||
| BigDecimal jumpRentPay = jumppays[1]; | |||
| BigDecimal jumppay = new BigDecimal(0); | |||
| if (jumpRevenuePay.compareTo(jumpRentPay) > 0 ) { | |||
| jumppay = jumppay.add(jumpRevenuePay); | |||
| }else { | |||
| jumppay = jumppay.add(jumpRentPay); | |||
| } | |||
| if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) { | |||
| needpay = jumppay.toPlainString(); | |||
| } | |||
| //保存销售额 | |||
| 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(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| sale.setId(idWorker.nextId()); | |||
| 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; | |||
| } | |||
| @Override | |||
| public WxRentContractYearsSumVo calcuteYearsRevenueRentUp(WxRentContract rentcontract) { | |||
| //查询销售总数 | |||
| WxRentContractRevenueSales rsq = new WxRentContractRevenueSales(); | |||
| rsq.updateTenantInfo(rentcontract); | |||
| rsq.setRentContractId(rentcontract.getId()); | |||
| //BigDecimal sum = wxRentContractRevenueSalesMapper.findSumSalesMoney(rsq); | |||
| List<Long> billIdList = wxRentContractRevenueSalesMapper.findBillId(rsq); | |||
| Date realStartTime = null; | |||
| Date realEndTime = null; | |||
| if (null != billIdList || billIdList.size() > 0 ) { | |||
| WxAllBill abq = new WxAllBill(); | |||
| abq.updateTenantInfo(rentcontract); | |||
| abq.setIds(billIdList); | |||
| abq.setStarttimeEqual(rentcontract.getYearsBegin()); | |||
| abq.setStarttimeEqual(rentcontract.getYearsEnd()); | |||
| abq.setSortColumn(" starttime asc"); | |||
| List<WxAllBill> billList = wxAllBillMapper.findList(abq); | |||
| if (null == billList || billList.size() <= 0 ){ | |||
| return null; | |||
| } | |||
| realStartTime = billList.get(0).getStarttime(); | |||
| realEndTime = billList.get(billList.size()-1).getEndtime(); | |||
| } | |||
| BigDecimal sum = new BigDecimal(0); | |||
| //计算跳点。 | |||
| BigDecimal[] jumppays = calcuteReveneuJump(sum, rentcontract,rentcontract.getYearsBegin(), rentcontract.getYearsEnd(),null); | |||
| BigDecimal jumpRevenuePay = jumppays[0]; | |||
| //BigDecimal jumpRentPay = jumppays[1]; | |||
| //销售收入不满足一年怎么算。 | |||
| if (realStartTime.equals(rentcontract.getYearsBegin()) && realEndTime.equals(rentcontract.getYearsEnd())) { | |||
| }else { | |||
| int days = DateUtils.daysBetween(realStartTime, realEndTime)+1; | |||
| if (rentcontract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { | |||
| jumpRevenuePay = jumpRevenuePay.multiply(new BigDecimal(days)).divide(new BigDecimal(12*rentcontract.getMonthAverageDays()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| }else { | |||
| jumpRevenuePay = jumpRevenuePay.multiply(new BigDecimal(days)).divide(new BigDecimal(365),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| } | |||
| BigDecimal receivepay = new BigDecimal(0); | |||
| //查询所有租金和物业账单的信息 | |||
| WxAllBill rentBillq = new WxAllBill(); | |||
| rentBillq.updateTenantInfo(rentcontract); | |||
| rentBillq.setRentContractId(rentcontract.getId()); | |||
| rentBillq.setBillType(EnumBillAllType.RENT.getCode()); | |||
| rentBillq.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); | |||
| rentBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| rentBillq.setStarttimeEqual(rentcontract.getYearsBegin()); | |||
| rentBillq.setEndtimeEqual(rentcontract.getYearsEnd()); | |||
| WxBillSum rentBillSum = wxAllBillMapper.getBillMonthSum(rentBillq); | |||
| if (null != rentBillSum) { | |||
| receivepay = receivepay.add(rentBillSum.getNeedPayNumber()); | |||
| } | |||
| WxPropertyContract bq = new WxPropertyContract(); | |||
| bq.updateTenantInfo(rentcontract); | |||
| bq.setMerchantId(rentcontract.getMerchantId()); | |||
| bq.setRentContractId(rentcontract.getId()); | |||
| bq.setOperationType(EnumContractOperationType.WHOLE.getCode()); | |||
| bq.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| List<WxPropertyContract> propertyList = wxPropertyContractService.findList(bq); | |||
| if (null != propertyList && propertyList.size() > 0 ) { | |||
| WxPropertyContract pc = propertyList.get(0); | |||
| WxAllBill propertyBillq = new WxAllBill(); | |||
| propertyBillq.updateTenantInfo(rentcontract); | |||
| propertyBillq.setPropertyContractId(pc.getId()); | |||
| propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); | |||
| propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); | |||
| propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| propertyBillq.setStarttimeEqual(rentcontract.getYearsBegin()); | |||
| propertyBillq.setEndtimeEqual(rentcontract.getYearsEnd()); | |||
| WxBillSum propertyBillSum = wxAllBillMapper.getBillMonthSum(rentBillq); | |||
| if (null != propertyBillSum) { | |||
| receivepay = receivepay.add(propertyBillSum.getNeedPayNumber()); | |||
| } | |||
| } | |||
| WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); | |||
| vo.setTotalSales(sum.toPlainString()); | |||
| vo.setTotalRevenue(jumpRevenuePay.toPlainString()); | |||
| vo.setBillReceivePay(receivepay.toPlainString()); | |||
| if ( new BigDecimal(vo.getOwe()).compareTo(new BigDecimal(0)) > 0) { | |||
| //增加一个账单 | |||
| WxAllBill createBillq = new WxAllBill(); | |||
| createBillq.updateTenantInfo(rentcontract); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| createBillq.setId(idWorker.nextId()); | |||
| createBillq.setMerchantId(rentcontract.getMerchantId()); | |||
| createBillq.setRentShopType(rentcontract.getRentShopType()); | |||
| createBillq.setCreatetime(new Date()); | |||
| createBillq.setUpdatetime(new Date()); | |||
| createBillq.setPriceDetail("年度汇算销售额:"+sum.toPlainString()+",应扣点金额:"+jumpRevenuePay.toPlainString()+",账单总金额:"+receivepay.toPlainString()+".差额:"+vo.getOwe()); | |||
| createBillq.setNeedPay(vo.getOwe()); | |||
| createBillq.setReceivePay(vo.getOwe()); | |||
| createBillq.setPay("0"); | |||
| createBillq.setBillType(EnumBillAllType.RENT.getCode()); | |||
| createBillq.setStarttime(rentcontract.getYearsBegin()); | |||
| createBillq.setEndtime(rentcontract.getYearsEnd()); | |||
| createBillq.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| createBillq.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); | |||
| createBillq.setBillRemark("扣点年度汇算自动生成"); | |||
| createBillq.setIsPreview(EnumYesOrNo.NO.getCode()); | |||
| createBillq.setRentContractId(rentcontract.getId()); | |||
| wxAllBillMapper.insert(createBillq); | |||
| } | |||
| return vo; | |||
| } | |||
| @Override | |||
| public List<WxRentContractRevenueJump> findJumpList(WxRentContractRevenueJump jump) { | |||
| return wxRentContractRevenueJumpMapper.findList(jump); | |||
| } | |||
| } | |||
| @@ -69,6 +69,8 @@ | |||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | |||
| <if test=" null != starttime">and `starttime` >= #{starttime}</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"> | |||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| @@ -30,11 +30,12 @@ | |||
| <result column="building_id" jdbcType="BIGINT" property="buildingId"/> | |||
| <result column="floor_id" jdbcType="BIGINT" property="floorId"/> | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`cur_number`,`pre_number`,`pre_time`,`pre_by`,`pre_by_name`,`start_time`,`end_time`,`create_by`,`create_by_name`, | |||
| `update_by`,`update_by_name`,`remark`,`time_id`,`meter_id`,`meter_type`,`meter_rate`,`is_public`,`meter_name`,`shop_id`,`shop_number`,`building_id`,`floor_id`,`price` | |||
| `update_by`,`update_by_name`,`remark`,`time_id`,`meter_id`,`meter_type`,`meter_rate`,`is_public`,`meter_name`,`shop_id`,`shop_number`,`building_id`,`floor_id`,`price`,`is_del` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -56,6 +57,7 @@ | |||
| <if test=" null != shopNumber and '' != shopNumber ">and shop_number like concat('%', #{shopNumber},'%')</if> | |||
| <if test=" null != buildingId ">and `building_id` = #{buildingId}</if> | |||
| <if test=" null != floorId ">and `floor_id` = #{floorId}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != createByName and '' != createByName ">and create_by_name like concat('%', #{createByName},'%')</if> | |||
| <if test=" null != shopIds "> | |||
| and shop_id in | |||
| @@ -104,6 +106,10 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| group by floor_id | |||
| </select> | |||
| <update id = "setIsDel" parameterType="HashMap"> | |||
| update wx_energy_meter_reading set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| </mapper> | |||
| @@ -18,11 +18,12 @@ | |||
| <result column="is_imported" jdbcType="INTEGER" property="isImported"/> | |||
| <result column="import_success" jdbcType="INTEGER" property="importSuccess"/> | |||
| <result column="calcute_success" jdbcType="INTEGER" property="calcuteSuccess"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`create_by`,`create_by_name`, | |||
| `update_by`,`update_by_name`,`remark`,`time_id`,`fees_id`,`is_calcuted`,`is_imported`,`import_success`,`calcute_success` | |||
| `update_by`,`update_by_name`,`remark`,`time_id`,`fees_id`,`is_calcuted`,`is_imported`,`import_success`,`calcute_success`,`is_del` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -41,6 +42,7 @@ | |||
| <if test=" null != isImported ">and `is_imported` = #{isImported}</if> | |||
| <if test=" null != importSuccess ">and `import_success` = #{importSuccess}</if> | |||
| <if test=" null != calcuteSuccess ">and `calcute_success` = #{calcuteSuccess}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -62,6 +64,10 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_energy_reading_calcute where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <update id = "setIsDel" parameterType="HashMap"> | |||
| update wx_energy_reading_calcute set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| </mapper> | |||
| @@ -12,10 +12,11 @@ | |||
| <result column="print_data_json" jdbcType="VARCHAR" property="printDataJson"/> | |||
| <result column="is_edit" jdbcType="INTEGER" property="isEdit"/> | |||
| <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`is_del`,`remark`,`type`,`sort`,`print_data_type`,`print_data_json`,`is_edit`,`default_value` | |||
| `id`,`name`,`is_del`,`remark`,`type`,`sort`,`print_data_type`,`print_data_json`,`is_edit`,`default_value`,`tenant_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -44,6 +45,10 @@ | |||
| <if test=" null != isEdit "> | |||
| and `is_edit` = #{isEdit} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and (`tenant_id` = #{tenantId} or `tenant_id` is null) | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -8,6 +8,7 @@ | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <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_money" jdbcType="VARCHAR" property="billMoney"/> | |||
| <result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/> | |||
| @@ -16,7 +17,7 @@ | |||
| </resultMap> | |||
| <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` | |||
| </sql> | |||
| @@ -30,6 +31,7 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </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 != ids "> | |||
| and id in | |||
| @@ -53,5 +55,17 @@ | |||
| from wx_rent_contract_revenue_sales where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findSumSalesMoney" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultType="BigDecimal"> | |||
| select sum(CAST(sale_money AS DECIMAL(20,2))) receive_pay | |||
| from wx_rent_contract_revenue_sales | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findBillId" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultType="Long"> | |||
| select distinct bill_id | |||
| from wx_rent_contract_revenue_sales | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||