Browse Source

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real

release_toaliyun_real
xiaohu 1 year ago
parent
commit
494e56f380
33 changed files with 863 additions and 237 deletions
  1. +9
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java
  2. +12
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java
  3. +3
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  4. +0
    -46
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java
  5. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java
  6. +1
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java
  7. +17
    -11
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  9. +12
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java
  10. +9
    -3
      mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java
  11. +7
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  12. +2
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  13. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxShopUsersInfo.java
  14. +10
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java
  15. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java
  16. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxContractCustomersMapper.java
  17. +0
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java
  18. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxShopUsersMapper.java
  19. +9
    -0
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  20. +7
    -4
      mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java
  21. +96
    -18
      mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java
  22. +24
    -12
      mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java
  23. +17
    -12
      mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java
  24. +244
    -60
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  25. +168
    -14
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  26. +90
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java
  27. +49
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  28. +26
    -5
      mallinkService/src/main/resources/mapper/WxAllBillMapper.xml
  29. +6
    -0
      mallinkService/src/main/resources/mapper/WxContractCustomersMapper.xml
  30. +6
    -17
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
  31. +17
    -2
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml
  32. +6
    -1
      mallinkService/src/main/resources/mapper/WxShopUsersInfoMapper.xml
  33. +5
    -1
      mallinkService/src/main/resources/mapper/WxShopUsersMapper.xml

+ 9
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java View File

@@ -15,6 +15,7 @@ import com.iformall.domain.po.WxShopUsersPerson;
import com.iformall.domain.po.WxShopUsers;
import com.iformall.domain.po.WxUserDataRule;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.BaseEntity.SortField;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumCUserBaseInfoSex;
import com.iformall.enums.EnumRentShopType;
@@ -25,6 +26,8 @@ import com.iformall.enums.EnumShopUsersStatus;
import com.iformall.enums.EnumShopUsersType;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxShopService;
import com.lowagie.text.pdf.BaseField;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -124,7 +127,12 @@ public class WxShopController extends BaseController {
wxShop = new WxShop();
}
wxShop.updateTenantInfo(getTenantInfo());
wxShop.setSortColumn("shop_number asc");
if (null != wxShop.getSortWay() && 1 == wxShop.getSortWay()) {
wxShop.setSortColumns(SortField.CreateDate_DESC);
}else {
wxShop.setSortColumn("shop_number asc");
}
//wxShop.setSortColumns(BaseEntity.SortField.CreateDate_DESC,BaseEntity.SortField.Id_DESC);
setDataRule(wxShop);
//查询自持的商业店铺


+ 12
- 0
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java View File

