Просмотр исходного кода

Merge commit '086ca2cc802acb8a4228bd664c86a6bb0c623d95' into release

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
ac86daa4ca
3 измененных файлов: 39 добавлений и 35 удалений
  1. +11
    -1
      mallinkCallback/src/main/java/com/iformall/controller/device/KwBoxV1Controller.java
  2. +9
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  3. +19
    -28
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 11
- 1
mallinkCallback/src/main/java/com/iformall/controller/device/KwBoxV1Controller.java Просмотреть файл

@@ -10,6 +10,7 @@ import com.iformall.domain.po.KwBoxCmdHistory;
import com.iformall.enums.EnumBoxRegisterStatus; import com.iformall.enums.EnumBoxRegisterStatus;
import com.iformall.service.kw.KwBoxCmdHistoryService; import com.iformall.service.kw.KwBoxCmdHistoryService;
import com.iformall.service.kw.KwBoxService; import com.iformall.service.kw.KwBoxService;

import io.netty.util.internal.StringUtil; import io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -19,6 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;


@@ -135,6 +139,12 @@ public class KwBoxV1Controller extends BaseController {
record.setId(kwBox.getId()); record.setId(kwBox.getId());
record.setLastOnlineTime(new Date()); record.setLastOnlineTime(new Date());
kwBoxService.saveOrUpdate(record); kwBoxService.saveOrUpdate(record);
Instant instant = deviceTime.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
if (localDateTime.getYear() == 1980)
deviceTime = new Date();


List<Map<String,String>> metersData = (List<Map<String,String>>)paramMap.get("meters"); List<Map<String,String>> metersData = (List<Map<String,String>>)paramMap.get("meters");
kwBoxService.saveMeterData(kwBox, metersData, deviceTime); kwBoxService.saveMeterData(kwBox, metersData, deviceTime);
@@ -147,7 +157,7 @@ public class KwBoxV1Controller extends BaseController {
{ {
updateMeters = true; updateMeters = true;
} else { } else {
if (!meters.containsAll(metersData.stream().map(m->m.get("addr")).collect(Collectors.toList())))
if (!meters.containsAll(metersData.stream().map(m->m.get(KwBoxService.METER_ADDRESS)).collect(Collectors.toList())))
updateMeters = true; updateMeters = true;
} }




+ 9
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Просмотреть файл

@@ -268,7 +268,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
} }
//保存物业合同信息 //保存物业合同信息
String message; String message;
boolean hasFlow = true;
if (record.getId() == null) { if (record.getId() == null) {
hasFlow = false;
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId()); record.setId(idWorker.nextId());
record.setRentalStartDate(wxRentContract.getRentalStartDate()); record.setRentalStartDate(wxRentContract.getRentalStartDate());
@@ -330,6 +332,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
record.setPrice(record.getPrice() != null ? record.getPrice() : 0); record.setPrice(record.getPrice() != null ? record.getPrice() : 0);
record.setDeposit(record.getDeposit() != null ? record.getDeposit() : 0); record.setDeposit(record.getDeposit() != null ? record.getDeposit() : 0);
record.setUpdatetime(new Date()); record.setUpdatetime(new Date());
if (CollectionUtils.isEmpty(record.getFlowParams())) {
hasFlow = false;
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
}
try { try {
wxPropertyContractMapper.updateByPrimaryKeySelective(record); wxPropertyContractMapper.updateByPrimaryKeySelective(record);
} catch (Exception e) { } catch (Exception e) {
@@ -340,8 +346,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
message = "更新物业合同信息成功"; message = "更新物业合同信息成功";
} }


if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) {
if (!CollectionUtils.isEmpty(record.getFlowParams())) {
if (hasFlow) {
if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) {
if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null) { if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null) {
updatePropertyContractStatus(record.getId()); updatePropertyContractStatus(record.getId());
} else { } else {
@@ -355,10 +361,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxPropertyContractMapper.updateStatus(updateRentContract); wxPropertyContractMapper.updateStatus(updateRentContract);
logger.info("id:{},启动审批流成功", record.getId().toString()); logger.info("id:{},启动审批流成功", record.getId().toString());
} }
}
} else {
//有模板,启动审批流,没有,直接生产账单
if (!CollectionUtils.isEmpty(record.getFlowParams())) {
} else {
if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null
&& record.getMerchantId() != null) { && record.getMerchantId() != null) {
wxRentContractService.updateRentContractStatus(record.getId()); wxRentContractService.updateRentContractStatus(record.getId());


+ 19
- 28
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -769,7 +769,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//按月计租 //按月计租
// if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) // if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode())
// ||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { // ||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
rentList = buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price,isPreview);
rentList = buildRentMonth(userId, wxRentContract, receivePeriod, lease, rentalStartDate, price, isPreview);
// } else { // } else {
// //如果按日 // //如果按日
// List<Date> yearList = new ArrayList<>(); // List<Date> yearList = new ArrayList<>();
@@ -830,7 +830,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return priceList; return priceList;
} }


