| @@ -92,6 +92,9 @@ public class WxMerchantTradeDailyController extends BaseController { | |||
| wxMerchantTradeDaily.getTradeAmt() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| wxMerchantTradeDaily.setTenantId(getTenantId()); | |||
| if(wxMerchantTradeDaily.getTradeCount() == null){ | |||
| wxMerchantTradeDaily.setTradeCount(0); | |||
| } | |||
| if (wxMerchantTradeDaily.getReportDate() == null) { | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | |||
| @@ -63,7 +63,7 @@ public class WxMerchantTradeDaily implements Serializable { | |||
| private String reportDate; | |||
| /*交易笔数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value = "交易笔数", name = "tradeCount") | |||
| private String tradeCount; | |||
| private Integer tradeCount; | |||
| /*凭证**/ | |||
| @io.swagger.annotations.ApiModelProperty(value = "凭证", name = "proof") | |||
| private String proof; | |||
| @@ -93,11 +93,11 @@ public class WxMerchantTradeDaily implements Serializable { | |||
| this.month = month; | |||
| } | |||
| public String getTradeCount() { | |||
| public Integer getTradeCount() { | |||
| return tradeCount; | |||
| } | |||
| public void setTradeCount(String tradeCount) { | |||
| public void setTradeCount(Integer tradeCount) { | |||
| this.tradeCount = tradeCount; | |||
| } | |||
| @@ -3,7 +3,6 @@ package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -181,6 +180,40 @@ public class WxPropertyContract extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") | |||
| private String fileNames; | |||
| @io.swagger.annotations.ApiModelProperty(value = "总租期(月)", name = "totalPeriodMonth") | |||
| private Integer totalPeriodMonth; | |||
| @io.swagger.annotations.ApiModelProperty(value = "总租期(天)", name = "totalPeriodDay") | |||
| private Integer totalPeriodDay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租赁单价", name = "rentPrice") | |||
| private Integer rentPrice; | |||
| public Integer getTotalPeriodMonth() { | |||
| return totalPeriodMonth; | |||
| } | |||
| public void setTotalPeriodMonth(Integer totalPeriodMonth) { | |||
| this.totalPeriodMonth = totalPeriodMonth; | |||
| } | |||
| public Integer getTotalPeriodDay() { | |||
| return totalPeriodDay; | |||
| } | |||
| public void setTotalPeriodDay(Integer totalPeriodDay) { | |||
| this.totalPeriodDay = totalPeriodDay; | |||
| } | |||
| public Integer getRentPrice() { | |||
| return rentPrice; | |||
| } | |||
| public void setRentPrice(Integer rentPrice) { | |||
| this.rentPrice = rentPrice; | |||
| } | |||
| public String getFileNames() { | |||
| return fileNames; | |||
| } | |||
| @@ -333,6 +333,39 @@ public class WxRentContract extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") | |||
| private String fileNames; | |||
| @io.swagger.annotations.ApiModelProperty(value = "总租期(月)", name = "totalPeriodMonth") | |||
| private Integer totalPeriodMonth; | |||
| @io.swagger.annotations.ApiModelProperty(value = "总租期(天)", name = "totalPeriodDay") | |||
| private Integer totalPeriodDay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租赁单价", name = "rentPrice") | |||
| private Integer rentPrice; | |||
| public Integer getTotalPeriodMonth() { | |||
| return totalPeriodMonth; | |||
| } | |||
| public void setTotalPeriodMonth(Integer totalPeriodMonth) { | |||
| this.totalPeriodMonth = totalPeriodMonth; | |||
| } | |||
| public Integer getTotalPeriodDay() { | |||
| return totalPeriodDay; | |||
| } | |||
| public void setTotalPeriodDay(Integer totalPeriodDay) { | |||
| this.totalPeriodDay = totalPeriodDay; | |||
| } | |||
| public Integer getRentPrice() { | |||
| return rentPrice; | |||
| } | |||
| public void setRentPrice(Integer rentPrice) { | |||
| this.rentPrice = rentPrice; | |||
| } | |||
| public String getRentInfo() { | |||
| return rentInfo; | |||
| } | |||
| @@ -73,11 +73,9 @@ public class WxMerchantTradeDailyVo extends BaseEntity { | |||
| /*交易笔数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value = "交易笔数", name = "tradeCount") | |||
| @Transient | |||
| private String tradeCount; | |||
| private Integer tradeCount; | |||
| /*凭证**/ | |||
| @io.swagger.annotations.ApiModelProperty(value = "凭证", name = "proof") | |||
| @Transient | |||
| private String proof; | |||
| @Transient | |||
| @@ -91,11 +89,11 @@ public class WxMerchantTradeDailyVo extends BaseEntity { | |||
| this.isToday = isToday; | |||
| } | |||
| public String getTradeCount() { | |||
| public Integer getTradeCount() { | |||
| return tradeCount; | |||
| } | |||
| public void setTradeCount(String tradeCount) { | |||
| public void setTradeCount(Integer tradeCount) { | |||
| this.tradeCount = tradeCount; | |||
| } | |||
| @@ -41,6 +41,7 @@ import java.net.HttpURLConnection; | |||
| import java.net.URL; | |||
| import java.text.DecimalFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.*; | |||
| import java.util.*; | |||
| /** | |||
| @@ -332,9 +333,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData update(WxRentContract record, Long userId,String userName) { | |||
| //对比上一次,是否有更改,有,重新生成预账单 | |||
| WxRentContract dbRent = wxRentContractMapper.selectByPrimaryKey(record.getId()); | |||
| //查询预账单用于展示 | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setRentContractId(record.getId()); | |||
| @@ -356,52 +354,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| } | |||
| } | |||
| /* //有改变,删除预账单,重新生成 | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { | |||
| boolean change = false; | |||
| if (CollectionUtils.isEmpty(resultList)) { | |||
| change = true; | |||
| } else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) { | |||
| change = true; | |||
| } else { | |||
| if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", "")) | |||
| || !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getRevenue().equals(dbRent.getRevenue()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| || !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| || !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } | |||
| } | |||
| if (change) { | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| } | |||
| }*/ | |||
| //启动审批流 | |||
| if(record.getFlowParams() != null){ | |||
| @@ -1081,6 +1033,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| //最后一期截止到结束日期 | |||
| if(i == paycount - 1){ | |||
| if(wxRentContract.getRentalEndDate().after(wxBillRent.getEndtime())) { | |||
| wxBillRent.setEndtime(wxRentContract.getRentalEndDate()); | |||
| } | |||
| ZoneId zone = ZoneId.systemDefault(); | |||
| LocalDateTime localDateTime = LocalDateTime.ofInstant(wxBillRent.getStarttime().toInstant(), zone); | |||
| LocalDate startLocalDate = localDateTime.toLocalDate(); | |||
| localDateTime = LocalDateTime.ofInstant(wxBillRent.getEndtime().toInstant(), zone); | |||
| LocalDate endLocalDate = localDateTime.toLocalDate(); | |||
| int[] diff = DateUtils.getDiff(startLocalDate,endLocalDate); | |||
| needpay = diff[0]*price; | |||
| double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); | |||
| needpay += diff[1] * oneDayProce; | |||
| } | |||
| wxBillRent.setNeedPay(needpay); | |||
| wxBillRent.setOwe(needpay); | |||
| wxBillRent.setReceivePay(needpay); | |||
| @@ -1128,7 +1100,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return resultMap; | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData deleteById(String id) { | |||
| @@ -5,6 +5,8 @@ import java.sql.Timestamp; | |||
| import java.text.DateFormat; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDate; | |||
| import java.time.Period; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| @@ -1083,4 +1085,23 @@ public class DateUtils { | |||
| } | |||
| } | |||
| /** | |||
| * 计算两个时间 相差n个月 零n天 | |||
| * @param start | |||
| * @param end | |||
| * @return | |||
| */ | |||
| public static int[] getDiff(LocalDate start,LocalDate end) { | |||
| if (!start.isBefore(end)) { | |||
| throw new IllegalArgumentException("Start must not be before end."); | |||
| } | |||
| Period period = Period.between(start, end); | |||
| int years = period.getYears(); | |||
| int months = period.getMonths(); | |||
| int days = period.getDays(); | |||
| return new int[] {years * 12 + months, days}; | |||
| } | |||
| } | |||
| @@ -38,6 +38,9 @@ | |||
| <result column="adjust_ratio" property="adjustRatio"/> | |||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | |||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | |||
| <result column="total_period_month" property="totalPeriodMonth"/> | |||
| <result column="total_period_day" property="totalPeriodDay"/> | |||
| <result column="rent_price" property="rentPrice"/> | |||
| </resultMap> | |||
| @@ -47,7 +50,8 @@ | |||
| `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, | |||
| `shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`, | |||
| `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`, | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`, `file_names` | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`, `file_names`, | |||
| total_period_month,total_period_day,rent_price | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -107,7 +111,8 @@ | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate, | |||
| start_date startDate,end_date endDate,rc.rent_contract_id rentContractId,br.`name` brandName, | |||
| s.addr,rc.apply_status applyStatus,rc.adjust_period adjustPeriod,rc.business_type businessType, | |||
| rc.adjust_ratio adjustRatio,rc.rent_info rentInfo, rc.file_names fileNames | |||
| rc.adjust_ratio adjustRatio,rc.rent_info rentInfo, rc.file_names fileNames, | |||
| rc.total_period_month,rc.total_period_day,rc.rent_price | |||
| from wx_property_contract rc | |||
| left join wx_shop s on rc.shop_id=s.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| @@ -44,6 +44,10 @@ | |||
| <result column="receive_period" property="receivePeriod"/> | |||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | |||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | |||
| <result column="total_period_month" property="totalPeriodMonth"/> | |||
| <result column="total_period_day" property="totalPeriodDay"/> | |||
| <result column="rent_price" property="rentPrice"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -53,7 +57,7 @@ | |||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | |||
| `start_date`,`end_date`, | |||
| `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | |||
| `business_type`,`rent_info`, `file_names` | |||
| `business_type`,`rent_info`, `file_names`,total_period_month,total_period_day,rent_price | |||
| </sql> | |||
| @@ -113,7 +117,8 @@ | |||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | |||
| rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | |||
| bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | |||
| ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names fileNames | |||
| ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names fileNames, | |||
| rc.total_period_month,rc.total_period_day,rc.rent_price | |||
| from wx_rent_contract rc | |||
| left join wx_shop s on rc.shop_id=s.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||