@@ -2,6 +2,7 @@ package com.iformall.controller.contract;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.UserDataRuleAnnotation;
@@ -138,6 +139,16 @@ public class WxPropertyContractController extends WxContractBaseController {
if (null == wxPropertyContract.getAdjustPeriod()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "adjustPeriod不能为空");
}
List<Long> shopIds = wxPropertyContract.shopIdsByShop();
if (null == shopIds || shopIds.size() <= 0 ) {
return new ResultData(Result.ERROR,"请选择店铺");
}
String shopIdStr = "";
for (int i = 0; i < shopIds.size(); i++) {
Long shopId = shopIds.get(i);
shopIdStr = shopIdStr +","+ shopId;
}
wxPropertyContract.setShopIdStr(shopIdStr);
}else {
WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId());
if (null == rentContract) {
@@ -159,6 +170,7 @@ public class WxPropertyContractController extends WxContractBaseController {
wxPropertyContract.setSignDate(rentContract.getSignDate());
wxPropertyContract.setRentInfo(rentContract.getRentInfo());
wxPropertyContract.setCustomersId(rentContract.getCustomersId());
wxPropertyContract.setShopIdStr(rentContract.getShopIdStr());
}
wxPropertyContract.setRentStartType(EnumRentStartType.RENTTIME.getCode());
return wxPropertyContractService.save(wxPropertyContract, user, user.getName(),false);


+ 3
- 2
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java View File

@@ -174,6 +174,9 @@ public class WxRentContractController extends WxContractBaseController {
if (null != wxRentContract.getDecimalSize() && wxRentContract.getDecimalSize() <= 0 ) {
wxRentContract.setDecimalSize(Constant.default_short_decimal_size);
}
WxRentContract contract = wxRentContractService.selectById(wxRentContract.getId());
wxRentContract.setRentArea(contract.getRentArea());
MallUserInfo user = getUser();
wxRentContract.updateTenantInfo(user);
wxRentContract.setAdjustPeriodHandle();
@@ -191,8 +194,6 @@ public class WxRentContractController extends WxContractBaseController {
return new ResultData(Result.ERROR,"请填写月平均天数");
}
WxRentContract contract = wxRentContractService.selectById(wxRentContract.getId());
wxRentContract.setRentArea(contract.getRentArea());
return wxRentContractService.update(wxRentContract, user,user.getName(),EnumFromType.OTHER.getCode(),oldDate,false,true);
}


+ 0
- 46
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java View File

@@ -83,52 +83,6 @@ public class WxRentPropertyContractController extends WxContractBaseController {
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();
// }
// }
wrc.setFloorName(floorName);
wrc.setBuildingName(buildingName);
wrc.setShopNumber(shopNumber);


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java View File

@@ -263,7 +263,7 @@ public class WxFinanceController extends BaseController {
@ApiOperation("增加临时费用")
@PostMapping("createTempFees")
public ResultData saveAdvance(@RequestBody WxAllBill record) {
public ResultData createTempFees(@RequestBody WxAllBill record) {
record.updateTenantInfo(getTenantInfo());
if (StringUtils.isBlank(record.getReceivePay())) {
return new ResultData(Result.ERROR,"请填写金额");


+ 1
- 2
mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java View File

@@ -124,8 +124,7 @@ public class WxMsgController extends BaseController {
// if(null == wxTemplateMsg.getOnOff()){
// wxTemplateMsg.setOnOff(1);
// }
wxTemplateMsgService.tempUpdStatus(wxTemplateMsg);
return new ResultData();
return wxTemplateMsgService.tempUpdStatus(wxTemplateMsg);
}

@ApiOperation("推送模板")


+ 17
- 11
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java View File

@@ -727,12 +727,16 @@ public class WxAllBillController extends BillBaseController {
be.setEnergyFeesName(fees.getName());
}
}
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(be.getShopId());
if (null != su) {
be.setCusName(su.getName());
}
if (StringUtils.isBlank(be.getCusName())) {
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(be.getShopId());
if (null != su) {
be.setCusName(su.getName());
}
}
}
}
}
return new ResultData(list);
@@ -793,11 +797,13 @@ public class WxAllBillController extends BillBaseController {
be.setEnergyFeesName(fees.getName());
}
}
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(be.getShopId());
if (null != su) {
be.setCusName(su.getName());
}
if (StringUtils.isBlank(be.getCusName())) {
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(be.getShopId());
if (null != su) {
be.setCusName(su.getName());
}
}
}
}
}
@@ -837,7 +843,7 @@ public class WxAllBillController extends BillBaseController {
record.setEnergyFeesIds(feesIdList);;
}
record.setIsPreview(EnumYesOrNo.NO.getCode());
record.setSortColumns("starttime asc , merchant_id desc");
record.setSortColumns("starttime asc , shop_id desc");
//未收明细表根据收款日查询
if (record.getNeedPayNoDays() == EnumYesOrNo.YES.getCode() && null != record.getReceiveDateEnd()) {


+ 1
- 1
mallinkService/src/main/java/com/iformall/common/ErrorCode.java View File

@@ -413,7 +413,7 @@ public enum ErrorCode{
TEMPLATE_DATA_ERROR(12092, "数据格式错误"),
TEMPLATE_ADD_ERROR(12093, "添加模板错误"),
TEMPLATE_IS_CREATE(12094, "模板已同步"),
TEMPLATE_NOT_CREATE(12095, "模板同步"),
TEMPLATE_NOT_CREATE(12095, "模板同步"),

/**
*


+ 12
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java View File

@@ -118,10 +118,13 @@ public class WxAllBill extends TenantEntity {
if (StringUtils.isBlank(pay)) {
pay = "0";
}
if (StringUtils.isBlank(returnPay)) {
returnPay = "0";
}
if (StringUtils.isBlank(useMoney)) {
useMoney = "0";
}
return new BigDecimal(pay).subtract(new BigDecimal(useMoney)).toPlainString();
return new BigDecimal(pay).subtract(new BigDecimal(returnPay)).subtract(new BigDecimal(useMoney)).toPlainString();
}

@Excel(name = "周期开始时间", format = "yyyy-MM-dd", width = 20, orderNum = "4")
@@ -281,6 +284,12 @@ public class WxAllBill extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="主物账单ID(针对合同里面的自定义科目账单)",name="parentBillId")
public Long parentBillId;
@io.swagger.annotations.ApiModelProperty(value="虚拟组合ID(针对店铺拆分用)",name="virtualComposeId")
public Long virtualComposeId;
@io.swagger.annotations.ApiModelProperty(value="父虚拟组合ID(针对店铺拆分,自定义科目账单用)",name="parentVirtualComposeId")
public Long parentVirtualComposeId;
@io.swagger.annotations.ApiModelProperty(value = "能源抄表计算ID", name = "energyReadingCalcuteId")
private Long energyReadingCalcuteId;
@@ -425,4 +434,6 @@ public class WxAllBill extends TenantEntity {
private List<Long> shopIdList;
@TableField(exist = false)
private List<Long> cusNameShopIdList;
@TableField(exist = false)
private String queryShopIdStr;
}

+ 9
- 3
mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java View File

@@ -254,6 +254,9 @@ public class WxPropertyContract extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "首期账单收款截止日期", name = "firstBillReceiveDate")
private Date firstBillReceiveDate;
@io.swagger.annotations.ApiModelProperty(value = "店铺编号串", name = "shopIdStr")
private String shopIdStr;
//查询过期提醒
@TableField(exist = false)
private Integer outDateNofity;
@@ -341,13 +344,16 @@ public class WxPropertyContract extends TenantEntity {
return null;
}
@TableField(exist = false)
private List<Long> merchantIds;
@TableField(exist = false)
List<WxEnergyFees> feeStandards;
@TableField(exist = false)
private Long queryShopId;
@TableField(exist = false)
private String merchantName;
@TableField(exist = false)
private String queryShopIdStr;
@TableField(exist = false)
private List<Long> customersIdList;

}

+ 7
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java View File

@@ -484,7 +484,7 @@ public class WxRentContract extends TenantEntity {
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
Long shopId = rentInfoObject.getLong("id");
String rentArea = rentInfoObject.getString("rentArea");
String rentArea = rentInfoObject.getString("operationArea");
if (StringUtils.isBlank(rentArea)) {
shopAreaMap.put(shopId, new BigDecimal("0"));
}else {
@@ -568,5 +568,11 @@ public class WxRentContract extends TenantEntity {
private Date salesStartTime;
@TableField(exist = false)
private Date salesEndTime;
@TableField(exist = false)
private String merchantName;
@TableField(exist = false)
private String queryShopIdStr;
@TableField(exist = false)
private List<Long> customersIdList;
}


+ 2
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxShop.java View File

@@ -238,5 +238,6 @@ public class WxShop extends TenantEntity {
private String shopUserTypeName;
@TableField(exist = false)
private String shopUserName;
@TableField(exist = false)
private Integer sortWay;
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxShopUsersInfo.java View File

@@ -73,6 +73,9 @@ public class WxShopUsersInfo extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
@io.swagger.annotations.ApiModelProperty(value = "创建的合同客户编号", name = "createContractCustomerId")
private Long createContractCustomerId;
@TableField(exist = false)
private String phoneEqual;
@TableField(exist = false)


+ 10
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java View File

@@ -1,5 +1,6 @@
package com.iformall.domain.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -21,6 +22,8 @@ public class WxRentPropertyContractVo extends TenantEntity {
private Long rentId;
private Long propertyId;
private Long customersId;
private String floorName;
private String buildingName;
@@ -104,5 +107,12 @@ public class WxRentPropertyContractVo extends TenantEntity {
private String queryShopNumber;
@TableField(exist = false)
private String merchantName;
@TableField(exist = false)
private String queryShopIdStr;
@TableField(exist = false)
private List<Long> customersIdList;
}


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java View File

@@ -48,5 +48,7 @@ public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> {
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);
void deleteEnergyReadingBills(@Param("energyReadingCalcuteId")Long energyReadingCalcuteId,@Param("tenantId")String tenantId);
void updateContractCusName(WxAllBill wxBillRent);

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxContractCustomersMapper.java View File

@@ -12,5 +12,7 @@ public interface WxContractCustomersMapper extends CommonMapper<WxContractCustom

List<WxContractCustomers> findList(WxContractCustomers wxShop);
List<Long> findIdList(WxContractCustomers wxShop);
WxContractCustomers selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
}

+ 0
- 2
mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java View File

@@ -30,8 +30,6 @@ public interface WxPropertyContractMapper extends CommonMapper<WxPropertyContrac

int updateRentContractEndStatus(WxPropertyContract wxRentContract);

void updateRentWaitSignStatus(WxPropertyContract wxRentContract);

//void updateRentInvalidStatus(WxPropertyContract wxRentContract);

//List<WxRentContract> getRentContractListByShop(Map<String, Object> params);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxShopUsersMapper.java View File

@@ -11,4 +11,6 @@ public interface WxShopUsersMapper extends CommonMapper<WxShopUsers, String> {

List<WxShopUsers> findList(WxShopUsers wxShop);
List<Long> findShopIdList(WxShopUsers wxShop);
void updateShopOld(WxShopUsers wxShop);
}

+ 9
- 0
mallinkService/src/main/java/com/iformall/service/WxShopService.java View File

@@ -129,10 +129,14 @@ public interface WxShopService {
WxShopUsers getOneShopUsers(WxShopUsers wxShopUsersShop);
List<WxShopUsers> getShopUsersList(WxShopUsers wxShopUsers);
void saveOrUpdateShopUsers(WxShopUsers wxShopUsers);
void changeShopUsers(WxShopUsers wxShopUsers);
void updateRentShopUsersOld(TenantEntity tenantEntity,Long shopId);
void deleteShopUsers(WxShopUsers wxShopUsers);
PageInfo<WxShopUsers> shopUsersListAsPage(WxShopUsers record,Integer pageIndex,Integer pageSize);
@@ -141,11 +145,16 @@ public interface WxShopService {
PageInfo<WxShopUsersInfo> shopUsersInfoListAsPage(WxShopUsersInfo record,Integer pageIndex,Integer pageSize);
void saveOrUpdateShopUsersInfo(WxShopUsersInfo wxShopUsersInfo);
void saveOrUpdateShopUsersPerson(WxShopUsersPerson wxShopUsers);
void deleteShopUsersPerson(WxShopUsersPerson wxShopUsers);
List<WxShopUsersInfo> getUserInfoList(WxShopUsersInfo wxShopUsersInfo);
List<Long> getUserInfoIds(WxShopUsersInfo wxShopUsersInfo);
List<Long> getUserShopIds(WxShopUsers wxShopUsers);
Map<Long,WxShopUsers> getShopUserMap(WxShopUsers wxShopUsers);


+ 7
- 4
mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java View File

@@ -61,10 +61,13 @@ public class WxRentContractAgileHelper {
EnumRentContractAgilTimeUnit timeUnit,int time,int payPeriod){
List<BillTimeVo> list = new ArrayList<>();
int count = 0;
List<Date> yearsBeginList = new ArrayList<Date>();
yearsBeginList.addAll(yearList);
if (yearsBeginList.size() > 0) {
yearsBeginList.remove(0);
List<Date> yearsBeginList = null;
if (null != yearList) {
yearsBeginList = new ArrayList<Date>();
yearsBeginList.addAll(yearList);
if (yearsBeginList.size() > 0) {
yearsBeginList.remove(0);
}
}
BillTimeVo receiveDate = null;
while (true) {


+ 96
- 18
mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java View File

@@ -14,6 +14,7 @@ import com.iformall.domain.po.WxContractCustomers;
import com.iformall.domain.po.WxContractShop;
import com.iformall.domain.po.WxEnergyFees;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxPropertyContract;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.po.WxRentContractAgileDeposit;
import com.iformall.domain.po.WxRentContractAgileDepositShop;
@@ -59,6 +60,7 @@ import com.iformall.service.WxMerchantService;
import com.iformall.service.WxShopService;
import com.iformall.service.helper.WxRentContractAgileHelper;
import com.iformall.service.helper.WxRentContractHelper;
import com.iformall.utils.Constant;
import com.iformall.utils.DateUtils;

import org.apache.commons.lang3.StringUtils;
@@ -125,8 +127,25 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
@Override
public PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) {
if (StringUtils.isNoneBlank(rentContract.getFloorForRule())) {
List<Long> contractIds = this.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, null, 0);
if (StringUtils.isNotBlank(rentContract.getFloorForRule()) || StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) {
List<Long> shopIdList = null;
if (StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) {
String[] qsids = rentContract.getQueryShopIdStr().split(",");
if (null != qsids && qsids.length > 0 ) {
shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < qsids.length ; i ++) {
String qsid = qsids[i];
if (StringUtils.isNotBlank(qsid)) {
shopIdList.add(Long.parseLong(qsid));
}
}
if (shopIdList.size() <= 0 ) {
shopIdList = null;
}
}
}
List<Long> contractIds = this.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, shopIdList, 0);
//List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null);
if (null == contractIds || contractIds.size() <= 0 ) {
rentContract.setId(-1L);
@@ -134,10 +153,63 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
rentContract.setIds(contractIds);
}
}
//根据客户名称查询
if (StringUtils.isNotBlank(rentContract.getMerchantName())) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(rentContract);
ccq.setName(rentContract.getMerchantName());
List<Long> customersIdList = wxContractCustomersMapper.findIdList(ccq);
if (null != customersIdList && customersIdList.size() > 0 ) {
rentContract.setCustomersIdList(customersIdList);
}else {
rentContract.setId(-1L);
}
}
PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract));
if (null != pageInfo && null != pageInfo.getList() && pageInfo.getList().size() > 0 ) {
List<Long> customersIdList = new ArrayList<Long>();
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){
WxRentContract contract = pageInfo.getList().get(i);
if (null != contract.getCustomersId()) {
customersIdList.add(contract.getCustomersId());
}
}
Map<Long,WxContractCustomers> customersMap = getContractCustomersMap(rentContract,customersIdList);
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ) {
WxRentContract contract = pageInfo.getList().get(i);
String merchantName = "";
if (null != customersMap && null != contract.getCustomersId()) {
WxContractCustomers cc = customersMap.get(contract.getCustomersId());
if (null != cc) {
merchantName = merchantName + cc.getName();
}
}
contract.setMerchantName(merchantName);
}
}
return pageInfo;
}
private Map<Long,WxContractCustomers> getContractCustomersMap(TenantEntity tenantEntity,List<Long> customerIds) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(tenantEntity);
ccq.setIds(customerIds);
List<WxContractCustomers> cclist = wxContractCustomersMapper.findList(ccq);
if (null != cclist && cclist.size() > 0 ){
Map<Long,WxContractCustomers> map = new HashMap<Long,WxContractCustomers>();
for (int i = 0 ; i < cclist.size() ; i ++ ) {
WxContractCustomers cc = cclist.get(i);
if (null != cc) {
map.put(cc.getId(),cc);
}
}
return map;
}
return null;
}
@Override
public WxRentContract selectById(Long id) {
@@ -480,11 +552,13 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
for (int j = 0 ; j < shopIdList.size(); j++ ) {
Long sid = shopIdList.get(j);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxShopUsers su = shopUserMap.get(sid);
String cusName = "";
if (null != su) {
cusName = su.getName();
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String cusName = null;
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(sid);
if (null != su) {
cusName = su.getName();
}
}
WxAllBill wxBillDeposit = new WxAllBill();
@@ -496,7 +570,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode());
wxBillDeposit.setPriceDetail(fees.getName());
wxBillDeposit.setPay("0");
wxBillDeposit.setReceivePay(new BigDecimal(deposit.getPrice()).multiply(shoprate).toPlainString());
wxBillDeposit.setReceivePay(new BigDecimal(deposit.getPrice()).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
wxBillDeposit.setNeedPay(wxBillDeposit.getReceivePay());
wxBillDeposit.setStarttime(wxRentContract.getRentalStartDate());
wxBillDeposit.setEndtime(wxRentContract.getRentalEndDate());
@@ -606,22 +680,26 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
for (int i = 0 ; i < shopIdList.size(); i++) {
Long sid= shopIdList.get(i);
BigDecimal shoprentArea = shopAreaMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(contract.getRentArea()),contract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxShopUsers su = shopUserMap.get(sid);
String cusName = "";
if (null != su) {
cusName = su.getName();
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(contract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String cusName = null;
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(sid);
if (null != su) {
cusName = su.getName();
}
}
String money = new BigDecimal(needpay).multiply(shoprate).toPlainString();
String money = new BigDecimal(needpay).multiply(shoprate).setScale(contract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString();
WxAllBill bill = buildUnDepositBill(unDeposit,idWorker,contract.getId(),fees,sid,cusName,start,end,receiveDate,money,shoprentArea.toPlainString(),user);
billList.add(bill);
}
}else {
Long sid= item.getShopId();
WxShopUsers su = shopUserMap.get(sid);
String cusName = "";
if (null != su) {
cusName = su.getName();
String cusName = null;
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(sid);
if (null != su) {
cusName = su.getName();
}
}
WxAllBill bill = buildUnDepositBill(unDeposit,idWorker,contract.getId(),fees,sid,cusName,start,end,receiveDate,needpay,item.getRentArea(),user);
billList.add(bill);


+ 24
- 12
mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java View File

@@ -129,18 +129,30 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill
wxBillRent.setId(-1L);
}
}
//List<Long> _sids = (List<Long>) CollectionUtils.intersection(shopIds, wxBillRent.getShopIdList());
// if (StringUtils.isNotBlank(wxBillRent.getCusName())) {
// WxShopUsers suq = new WxShopUsers();
// suq.updateTenantInfo(wxBillRent);
// suq.setName(wxBillRent.getCusName());
// List<Long> shopIds = wxShopService.getUserShopIds(suq);
// if (null != shopIds && shopIds.size() > 0 ) {
// wxBillRent.setCusNameShopIdList(shopIds);;
// }else {
// wxBillRent.setId(-1L);
// }
// }
if (StringUtils.isNotBlank(wxBillRent.getQueryShopIdStr())) {
String[] qsids = wxBillRent.getQueryShopIdStr().split(",");
if (null != qsids && qsids.length > 0 ) {
List<Long> shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < qsids.length ; i ++) {
String qsid = qsids[i];
if (StringUtils.isNotBlank(qsid)) {
shopIdList.add(Long.parseLong(qsid));
}
}
if (null != shopIdList && shopIdList.size() > 0 ) {
if (null != wxBillRent.getShopIdList()) {
List<Long> _sids = (List<Long>) CollectionUtils.intersection(shopIdList, wxBillRent.getShopIdList());
if (null != _sids && _sids.size() > 0 ) {
wxBillRent.setShopIdList(_sids);
}else {
wxBillRent.setId(-1L);
}
}else {
wxBillRent.setShopIdList(shopIdList);
}
}
}
}
}
@Override


+ 17
- 12
mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java View File

@@ -362,13 +362,13 @@ public class WxFinanceServiceImpl implements WxFinanceService {
if (null == shopId) {
shopId = be.getShopId();
}
if (shopId != be.getShopId()) {
if (shopId.longValue() != be.getShopId().longValue()) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"多个房源合并收款不能冲抵");
}
}
WxAllBill abq = new WxAllBill();
abq.updateTenantInfo(dto);
abq.setFeesStandarsId(dto.getFeesId());
abq.setEnergyFeesId(dto.getFeesId());
abq.setBillType(EnumBillAllType.ADVANCE.getCode());
abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode());
abq.setSortColumns(SortField.Createtime_ASC);
@@ -1003,7 +1003,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
if (!shopIdList.contains(be.getShopId())) {
shopIdList.add(be.getShopId());
shopnumberSb.append(be.getShopNumber()).append(",");
shopnumberSb.append(be.getShopId()).append(",");
billCusSb.append(be.getCusName()).append(",");
}
}
@@ -1082,7 +1082,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
if (!shopIdList.contains(be.getShopId())) {
shopIdList.add(be.getShopId());
shopnumberSb.append(be.getShopNumber()).append(",");
shopnumberSb.append(be.getShopId()).append(",");
billCusSb.append(be.getCusName()).append(",");
}
}
@@ -1223,13 +1223,17 @@ public class WxFinanceServiceImpl implements WxFinanceService {
WxAllBill advanceBill = new WxAllBill();
advanceBill.updateTenantInfo(record);
advanceBill.setShopId(wxShop.getId());
WxShopUsers su = new WxShopUsers();
su.updateTenantInfo(record);
su.setShopId(wxShop.getId());
su.setStatus(EnumShopUsersStatus.LIVE.getCode());
WxShopUsers wsu = wxShopService.getOneShopUsers(su);
if (null != wsu) {
advanceBill.setCusName(wsu.getName());
if (StringUtils.isNotBlank(record.getCusName())) {
advanceBill.setCusName(record.getCusName());
}else {
WxShopUsers su = new WxShopUsers();
su.updateTenantInfo(record);
su.setShopId(wxShop.getId());
su.setStatus(EnumShopUsersStatus.LIVE.getCode());
WxShopUsers wsu = wxShopService.getOneShopUsers(su);
if (null != wsu) {
advanceBill.setCusName(wsu.getName());
}
}
advanceBill.setNeedPay(record.getReceivePay());
advanceBill.setReceivePay(receivePay);
@@ -1237,7 +1241,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
advanceBill.setUseMoney("0");
advanceBill.setBillType(billType.getCode());
//advanceBill.setPayWay();
advanceBill.setPayDate(new Date());
//advanceBill.setPayDate(new Date());
advanceBill.setStarttime(starttime);
advanceBill.setEndtime(endtime);
advanceBill.setReceiveDate(starttime);
@@ -1247,6 +1251,7 @@ public class WxFinanceServiceImpl implements WxFinanceService {
advanceBill.setIsPreview(EnumYesOrNo.NO.getCode());
advanceBill.setBillRemark(record.getBillRemark());
advanceBill.setCanEdit(EnumYesOrNo.YES.getCode());
advanceBill.setRentArea(wxShop.getRentArea());
wxBillAllHelper.saveOrUpdateBill(advanceBill, user);
}


+ 244
- 60
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java View File

@@ -85,6 +85,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
@Lazy
@Autowired
WxRentContractService wxRentContractService;
@Lazy
@Autowired
WxAgileContractService wxAgileContractService;

@Lazy
@Autowired
@@ -107,18 +111,91 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService

@Override
public PageInfo<WxPropertyContract> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) {
if (StringUtils.isNotBlank(record.getFloorForRule())) {
List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule() , null, null,record.getShopTypeForRule(), 0, 0,null);
if (null == mids || mids.size() <= 0 ) {
record.setId(-1L);
if (StringUtils.isNotBlank(record.getFloorForRule()) || StringUtils.isNotBlank(record.getQueryShopIdStr())) {
List<Long> shopIdList = null;
if (StringUtils.isNotBlank(record.getQueryShopIdStr())) {
String[] qsids = record.getQueryShopIdStr().split(",");
if (null != qsids && qsids.length > 0 ) {
shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < qsids.length ; i ++) {
String qsid = qsids[i];
if (StringUtils.isNotBlank(qsid)) {
shopIdList.add(Long.parseLong(qsid));
}
}
if (shopIdList.size() <= 0 ) {
shopIdList = null;
}
}
}
List<Long> contractIds = wxAgileContractService.findBuildingFloorContractIds(record, record.getFloorForRule(), null, null, shopIdList, 0);
//List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule() , null, null,record.getShopTypeForRule(), 0, 0,null);
if (null == contractIds || contractIds.size() <= 0 ) {
record.setId(-1L);
} else {
record.setMerchantIds(mids);
record.setIds(contractIds);
}
}
//根据客户名称查询
if (StringUtils.isNotBlank(record.getMerchantName())) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(record);
ccq.setName(record.getMerchantName());
List<Long> customersIdList = wxContractCustomersMapper.findIdList(ccq);
if (null != customersIdList && customersIdList.size() > 0 ) {
record.setCustomersIdList(customersIdList);
}else {
record.setId(-1L);
}
}
PageInfo<WxPropertyContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPropertyContractMapper.findList(record));
if (null != pageInfo && null != pageInfo.getList() && pageInfo.getList().size() > 0 ) {
List<Long> customersIdList = new ArrayList<Long>();
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){
WxPropertyContract contract = pageInfo.getList().get(i);
if (null != contract.getCustomersId()) {
customersIdList.add(contract.getCustomersId());
}
}
Map<Long,WxContractCustomers> customersMap = getContractCustomersMap(record,customersIdList);
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ) {
WxPropertyContract contract = pageInfo.getList().get(i);
String merchantName = "";
if (null != customersMap && null != contract.getCustomersId()) {
WxContractCustomers cc = customersMap.get(contract.getCustomersId());
if (null != cc) {
merchantName = merchantName + cc.getName();
}
}
contract.setMerchantName(merchantName);
}
}
return pageInfo;
}
private Map<Long,WxContractCustomers> getContractCustomersMap(TenantEntity tenantEntity,List<Long> customerIds) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(tenantEntity);
ccq.setIds(customerIds);
List<WxContractCustomers> cclist = wxContractCustomersMapper.findList(ccq);
if (null != cclist && cclist.size() > 0 ){
Map<Long,WxContractCustomers> map = new HashMap<Long,WxContractCustomers>();
for (int i = 0 ; i < cclist.size() ; i ++ ) {
WxContractCustomers cc = cclist.get(i);
if (null != cc) {
map.put(cc.getId(),cc);
}
}
return map;
}
return null;
}
@Override
public List<WxPropertyContract> findList(WxPropertyContract record) {
return wxPropertyContractMapper.findList(record);
@@ -244,27 +321,26 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
//查询主账单列表,排除其他标砖费用,包括一次性费用,非一次性费用
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setPropertyContractId(id);
wxBillRent.setSortColumns("starttime asc");
wxBillRent.updateTenantInfo(tenantEntity);
//物业主账单
wxBillRent.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId());
List<WxAllBill> retList = wxAllBillMapper.findList(wxBillRent);
List<WxAllBill> retList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent);
//获取非一次性的,
wxBillRent.setEnergyFeesId(null);
wxBillRent.setBillType(EnumBillAllType.PROPERTY.getCode());
wxBillRent.setHasParentBillId(EnumYesOrNo.YES.getCode());
List<WxAllBill> unFixedList = wxAllBillMapper.findList(wxBillRent);
List<WxAllBill> unFixedList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent);
Map<Long,List<WxAllBill>> childMap = null;
if (null != unFixedList && unFixedList.size() > 0 ) {
childMap = new HashMap<Long,List<WxAllBill>>();
for (int i = 0 ; i < unFixedList.size(); i++) {
WxAllBill ub = unFixedList.get(i);
if (null != ub) {
List<WxAllBill> childList = childMap.get(ub.getParentBillId());
List<WxAllBill> childList = childMap.get(ub.getParentVirtualComposeId());
if (null == childList) {
childList = new ArrayList<WxAllBill>();
childMap.put(ub.getParentBillId(), childList);
childMap.put(ub.getParentVirtualComposeId(), childList);
}
ub.setFeesStandarsId(ub.getEnergyFeesId());
childList.add(ub);
@@ -274,7 +350,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
if (null != childMap ) {
for (int i = 0 ; i < retList.size(); i ++) {
WxAllBill ub = retList.get(i);
List<WxAllBill> childList = childMap.get(ub.getId());
List<WxAllBill> childList = childMap.get(ub.getVirtualComposeId());
ub.setChildList(childList);
}
}
@@ -542,6 +618,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
}

@Override
@Transactional(rollbackFor = {Exception.class})
public ResultData updatePropertyContractStatus(Long id) {
if (id == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
@@ -556,6 +633,19 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxPropertyContract.setStatus(EnumRentContractStatus.READY_FOR_PAING.getCode());
}
wxPropertyContractMapper.updateById(wxPropertyContract);
//合同客户状态变更
WxContractCustomers customers = wxContractCustomersMapper.selectById(record.getCustomersId(), record.getTenantId());
customers.setStatus(EnumContractCustomersStatus.FORMUL.getCode());
customers.setUpdateDate(new Date());
wxContractCustomersMapper.updateById(customers);
//把customers写入到wxShopUser
String cusName = castCustomersToShopUsers(customers,record.shopIdsByShop());
//如果合同的账单cusName为空的话,则设置为customers name
handleContractBillCusName(record,cusName);
//建立账单
if (record.getReceivePeriod() != null && new BigDecimal(record.getPrice()).compareTo(new BigDecimal(0)) > 0) {
//预览账单改为正式,并写入商户id
@@ -563,6 +653,69 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
}
return new ResultData(Result.SUCCESS, "操作成功");
}
public String castCustomersToShopUsers(WxContractCustomers customers,List<Long> shopIdList) {
WxShopUsersInfo suiq = new WxShopUsersInfo();
suiq.updateTenantInfo(customers);
suiq.setPrincipalType(customers.getPrincipalType());
suiq.setName(customers.getName());
suiq.setPhone(customers.getPhone());
List<WxShopUsersInfo> ids = wxShopService.getUserInfoList(suiq);
Long infoId = null;
String cusName = null;
if (null == ids || ids.size() <= 0 ) {
WxShopUsersInfo sui = new WxShopUsersInfo();
sui.updateTenantInfo(customers);
sui.setPrincipalType(customers.getPrincipalType());
sui.setName(customers.getName());
sui.setPhone(customers.getPhone());
sui.setLegalPerson(customers.getLegalPerson());
sui.setIdNumber(customers.getIdNumber());
sui.setSex(customers.getSex());
sui.setLinkPerson(customers.getLinkPerson());
sui.setCreateContractCustomerId(customers.getId());
wxShopService.saveOrUpdateShopUsersInfo(sui);
infoId = sui.getId();
cusName = customers.getName();
}else {
infoId = ids.get(0).getId();
cusName = ids.get(0).getName();
}
for (int i = 0 ; i < shopIdList.size(); i++) {
Long shopId = shopIdList.get(i);
//查询这个infoId是不是当前的租户
WxShopUsers suq = new WxShopUsers();
suq.updateTenantInfo(customers);
suq.setShopId(shopId);
suq.setInfoId(infoId);
suq.setStatus(EnumShopUsersStatus.LIVE.getCode());
List<WxShopUsers> ulist = wxShopService.getShopUsersList(suq);
if (null != ulist && ulist.size() > 0 ) {
//WxShopUsers su = ulist.get(0);
}else {
//先把当前的租户变更掉
wxShopService.updateRentShopUsersOld(customers,shopId);
//新增租户
WxShopUsers su = new WxShopUsers();
su.updateTenantInfo(customers);
su.setShopId(shopId);
su.setInfoId(infoId);
su.setType(EnumShopUsersType.RENTER.getCode());
su.setStatus(EnumShopUsersStatus.LIVE.getCode());
wxShopService.saveOrUpdateShopUsers(su);
}
}
return cusName;
}
public void handleContractBillCusName(WxPropertyContract record,String cusName) {
WxAllBill bill = new WxAllBill();
bill.updateTenantInfo(record);
bill.setCusName(cusName);
bill.setPropertyContractId(record.getId());
wxAllBillMapper.updateContractCusName(bill);
}

@Override
public void updatePropertyPreviewBill(WxPropertyContract record) {
@@ -600,11 +753,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
for (int i = 0 ; i < shopIds.size(); i++) {
Long shopId = shopIds.get(i);
BigDecimal shoprentArea = shopAreaRateMap.get(shopId);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxPropertyContract.getRentArea()),wxPropertyContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxShopUsers su = shopUserMap.get(shopId);
String cusName = "";
if (null != su) {
cusName = su.getName();
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxPropertyContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String cusName = null;
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(shopId);
if (null != su) {
cusName = su.getName();
}
}
WxAllBill wxBillDeposit = new WxAllBill();
@@ -613,7 +768,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxBillDeposit.setPropertyContractId(wxPropertyContract.getId());
wxBillDeposit.setPay("0");
String needpay = wxPropertyContract.getDeposit();
wxBillDeposit.setNeedPay(new BigDecimal(needpay).multiply(shoprate).toPlainString());
wxBillDeposit.setNeedPay(new BigDecimal(needpay).multiply(shoprate).setScale(wxPropertyContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
wxBillDeposit.setReceivePay(wxBillDeposit.getNeedPay());
wxBillDeposit.setIsPreview(EnumYesOrNo.NO.getCode());
wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode());
@@ -748,7 +903,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Map<String,Object> resultMap = new HashedMap();
List<WxAllBill> propertyResultList = new ArrayList<WxAllBill>();
List<WxAllBill> allResultList = new ArrayList<WxAllBill>();
List<WxAllBill> fixedResultList = new ArrayList<WxAllBill>();

Date endDate = null;
if(yearList.size() > 1){
@@ -872,72 +1027,74 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
//设置科目
property.setEnergyFeesId(svo.getFeeStandards().getId());
property.setFeesStandarsId(property.getEnergyFeesId());//合同动态表格需要。
allResultList.add(property);
childList.add(property);
}
}
wxBillProperty.setChildList(childList);
//主账单列表
propertyResultList.add(wxBillProperty);
if (new BigDecimal(wxBillProperty.getReceivePay()).compareTo(new BigDecimal(0)) > 0 ) {
allResultList.add(wxBillProperty);
}
}
if (null != fixedList && fixedList.size() > 0 ) {
for (int i = 0 ; i < fixedList.size(); i ++ ) {
WxBillFeesStandardsListVo svo = fixedList.get(i);
WxAllBill property = generateBillPropertyByBillStandards(null,wxPayAccountBill,wxPropertyContract,isPreview,user,svo,billcount,shopInfo);
allResultList.add(property);
fixedResultList.add(property);
}
}
}
//批量生成预账单
if(saveDb && allResultList.size() > 0 ) {
if(saveDb) {
WxShopUsers suq = new WxShopUsers();
suq.updateTenantInfo(wxPropertyContract);
suq.setShopIds(shopIdList);
suq.setStatus(EnumShopUsersStatus.LIVE.getCode());
Map<Long,WxShopUsers> shopUserMap = wxShopService.getShopUserMap(suq);
final IdWorker idWorker = IdWorker.get();
//根据店铺来拆分
List<WxAllBill> shopAllBillList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < allResultList.size(); i++ ) {
WxAllBill rb = allResultList.get(i);
for (int g = 0 ; g < shopIdList.size(); g ++ ){
WxAllBill rs = new WxAllBill();
Long sid = shopIdList.get(g);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxPropertyContract.getRentArea()),wxPropertyContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(rs, rb);
rs.setId(idWorker.nextId());
rs.setShopId(sid);
rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString());
rs.setReceivePay(rs.getNeedPay());
rs.setShopId(sid);
rs.setRentArea(shoprentArea.toPlainString());
if (null != shopUserMap ) {
WxShopUsers wsu = shopUserMap.get(sid);
if (null != wsu) {
rs.setCusName(wsu.getName());
}
};
shopAllBillList.add(rs);
} catch (IllegalAccessException e) {
logger.error("saveBill error.",e);
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败");
} catch (InvocationTargetException e) {
logger.error("saveBill error.",e);
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败");
}
}
if (propertyResultList.size() > 0 ) {
for (int i = 0 ; i < propertyResultList.size(); i++ ) {
WxAllBill rb = propertyResultList.get(i);
for (int g = 0 ; g < shopIdList.size(); g ++ ){
//主物业账单根据店铺拆分
Long sid = shopIdList.get(g);
WxAllBill rs = new WxAllBill();
setNewsBills(wxPropertyContract, rs, rb, sid, shopAreaRateMap,shopUserMap);
rs.setVirtualComposeId(rb.getId());
shopAllBillList.add(rs);
//其他周期的费用账单也需要拆分,并关联parentBillId
if (null != rb.getChildList() && rb.getChildList().size() > 0) {
for (int h = 0 ; h < rb.getChildList().size(); h++ ) {
WxAllBill ufb = rb.getChildList().get(h);
WxAllBill ufbn = new WxAllBill();
setNewsBills(wxPropertyContract, ufbn, ufb, sid, shopAreaRateMap,shopUserMap);
ufbn.setParentBillId(rs.getId());
ufbn.setParentVirtualComposeId(rb.getId());
shopAllBillList.add(ufbn);
}
}
}
}
}
//一次性费用
if (fixedResultList.size() > 0 ) {
for (int i = 0 ; i < fixedResultList.size(); i++ ) {
WxAllBill rb = fixedResultList.get(i);
for (int g = 0 ; g < shopIdList.size(); g ++ ){
Long sid = shopIdList.get(g);
WxAllBill rs = new WxAllBill();
setNewsBills(wxPropertyContract, rs, rb, sid, shopAreaRateMap,shopUserMap);
shopAllBillList.add(rs);
}
}
}
wxAllBillMapper.insertBills(wxPropertyContract.getTenantId() ,shopAllBillList);
if (shopAllBillList.size() > 0 ) {
wxAllBillMapper.insertBills(wxPropertyContract.getTenantId() ,shopAllBillList);
}
//for (int i = 0 ; i < resultList.size() ; i++) {
// wxBillPropertyMapper.insert(resultList.get(i));
//}
@@ -947,6 +1104,33 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
return resultMap;
}
private void setNewsBills(WxPropertyContract wxPropertyContract,WxAllBill newBill,WxAllBill oldBill,Long shopId,Map<Long, BigDecimal> shopAreaRateMap,Map<Long,WxShopUsers> shopUserMap) {
BigDecimal shoprentArea = shopAreaRateMap.get(shopId);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxPropertyContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
final IdWorker idWorker = IdWorker.get();
try {
BeanUtils.copyProperties(newBill, oldBill);
newBill.setId(idWorker.nextId());
newBill.setShopId(shopId);
newBill.setNeedPay(new BigDecimal(oldBill.getNeedPay()).multiply(shoprate).setScale(wxPropertyContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
newBill.setReceivePay(newBill.getNeedPay());
newBill.setRentArea(shoprentArea.toPlainString());
if (null != shopUserMap ) {
WxShopUsers wsu = shopUserMap.get(shopId);
if (null != wsu) {
newBill.setCusName(wsu.getName());
}
};
} catch (IllegalAccessException e) {
logger.error("saveBill error.",e);
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败");
} catch (InvocationTargetException e) {
logger.error("saveBill error.",e);
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败");
}
}
private WxAllBill generateBillPropertyByBillStandards(WxAllBill wxBillProperty,WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,MallUserInfo user,WxBillFeesStandardsListVo svo,
Integer billcount,Map<String, Object> shopInfo) {


+ 168
- 14
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -29,6 +29,7 @@ import com.iformall.domain.po.WxRentContractRevenueJump;
import com.iformall.domain.po.WxRentContractRevenueSales;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.po.WxShopUsers;
import com.iformall.domain.po.WxShopUsersInfo;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.BillTimeVo;
import com.iformall.domain.vo.RatioVo;
@@ -63,6 +64,7 @@ import com.iformall.enums.EnumRentDayPriceCalcute;
import com.iformall.enums.EnumRentShopType;
import com.iformall.enums.EnumRentStartType;
import com.iformall.enums.EnumShopUsersStatus;
import com.iformall.enums.EnumShopUsersType;
import com.iformall.enums.EnumTradeDailyDateType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.exception.MallinkException;
@@ -359,10 +361,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//查询预账单用于展示
WxAllBill wxBillRent = new WxAllBill();
wxBillRent.setRentContractId(id);
wxBillRent.setSortColumns("starttime asc");
wxBillRent.updateTenantInfo(wxRentContract);
wxBillRent.setBillType(EnumBillAllType.RENT.getCode());
List<WxAllBill> resultList = wxAllBillMapper.findList(wxBillRent);
List<WxAllBill> resultList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent);
result.put("previewBillRentList",resultList);
return result;
@@ -930,11 +931,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int i = 0 ; i < shopIdList.size(); i++ ) {
Long sid = shopIdList.get(i);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
WxShopUsers su = shopUserMap.get(sid);
String cusName = "";
if (null != su) {
cusName = su.getName();
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
String cusName = null;
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(sid);
if (null != su) {
cusName = su.getName();
}
}
WxAllBill wxBillDeposit = new WxAllBill();
@@ -954,7 +957,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
// count = wxRentContract.getRentArea();
// }
// String needpay = depositFee.calcuteTotalMoney(wxRentContract.getDecimalSize(), null, null, count, true, null, null);
wxBillDeposit.setReceivePay(new BigDecimal(needpay).multiply(shoprate).toPlainString());
wxBillDeposit.setReceivePay(new BigDecimal(needpay).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
wxBillDeposit.setNeedPay(wxBillDeposit.getReceivePay());
//wxBillDeposit.setOwe(needpay);
//找到计租方式
@@ -1474,15 +1477,21 @@ public class WxRentContractServiceImpl implements WxRentContractService {
WxAllBill rs = new WxAllBill();
Long sid = shopIdList.get(g);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(rs, rb);
rs.setId(idWorker.nextId());
rs.setShopId(sid);
rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString());
rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
rs.setReceivePay(rs.getNeedPay());
rs.setShopId(sid);
rs.setRentArea(shoprentArea.toPlainString());
if (StringUtils.isNotBlank(rb.getBussinessManageFeeNeedPay())) {
rs.setBussinessManageFeeNeedPay(new BigDecimal(rb.getBussinessManageFeeNeedPay()).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
}
if (StringUtils.isNotBlank(rb.getOperatingManageFeeNeedPay())) {
rs.setOperatingManageFeeNeedPay(new BigDecimal(rb.getOperatingManageFeeNeedPay()).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
}
if (null != shopUserMap ) {
WxShopUsers wsu = shopUserMap.get(sid);
if (null != wsu) {
@@ -1508,12 +1517,12 @@ public class WxRentContractServiceImpl implements WxRentContractService {
WxAllBill rs = new WxAllBill();
Long sid = shopIdList.get(g);
BigDecimal shoprentArea = shopAreaRateMap.get(sid);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP);
BigDecimal shoprate = shoprentArea.divide(new BigDecimal(wxRentContract.getRentArea()),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP);
try {
BeanUtils.copyProperties(rs, rb);
rs.setId(idWorker.nextId());
rs.setShopId(sid);
rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).toPlainString());
rs.setNeedPay(new BigDecimal(rb.getNeedPay()).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString());
rs.setReceivePay(rs.getNeedPay());
rs.setShopId(sid);
rs.setRentArea(shoprentArea.toPlainString());
@@ -1695,8 +1704,25 @@ public class WxRentContractServiceImpl implements WxRentContractService {
@Override
public PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) {
if (StringUtils.isNoneBlank(rentContract.getFloorForRule())) {
List<Long> contractIds = wxAgileContractService.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, null, 0);
if (StringUtils.isNotBlank(rentContract.getFloorForRule()) || StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) {
List<Long> shopIdList = null;
if (StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) {
String[] qsids = rentContract.getQueryShopIdStr().split(",");
if (null != qsids && qsids.length > 0 ) {
shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < qsids.length ; i ++) {
String qsid = qsids[i];
if (StringUtils.isNotBlank(qsid)) {
shopIdList.add(Long.parseLong(qsid));
}
}
if (shopIdList.size() <= 0 ) {
shopIdList = null;
}
}
}
List<Long> contractIds = wxAgileContractService.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, shopIdList, 0);
//List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null);
if (null == contractIds || contractIds.size() <= 0 ) {
rentContract.setId(-1L);
@@ -1704,10 +1730,68 @@ public class WxRentContractServiceImpl implements WxRentContractService {
rentContract.setIds(contractIds);
}
}
//根据客户名称查询
if (StringUtils.isNotBlank(rentContract.getMerchantName())) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(rentContract);
ccq.setName(rentContract.getMerchantName());
List<Long> customersIdList = wxContractCustomersMapper.findIdList(ccq);
if (null != customersIdList && customersIdList.size() > 0 ) {
rentContract.setCustomersIdList(customersIdList);
}else {
rentContract.setId(-1L);
}
}
//PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract));
PageInfo<WxRentContract> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract));
if (null != pageInfo && null != pageInfo.getList()) {
List<Long> customersIdList = new ArrayList<Long>();
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){
WxRentContract contract = pageInfo.getList().get(i);
if (null != contract.getCustomersId()) {
customersIdList.add(contract.getCustomersId());
}
}
Map<Long,WxContractCustomers> customersMap = getContractCustomersMap(rentContract,customersIdList);
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ) {
WxRentContract contract = pageInfo.getList().get(i);
String merchantName = "";
if (null != customersMap && null != contract.getCustomersId()) {
WxContractCustomers cc = customersMap.get(contract.getCustomersId());
if (null != cc) {
merchantName = merchantName + cc.getName();
}
}
contract.setMerchantName(merchantName);
}
}
return pageInfo;
}
private Map<Long,WxContractCustomers> getContractCustomersMap(TenantEntity tenantEntity,List<Long> customerIds) {
if (null == customerIds || customerIds.size() <= 0 ) {
return null;
}
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(tenantEntity);
ccq.setIds(customerIds);
List<WxContractCustomers> cclist = wxContractCustomersMapper.findList(ccq);
if (null != cclist && cclist.size() > 0 ){
Map<Long,WxContractCustomers> map = new HashMap<Long,WxContractCustomers>();
for (int i = 0 ; i < cclist.size() ; i ++ ) {
WxContractCustomers cc = cclist.get(i);
if (null != cc) {
map.put(cc.getId(),cc);
}
}
return map;
}
return null;
}
@Override
@Transactional(rollbackFor = {Exception.class})
@@ -1747,6 +1831,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
@Override
@Transactional(rollbackFor = {Exception.class})
public ResultData updateRentContractStatus(Long id,boolean buildProperyBill) {
if (id == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
@@ -1778,6 +1863,12 @@ public class WxRentContractServiceImpl implements WxRentContractService {
customers.setUpdateDate(new Date());
wxContractCustomersMapper.updateById(customers);
//把customers写入到wxShopUser
String cusName = castCustomersToShopUsers(customers,record.shopIdsByRentInfo());
//如果合同的账单cusName为空的话,则设置为customers name
handleContractBillCusName(record,cusName);
//EventUtil.publistRentEvent(this, wxRentContract);
//建立账单
//自定义账单无单价,为能生成账单,设置该值
@@ -1817,6 +1908,69 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(Result.SUCCESS, "操作成功");
}
public String castCustomersToShopUsers(WxContractCustomers customers,List<Long> shopIdList) {
WxShopUsersInfo suiq = new WxShopUsersInfo();
suiq.updateTenantInfo(customers);
suiq.setPrincipalType(customers.getPrincipalType());
suiq.setName(customers.getName());
suiq.setPhone(customers.getPhone());
List<WxShopUsersInfo> ids = wxShopService.getUserInfoList(suiq);
Long infoId = null;
String cusName = null;
if (null == ids || ids.size() <= 0 ) {
WxShopUsersInfo sui = new WxShopUsersInfo();
sui.updateTenantInfo(customers);
sui.setPrincipalType(customers.getPrincipalType());
sui.setName(customers.getName());
sui.setPhone(customers.getPhone());
sui.setLegalPerson(customers.getLegalPerson());
sui.setIdNumber(customers.getIdNumber());
sui.setSex(customers.getSex());
sui.setLinkPerson(customers.getLinkPerson());
sui.setCreateContractCustomerId(customers.getId());
wxShopService.saveOrUpdateShopUsersInfo(sui);
infoId = sui.getId();
cusName = customers.getName();
}else {
infoId = ids.get(0).getId();
cusName = ids.get(0).getName();
}
for (int i = 0 ; i < shopIdList.size(); i++) {
Long shopId = shopIdList.get(i);
//查询这个infoId是不是当前的租户
WxShopUsers suq = new WxShopUsers();
suq.updateTenantInfo(customers);
suq.setShopId(shopId);
suq.setInfoId(infoId);
suq.setStatus(EnumShopUsersStatus.LIVE.getCode());
List<WxShopUsers> ulist = wxShopService.getShopUsersList(suq);
if (null != ulist && ulist.size() > 0 ) {
//WxShopUsers su = ulist.get(0);
}else {
//先把当前的租户变更掉
wxShopService.updateRentShopUsersOld(customers,shopId);
//新增租户
WxShopUsers su = new WxShopUsers();
su.updateTenantInfo(customers);
su.setShopId(shopId);
su.setInfoId(infoId);
su.setType(EnumShopUsersType.RENTER.getCode());
su.setStatus(EnumShopUsersStatus.LIVE.getCode());
wxShopService.saveOrUpdateShopUsers(su);
}
}
return cusName;
}
public void handleContractBillCusName(WxRentContract record,String cusName) {
WxAllBill bill = new WxAllBill();
bill.updateTenantInfo(record);
bill.setCusName(cusName);
bill.setRentContractId(record.getId());
wxAllBillMapper.updateContractCusName(bill);
}
@Override
public void updatePropertyPreviewBill(WxRentContract record) {


+ 90
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java View File

@@ -4,14 +4,17 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAllBill;
import com.iformall.domain.po.WxContractCustomers;
import com.iformall.domain.po.WxFlowRecord;
import com.iformall.domain.po.WxPropertyContract;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxRentPropertyContractVo;
import com.iformall.enums.EnumContract;
import com.iformall.enums.EnumContractOperationType;
import com.iformall.enums.EnumContractType;
import com.iformall.enums.EnumRentShopType;
import com.iformall.mapper.WxContractCustomersMapper;
import com.iformall.mapper.WxPropertyContractMapper;
import com.iformall.mapper.WxRentContractMapper;
import com.iformall.service.WxAgileContractService;
@@ -22,6 +25,7 @@ import com.iformall.service.WxRentContractService;
import com.iformall.service.WxRentPropertyContractService;
import com.iformall.service.WxShopService;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +49,9 @@ public class WxRentPropertyContractServiceImpl implements WxRentPropertyContract

@Autowired
WxPropertyContractMapper wxPropertyContractMapper;
@Autowired
WxContractCustomersMapper wxContractCustomersMapper;

@Autowired
WxPropertyContractService wxPropertyContractService;
@@ -65,13 +72,90 @@ public class WxRentPropertyContractServiceImpl implements WxRentPropertyContract

@Override
public PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) {
List<Long> ids = wxAgileContractService.findBuildingFloorContractIds(record, record.getFloorForRule(), null, null, null, 0);
if (null == ids || ids.size() <= 0 ) {
record.setId(-1L);
}else {
record.setIds(ids);
if (StringUtils.isNotBlank(record.getFloorForRule()) || StringUtils.isNotBlank(record.getQueryShopIdStr())) {
List<Long> shopIdList = null;
if (StringUtils.isNotBlank(record.getQueryShopIdStr())) {
String[] qsids = record.getQueryShopIdStr().split(",");
if (null != qsids && qsids.length > 0 ) {
shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < qsids.length ; i ++) {
String qsid = qsids[i];
if (StringUtils.isNotBlank(qsid)) {
shopIdList.add(Long.parseLong(qsid));
}
}
if (shopIdList.size() <= 0 ) {
shopIdList = null;
}
}
}
List<Long> contractIds = wxAgileContractService.findBuildingFloorContractIds(record, record.getFloorForRule(), null, null, shopIdList, 0);
//List<Long> mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null);
if (null == contractIds || contractIds.size() <= 0 ) {
record.setId(-1L);
} else {
record.setIds(contractIds);
}
}
//根据客户名称查询
if (StringUtils.isNotBlank(record.getMerchantName())) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(record);
ccq.setName(record.getMerchantName());
List<Long> customersIdList = wxContractCustomersMapper.findIdList(ccq);
if (null != customersIdList && customersIdList.size() > 0 ) {
record.setCustomersIdList(customersIdList);
}else {
record.setId(-1L);
}
}
PageInfo<WxRentPropertyContractVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record));
if (null != pageInfo && null != pageInfo.getList() && pageInfo.getList().size() > 0 ) {
List<Long> customersIdList = new ArrayList<Long>();
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){
WxRentPropertyContractVo contract = pageInfo.getList().get(i);
if (null != contract.getCustomersId()) {
customersIdList.add(contract.getCustomersId());
}
}
Map<Long,WxContractCustomers> customersMap = getContractCustomersMap(record,customersIdList);
for (int i = 0 ; i < pageInfo.getList().size(); i ++ ) {
WxRentPropertyContractVo contract = pageInfo.getList().get(i);
String merchantName = "";
if (null != customersMap && null != contract.getCustomersId()) {
WxContractCustomers cc = customersMap.get(contract.getCustomersId());
if (null != cc) {
merchantName = merchantName + cc.getName();
}
}
contract.setMerchantName(merchantName);
}
}
return pageInfo;
}
private Map<Long,WxContractCustomers> getContractCustomersMap(TenantEntity tenantEntity,List<Long> customerIds) {
WxContractCustomers ccq = new WxContractCustomers();
ccq.updateTenantInfo(tenantEntity);
ccq.setIds(customerIds);
List<WxContractCustomers> cclist = wxContractCustomersMapper.findList(ccq);
if (null != cclist && cclist.size() > 0 ){
Map<Long,WxContractCustomers> map = new HashMap<Long,WxContractCustomers>();
for (int i = 0 ; i < cclist.size() ; i ++ ) {
WxContractCustomers cc = cclist.get(i);
if (null != cc) {
map.put(cc.getId(),cc);
}
}
return map;
}
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record));
return null;
}

@Override


+ 49
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java View File

@@ -132,25 +132,26 @@ public class WxShopServiceImpl implements WxShopService {
suq.setShopIds(shopIdList);
suq.setStatus(EnumShopUsersStatus.LIVE.getCode());
Map<Long, WxShopUsers> shopUserMap = this.getShopUserMap(suq);
if (null != shopUserMap) {
for (int i = 0 ; i < page.getList().size(); i ++) {
WxShop shop = page.getList().get(i);
for (int i = 0 ; i < page.getList().size(); i ++) {
WxShop shop = page.getList().get(i);
if (null != shopUserMap) {
WxShopUsers su = shopUserMap.get(shop.getId());
if (null != su) {
shop.setShopUserType(su.getType());
shop.setShopUserTypeName(su.getTypeName());
shop.setShopUserName(su.getName());
}
if (null != buildingMap) {
String buildingName = buildingMap.get(shop.getBuilding());
shop.setBuildingName(buildingName);
}
if (null != floorMap) {
String floorName = floorMap.get(shop.getFloor());
shop.setFloorName(floorName);
}
}
}
}
if (null != buildingMap) {
String buildingName = buildingMap.get(shop.getBuilding());
shop.setBuildingName(buildingName);
}
if (null != floorMap) {
String floorName = floorMap.get(shop.getFloor());
shop.setFloorName(floorName);
}
}
}
return page;
}
@@ -999,6 +1000,12 @@ public class WxShopServiceImpl implements WxShopService {
return null;
}
@Override
public List<WxShopUsers> getShopUsersList(WxShopUsers wxShopUsers) {
List<WxShopUsers> shopUserList = wxShopUsersMapper.findList(wxShopUsers);
return shopUserList;
}
private void setShopUserProperty(WxShopUsers sus) {
WxShopUsersInfo su = wxShopUsersInfoMapper.selectById(sus.getInfoId());
if (null != su) {
@@ -1067,6 +1074,15 @@ public class WxShopServiceImpl implements WxShopService {
wxShopUsersMapper.updateById(wxShopUsers);
}
@Override
public void updateRentShopUsersOld(TenantEntity tenantEntity,Long shopId) {
WxShopUsers wxShopUsers = new WxShopUsers();
wxShopUsers.setShopId(shopId);
wxShopUsers.setUpdateDate(new Date());
wxShopUsers.setType(EnumShopUsersType.RENTER.getCode());
wxShopUsersMapper.updateShopOld(wxShopUsers);
}
@Override
public void deleteShopUsers(WxShopUsers wxShopUsers) {
wxShopUsersMapper.deleteById(wxShopUsers.getId());
@@ -1095,6 +1111,21 @@ public class WxShopServiceImpl implements WxShopService {
PageInfo<WxShopUsersInfo> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopUsersInfoMapper.findList(record));
return page;
}
@Override
public void saveOrUpdateShopUsersInfo(WxShopUsersInfo record) {
if (record.getId() == null) {
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
Date date = new Date();
record.setUpdateDate(date);
record.setCreateDate(date);
wxShopUsersInfoMapper.insert(record);
}else {
record.setUpdateDate(new Date());
wxShopUsersInfoMapper.updateById(record);
}
}

@Override
public void saveOrUpdateShopUsersPerson(WxShopUsersPerson record) {
@@ -1118,6 +1149,11 @@ public class WxShopServiceImpl implements WxShopService {
public void deleteShopUsersPerson(WxShopUsersPerson record) {
wxShopUsersPersonMapper.deleteById(record.getId());
}
@Override
public List<WxShopUsersInfo> getUserInfoList(WxShopUsersInfo wxShopUsersInfo) {
return wxShopUsersInfoMapper.findList(wxShopUsersInfo);
}

@Override
public List<Long> getUserInfoIds(WxShopUsersInfo wxShopUsersInfo) {


+ 26
- 5
mallinkService/src/main/resources/mapper/WxAllBillMapper.xml View File

@@ -40,6 +40,8 @@
<result column="rent_contract_agile_fees_type" jdbcType="INTEGER" property="rentContractAgileFeesType"/>
<result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
<result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/>
<result column="virtual_compose_id" jdbcType="BIGINT" property="virtualComposeId"/>
<result column="parent_virtual_compose_id" jdbcType="BIGINT" property="parentVirtualComposeId"/>
<result column="energy_reading_calcuteId" jdbcType="BIGINT" property="energyReadingCalcuteId" />
<result column="energy_reading_id" jdbcType="BIGINT" property="energyReadingId" />
<result column="extra_create_from" jdbcType="INTEGER" property="extraCreateFrom" />
@@ -52,8 +54,8 @@
`id`,`tenant_id`,`parent_tenant_id`,`shop_id`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`,
`price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`,
`bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`receive_date`,`period`,
`is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,
`can_edit`,`cus_name`
`is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`property_contract_id`,`parent_bill_id`,`virtual_compose_id`,`parent_virtual_compose_id`,
`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,`can_edit`,`cus_name`
</sql>

<sql id="dynamicWhereConditions">
@@ -71,6 +73,8 @@
<if test=" null != rentContractAgileFeesType ">and `rent_contract_agile_fees_type` = #{rentContractAgileFeesType}</if>
<if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
<if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if>
<if test=" null != virtualComposeId ">and `virtual_compose_id` = #{virtualComposeId}</if>
<if test=" null != parentVirtualComposeId ">and `parent_virtual_compose_id` = #{parentVirtualComposeId}</if>
<if test=" null != isPreview ">and `is_preview` = #{isPreview}</if>
<if test=" null != starttime">and `starttime` &gt;= #{starttime}</if>
<if test=" null != endtime">and `endtime` &lt;= #{endtime}</if>
@@ -79,7 +83,7 @@
<if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if>
<if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if>
<if test=" null != noExtraCreateFrom">and `extra_create_from` is null</if>
<if test=" null != advanceHasMoney">and bill_type = 6 and IFNULL(`pay`,'0') - IFNULL(`use_money`,'0') &gt; 0</if>
<if test=" null != advanceHasMoney">and bill_type = 6 and IFNULL(`pay`,'0') -IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') &gt; 0</if>
<if test=" null != canEdit">and `can_edit` = #{canEdit}</if>
<if test=" null != month and '' != month">
and date_format(starttime,'%Y-%m') &lt;= #{month} and date_format(endtime,'%Y-%m') &gt;= #{month}
@@ -228,8 +232,14 @@
sum(CAST(ifnull(set_off,'0') AS DECIMAL(20,2))) set_off,
sum(CAST(ifnull(use_money,'0') AS DECIMAL(20,2))) use_money,
sum(CAST(ifnull(return_pay,'0') AS DECIMAL(20,2))) return_pay,
sum(CAST(ifnull(bussiness_manage_fee_need_pay,'0') AS DECIMAL(20,2))) bussiness_manage_fee_need_pay,
sum(CAST(ifnull(operating_manage_fee_need_pay,'0') AS DECIMAL(20,2))) operating_manage_fee_need_pay,
starttime,
endtime
endtime,
receive_date,
virtual_compose_id,
parent_virtual_compose_id,
energy_fees_id
from wx_all_bill
<include refid="dynamicWhereConditions"/>
group by starttime,endtime
@@ -387,7 +397,8 @@
#{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark},
#{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay},
#{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.rentContractAgileFeesType},#{item.propertyContractId},
#{item.parentBillId},#{item.energyReadingCalcuteId},#{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit},#{item.cusName}
#{item.parentBillId},#{item.virtualComposeId},#{item.parentVirtualComposeId},#{item.energyReadingCalcuteId},
#{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit},#{item.cusName}
)
</foreach>
</insert>
@@ -402,5 +413,15 @@
and pay &lt;= 0 and IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
</delete>
<update id="updateContractCusName" parameterType="com.iformall.domain.po.WxAllBill">
update wx_all_bill set cus_name = #{cusName} where cus_name is null
<if test=" null != rentContractId">
and rent_contract_id = #{rentContractId}
</if>
<if test=" null != propertyContractId">
and property_contract_id = #{propertyContractId}
</if>
</update>
</mapper>


+ 6
- 0
mallinkService/src/main/resources/mapper/WxContractCustomersMapper.xml View File

@@ -76,6 +76,12 @@
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxContractCustomers" resultType="Long">
select id
from wx_contract_customers
<include refid="dynamicWhereConditions"/>
</select>
<select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
select
<include refid="allColumns"/>


+ 6
- 17
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml View File

@@ -63,13 +63,13 @@
<result column="first_bill_date_start" jdbcType="TIMESTAMP" property="firstBillDateStart"/>
<result column="first_bill_date_end" jdbcType="TIMESTAMP" property="firstBillDateEnd"/>
<result column="first_bill_receive_date" jdbcType="TIMESTAMP" property="firstBillReceiveDate"/>
<result column="shop_id_str" jdbcType="VARCHAR" property="shopIdStr"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`customers_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`,
`sign_date`,`receive_period`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by_name`,`update_by_name`,
`deposit`,`is_del`,`receive_period_unit`,`create_by`,`update_by`,`first_bill_receive_date`,
`deposit`,`is_del`,`receive_period_unit`,`create_by`,`update_by`,`first_bill_receive_date`,`shop_id_str`,
`updatetime`,`createtime`,`rent_area`,`fees_standards_info`,`first_bill_date_start`,`first_bill_date_end`,
`link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`,`day_price_calcute`,`month_average_days`,
`start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`,fixed_price,`pay_period_rate`,
@@ -122,10 +122,10 @@
and business_id in (${businessForRule})
</if>
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="mItem" open="(" separator="," close=")">
#{mItem}
<if test=" null != customersIdList ">
and customers_id in
<foreach collection="customersIdList" index="index" item="cusItem" open="(" separator="," close=")">
#{cusItem}
</foreach>
</if>
@@ -227,17 +227,6 @@
and rental_end_date &lt;now()
</update>
<update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
update wx_property_contract set status=#{status} where status!=7
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and merchant_id is null
</update>
<update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
update wx_property_contract set apply_status=#{applyStatus}
<if test=" null != businessType ">,business_type=#{businessType}</if>


+ 17
- 2
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml View File

@@ -146,6 +146,13 @@
<if test=" null != queryShopId">
and concat(',',shop_id_str,',') like concat('%,',#{queryShopId},',%')
</if>
<if test=" null != customersIdList ">
and customers_id in
<foreach collection="customersIdList" index="index" item="cusItem" open="(" separator="," close=")">
#{cusItem}
</foreach>
</if>

<if test=" null != statuss ">
and status in
@@ -249,7 +256,8 @@
<resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo">
<id column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="parent_tenant_id" property="parentTenantId"/>
<result column="parent_tenant_id" property="parentTenantId"/>
<result column="customers_id" jdbcType="BIGINT" property="customersId"/>
<result column="rent_id" property="rentId"/>
<result column="property_id" property="propertyId"/>
<result column="rent_info" property="rentInfo"/>
@@ -277,7 +285,7 @@

<select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
select rc.id,rc.tenant_id,rc.parent_tenant_id,rc.id as rent_id, pc.id as property_id, rc.rental_start_date,rc.rental_end_date,rc.`status`,
select rc.id,rc.tenant_id,rc.parent_tenant_id,rc.customers_id,rc.id as rent_id, pc.id as property_id, rc.rental_start_date,rc.rental_end_date,rc.`status`,
rc.price as rent_price,rc.contract_number,rc.type,rc.apply_status,rc.price_detail,rc.revenue_fixed_rent_price,rc.revenue_rent_price,
rc.rent_info,pc.price as property_price,pc.`status` as property_status,
rc.price_unit as rent_price_unit,pc.price_unit as property_price_unit,rc.day_price_calcute,rc.free_period_remark,
@@ -299,6 +307,13 @@
<if test=" null != propertyId and '' != propertyId">
and pc.`id` = #{propertyId}
</if>
<if test=" null != customersIdList ">
and rc.customers_id in
<foreach collection="customersIdList" index="index" item="cusItem" open="(" separator="," close=")">
#{cusItem}
</foreach>
</if>
<!-- <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
</if>


+ 6
- 1
mallinkService/src/main/resources/mapper/WxShopUsersInfoMapper.xml View File

@@ -15,11 +15,12 @@
<result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="create_contract_customer_id" jdbcType="BIGINT" property="createContractCustomerId"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_shop_id`,`principal_type`,`name`,`phone`,`legal_person`,`id_number`,`sex`,
`link_person`,`create_date`,`update_date`
`link_person`,`create_date`,`update_date`,`create_contract_customer_id`
</sql>

<sql id="dynamicWhereConditions">
@@ -40,6 +41,10 @@
and `create_shop_id` = #{createShopId}
</if>
<if test=" null != createContractCustomerId">
and `create_contract_customer_id` = #{createContractCustomerId}
</if>
<if test=" null != principalType">
and `principal_type` = #{principalType}
</if>


+ 5
- 1
mallinkService/src/main/resources/mapper/WxShopUsersMapper.xml View File

@@ -82,5 +82,9 @@
select distinct shop_id
from wx_shop_users
<include refid="dynamicWhereConditions"/>
</select>
</select>
<update id="updateShopOld" parameterType="com.iformall.domain.po.WxShopUsers">
update wx_shop_users set status = 1,update_date=#{updateDate} where shop_id = #{shopId} and status = 0 and `type` = #{type}
</update>
</mapper>

Loading…
Cancel
Save