소스 검색

[合同优化][修改][晚上合同优化需求]

release_toaliyun_real
luozukai 7 년 전
부모
커밋
54d4d24197
4개의 변경된 파일66개의 추가작업 그리고 48개의 파일을 삭제
  1. +39
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumPriceUnit.java
  2. +3
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  3. +9
    -39
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  4. +15
    -0
      mallinkService/src/main/java/com/iformall/utils/DateUtils.java

+ 39
- 0
mallinkService/src/main/java/com/iformall/enums/EnumPriceUnit.java 파일 보기

@@ -0,0 +1,39 @@
package com.iformall.enums;


/**
* @author gongbiao
*/

public enum EnumPriceUnit {

D(1,"日"),
M(2,"月"),
Y(3,"年"),
;

public static EnumPriceUnit getEnum(Integer code) {
for (EnumPriceUnit value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumPriceUnit(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 3
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java 파일 보기

@@ -131,6 +131,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
}
}
}
if(wxPropertyContract.getPriceUnit() == null){
wxPropertyContract.setPriceUnit(EnumPriceUnit.M.getCode());
}

wxPropertyContract.setPrice(wxPropertyContract.getPrice() != null ? wxPropertyContract.getPrice() : 0);
wxPropertyContract.setDeposit(wxPropertyContract.getDeposit() != null ? wxPropertyContract.getDeposit() : 0);
@@ -335,15 +338,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
List<WxBillProperty> billList = wxBillPropertyMapper.findList(wxBillRent);
record.setPreviewBillRentList(billList);

//生成预览账单
// if(CollectionUtils.isEmpty(billList) ||
// (!wxPropertyContract.getReceivePeriod().equals(record.getReceivePeriod())
// ||!wxPropertyContract.getPrice().equals(record.getPrice())
// ||!wxPropertyContract.getDeposit().equals(record.getDeposit())
// ||!wxPropertyContract.getAdjustPeriod().equals(record.getAdjustPeriod())
// || !DateUtils.date2String(wxPropertyContract.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd"))
// )){

if(!haspreview){
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null
&& !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) {


+ 9
- 39
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java 파일 보기

@@ -94,8 +94,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {

@Autowired
WxMerchantShopMapper wxMerchantShopMapper;
@Autowired
WxShopService wxShopService;

@Override
public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) {
@@ -156,6 +154,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
}
if(wxRentContract.getPriceUnit() == null){
wxRentContract.setPriceUnit(EnumPriceUnit.M.getCode());
}

//商场信息
WxMall wxMall = new WxMall();
@@ -167,23 +168,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0);
wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0);

//目前只有多经点位租赁合同
// WxShop wxShop = wxShopService.getById(wxRentContract.getShopId());
// if(wxShop !=null && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){
// //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月
// if(wxRentContract.getAdjustPeriod().intValue() == 1){
// wxRentContract.setAdjustPeriod(1);
// wxRentContract.setMonthHandleType(null);
// }else if(wxRentContract.getAdjustPeriod().intValue() == 2){
// wxRentContract.setAdjustPeriod(2);
// wxRentContract.setMonthHandleType(2);
// }else if(wxRentContract.getAdjustPeriod().intValue() == 3){
// wxRentContract.setAdjustPeriod(2);
// wxRentContract.setMonthHandleType(3);
// }
// }


result.put("wxRentContract", wxRentContract);
//关联的商户
if (wxRentContract.getMerchantId() != null) {
@@ -250,7 +234,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
instance.setTime(record.getRentalStartDate());
instance.add(dayType, record.getLease());
instance.add(Calendar.DAY_OF_MONTH, -1);
// record.setRentalEndDate(instance.getTime());
//起租结束时间
if (!record.getStartDate().equals(record.getRentalStartDate())) {
instance.clear();
@@ -435,17 +418,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
instance.setTime(record.getRentalStartDate());
instance.add(dayType, record.getLease());
instance.add(Calendar.DAY_OF_MONTH, -1);
//record.setRentalEndDate(instance.getTime());

//起租结束时间
// if (!record.getStartDate().equals(record.getRentalStartDate())) {
// instance.clear();
// instance.setTime(record.getRentalStartDate());
// instance.add(Calendar.DAY_OF_MONTH, -1);
// record.setEndDate(instance.getTime());
// } else {
// record.setEndDate(record.getStartDate());
// }

if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
BigDecimal hundred = new BigDecimal(100);
@@ -899,12 +871,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int paycount = lease / receivePeriod + extracount;
int index = paycount - 1;
final IdWorker idWorker = IdWorker.get();

//自然月计租,而且残月,周期整除,n+1,最后一个周期作为残月
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())
&& !isFirstDay(wxRentContract.getRentalStartDate())
&& (wxRentContract.getLease() % wxRentContract.getReceivePeriod() == 0)
&& isLastYesr
&& wxRentContract.getReceivePeriod() != 1
){
paycount ++;
}
@@ -1078,14 +1051,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//最后一期截止到结束日期
if(i == paycount - 1){
if(wxBillRent.getEndtime().after(wxRentContract.getRentalEndDate())) {
wxBillRent.setEndtime(wxRentContract.getRentalEndDate());
}
wxBillRent.setEndtime(wxRentContract.getRentalEndDate());

SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(s.format(wxBillRent.getStarttime()));
System.out.println(s.format(wxBillRent.getEndtime()));
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),wxBillRent.getEndtime());
//当天也算,加1天
Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1);
int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate);
needpay = diff[0]*price;

double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate());


+ 15
- 0
mallinkService/src/main/java/com/iformall/utils/DateUtils.java 파일 보기

@@ -1112,4 +1112,19 @@ public class DateUtils {
return new int[] {years * 12 + months, days};
}

/**
* 获取设置后的时间
* @param date
* @param type Calendar.DATE Calendar.MONTH
* @param set
* @return
*/
public static Date getDaySet(Date date,int type,int set){
Calendar cale = Calendar.getInstance();
cale.setTime(date);
cale.add(type,set);
return cale.getTime();
}


}

불러오는 중...
취소
저장