public List<WxBillRent> buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview) {
public List<WxBillRent> buildRentMonth(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview) {
int size = 0; int size = 0;
long[] priceArrs = null; long[] priceArrs = null;
List<Map<String, Object>> shopInfos = new ArrayList<>(); List<Map<String, Object>> shopInfos = new ArrayList<>();
@@ -877,8 +877,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
} }
} else { } else {
for (int i = 1; i < size; i++) { for (int i = 1; i < size; i++) {
BigDecimal divide = priceD.add(new BigDecimal(integers.get(i)));
priceD = priceD.add(divide);
priceD = priceD.add(new BigDecimal(integers.get(i)));
priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue();
} }
} }
@@ -919,13 +918,27 @@ public class WxRentContractServiceImpl implements WxRentContractService {
yearList.add(startDate); yearList.add(startDate);
} }


Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs, yearList, Calendar.MONTH, wxRentContract, userId, wxMerchant, billcount, isPreview, shopInfos);

String shopInfoStr = null;
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int rentSize = rentInfoArray.size();
Map<String, Object> shopInfoMap = new HashMap<>(rentSize);
for (int j = 0; j < rentSize; j++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(j);
shopInfoMap.put(rentInfoObject.getString("shopNumber"), rentInfoObject.getString("buildArea"));
}
shopInfoStr = JSONObject.toJSONString(shopInfoMap);
}

Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr);
List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList"); List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList");
resultList.addAll(billRentList); resultList.addAll(billRentList);
return resultList; return resultList;
} }


public Map<String, Object> buildRent(int receivePeriod,long[] priceArrs, List<Date> yearList,int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview,List<Map<String, Object>> shopInfoList) {
public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr) {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Map<String,Object> resultMap = new HashedMap(); Map<String,Object> resultMap = new HashedMap();
List<WxBillRent> resultList = new ArrayList<>(); List<WxBillRent> resultList = new ArrayList<>();
@@ -958,28 +971,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {


//获取price 、shopInfo //获取price 、shopInfo
long price = priceArrs[index]; long price = priceArrs[index];
Map<String, Object> shopInfo = null;
if(!CollectionUtils.isEmpty(shopInfoList)){
shopInfo = shopInfoList.get(index);
}

String shopInfoStr = null;
if (shopInfo != null) {
shopInfoStr = JSONObject.toJSONString(shopInfo);
} else {
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int rentSize = rentInfoArray.size();
Map<String, Object> shopInfoMap = new HashMap<>();
for (int j = 0; j < rentSize; j++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(j);
shopInfoMap.put(rentInfoObject.getString("shopNumber"), 0);
}
shopInfoStr = JSONObject.toJSONString(shopInfoMap);
}
}


WxBillRent wxBillRent = new WxBillRent(); WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setIsPreview(isPreview); wxBillRent.setIsPreview(isPreview);


Загрузка…
Отмена
Сохранить