diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java index f614ce03a..9eb3e830b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxShopController.java @@ -16,7 +16,6 @@ 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; import com.iformall.enums.EnumShopSellStatus; diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java index 288c7f802..5919e7eee 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java @@ -54,12 +54,8 @@ public class WxAgileContractController extends WxContractBaseController { @Autowired private WxRentContractMapper wxRentContractMapper; @Autowired - private WxRentPropertyContractService wxRentPropertyContractService; - @Autowired private WxShopService wxShopService; @Autowired - WxPropertyContractService wxPropertyContractService; - @Autowired WxMallBuildingService buildingService; @Autowired WxMallFloorService floorService; @@ -77,7 +73,7 @@ public class WxAgileContractController extends WxContractBaseController { wxRentContract = new WxRentContract(); } wxRentContract.updateTenantInfo(getTenantInfo()); - wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); + //wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); wxRentContract.setSortColumns(" updatetime desc"); //Map result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); WxUserDataRule dataRule = this.getCurrentDataFloors(); @@ -142,18 +138,18 @@ public class WxAgileContractController extends WxContractBaseController { public ResultData saveOrUpdate(@RequestBody WxRentContract wxRentContract) { MallUserInfo user = getUser(); wxRentContract.updateTenantInfo(user); - wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); + //wxRentContract.setAgileType(EnumRentAgileType.AGILE.getCode()); if (null == wxRentContract.getDayPriceCalcute()) { return new ResultData(Result.ERROR,"请选择日均单价计费规则"); } //以前合同必填的数据初始化 wxRentContract.setDecimalSize(2); wxRentContract.setReceivePeriodUnit(EnumContractReceivePeriodUnit.MONTH.getCode()); - wxRentContract.setRevenueRatio(EnumYesOrNo.NO.getCode()); - wxRentContract.setRevenueFixedRentPrice(EnumYesOrNo.NO.getCode()); - wxRentContract.setOutDateNotifyDays(0); + //wxRentContract.setRevenueRatio(EnumYesOrNo.NO.getCode()); + //wxRentContract.setRevenueFixedRentPrice(EnumYesOrNo.NO.getCode()); + //wxRentContract.setOutDateNotifyDays(0); wxRentContract.setPayPeriodRate(1); - wxRentContract.setOperationType(EnumContractOperationType.PART.getCode()); + //wxRentContract.setOperationType(EnumContractOperationType.PART.getCode()); if (null == wxRentContract.getRentalStartDate()) { return new ResultData(Result.ERROR,"请选择合同开始日期"); } @@ -224,17 +220,12 @@ public class WxAgileContractController extends WxContractBaseController { */ @GetMapping("depositFeesList") public ResultData depositFeesList() { - WxEnergyFees dt = new WxEnergyFees(); + WxFinanceFees dt = new WxFinanceFees(); dt.updateTenantInfo(getTenantInfo()); dt.setIsDel(EnumYesOrNo.NO.getCode()); - List billTypeList = new ArrayList(); - billTypeList.add(EnumBillAllType.RENT_DEPOSIT.getCode()); - billTypeList.add(EnumBillAllType.PROPERTY.getCode()); - billTypeList.add(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); - dt.setBillTypeList(billTypeList); dt.setIsDespoit(EnumYesOrNo.YES.getCode()); dt.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); + PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); if (null == page) { return new ResultData(); } @@ -243,19 +234,13 @@ public class WxAgileContractController extends WxContractBaseController { @GetMapping("unDepositFeesList") public ResultData unDepositFeesList() { - WxEnergyFees dt = new WxEnergyFees(); + WxFinanceFees dt = new WxFinanceFees(); dt.updateTenantInfo(getTenantInfo()); dt.setIsDel(EnumYesOrNo.NO.getCode()); - List billTypeList = new ArrayList(); - billTypeList.add(EnumBillAllType.RENT.getCode()); - billTypeList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - billTypeList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getCode()); - billTypeList.add(EnumBillAllType.PROPERTY.getCode()); - dt.setBillTypeList(billTypeList); dt.setIsDespoit(EnumYesOrNo.NO.getCode()); - dt.setIsPublic(EnumYesOrNo.NO.getCode()); + //dt.setIsPublic(EnumYesOrNo.NO.getCode()); dt.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); + PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); if (null == page) { return new ResultData(); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java index f74494c4d..a1015972d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java @@ -5,7 +5,6 @@ import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxContractCustomers; import com.iformall.domain.po.WxFlowModel; import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.TenantEntity; @@ -20,7 +19,6 @@ import com.iformall.enums.EnumRentShopType; import com.iformall.exception.MallinkException; import com.iformall.service.WxAgileContractService; import com.iformall.service.WxFlowService; -import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; import com.iformall.service.WxShopService; @@ -53,10 +51,8 @@ public class WxContractBaseController extends BaseController{ @Autowired private WxRentContractService wxRentContractService; - @Autowired - private WxPropertyContractService wxPropertyContractService; - protected Map generateFlowParams(WxContractCustomers contractCustomers,EnumFlowKey flowType,EnumFlowContractType contractType,EnumRentAgileType agileType,String remark,Long contractId,Long wholeProperyId) { + protected Map generateFlowParams(WxContractCustomers contractCustomers,EnumFlowKey flowType,EnumFlowContractType contractType,String remark,Long contractId,Long wholeProperyId) { Map map = new HashMap(); map.put("businessType", flowType.getCode()); map.put("remark", remark); @@ -83,13 +79,6 @@ public class WxContractBaseController extends BaseController{ } variablesList.add(contractNumberMap); - if (null != agileType) { - Map agileTypeMap = new HashMap(); - agileTypeMap.put("key","agileType"); - agileTypeMap.put("value",String.valueOf(agileType.getCode())); - variablesList.add(agileTypeMap); - } - Map rentNameMap = new HashMap(); rentNameMap.put("key","rentName"); rentNameMap.put("value",contractCustomers.getName()); @@ -114,12 +103,7 @@ public class WxContractBaseController extends BaseController{ protected boolean rentContractHasWorkFlow(WxRentContract wxRentContract) { WxFlowModel wxFlowModel = new WxFlowModel(); - if(wxRentContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue() || - wxRentContract.getOperationType().intValue() == EnumContractOperationType.JINMAO.getCode().intValue()) { - wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_CONTRACT.getCode()); - }else { - wxFlowModel.setFlowType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode()); - } + wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_CONTRACT.getCode()); wxFlowModel.updateTenantInfo(wxRentContract); List flows = wxFlowService.getModelBybusiness(wxFlowModel); if (null != flows && flows.size() > 0) { @@ -128,21 +112,6 @@ public class WxContractBaseController extends BaseController{ return false; } - protected boolean propertyContractHasWorkFlow(WxPropertyContract wxPropertyContract) { - WxFlowModel wxFlowModel = new WxFlowModel(); - if(wxPropertyContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) { - wxFlowModel.setFlowType(EnumFlowKey.NEW_PRO_CONTRACT.getCode()); - }else { - wxFlowModel.setFlowType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode()); - } - wxFlowModel.updateTenantInfo(wxPropertyContract); - List flows = wxFlowService.getModelBybusiness(wxFlowModel); - if (null != flows && flows.size() > 0) { - return true; - } - return false; - } - public static boolean dateHasIntersection(Date startDate1, Date endDate1, Date startDate2, Date endDate2) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (startDate1.compareTo(endDate2) <= 0 && startDate2.compareTo(endDate1) <= 0) { @@ -194,27 +163,17 @@ public class WxContractBaseController extends BaseController{ statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); statusList.add(EnumRentContractStatus.PERFORMANCE.getCode()); statusList.add(EnumRentContractStatus.UNWRITE.getCode()); - if (isRent) { - WxRentContract rc = new WxRentContract(); - rc.updateTenantInfo(tenantEntity); - rc.setIds(contractIds); - rc.setStatuss(statusList); - /**满足下面条件的都算 - * 1. 合同开始日期<=当前合同开始日期 && 合同结束日期 > 当前合同开始日期 - * 2. 合同开始日期 >= 当前合同开始日期 && 合同开始日期 <= 当前结束日期 - */ - rc.setUseStartTime(contractStartDate); - rc.setUseEndTime(contractEndDate); - usedContractIds = wxRentContractService.findIdList(rc); - }else { - WxPropertyContract rc = new WxPropertyContract(); - rc.updateTenantInfo(tenantEntity); - rc.setIds(contractIds); - rc.setStatuss(statusList); - rc.setUseStartTime(contractStartDate); - rc.setUseEndTime(contractEndDate); - usedContractIds = wxPropertyContractService.findIdList(rc); - } + WxRentContract rc = new WxRentContract(); + rc.updateTenantInfo(tenantEntity); + rc.setIds(contractIds); + rc.setStatuss(statusList); + /**满足下面条件的都算 + * 1. 合同开始日期<=当前合同开始日期 && 合同结束日期 > 当前合同开始日期 + * 2. 合同开始日期 >= 当前合同开始日期 && 合同开始日期 <= 当前结束日期 + */ + rc.setUseStartTime(contractStartDate); + rc.setUseEndTime(contractEndDate); + usedContractIds = wxRentContractService.findIdList(rc); if (null != usedContractIds && usedContractIds.size() > 0 ) { BigDecimal usedArea = wxAgileContractService.sumShopContractAreas(tenantEntity, shopId,usedContractIds); BigDecimal totalUsedArea = usedArea.add(contractShopArea); @@ -260,18 +219,4 @@ public class WxContractBaseController extends BaseController{ rentContract.getRentShopArea(),true); } - protected void propertyContractValidShop(WxPropertyContract propertyContract) throws Exception { - //当前的不能<=0 - Map rentAreaMap = propertyContract.getRentShopArea(); - for (Iterator it = rentAreaMap.keySet().iterator();it.hasNext();) { - Long shopId= it.next(); - BigDecimal ra = rentAreaMap.get(shopId); - if (ra.compareTo(new BigDecimal(0)) <= 0 ) { - throw new MallinkException(Result.ERROR, "房间面积不能为0。"); - } - } - contractValidShop(propertyContract,propertyContract.getId(),propertyContract.getRentalStartDate(),propertyContract.getRentalEndDate(),propertyContract.shopIdsByShop(), - propertyContract.getRentShopArea(),false); - } - } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java deleted file mode 100644 index a0258a22f..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ /dev/null @@ -1,612 +0,0 @@ -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; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxPropertyContractUpdateDto; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxContractCustomers; -import com.iformall.domain.po.WxContractShop; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.WxShop; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.po.base.BaseEntity.SortField; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxContractCustomersMapper; -import com.iformall.mapper.WxContractShopMapper; -import com.iformall.mapper.WxPropertyContractMapper; -import com.iformall.service.*; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxPropertyContract") -public class WxPropertyContractController extends WxContractBaseController { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxPropertyContractService wxPropertyContractService; - @Autowired - private WxAllBillService wxAllBillService; - @Autowired - private WxPropertyContractMapper wxPropertyContractMapper; - @Autowired - private WxRentPropertyContractService wxRentPropertyContractService; - @Autowired - WxMallBuildingService buildingService; - @Autowired - WxMallFloorService floorService; - @Autowired - private WxShopService wxShopService; - @Autowired - private WxRentContractService rentContractService; - @Autowired - private WxAgileContractService wxAgileContractService; - - @GetMapping("/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::list"); - if (null == wxPropertyContract) { - wxPropertyContract = new WxPropertyContract(); - } - wxPropertyContract.updateTenantInfo(getTenantInfo()); - Map result = new HashMap<>(); - wxPropertyContract.setSortColumns("updatetime desc"); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxPropertyContract.setFloorForRule(dataRule.getFloorIds()); - wxPropertyContract.setBusinessForRule(dataRule.getBussinessIds()); - wxPropertyContract.setShopTypeForRule(dataRule.getShopTypes()); - } - PageInfo pageInfo = wxPropertyContractService.listAsPage(wxPropertyContract, pageNum, pageSize); - Integer hasFlow = null; - if (null != pageInfo && null != pageInfo.getList()) { - for (WxPropertyContract wpc : pageInfo.getList()) { - if (null == hasFlow) { - if(propertyContractHasWorkFlow(wpc)) { - hasFlow = 1; - }else { - hasFlow = 0; - } - } - wpc.setFlowHas(hasFlow); - } - } - - result.put("pageInfo", pageInfo); - return new ResultData(result); - } - - - - //第一步 - @PostMapping("addBasic") - public ResultData addBasic(@RequestBody WxPropertyContract wxPropertyContract) { - MallUserInfo user = getUser(); - wxPropertyContract.updateTenantInfo(user); - if (null == wxPropertyContract.getCreateType()) { - return new ResultData("createType参数不能为空"); - } - if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - if (StringUtils.isBlank(wxPropertyContract.getRentInfo())) { - return new ResultData(Result.ERROR,"请选择店铺"); - } - if (null == wxPropertyContract.getRentalStartDate()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "起租开始时间不能为空"); - } - if (null == wxPropertyContract.getRentalEndDate()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "起租结束时间不能为空"); - } - if (null == wxPropertyContract.getStartDate()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "计租日不能为空"); - } - if (null == wxPropertyContract.getLease()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "lease不能为空"); - } - if (null == wxPropertyContract.getOperationType()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "operationType不能为空"); - } - if (null == wxPropertyContract.getAdjustPeriod()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "adjustPeriod不能为空"); - } - List 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) { - return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); - } - if (rentContract.getStatus().equals(EnumRentContractStatus.OUT_DATE.getCode()) || - rentContract.getStatus().equals(EnumRentContractStatus.TERMINATE.getCode()) || - rentContract.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) { - return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED); - } - wxPropertyContract.setRentArea(rentContract.getRentArea()); - wxPropertyContract.setOperationType(rentContract.getOperationType()); - wxPropertyContract.setAdjustPeriod(rentContract.getAdjustPeriod()); - wxPropertyContract.setLease(rentContract.getLease()); - wxPropertyContract.setRentalStartDate(rentContract.getRentalStartDate()); - wxPropertyContract.setRentalEndDate(rentContract.getRentalEndDate()); - wxPropertyContract.setStartDate(rentContract.getStartDate()); - wxPropertyContract.setEndDate(rentContract.getEndDate()); - wxPropertyContract.setSignDate(rentContract.getSignDate()); - wxPropertyContract.setRentInfo(rentContract.getRentInfo()); - wxPropertyContract.setCustomersId(rentContract.getCustomersId()); - wxPropertyContract.setShopIdStr(rentContract.getShopIdStr()); - //如果是租金+物业的,则租金和物业一一对应。 - if (wxPropertyContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()){ - WxPropertyContract pq = new WxPropertyContract(); - pq.updateTenantInfo(rentContract); - pq.setRentContractId(rentContract.getId()); - pq.setOperationType(EnumContractOperationType.WHOLE.getCode()); - List plist = wxPropertyContractService.findList(pq); - if (null != plist && plist.size() > 0 ) { - wxPropertyContract.setId(plist.get(0).getId()); - } - } - } - wxPropertyContract.setRentStartType(EnumRentStartType.RENTTIME.getCode()); - try { - propertyContractValidShop(wxPropertyContract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - return wxPropertyContractService.save(wxPropertyContract, user, user.getName(),false); - } - - //第二步,设置价格, - @PostMapping("add") - public ResultData addMoney(@RequestBody WxPropertyContract wxPropertyContract) { - if (null == wxPropertyContract.getId()) { - return new ResultData(Result.ERROR,"id不能为空"); - } - MallUserInfo user = getUser(); - wxPropertyContract.updateTenantInfo(user); - wxPropertyContract.setAdjustPeriodHandle(); - //第一步已经设置过了,无需再设置 - wxPropertyContract.setLinkPerson(null); - wxPropertyContract.setLinkPhone(null); - if (null != wxPropertyContract.getFeeStandards() && wxPropertyContract.getFeeStandards().size() > 0 ) { - wxPropertyContract.setFeesStandardsInfo(JSON.toJSONString(wxPropertyContract.getFeeStandards())); - } - if (null == wxPropertyContract.getDayPriceCalcute()){ - wxPropertyContract.setDayPriceCalcute(EnumRentDayPriceCalcute.REAL_DAYS.getCode()); - } - if (wxPropertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode().intValue() && null == wxPropertyContract.getMonthAverageDays()) { - return new ResultData(Result.ERROR,"请填写月平均天数"); - } - return wxPropertyContractService.updateMoney(wxPropertyContract, user, user.getName(),false); - } - - //物业合同-最后一步切换 按什么日期生成账单 - @PostMapping("updateRentStartTime") - public ResultData updateRentStartTime(@RequestBody WxPropertyContract wxPropertyContract) { - WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(wxPropertyContract.getId()); - MallUserInfo user = getUser(); - propertyContract.updateTenantInfo(user); - propertyContract.setAdjustPeriodHandle(); - if (propertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - propertyContract.calcutePrice(propertyContract.getRentArea()); - }else { - WxRentContract rentContract = rentContractService.getSimpleDeatil(propertyContract.getRentContractId()); - wxPropertyContract.calcutePrice(rentContract.getRentArea()); - } - propertyContract.setRentStartType(wxPropertyContract.getRentStartType()); - if (null != wxPropertyContract.getFeeStandards() && wxPropertyContract.getFeeStandards().size() > 0 ) { - wxPropertyContract.setFeesStandardsInfo(JSON.toJSONString(wxPropertyContract.getFeeStandards())); - } - return wxPropertyContractService.updateMoney(propertyContract, user, user.getName(),false); - } - - //第三步提交 - @PostMapping("update") - public ResultData update(@RequestBody WxPropertyContractUpdateDto dto) { - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - MallUserInfo user = getUser(); - wxPropertyContract.setId(dto.getId()); - wxPropertyContract.updateTenantInfo(user); - wxPropertyContract.setFileNames(dto.getFileNames()); - wxPropertyContract.setFlowParams(dto.getFlowParams()); - return wxPropertyContractService.updateFile(wxPropertyContract, user, user.getName(),true); - - } - - /** - * 计算价格 - */ - @PostMapping("calcutePrice") - public ResultData calcutePrice(@RequestBody WxPropertyContract wxPropertyContract) { - if (null == wxPropertyContract.getCreateType()) { - return new ResultData("createType参数不能为空"); - } - if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - if (StringUtils.isBlank(wxPropertyContract.getRentArea())) { - return new ResultData("rentArea,shopIds参数不能为空"); - } - wxPropertyContract.calcutePrice(wxPropertyContract.getRentArea()); - }else { - WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId()); - wxPropertyContract.calcutePrice(rentContract.getRentArea()); - } - return new ResultData(wxPropertyContract.getPrice()); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::findById"); -// WxBillProperty wxBillProperty = new WxBillProperty(); -// wxBillProperty.updateTenantInfo(getTenantInfo()); -// wxBillPropertyService.updateBillStatus(wxBillProperty); - try { - Map data = wxPropertyContractService.getById(id); - return new ResultData(data); - } catch (MallinkException e) { - logger.error(e.getMessage()); - return new ResultData(e.getErrorCode(), e.getMessage()); - } - } - - - /** - * 作废 - * @param wxRentContract - * @return - */ - @PostMapping("/unvalid") - public ResultData unvalid(@RequestBody WxPropertyContract proertyContract) { - WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); - if (null == contract) { - return new ResultData(Result.ERROR, "合同不存在."); - } - MallUserInfo user = this.getUser(); - if (contract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue() || - contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || - (contract.getStatus().intValue() == EnumRentContractStatus.PERFORMANCE.getCode().intValue() - && (contract.getApplyStatus().intValue() == EnumRentContractAppStatus.REJECT.getCode().intValue() || - contract.getApplyStatus().intValue() == EnumRentContractAppStatus.SETBACK.getCode().intValue()))) { - contract.setStatus(EnumRentContractStatus.INVALID.getCode()); - contract.setUpdatetime(new Date()); - contract.setUpdateBy(user.getId()); - try { - wxPropertyContractService.updatePropertyContract(contract); - return new ResultData(contract); - }catch(Exception e) { - logger.error(" WxPropertyContract unvalid error.",e); - return new ResultData(Result.ERROR,"系统错误"); - } - - }else { - return new ResultData(Result.ERROR, "合同状态不允许作废.只能作废草稿或者履约拒绝的合同。"); - } - } - - /** - * 终止 - * @param id - * @param status - * @return - */ - @PostMapping("endContract") - @SystemControllerLog(description = "物业合同-终止合同") - public ResultData endContract(@RequestBody WxPropertyContract proertyContract) { - proertyContract.updateTenantInfo(getTenantInfo()); - wxPropertyContractService.endContract(proertyContract,this.getUser()); - return new ResultData(proertyContract); - } - - /** - * 设置定时终止时间 - * @return - */ - @PostMapping("setEndContractTime") - public ResultData setEndContractTime(@RequestBody WxPropertyContract proertyContract) { - wxPropertyContractService.setEndContractTime(proertyContract); - return new ResultData(); - } - - @PostMapping("effective") - @ApiImplicitParams({}) - public ResultData effective(@RequestBody WxPropertyContract proertyContract) { - WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); - if (null == contract) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"物业合同不存在"); - } - //查询是否有审批流程 - if(propertyContractHasWorkFlow(contract)) { - return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"物业合同存在工作流,不允许直接生效。"); - } - - if (contract.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"租赁合同状态为草稿才能进行此操作"); - } - - if (contract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { -// if (shopHasValidProperty(contract)) { -// return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同。"); -// } - }else { - if (rentHasValidProperty(contract)) { - return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。"); - } - } - try { - propertyContractValidShop(contract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - wxPropertyContractService.updatePropertyContractStatus(proertyContract.getId()); - return new ResultData(Result.SUCCESS,"合同生效成功!"); - } - -// private boolean shopHasValidProperty(WxPropertyContract contract) { -// List shopIds = contract.shopIdsByShop(); -// if (null == shopIds || shopIds.size() <= 0 ) { -// return false; -// } -// List contractIdList = wxAgileContractService.findShopContractIds(contract, shopIds); -// if (null == contractIdList || contractIdList.size() <= 0 ) { -// return false; -// } -// -// WxPropertyContract wpc = new WxPropertyContract(); -// wpc.setIds(contractIdList); -// List statuss = EnumRentContractStatus.getValidStatus(); -// statuss.add(EnumRentContractStatus.PERFORMANCE.getCode()); -// wpc.setStatuss(statuss); -// List list = wxPropertyContractService.findList(wpc); -// if (null != list && list.size() > 0 ) { -// return true; -// } -// return false; -// } - - private boolean rentHasValidProperty(WxPropertyContract contract) { - WxPropertyContract wpc = new WxPropertyContract(); - wpc.setRentContractId(contract.getRentContractId()); - List statuss = EnumRentContractStatus.getValidStatus(); - statuss.add(EnumRentContractStatus.PERFORMANCE.getCode()); - wpc.setStatuss(statuss); - List list = wxPropertyContractService.findList(wpc); - if (null != list && list.size() > 0 ) { - return true; - } - return false; - } - - @PostMapping("apply") - public ResultData apply(@RequestBody WxPropertyContract proertyContract) { - MallUserInfo user = getUser(); - WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); - if (null == contract) { - return new ResultData(Result.ERROR, "编号["+contract.getContractNumber()+"]未找到租金合同"); - } - - //查询是否有审批流程 - if(!propertyContractHasWorkFlow(contract)) { - return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"物业合同不存在工作流,不能提交审批。"); - } - - if (contract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { -// if (shopHasValidProperty(contract)) { -// return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同。"); -// } - }else { - if (rentHasValidProperty(contract)) { - return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。"); - } - } - - try { - propertyContractValidShop(contract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - - String remark = ""; - Map map = contract.getFlowParams(); - if (null != map) { - remark = (String) map.get("remark"); - } - - WxContractCustomers customers = wxAgileContractService.findCustomers(contract, contract.getCustomersId()); - if(contract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) { - contract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.PROPERTY,null, remark, contract.getId(),null)); - }else { - contract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.WHOLE_SHOP,null, remark, contract.getId(),null)); - } - return wxPropertyContractService.apply(contract,user); - } - - @PostMapping("renewal") - public ResultData renewal(@RequestBody WxPropertyContract proertyContract) { - MallUserInfo user = getUser(); - - if (null == proertyContract.getId()){ - return new ResultData(Result.ERROR, "合同ID不能为空"); - } - - if (null == proertyContract.getRentalStartDate() || null == proertyContract.getRentalEndDate()){ - return new ResultData(Result.ERROR, "请选择租赁开始日期和截止日期"); - } - - if (null == proertyContract.getStartDate()){ - return new ResultData(Result.ERROR, "请选择计租日期"); - } - - if (null == proertyContract.getSignDate()){ - return new ResultData(Result.ERROR, "请选择签约日期"); - } - - WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); - if (null == contract) { - return new ResultData(Result.ERROR, "未找到物业合同"); - } - - if (contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - return new ResultData(Result.ERROR, "不能操作租金+物业合同"); - } - - if (!(contract.getRentalEndDate().before(proertyContract.getRentalStartDate()))) { - return new ResultData(Result.ERROR, "续租合同开始日期要大于原合同截止日期"); - } - - if (contract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { - return new ResultData(Result.ERROR,"租金合同未完善,请先完善。"); - } - - - contract.setRentalStartDate(proertyContract.getRentalStartDate()); - contract.setRentalEndDate(proertyContract.getRentalEndDate()); - contract.setSignDate(proertyContract.getSignDate()); - contract.setStartDate(proertyContract.getStartDate()); - contract.setEndDate(proertyContract.getStartDate()); - - try { - propertyContractValidShop(contract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - - try { - wxPropertyContractService.renewal(contract,user,false); - }catch(Exception e) { - logger.error("renewal error.",e); - return new ResultData(Result.ERROR,e.getMessage()); - } - - return new ResultData(contract); - } - - - @PostMapping("transfer") - public ResultData transfer(@RequestBody WxPropertyContract proertyContract) { - MallUserInfo user = getUser(); - - if (null == proertyContract.getId() || null == proertyContract.getCustomerType() || - StringUtils.isBlank(proertyContract.getCustomerName()) || StringUtils.isBlank(proertyContract.getCustomerPhone())){ - return new ResultData(Result.ERROR, "缺少参数"); - } - - WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); - if (null == contract) { - return new ResultData(Result.ERROR, "未找到物业合同"); - } - - if (contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - return new ResultData(Result.ERROR, "不能操作租金+物业合同"); - } - - try { - contract.setCustomersId(proertyContract.getCustomersId()); - contract.setCustomerType(proertyContract.getCustomerType()); - contract.setCustomerName(proertyContract.getCustomerName()); - contract.setCustomerLinkPerson(proertyContract.getCustomerLinkPerson()); - contract.setCustomerPhone(proertyContract.getCustomerPhone()); - contract.setCustomerLegalPerson(proertyContract.getCustomerLegalPerson()); - wxPropertyContractService.transfer(contract,user); - }catch(Exception e) { - logger.error("transfer error.",e); - return new ResultData(Result.ERROR,e.getMessage()); - } - - return new ResultData(contract); - } - - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData delete(Long id) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); - wxPropertyContractService.deleteById(id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - - - @RequestMapping("/download") - public void download(HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::download"); - wxPropertyContractService.download(request, response); - } - -// @GetMapping("/getPropertyContractStatusInfo") -// @SystemControllerLog(description = "物业合同-状态信息") -// public ResultData getPropertyContractStatusInfo(@ModelAttribute WxPropertyContract wxPropertyContract) { -// logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getPropertyContractStatusInfo"); -// wxPropertyContract.updateTenantInfo(getTenantInfo()); -// return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(wxPropertyContract)); -// } - -// @GetMapping("/getRentContractList") -// @SystemControllerLog(description = "物业合同-查询列表") -// public ResultData getRentContractList(@ModelAttribute WxPropertyContract wxPropertyContract) { -// logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getRentContractList"); -// wxPropertyContract.updateTenantInfo(getTenantInfo()); -// return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractList(wxPropertyContract)); -// } - -// @GetMapping("/endPropertyContractByRentContractId") -// @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) -// @SystemControllerLog(description = "物业合同-根据租赁合同终止") -// public ResultData endPropertyContractByRentContractId(Long rentContractId) { -// logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endPropertyContractByRentContractId"); -// return wxPropertyContractService.endPropertyContractByRentContractId(rentContractId); -// } - - @GetMapping("/hasRentContract") - @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) - public ResultData hasRentContract(Long rentContractId) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::hasRentContract"); - //return wxPropertyContractService.hasRentContract(rentContractId); - return new ResultData(false); - } - - @PostMapping("updatePropertyContractStatus") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData updatePropertyContractStatus(@RequestBody WxPropertyContract wxPropertyContract) { - logger.debug("[" + getIpAddr() + "] WxPropertyContractController::updateRentContractStatus"); - //return wxPropertyContractService.updatePropertyContractStatus(wxPropertyContract.getId()); - return new ResultData(); - } - - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index bb598b9e5..d35a1e807 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -53,54 +53,50 @@ public class WxRentContractController extends WxContractBaseController { @Autowired private WxAgileContractService wxAgileContractService; @Autowired - private WxRentPropertyContractService wxRentPropertyContractService; - @Autowired private WxShopService wxShopService; @Autowired - WxPropertyContractService wxPropertyContractService; - @Autowired WxMallBuildingService buildingService; @Autowired WxMallFloorService floorService; @Autowired WxBillAllHelper wxBillAllHelper; - @GetMapping("/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData list(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::list"); - if (null == wxRentContract) { - wxRentContract = new WxRentContract(); - } - wxRentContract.updateTenantInfo(getTenantInfo()); - wxRentContract.setSortColumns(" updatetime desc"); - //Map result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxRentContract.setFloorForRule(dataRule.getFloorIds()); - wxRentContract.setBusinessForRule(dataRule.getBussinessIds()); - wxRentContract.setShopTypeForRule(dataRule.getShopTypes()); - } - wxRentContract.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); - PageInfo page = wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize); - Integer hasFlow = null; - if (null != page && null != page.getList()) { - for (WxRentContract wrc: page.getList()) { - if (null == hasFlow) { - if(rentContractHasWorkFlow(wrc)) { - hasFlow = 1; - }else { - hasFlow = 0; - } - } - wrc.setFlowHas(hasFlow); - } - } - - return new ResultData(page); - } +// @GetMapping("/list") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) +// public ResultData list(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::list"); +// if (null == wxRentContract) { +// wxRentContract = new WxRentContract(); +// } +// wxRentContract.updateTenantInfo(getTenantInfo()); +// wxRentContract.setSortColumns(" updatetime desc"); +// //Map result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); +// WxUserDataRule dataRule = this.getCurrentDataFloors(); +// if (null != dataRule) { +// wxRentContract.setFloorForRule(dataRule.getFloorIds()); +// wxRentContract.setBusinessForRule(dataRule.getBussinessIds()); +// wxRentContract.setShopTypeForRule(dataRule.getShopTypes()); +// } +// wxRentContract.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); +// PageInfo page = wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize); +// Integer hasFlow = null; +// if (null != page && null != page.getList()) { +// for (WxRentContract wrc: page.getList()) { +// if (null == hasFlow) { +// if(rentContractHasWorkFlow(wrc)) { +// hasFlow = 1; +// }else { +// hasFlow = 0; +// } +// } +// wrc.setFlowHas(hasFlow); +// } +// } +// +// return new ResultData(page); +// } @GetMapping("getDateDiff") @ApiImplicitParams({ @@ -121,39 +117,39 @@ public class WxRentContractController extends WxContractBaseController { * @param wxRentContract * @return */ - @PostMapping("add") - public ResultData add(@RequestBody WxRentContract wxRentContract) { - //WxMerchant wxMerchant = new WxMerchant(); - //wxMerchant.setName(wxRentContract.getMerchantName()); - //wxMerchant.setId(wxRentContract.getMerchantId()); -// if (wxMerchantService.hasMerchant(wxMerchant)) { -// return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); -// } - MallUserInfo user = getUser(); - wxRentContract.updateTenantInfo(user); - wxRentContract.setAdjustPeriodHandle(); - Date oldDate = wxRentContract.getRentalStartDate(); - wxRentContract.setRentStartType(EnumRentStartType.RENTTIME.getCode()); -// if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ -// wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); -// } - try { - rentContractValidShop(wxRentContract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - return wxRentContractService.save(wxRentContract, user,user.getName(),oldDate); - } +// @PostMapping("add") +// public ResultData add(@RequestBody WxRentContract wxRentContract) { +// //WxMerchant wxMerchant = new WxMerchant(); +// //wxMerchant.setName(wxRentContract.getMerchantName()); +// //wxMerchant.setId(wxRentContract.getMerchantId()); +//// if (wxMerchantService.hasMerchant(wxMerchant)) { +//// return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); +//// } +// MallUserInfo user = getUser(); +// wxRentContract.updateTenantInfo(user); +// wxRentContract.setAdjustPeriodHandle(); +// Date oldDate = wxRentContract.getRentalStartDate(); +// wxRentContract.setRentStartType(EnumRentStartType.RENTTIME.getCode()); +//// if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +//// wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); +//// } +// try { +// rentContractValidShop(wxRentContract); +// } catch (Exception e) { +// return new ResultData(Result.ERROR,e.getMessage()); +// } +// return wxRentContractService.save(wxRentContract, user,user.getName(),oldDate); +// } - /** - * 计算价格 - */ - @PostMapping("calcutePrice") - public ResultData calcutePrice(@RequestBody WxRentContract wxRentContract) { - wxRentContract.calcutePrice(); - return new ResultData(wxRentContract.getPrice()); - } +// /** +// * 计算价格 +// */ +// @PostMapping("calcutePrice") +// public ResultData calcutePrice(@RequestBody WxRentContract wxRentContract) { +// wxRentContract.calcutePrice(); +// return new ResultData(wxRentContract.getPrice()); +// } /** * 获取免租期 @@ -165,142 +161,142 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(wxRentContractService.getFreePeriods(contract)); } - /** - * 设置免租期 - * @param wxRentContract - * @return - */ - @PostMapping("setFreePeriod") - public ResultData setFreePeriod(@RequestBody WxRentContract wxRentContract) { - wxRentContract.updateTenantInfo(getTenantInfo()); - wxRentContractService.saveFreePeriods(wxRentContract); - return new ResultData(); - } - +// /** +// * 设置免租期 +// * @param wxRentContract +// * @return +// */ +// @PostMapping("setFreePeriod") +// public ResultData setFreePeriod(@RequestBody WxRentContract wxRentContract) { +// wxRentContract.updateTenantInfo(getTenantInfo()); +// wxRentContractService.saveFreePeriods(wxRentContract); +// return new ResultData(); +// } +// /** * 新增第二步 防止前端3秒重复提交 * @param wxRentContract * @return */ - @PostMapping("updateMoney") - public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); - 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(); - wxRentContract.calcutePrice(); - //wxRentContract.setRentPriceHandle(); - wxRentContract.calcuteDepositTotal(); - Date oldDate = wxRentContract.getRentalStartDate(); - if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ - wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); - } - wxRentContract.setOperationType(null); - if (null == wxRentContract.getDayPriceCalcute()){ - wxRentContract.setDayPriceCalcute(EnumRentDayPriceCalcute.REAL_DAYS.getCode()); - } - if (wxRentContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode().intValue() && null == wxRentContract.getMonthAverageDays()) { - return new ResultData(Result.ERROR,"请填写月平均天数"); - } - - return wxRentContractService.update(wxRentContract, user,user.getName(),EnumFromType.OTHER.getCode(),oldDate,false,true); - } +// @PostMapping("updateMoney") +// public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); +// 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(); +// wxRentContract.calcutePrice(); +// //wxRentContract.setRentPriceHandle(); +// wxRentContract.calcuteDepositTotal(); +// Date oldDate = wxRentContract.getRentalStartDate(); +// if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +// wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); +// } +// wxRentContract.setOperationType(null); +// if (null == wxRentContract.getDayPriceCalcute()){ +// wxRentContract.setDayPriceCalcute(EnumRentDayPriceCalcute.REAL_DAYS.getCode()); +// } +// if (wxRentContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode().intValue() && null == wxRentContract.getMonthAverageDays()) { +// return new ResultData(Result.ERROR,"请填写月平均天数"); +// } +// +// return wxRentContractService.update(wxRentContract, user,user.getName(),EnumFromType.OTHER.getCode(),oldDate,false,true); +// } - //切换生成账单方式 - @PostMapping("updateRentStartTime") - public ResultData updateRentStartTime(@RequestBody WxRentContract wxRentContract) { - MallUserInfo user = getUser(); - wxRentContract.updateTenantInfo(user); - return wxRentContractService.updateRentStartTime(wxRentContract, user); - } +// //切换生成账单方式 +// @PostMapping("updateRentStartTime") +// public ResultData updateRentStartTime(@RequestBody WxRentContract wxRentContract) { +// MallUserInfo user = getUser(); +// wxRentContract.updateTenantInfo(user); +// return wxRentContractService.updateRentStartTime(wxRentContract, user); +// } /** * 新增第三步 * @param wxRentContract * @return */ - @PostMapping("updateFile") - public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); - MallUserInfo user = getUser(); - wxRentContract.updateTenantInfo(user); - //wxRentContract.setAdjustPeriodHandle(); - //wxRentContract.setRentPriceHandle(); -// Date oldDate = wxRentContract.getRentalStartDate(); -// if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ -// wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); +// @PostMapping("updateFile") +// public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); +// MallUserInfo user = getUser(); +// wxRentContract.updateTenantInfo(user); +// //wxRentContract.setAdjustPeriodHandle(); +// //wxRentContract.setRentPriceHandle(); +//// Date oldDate = wxRentContract.getRentalStartDate(); +//// if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +//// wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); +//// } +// //wxRentContract.setRentShopType(null); +// //wxRentContract.setOperationType(null); +// +// return wxRentContractService.updateFile(wxRentContract, user,user.getName(),true); +// } + +// @GetMapping("/findById") +// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) +// public ResultData findById(Long id,Integer noBillList) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::findById"); +// // 同步欠缴状态 +//// WxAllBill wxBillRent = new WxAllBill(); +//// wxBillRent.updateTenantInfo(getTenantInfo()); +//// wxBillRentService.updateBillStatus(wxBillRent); +// try { +// Map data = wxRentContractService.getById(id,noBillList); +// return new ResultData(data); +// } catch (MallinkException e) { +// logger.error(e.getMessage()); +// return new ResultData(e.getErrorCode(), e.getMessage()); // } - //wxRentContract.setRentShopType(null); - //wxRentContract.setOperationType(null); - - return wxRentContractService.updateFile(wxRentContract, user,user.getName(),true); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id,Integer noBillList) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::findById"); - // 同步欠缴状态 -// WxAllBill wxBillRent = new WxAllBill(); -// wxBillRent.updateTenantInfo(getTenantInfo()); -// wxBillRentService.updateBillStatus(wxBillRent); - try { - Map data = wxRentContractService.getById(id,noBillList); - return new ResultData(data); - } catch (MallinkException e) { - logger.error(e.getMessage()); - return new ResultData(e.getErrorCode(), e.getMessage()); - } - } +// } - @PostMapping("update") - @SystemControllerLog(description = "租赁合同-更新") - public ResultData update(@RequestBody WxRentContract rentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); - - WxRentContract cure = wxRentContractService.getSimpleDeatil(rentContract.getId()); - if (null == cure) { - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"租赁合同未查询到"); - } - - if (cure.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()|| - cure.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || - (cure.getStatus().intValue() == EnumRentContractStatus.PERFORMANCE.getCode().intValue() - && (cure.getApplyStatus().intValue()== EnumRentContractAppStatus.REJECT.getCode().intValue() || - cure.getApplyStatus().intValue()== EnumRentContractAppStatus.SETBACK.getCode().intValue()))) { - MallUserInfo user = getUser(); - rentContract.updateTenantInfo(user); - rentContract.setAdjustPeriodHandle(); - //rentContract.setRentPriceHandle(); - Date oldDate = rentContract.getRentalStartDate(); - if(rentContract.getRentStartType()!=null && rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ - rentContract.setRentalStartDate(rentContract.getStartDate()); - } - - try { - rentContractValidShop(rentContract); - } catch (Exception e) { - return new ResultData(Result.ERROR,e.getMessage()); - } - - ResultData update = null; - try { - update = wxRentContractService.updateOneStep(rentContract, user, user.getName(), EnumFromType.OTHER.getCode(), oldDate,false); - } catch (MallinkException e) { - return new ResultData(update.code,update.message); - } - return update; - }else { - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"当前合同状态不允许修改"); - } - } +// @PostMapping("update") +// @SystemControllerLog(description = "租赁合同-更新") +// public ResultData update(@RequestBody WxRentContract rentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); +// +// WxRentContract cure = wxRentContractService.getSimpleDeatil(rentContract.getId()); +// if (null == cure) { +// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"租赁合同未查询到"); +// } +// +// if (cure.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()|| +// cure.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || +// (cure.getStatus().intValue() == EnumRentContractStatus.PERFORMANCE.getCode().intValue() +// && (cure.getApplyStatus().intValue()== EnumRentContractAppStatus.REJECT.getCode().intValue() || +// cure.getApplyStatus().intValue()== EnumRentContractAppStatus.SETBACK.getCode().intValue()))) { +// MallUserInfo user = getUser(); +// rentContract.updateTenantInfo(user); +// rentContract.setAdjustPeriodHandle(); +// //rentContract.setRentPriceHandle(); +// Date oldDate = rentContract.getRentalStartDate(); +// if(rentContract.getRentStartType()!=null && rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +// rentContract.setRentalStartDate(rentContract.getStartDate()); +// } +// +// try { +// rentContractValidShop(rentContract); +// } catch (Exception e) { +// return new ResultData(Result.ERROR,e.getMessage()); +// } +// +// ResultData update = null; +// try { +// update = wxRentContractService.updateOneStep(rentContract, user, user.getName(), EnumFromType.OTHER.getCode(), oldDate,false); +// } catch (MallinkException e) { +// return new ResultData(update.code,update.message); +// } +// return update; +// }else { +// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"当前合同状态不允许修改"); +// } +// } /** * 作废 @@ -326,20 +322,6 @@ public class WxRentContractController extends WxContractBaseController { wxRentContractService.updateRentContract(contract); //删除预览的账单 wxRentContractService.deletePrewBill(contract); - - if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - if (null != wxRentContract.getPropertyId()) { - WxPropertyContract propertyContract = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); - propertyContract.setStatus(EnumRentContractStatus.INVALID.getCode()); - - propertyContract.setUpdatetime(new Date()); - propertyContract.setUpdateBy(user.getId()); - wxPropertyContractService.updatePropertyContract(propertyContract); - - //删除预览的账单 - wxPropertyContractService.deletePreviewBill(propertyContract); - } - } return new ResultData(); }else { return new ResultData(Result.ERROR, "合同状态不允许作废.只能作废草稿或者履约拒绝的合同。"); @@ -360,13 +342,6 @@ public class WxRentContractController extends WxContractBaseController { } wxRentContract.updateTenantInfo(contract); wxRentContractService.endContract(wxRentContract,this.getUser()); - //租金+物业的终止 - if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - WxPropertyContract wpc = new WxPropertyContract(); - wpc.setId(wxRentContract.getPropertyId()); - wpc.setEndContractTime(wxRentContract.getEndContractTime()); - wxPropertyContractService.endContract(wpc,this.getUser()); - } return new ResultData(); } @@ -410,17 +385,6 @@ public class WxRentContractController extends WxContractBaseController { if (contract.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"租赁合同状态为草稿才能进行此操作"); } -// //店铺是否存在其他有效合同里面 -// boolean result = wxRentContractService.hasOtherValidContractShop(contract); -// if (result) { -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"店铺已经在其他计租中或者已签约未到期的合同里面了。"); -// } - -// try { -// validConfilit(contract); -// } catch (Exception e) { -// return new ResultData(Result.ERROR,e.getMessage()); -// } try { rentContractValidShop(contract); @@ -428,50 +392,10 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(Result.ERROR,e.getMessage()); } - //如果是租金+物业合同,如果没有物业合同或者物业合同不是草稿状态,不能提交审核 - if (contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - if (null == wxRentContract.getPropertyId()) { - return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); - } - WxPropertyContract property = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); - if (null == property) { - return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); - } - if (property.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { - return new ResultData(Result.ERROR,"物业合同未完善,请先完善。"); - } - if (property.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { - return new ResultData(Result.ERROR,"物业合同当前状态不能直接生效。"); - } - } - wxRentContractService.updateRentContractStatus(wxRentContract.getId(),false); - if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - wxPropertyContractService.updatePropertyContractStatus(wxRentContract.getPropertyId()); - } return new ResultData(Result.SUCCESS,"合同生效成功!"); } -// private void validConfilit(WxRentContract rentContract) throws Exception { -// //判断是否该合同的时间和有效的合同是否冲突 -// List shopIds = rentContract.shopIdsByRentInfo(); -// for (Long sid: shopIds) { -// WxRentContract rcq = new WxRentContract(); -// rcq.setStatuss(EnumRentContractStatus.getValidStatus()); -// rcq.setQueryShopId(sid); -// List crcs = wxRentContractService.findList(rcq); -// if (null != crcs) { -// for (WxRentContract crc : crcs) { -// if((rentContract.getRentalEndDate().before(crc.getRentalStartDate()) && rentContract.getRentalStartDate().after(new Date())) || -// rentContract.getRentalStartDate().after(crc.getRentalEndDate())) { -// }else { -// throw new MallinkException(Result.ERROR, "店铺["+sid+"]的计租时间区间与合同["+crc.getContractNumber()+"]有冲突。"); -// } -// } -// } -// } -// } - @PostMapping("apply") public ResultData apply(@RequestBody WxRentContract wxRentContract) { WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); @@ -484,44 +408,14 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"租赁合同不存在工作流,不能提交审批。"); } -// try { -// validConfilit(rentContract); -// } catch (Exception e) { -// return new ResultData(Result.ERROR,e.getMessage()); -// } - try { rentContractValidShop(rentContract); } catch (Exception e) { return new ResultData(Result.ERROR,e.getMessage()); } - //如果是租金+物业合同,如果没有物业合同或者物业合同不是草稿状态,不能提交审核 - if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - if (null == wxRentContract.getPropertyId()) { - return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); - } - WxPropertyContract property = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); - if (null == property) { - return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); - } - if (property.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { - return new ResultData(Result.ERROR,"物业合同未完善,请先完善。"); - } - if (property.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { - return new ResultData(Result.ERROR,"物业合同当前状态不能提交审批。"); - } - } WxContractCustomers customers = wxAgileContractService.findCustomers(rentContract, rentContract.getCustomersId()); - - if(rentContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue() || - rentContract.getOperationType().intValue() == EnumContractOperationType.JINMAO.getCode().intValue()) { - rentContract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_RENT_CONTRACT, EnumFlowContractType.RENT,EnumRentAgileType.getEnum(rentContract.getAgileType()), wxRentContract.getRemark(), wxRentContract.getId(),null)); - }else if(rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()){ - rentContract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NNEW_RENT_CONTRACT, EnumFlowContractType.WHOLE_SHOP, EnumRentAgileType.getEnum(rentContract.getAgileType()),wxRentContract.getRemark(), wxRentContract.getId(),wxRentContract.getPropertyId())); - }else { - return new ResultData(Result.ERROR,"合同操作类型非法。"); - } + rentContract.setFlowParams(generateFlowParams(customers,EnumFlowKey.NEW_RENT_CONTRACT, EnumFlowContractType.RENT, wxRentContract.getRemark(), wxRentContract.getId(),null)); return wxRentContractService.apply(rentContract,user); } @@ -556,22 +450,6 @@ public class WxRentContractController extends WxContractBaseController { if (rentContract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { return new ResultData(Result.ERROR,"租金合同未完善,请先完善。"); } - WxPropertyContract property = null; - if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - - WxPropertyContract pq = new WxPropertyContract(); - pq.updateTenantInfo(rentContract); - pq.setOperationType(EnumContractOperationType.WHOLE.getCode()); - pq.setRentContractId(wxRentContract.getId()); - List pclist = wxPropertyContractService.findList(pq); - if (null == pclist || pclist.size() <= 0 ) { - return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); - } - property = pclist.get(0); - if (property.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { - return new ResultData(Result.ERROR,"物业合同未完善,请先完善。"); - } - } MallUserInfo user = getUser(); @@ -590,7 +468,7 @@ public class WxRentContractController extends WxContractBaseController { } try { - wxRentContractService.renewal(rentContract,property,user); + wxRentContractService.renewal(rentContract,user); }catch(Exception e) { logger.error("renewal error.",e); return new ResultData(Result.ERROR,e.getMessage()); @@ -632,40 +510,38 @@ public class WxRentContractController extends WxContractBaseController { } - - - @GetMapping("getRentContractList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData getRentContractList(@ModelAttribute WxRentContract wxRentContract, Integer validStatus, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractList"); - if (null == wxRentContract) wxRentContract = new WxRentContract(); - wxRentContract.updateTenantInfo(getTenantInfo()); - if (StringUtils.isNotBlank(wxRentContract.getOnlyPropertyContractId()) && (!"undefined".equals(wxRentContract.getOnlyPropertyContractId()))) { - try { - Long contractId = Long.parseLong(wxRentContract.getOnlyPropertyContractId()); - if (contractId > 0 ) { - wxRentContract.setId(contractId); - } - } catch (NumberFormatException e) { - } - - } else { - //正常状态, 物业合同 - if (validStatus != null && 1 == validStatus) { - wxRentContract.setStatuss(EnumRentContractStatus.getValidStatus()); - //续签的合同,包括正常到期 - }else if (validStatus != null && 2== validStatus) { - List statuss = EnumRentContractStatus.getValidStatus(); - statuss.add(EnumRentContractStatus.OUT_DATE.getCode()); - wxRentContract.setStatuss(statuss); - } - } - - wxRentContract.setSortColumns(SortField.Createtime_DESC); - return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); - } +// @GetMapping("getRentContractList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) +// public ResultData getRentContractList(@ModelAttribute WxRentContract wxRentContract, Integer validStatus, Integer pageNum, Integer pageSize) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractList"); +// if (null == wxRentContract) wxRentContract = new WxRentContract(); +// wxRentContract.updateTenantInfo(getTenantInfo()); +// if (StringUtils.isNotBlank(wxRentContract.getOnlyPropertyContractId()) && (!"undefined".equals(wxRentContract.getOnlyPropertyContractId()))) { +// try { +// Long contractId = Long.parseLong(wxRentContract.getOnlyPropertyContractId()); +// if (contractId > 0 ) { +// wxRentContract.setId(contractId); +// } +// } catch (NumberFormatException e) { +// } +// +// } else { +// //正常状态, 物业合同 +// if (validStatus != null && 1 == validStatus) { +// wxRentContract.setStatuss(EnumRentContractStatus.getValidStatus()); +// //续签的合同,包括正常到期 +// }else if (validStatus != null && 2== validStatus) { +// List statuss = EnumRentContractStatus.getValidStatus(); +// statuss.add(EnumRentContractStatus.OUT_DATE.getCode()); +// wxRentContract.setStatuss(statuss); +// } +// } +// +// wxRentContract.setSortColumns(SortField.Createtime_DESC); +// return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); +// } @GetMapping("getPayAccountInfo") @SystemControllerLog(description = "租赁合同-获取甲方账户") @@ -689,30 +565,30 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(map); } - @GetMapping("/hasRentStatus") - public ResultData hasRentStatus(@ModelAttribute WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::hasRentStatus"); - wxRentContract.updateTenantInfo(getTenantInfo()); - return wxRentContractService.hasRentStatus(wxRentContract); - } +// @GetMapping("/hasRentStatus") +// public ResultData hasRentStatus(@ModelAttribute WxRentContract wxRentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::hasRentStatus"); +// wxRentContract.updateTenantInfo(getTenantInfo()); +// return wxRentContractService.hasRentStatus(wxRentContract); +// } - @GetMapping("/hasContractNumber") - public ResultData hasContractNumber(@ModelAttribute WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::hasContractNumber"); - wxRentContract.updateTenantInfo(getTenantInfo()); - return wxRentContractService.hasContractNumber(wxRentContract); - } - - @GetMapping("getMerchantList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) - public ResultData getMerchantList(Integer shopType) throws Exception{ - WxMerchant wxMerchant = new WxMerchant(); - wxMerchant.updateTenantInfo(getTenantInfo()); - wxMerchant.setRentShopType(shopType); - wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); - return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.getMerchantList(wxMerchant)); - } +// @GetMapping("/hasContractNumber") +// public ResultData hasContractNumber(@ModelAttribute WxRentContract wxRentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::hasContractNumber"); +// wxRentContract.updateTenantInfo(getTenantInfo()); +// return wxRentContractService.hasContractNumber(wxRentContract); +// } + +// @GetMapping("getMerchantList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) +// public ResultData getMerchantList(Integer shopType) throws Exception{ +// WxMerchant wxMerchant = new WxMerchant(); +// wxMerchant.updateTenantInfo(getTenantInfo()); +// wxMerchant.setRentShopType(shopType); +// wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); +// return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.getMerchantList(wxMerchant)); +// } @PostMapping("savePayAccountInfo") public ResultData savePayAccountInfo(@RequestBody WxPayAccountBill payAccountBill) { @@ -736,34 +612,34 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(); } - @GetMapping("/getContractByContractNumber") - public ResultData getContractByContractNumber(@ModelAttribute WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] WxRentContractController::getContractByContractNumber"); - wxRentContract.updateTenantInfo(getTenantInfo()); - return wxRentContractService.getContractByContractNumber(wxRentContract); - } +// @GetMapping("/getContractByContractNumber") +// public ResultData getContractByContractNumber(@ModelAttribute WxRentContract wxRentContract) { +// logger.debug("[" + getIpAddr() + "] WxRentContractController::getContractByContractNumber"); +// wxRentContract.updateTenantInfo(getTenantInfo()); +// return wxRentContractService.getContractByContractNumber(wxRentContract); +// } - @GetMapping("/init") - @TenantIgnore - public ResultData init() { - List clist = wxRentContractService.findList(new WxRentContract()); - for (WxRentContract wrc: clist) { - List shopIds = wrc.shopIdsByRentInfo(); - if (null != shopIds) { - List shops = wxShopService.getByIds(this.getTenantInfo(),shopIds); - String shopIdstr = ""; - for (WxShop shop : shops) { - shopIdstr = shopIdstr +","+shop.getId(); - } - if(!StringUtils.isBlank(shopIdstr)) { - wrc.setShopIdStr(shopIdstr); - wxRentContractService.updateRentContract(wrc); - } - } - } - return new ResultData(); - } +// @GetMapping("/init") +// @TenantIgnore +// public ResultData init() { +// List clist = wxRentContractService.findList(new WxRentContract()); +// for (WxRentContract wrc: clist) { +// List shopIds = wrc.shopIdsByRentInfo(); +// if (null != shopIds) { +// List shops = wxShopService.getByIds(this.getTenantInfo(),shopIds); +// String shopIdstr = ""; +// for (WxShop shop : shops) { +// shopIdstr = shopIdstr +","+shop.getId(); +// } +// if(!StringUtils.isBlank(shopIdstr)) { +// wrc.setShopIdStr(shopIdstr); +// wxRentContractService.updateRentContract(wrc); +// } +// } +// } +// return new ResultData(); +// } //查询联营扣点,联营取高的合同 @GetMapping("getRevenueContractList") @@ -783,7 +659,8 @@ public class WxRentContractController extends WxContractBaseController { //statusList.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); wxRentContract.setStatuss(statusList); wxRentContract.setSortColumns(SortField.Createtime_DESC); - return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); + //return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); + return new ResultData(); } //查询联营扣点,联营取高的合同账单周期 @@ -874,32 +751,32 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(retMap); } - //查询商户计租合同列表 - @GetMapping("revenuePropertyContract") - public ResultData revenuePropertyContract(@ModelAttribute WxRentContract rentContract) { - if (null == rentContract) rentContract = new WxRentContract(); - rentContract.updateTenantInfo(getTenantInfo()); - WxRentContract contract = wxRentContractService.selectById(rentContract.getId()); - //纯联营扣点方式,不能加物业费一起算 - if (contract.getType().intValue() == EnumRentContractType.RENT_BY_JOINT.getCode()) { - return new ResultData(); - } - WxPropertyContract bq = new WxPropertyContract(); - bq.updateTenantInfo(rentContract); - bq.setRentContractId(rentContract.getId()); - bq.setOperationType(EnumContractOperationType.WHOLE.getCode()); - //包括提前终止的,租金+物业合同是一对一的 - List statusList = new ArrayList(); - statusList.add(EnumRentContractStatus.PAING.getCode()); - statusList.add(EnumRentContractStatus.TERMINATE.getCode()); - //bq.setStatus(EnumRentContractStatus.PAING.getCode()); - bq.setStatuss(statusList); - List propertyList = wxPropertyContractService.findList(bq); - if (null != propertyList && propertyList.size() > 0 ) { - return new ResultData(propertyList.get(0)); - } - return new ResultData(); - } +// //查询商户计租合同列表 +// @GetMapping("revenuePropertyContract") +// public ResultData revenuePropertyContract(@ModelAttribute WxRentContract rentContract) { +// if (null == rentContract) rentContract = new WxRentContract(); +// rentContract.updateTenantInfo(getTenantInfo()); +// WxRentContract contract = wxRentContractService.selectById(rentContract.getId()); +// //纯联营扣点方式,不能加物业费一起算 +// if (contract.getType().intValue() == EnumRentContractType.RENT_BY_JOINT.getCode()) { +// return new ResultData(); +// } +// WxPropertyContract bq = new WxPropertyContract(); +// bq.updateTenantInfo(rentContract); +// bq.setRentContractId(rentContract.getId()); +// bq.setOperationType(EnumContractOperationType.WHOLE.getCode()); +// //包括提前终止的,租金+物业合同是一对一的 +// List statusList = new ArrayList(); +// statusList.add(EnumRentContractStatus.PAING.getCode()); +// statusList.add(EnumRentContractStatus.TERMINATE.getCode()); +// //bq.setStatus(EnumRentContractStatus.PAING.getCode()); +// bq.setStatuss(statusList); +// List propertyList = wxPropertyContractService.findList(bq); +// if (null != propertyList && propertyList.size() > 0 ) { +// return new ResultData(propertyList.get(0)); +// } +// return new ResultData(); +// } /** * 扣点设置销售额重新计算 @@ -915,16 +792,16 @@ public class WxRentContractController extends WxContractBaseController { if (null == wxRentContract.getSalesStartTime() || null == wxRentContract.getSalesEndTime()) { return new ResultData(Result.ERROR, "时间不能为空"); } - return new ResultData(wxRentContractService.setRevenueSales(this.getUser(),rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime(),wxRentContract.getPropertyContractId())); + return new ResultData(wxRentContractService.setRevenueSales(this.getUser(),rentContract,wxRentContract.getSalesMoney(),wxRentContract.getSalesStartTime(),wxRentContract.getSalesEndTime())); } - //查询合同年限 - @GetMapping("getContractYears") - public ResultData getContractYears(@ModelAttribute WxRentContract wxRentContract) { - if (null == wxRentContract) wxRentContract = new WxRentContract(); - WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); - return new ResultData(wxRentContractService.getRentContractYears(rentContract)); - } +// //查询合同年限 +// @GetMapping("getContractYears") +// public ResultData getContractYears(@ModelAttribute WxRentContract wxRentContract) { +// if (null == wxRentContract) wxRentContract = new WxRentContract(); +// WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); +// return new ResultData(wxRentContractService.getRentContractYears(rentContract)); +// } //查询合同年限已输入销售额情况 @PostMapping("getContractYearsSales") @@ -968,7 +845,6 @@ public class WxRentContractController extends WxContractBaseController { if (null == jumpList || jumpList.size() <= 0 ) { return new ResultData(Result.ERROR, "合同未设置跳点,不用做汇算"); } - rentContract.setPropertyContractId(wxRentContract.getPropertyContractId()); return new ResultData(wxRentContractService.calcuteYearsRevenueRentUp(this.getUser(),rentContract)); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractDepositTypeController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractDepositTypeController.java deleted file mode 100644 index 846049dcf..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractDepositTypeController.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.iformall.controller.contract; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumFeesStandardsCalcuteUnit; -import com.iformall.enums.EnumFeesStandardsTimeUnit; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.*; - -import io.swagger.annotations.ApiOperation; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -/** - */ -@RestController -@RequestMapping("wxRentContractDepositType") -public class WxRentContractDepositTypeController extends WxContractBaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxEnergyService wxEnergyService; - - /** - * 押金类型 - * @return - */ - @GetMapping("list") - public ResultData billTypes() { - WxEnergyFees dt = new WxEnergyFees(); - dt.updateTenantInfo(getTenantInfo()); - dt.setIsDel(EnumYesOrNo.NO.getCode()); - dt.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); - dt.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxEnergyService.feesListAsPage(dt, 1, 100,false); - if (null == page) { - return new ResultData(); - } - return new ResultData(page.getList()); - } - - @ApiOperation("查询物业合同计量单位列表") - @GetMapping("typeCalcuteUnitList") - public ResultData typeCalcuteUnitList() { - List enumList = EnumBillAllType.getCalucuteUnites(EnumBillAllType.RENT_DEPOSIT.getCode()); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsCalcuteUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } - - @ApiOperation("查询物业合同时间单位列表") - @GetMapping("typeTimeUnitList") - public ResultData typeTimeUnitList() { - List enumList = EnumBillAllType.getTimeUnites(EnumBillAllType.RENT_DEPOSIT.getCode()); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsTimeUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } - -} - - diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java deleted file mode 100644 index 3493bfbff..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.iformall.controller.contract; - -import com.alibaba.fastjson.JSONArray; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.annotation.UserDataRuleAnnotation; -import com.iformall.common.ResultData; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxRentPropertyContractVo; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumShopSellStatus; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxMallBuildingService; -import com.iformall.service.WxMallFloorService; -import com.iformall.service.WxRentPropertyContractService; -import com.iformall.service.WxShopService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxRentPropertyContract") -public class WxRentPropertyContractController extends WxContractBaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxRentPropertyContractService wxRentPropertyContractService; - @Autowired - WxMallBuildingService buildingService; - @Autowired - WxMallFloorService floorService; - @Autowired - private WxShopService wxShopService; - - @GetMapping("/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData list(@ModelAttribute WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::list"); - if (null == wxRentPropertyContractVo) { - wxRentPropertyContractVo = new WxRentPropertyContractVo(); - } - wxRentPropertyContractVo.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxRentPropertyContractVo.setFloorForRule(dataRule.getFloorIds()); - wxRentPropertyContractVo.setBusinessForRule(dataRule.getBussinessIds()); - wxRentPropertyContractVo.setShopTypeForRule(dataRule.getShopTypes()); - } - PageInfo page = wxRentPropertyContractService.listContractVo(wxRentPropertyContractVo, pageNum, pageSize); - Integer hasFlow = null; - if (null != page && null != page.getList()) { - for (WxRentPropertyContractVo wrc: page.getList()) { - if (null == hasFlow) { - if(rentPropertyHasWorkFlow(wrc)) { - hasFlow = 1; - }else { - hasFlow = 0; - } - } - wrc.setFlowHas(hasFlow); - String renInfo = wrc.getRentInfo(); - if (!StringUtils.isBlank(renInfo)) { - String floorName = ""; - String buildingName = ""; - String shopNumber = ""; - JSONArray arrays = JSONArray.parseArray(renInfo); - if ( null != arrays) { - List floorIds = new ArrayList(); - List buildIds = new ArrayList(); - List shopIds = new ArrayList(); - wrc.setFloorName(floorName); - wrc.setBuildingName(buildingName); - wrc.setShopNumber(shopNumber); - } - - } - } - } - - return new ResultData(page); - } - - @ApiOperation("根据id查询接口") - @GetMapping("/findById") - @ApiImplicitParams({ - @ApiImplicitParam(name = "rentId", value = "租金合同编号", dataType = "Long", paramType = "query", required = false), - @ApiImplicitParam(name = "propertyId", value = "物业合同编号", dataType = "Long", paramType = "query", required = false), - @ApiImplicitParam(name = "id", value = "租金合同编号(工作流用)", dataType = "String", paramType = "query", required = false)}) - public ResultData findById(String id) { - logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::findById"); - //if (null != rentId || null != propertyId) { - // return wxRentPropertyContractService.getContractInfo(rentId,propertyId); - //}else - if (!StringUtils.isBlank(id)) { - //租金+物业工作流查询会传此id - String[] ids = id.split("_RP_"); - if (ids.length == 2 ) { - Long rId = Long.parseLong(ids[0]); - Long pId = Long.parseLong(ids[1]); - return wxRentPropertyContractService.getContractInfo(rId,pId); - } - } - return new ResultData(); - } - - @ApiOperation("合同审批详情") - @GetMapping("/getContractApplyInfo") - @ApiImplicitParams({ - @ApiImplicitParam(name = "rentId", value = "租金合同编号", dataType = "Long", paramType = "query", required = true), - @ApiImplicitParam(name = "propertyId", value = "物业合同编号", dataType = "Long", paramType = "query", required = true)}) - public ResultData getContractApplyInfo(Long rentId,Long propertyId) { - logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::getContractApplyInfo"); - return wxRentPropertyContractService.getContractApplyInfo(rentId,propertyId); - } - - @PostMapping("insertRentForCreate") - @SystemControllerLog(description = "租赁合同-添加") - public ResultData insertRent(@RequestBody WxRentContract wxRentContract) { - logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::insertRentForCreate"); - MallUserInfo user = getUser(); - wxRentContract.updateTenantInfo(user); - return wxRentPropertyContractService.insertRentForCreate(wxRentContract); - } - -} - - diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java index 7e52eb26f..2bbcef4b1 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java @@ -5,8 +5,8 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxEnergyFeesShop; +import com.iformall.domain.po.WxFinanceFees; +import com.iformall.domain.po.WxFeesCalcuteShop; import com.iformall.domain.po.WxEnergyFeesTime; import com.iformall.domain.po.WxEnergyMeter; import com.iformall.domain.po.WxEnergyMeterChild; @@ -18,7 +18,6 @@ import com.iformall.domain.po.WxMallFloor; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.WxUserDataRule; import com.iformall.domain.po.base.BaseEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumEnergyMeterPhysicsType; import com.iformall.enums.EnumEnergyMeterShopFloorType; import com.iformall.enums.EnumEnergyMeterType; @@ -376,7 +375,7 @@ public class WxEnergyController extends BaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData shopFeesList(@ModelAttribute WxEnergyFeesShop record, Integer pageNum, Integer pageSize) { + public ResultData shopFeesList(@ModelAttribute WxFeesCalcuteShop record, Integer pageNum, Integer pageSize) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); if (StringUtils.isNotBlank(record.getFeesIdsStr())) { @@ -389,7 +388,7 @@ public class WxEnergyController extends BaseController { record.setFeesIds(feesIdList); } } - PageInfo list = wxEnergyService.feesShopListAsPage(record,pageNum,pageSize); + PageInfo list = wxEnergyService.feesShopListAsPage(record,pageNum,pageSize); return new ResultData(list); } @@ -415,21 +414,21 @@ public class WxEnergyController extends BaseController { @ApiOperation("计费标准新增修改") @PostMapping("calcuteFeesShopEndTime") - public ResultData calcuteFeesShopEndTime(@RequestBody WxEnergyFeesShop record) { + public ResultData calcuteFeesShopEndTime(@RequestBody WxFeesCalcuteShop record) { return new ResultData(record.calcuteEndTime()); } @ApiOperation("计算公式组件") @GetMapping("feesShopComponentList") - public ResultData shopFeesList(@ModelAttribute WxEnergyFeesShop record) { + public ResultData shopFeesList(@ModelAttribute WxFeesCalcuteShop record) { record.updateTenantInfo(getTenantInfo()); return new ResultData(wxEnergyService.getFeesShopComponentList(record)); } @ApiOperation("计费标准新增修改") @PostMapping("createFeesShop") - public ResultData createFeesShop(@RequestBody WxEnergyFeesShop record) { + public ResultData createFeesShop(@RequestBody WxFeesCalcuteShop record) { record.updateTenantInfo(getTenantInfo()); wxEnergyService.createFeesShop(record); return new ResultData(); @@ -437,21 +436,21 @@ public class WxEnergyController extends BaseController { @ApiOperation("删除计费标准关联") @PostMapping("deleteFeesShop") - public ResultData deleteFeesShop(@RequestBody WxEnergyFeesShop record) { + public ResultData deleteFeesShop(@RequestBody WxFeesCalcuteShop record) { wxEnergyService.deleteFeesShop(record); return new ResultData(); } @ApiOperation("店铺计费标准详情") @GetMapping("feesShopDetail") - public ResultData feesShopDetail(@ModelAttribute WxEnergyFeesShop record) { + public ResultData feesShopDetail(@ModelAttribute WxFeesCalcuteShop record) { record.updateTenantInfo(getTenantInfo()); return new ResultData(wxEnergyService.getFeesShop(record.getId(),record.getTenantId())); } @ApiOperation("店铺修改计费标准") @PostMapping("updateFeesShop") - public ResultData updateFeesShop(@RequestBody WxEnergyFeesShop record) { + public ResultData updateFeesShop(@RequestBody WxFeesCalcuteShop record) { record.updateTenantInfo(getTenantInfo()); wxEnergyService.updateFeesShop(record); return new ResultData(); @@ -459,7 +458,7 @@ public class WxEnergyController extends BaseController { @ApiOperation("计费标准记录导出") @GetMapping("feesShopExport") - public void feesShopExport(@ModelAttribute WxEnergyFeesShop record, HttpServletRequest request, HttpServletResponse response) { + public void feesShopExport(@ModelAttribute WxFeesCalcuteShop record, HttpServletRequest request, HttpServletResponse response) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); if (StringUtils.isNotBlank(record.getFeesIdsStr())) { @@ -585,87 +584,76 @@ public class WxEnergyController extends BaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData feesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { + public ResultData feesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); if (null != record.getIsFeesShopQuery() && record.getIsFeesShopQuery() == EnumYesOrNo.YES.getCode()) { - List billTypeList = new ArrayList(); - billTypeList.add(EnumBillAllType.PROPERTY.getCode()); - billTypeList.add(EnumBillAllType.DAILY.getCode()); - billTypeList.add(EnumBillAllType.OTHER.getCode()); - record.setBillTypeList(billTypeList); - record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); - record.setFixedPrice(EnumYesOrNo.NO.getCode()); + //record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); + //record.setFixedPrice(EnumYesOrNo.NO.getCode()); }else { - record.setBillType(EnumBillAllType.DAILY.getCode()); } - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); + PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); return new ResultData(page); } @ApiOperation("科目新增") @PostMapping("saveFees") - public ResultData saveFees(@RequestBody WxEnergyFees record) { + public ResultData saveFees(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); - record.setBillType(EnumBillAllType.DAILY.getCode()); - if (null == record.getType()) { - return new ResultData(Result.ERROR,"请选择能源表类型"); - } - if (null == record.getFixedPrice()) { - return new ResultData(Result.ERROR,"请选择是否是一次性费用"); - } +// if (null == record.getFixedPrice()) { +// return new ResultData(Result.ERROR,"请选择是否是一次性费用"); +// } wxEnergyService.saveOrUpdateFees(record); return new ResultData(); } @ApiOperation("临时付款给商户科目新增") @PostMapping("saveToPayMerchantFees") - public ResultData saveToPayMerchantFees(@RequestBody WxEnergyFees record) { + public ResultData saveToPayMerchantFees(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); - record.setBillType(EnumBillAllType.TEMP_TO_PAYMERCHANT.getCode()); - record.setCashierType(EnumFinanceCashierType.PAY.getCode()); - record.setFixedPrice(EnumYesOrNo.YES.getCode()); + //record.setCashierType(EnumFinanceCashierType.PAY.getCode()); + //record.setFixedPrice(EnumYesOrNo.YES.getCode()); record.setIsDespoit(EnumYesOrNo.YES.getCode()); wxEnergyService.saveOrUpdateFees(record); return new ResultData(); } @PostMapping("feesUpdateIsDel") - public ResultData feesUpdateIsDel(@RequestBody WxEnergyFees record) { + public ResultData feesUpdateIsDel(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); wxEnergyService.setFeesIsDel(record); return new ResultData(); } - @ApiOperation("查询科目计量单位列表") - @GetMapping("feesCalcuteUnitList") - public ResultData typeCalcuteUnitList(Integer billType) { - List enumList = EnumBillAllType.getCalucuteUnites(billType); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsCalcuteUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } - - @ApiOperation("查询科目计算时间单位列表") - @GetMapping("feesTimeUnitList") - public ResultData typeTimeUnitList(Integer billType) { - List enumList = EnumBillAllType.getTimeUnites(billType); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsTimeUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } +// @ApiOperation("查询科目计量单位列表") +// @GetMapping("feesCalcuteUnitList") +// public ResultData typeCalcuteUnitList(Integer billType) { +// List enumList = EnumBillAllType.getCalucuteUnites(billType); +// if (null != enumList) { +// Map retMap = new HashMap(); +// for (int i = 0 ; i < enumList.size(); i++) { +// EnumFeesStandardsCalcuteUnit cu = enumList.get(i); +// retMap.put(cu.getCode(), cu.getMessage()); +// } +// return new ResultData(retMap); +// } +// return new ResultData(); +// } +// +// @ApiOperation("查询科目计算时间单位列表") +// @GetMapping("feesTimeUnitList") +// public ResultData typeTimeUnitList(Integer billType) { +// List enumList = EnumBillAllType.getTimeUnites(billType); +// if (null != enumList) { +// Map retMap = new HashMap(); +// for (int i = 0 ; i < enumList.size(); i++) { +// EnumFeesStandardsTimeUnit cu = enumList.get(i); +// retMap.put(cu.getCode(), cu.getMessage()); +// } +// return new ResultData(retMap); +// } +// return new ResultData(); +// } @ApiOperation("抄表数据分页列表接口") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java deleted file mode 100644 index 2f9a28072..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFeesStandardsController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.iformall.controller.market; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumFeesStandardsCalcuteUnit; -import com.iformall.enums.EnumFeesStandardsTimeUnit; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxEnergyService; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 物业合同的其他费用 - * @author Administrator - * - */ -@RestController -@RequestMapping("feesStandars") -public class WxFeesStandardsController extends BaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxEnergyService wxEnergyService; - - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - public ResultData list(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { - if (null == record) { - record = new WxEnergyFees(); - } - record.updateTenantInfo(getTenantInfo()); - record.setBillType(EnumBillAllType.PROPERTY.getCode()); - record.setIsDel(EnumYesOrNo.NO.getCode()); - record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); - return new ResultData(page); - } - - - @ApiOperation("查询物业合同费用标准列表") - @GetMapping("typeList") - public ResultData typeList() { - WxEnergyFees record = new WxEnergyFees(); - record.updateTenantInfo(getTenantInfo()); - record.setBillType(EnumBillAllType.PROPERTY.getCode()); - record.setIsDel(EnumYesOrNo.NO.getCode()); - record.setIsSystem(EnumYesOrNo.NO.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, 1, 100,false); - if (null != page) { - return new ResultData(page.getList()); - } - return new ResultData(); - } - - @ApiOperation("查询物业合同计量单位列表") - @GetMapping("typeCalcuteUnitList") - public ResultData typeCalcuteUnitList() { - List enumList = EnumBillAllType.getCalucuteUnites(EnumBillAllType.PROPERTY.getCode()); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsCalcuteUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } - - @ApiOperation("查询物业合同时间单位列表") - @GetMapping("typeTimeUnitList") - public ResultData typeTimeUnitList() { - List enumList = EnumBillAllType.getTimeUnites(EnumBillAllType.PROPERTY.getCode()); - if (null != enumList) { - Map retMap = new HashMap(); - for (int i = 0 ; i < enumList.size(); i++) { - EnumFeesStandardsTimeUnit cu = enumList.get(i); - retMap.put(cu.getCode(), cu.getMessage()); - } - return new ResultData(retMap); - } - return new ResultData(); - } -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java index a08be1eac..e3821040c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java @@ -10,7 +10,7 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinanceCheckOut; import com.iformall.domain.po.WxFinanceFinish; import com.iformall.domain.po.WxFinanceFinishReceive; @@ -28,7 +28,6 @@ import com.iformall.domain.vo.WxFinanceReceiveBillSum; import com.iformall.domain.vo.WxFinanceReceiveCountVo; import com.iformall.domain.vo.WxFinanceReceiveSumVo; import com.iformall.domain.vo.WxFinanceReceiveVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumFinanceCashierType; import com.iformall.enums.EnumFinanceFinishStatus; import com.iformall.enums.EnumFinanceReceiveStatus; @@ -74,45 +73,45 @@ public class WxFinanceController extends BaseController { @Autowired WxFlowService wxFlowService; - /** - * 账单合同类型(可自定义的) - * @return - */ - @GetMapping("contractBillTypes") - public ResultData contractBillTypes() { - List list = new ArrayList(); - for (EnumBillAllType t : EnumBillAllType.values()) { - if (t == EnumBillAllType.RENT_DEPOSIT || t == EnumBillAllType.PROPERTY) { - Map m = new HashMap(); - m.put("id", t.getCode()); - m.put("name", t.getMessage()); - m.put("isFixedPrice", t.isFixedPrice()); - m.put("isDeposit", t.isDeposit()); - list.add(m); - } - } - return new ResultData(list); - } - - /** - * 账单临时类型(可自定义的) - * @return - */ - @GetMapping("otherBillTypes") - public ResultData otherBillTypes() { - List list = new ArrayList(); - for (EnumBillAllType t : EnumBillAllType.values()) { - if (t == EnumBillAllType.OTHER || t == EnumBillAllType.OTHER_DEPOSIT) { - Map m = new HashMap(); - m.put("id", t.getCode()); - m.put("name", t.getMessage()); - m.put("isFixedPrice", t.isFixedPrice()); - m.put("isDeposit", t.isDeposit()); - list.add(m); - } - } - return new ResultData(list); - } +// /** +// * 账单合同类型(可自定义的) +// * @return +// */ +// @GetMapping("contractBillTypes") +// public ResultData contractBillTypes() { +// List list = new ArrayList(); +// for (EnumBillAllType t : EnumBillAllType.values()) { +// if (t == EnumBillAllType.RENT_DEPOSIT || t == EnumBillAllType.PROPERTY) { +// Map m = new HashMap(); +// m.put("id", t.getCode()); +// m.put("name", t.getMessage()); +// m.put("isFixedPrice", t.isFixedPrice()); +// m.put("isDeposit", t.isDeposit()); +// list.add(m); +// } +// } +// return new ResultData(list); +// } + +// /** +// * 账单临时类型(可自定义的) +// * @return +// */ +// @GetMapping("otherBillTypes") +// public ResultData otherBillTypes() { +// List list = new ArrayList(); +// for (EnumBillAllType t : EnumBillAllType.values()) { +// if (t == EnumBillAllType.OTHER || t == EnumBillAllType.OTHER_DEPOSIT) { +// Map m = new HashMap(); +// m.put("id", t.getCode()); +// m.put("name", t.getMessage()); +// m.put("isFixedPrice", t.isFixedPrice()); +// m.put("isDeposit", t.isDeposit()); +// list.add(m); +// } +// } +// return new ResultData(list); +// } @GetMapping("receiveCashierTypes") public ResultData receiveCashierTypes() { @@ -132,92 +131,73 @@ public class WxFinanceController extends BaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData contractFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { - record.updateTenantInfo(getTenantInfo()); - record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - //查询非能源费用科目 - List billTypeList = new ArrayList(); - billTypeList.add(EnumBillAllType.RENT_DEPOSIT.getCode()); - billTypeList.add(EnumBillAllType.PROPERTY.getCode()); - if (null != record.getIsAllList() && EnumYesOrNo.YES.getCode() == record.getIsAllList()) { - billTypeList.add(EnumBillAllType.RENT.getCode()); - billTypeList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - billTypeList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getCode()); - billTypeList.add(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); - } - record.setBillTypeList(billTypeList); - record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); - return new ResultData(page); - } - - @ApiOperation("其他费用科目列表") - @GetMapping("otherFeesList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - public ResultData otherFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { + public ResultData contractFeesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - //查询非能源费用科目 - List billTypeList = new ArrayList(); - billTypeList.add(EnumBillAllType.OTHER.getCode()); - billTypeList.add(EnumBillAllType.OTHER_DEPOSIT.getCode()); - record.setBillTypeList(billTypeList); - record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); + //record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); + PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); return new ResultData(page); } - @ApiOperation("预收科目列表") - @GetMapping("advanceFeesList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - public ResultData advanceTypeList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { - record.updateTenantInfo(getTenantInfo()); - record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - record.setBillType(EnumBillAllType.ADVANCE.getCode()); - record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); - return new ResultData(page); - } - - @ApiOperation("临时付款科目列表") - @GetMapping("toPayMerchantFeesList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - public ResultData toPayMerchantFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { - record.updateTenantInfo(getTenantInfo()); - record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - record.setBillType(EnumBillAllType.TEMP_TO_PAYMERCHANT.getCode()); - record.setCashierType(EnumFinanceCashierType.PAY.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); - return new ResultData(page); - } +// @ApiOperation("其他费用科目列表") +// @GetMapping("otherFeesList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), +// }) +// public ResultData otherFeesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { +// record.updateTenantInfo(getTenantInfo()); +// record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); +// record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); +// PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); +// return new ResultData(page); +// } +// +// @ApiOperation("预收科目列表") +// @GetMapping("advanceFeesList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), +// }) +// public ResultData advanceTypeList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { +// record.updateTenantInfo(getTenantInfo()); +// record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); +// record.setBillType(EnumBillAllType.ADVANCE.getCode()); +// record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); +// PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); +// return new ResultData(page); +// } +// +// @ApiOperation("临时付款科目列表") +// @GetMapping("toPayMerchantFeesList") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), +// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), +// }) +// public ResultData toPayMerchantFeesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { +// record.updateTenantInfo(getTenantInfo()); +// record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); +// record.setBillType(EnumBillAllType.TEMP_TO_PAYMERCHANT.getCode()); +// record.setCashierType(EnumFinanceCashierType.PAY.getCode()); +// PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,true); +// return new ResultData(page); +// } @ApiOperation("费用区间列表") @PostMapping("saveFees") - public ResultData saveFees(@RequestBody WxEnergyFees record) { + public ResultData saveFees(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); - if (null == record.getBillType()) { - return new ResultData(Result.ERROR,"请选择绑定账单类型"); - } - if (record.getBillType() == EnumBillAllType.RENT_DEPOSIT.getCode()) { - record.setIsDespoit(EnumYesOrNo.YES.getCode()); - record.setFixedPrice(EnumYesOrNo.YES.getCode()); - } +// if (record.getBillType() == EnumBillAllType.RENT_DEPOSIT.getCode()) { +// record.setIsDespoit(EnumYesOrNo.YES.getCode()); +// record.setFixedPrice(EnumYesOrNo.YES.getCode()); +// } wxEnergyService.saveOrUpdateFees(record); return new ResultData(); } @PostMapping("feesUpdateIsDel") - public ResultData feesUpdateIsDel(@RequestBody WxEnergyFees record) { + public ResultData feesUpdateIsDel(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); wxEnergyService.setFeesIsDel(record); return new ResultData(); @@ -254,10 +234,10 @@ public class WxFinanceController extends BaseController { @ApiOperation("预收科目新增修改") @PostMapping("saveAdvanceFees") - public ResultData saveAdvanceType(@RequestBody WxEnergyFees record) { + public ResultData saveAdvanceType(@RequestBody WxFinanceFees record) { record.updateTenantInfo(getTenantInfo()); - record.setBillType(EnumBillAllType.ADVANCE.getCode()); - record.setFixedPrice(EnumYesOrNo.YES.getCode()); + //record.setBillType(EnumBillAllType.ADVANCE.getCode()); + //record.setFixedPrice(EnumYesOrNo.YES.getCode()); wxEnergyService.saveOrUpdateFees(record); return new ResultData(); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinancePrintController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinancePrintController.java index d7f03a3a9..5b2b8cfff 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinancePrintController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinancePrintController.java @@ -5,11 +5,10 @@ import com.iformall.annotation.TenantIgnore; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinancePrintData; import com.iformall.domain.po.WxFinancePrintTemplate; import com.iformall.domain.po.base.BaseEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumFinancePrintDataType; import com.iformall.enums.EnumYesOrNo; import com.iformall.service.WxFinancePrintService; diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java index 08e2c379e..8021c08ca 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java @@ -5,7 +5,6 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxSettleMerchant; import com.iformall.domain.po.base.BaseEntity; @@ -16,9 +15,7 @@ import com.iformall.exception.MallinkException; import com.iformall.service.WxAgileContractService; import com.iformall.service.WxAllBillService; import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; -import com.iformall.service.WxRentPropertyContractService; import com.iformall.service.WxSettleMerchantService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -54,8 +51,6 @@ public class WxSettleMerchantController extends BaseController { @Autowired private WxAllBillService wxAllBillService; @Autowired - WxPropertyContractService wxPropertyContractService; - @Autowired WxAgileContractService wxAgileContractService; @ApiOperation("分页列表接口") @@ -217,22 +212,23 @@ public class WxSettleMerchantController extends BaseController { return new ResultData(Result.ERROR,"未查询到合同"); } //查询计租中的合同 - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.updateTenantInfo(getTenantInfo()); - wxPropertyContract.setIds(contractIds); - wxPropertyContract.setStatus(EnumRentContractStatus.PAING.getCode()); - List rlist = wxPropertyContractService.findList(wxPropertyContract); - if (null == rlist || rlist.size() <= 0 ) { - return new ResultData(Result.ERROR,"无计租中物业合同"); - } - WxPropertyContract property = rlist.get(0); - WxAllBill br = new WxAllBill(); - br.setShopIdList(shopIds); - br.setPropertyContractId(property.getId()); - br.setStarttime(wxSettleMerchant.getBeginTime()); - br.setEndtime(wxSettleMerchant.getEndTime()); - - PageInfo blist = wxAllBillService.listAsPage(br,1, 10000); +// WxPropertyContract wxPropertyContract = new WxPropertyContract(); +// wxPropertyContract.updateTenantInfo(getTenantInfo()); +// wxPropertyContract.setIds(contractIds); +// wxPropertyContract.setStatus(EnumRentContractStatus.PAING.getCode()); +// List rlist = wxPropertyContractService.findList(wxPropertyContract); +// if (null == rlist || rlist.size() <= 0 ) { +// return new ResultData(Result.ERROR,"无计租中物业合同"); +// } +// WxPropertyContract property = rlist.get(0); +// WxAllBill br = new WxAllBill(); +// br.setShopIdList(shopIds); +// br.setPropertyContractId(property.getId()); +// br.setStarttime(wxSettleMerchant.getBeginTime()); +// br.setEndtime(wxSettleMerchant.getEndTime()); +// +// PageInfo blist = wxAllBillService.listAsPage(br,1, 10000); + PageInfo blist = null; if (null == blist || null == blist.getList() || blist.getList().size() <= 0 ) { return new ResultData(Result.ERROR,"物业合同无对应账单"); } @@ -246,8 +242,8 @@ public class WxSettleMerchantController extends BaseController { all = all.add(new BigDecimal(_np)); } Map retMap = new HashMap(); - retMap.put("property", property); - retMap.put("money", all.setScale(property.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); + //retMap.put("property", property); + //retMap.put("money", all.setScale(property.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); return new ResultData(retMap); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java index f19a7a9e2..4820ceb02 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxAllBillController.java @@ -16,7 +16,7 @@ import com.iformall.domain.po.WxBillAction; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxCoupon; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPayAccountBill; import com.iformall.domain.po.WxShop; @@ -30,7 +30,6 @@ import com.iformall.domain.vo.WxBillHotNotify; import com.iformall.domain.vo.WxBillJianMian; import com.iformall.domain.vo.WxBillSum; import com.iformall.domain.vo.WxShopBillVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillOweOrNearType; import com.iformall.enums.EnumBillStatus; import com.iformall.enums.EnumCouponType; @@ -301,9 +300,9 @@ public class WxAllBillController extends BillBaseController { return null; } - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(wxShop); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); BigDecimal needpay = new BigDecimal(0); BigDecimal paid = new BigDecimal(0); BigDecimal owe = new BigDecimal(0); @@ -311,7 +310,7 @@ public class WxAllBillController extends BillBaseController { for (int i = 0 ; i < sumList.size() ; i ++) { WxBillSum s = sumList.get(i); if (null != s.getEnergyFeesId() && null != feesMap) { - WxEnergyFees fees = feesMap.get(s.getEnergyFeesId()); + WxFinanceFees fees = feesMap.get(s.getEnergyFeesId()); if (null != fees) { s.setBillName(fees.getName()); s.setEnergyFeesName(fees.getName()); @@ -352,16 +351,16 @@ public class WxAllBillController extends BillBaseController { * 账单类型 * @return */ - @GetMapping("billTypes") - public ResultData billTypes() { - Map tmap = new HashMap(); - for (EnumBillAllType t : EnumBillAllType.values()) { - if (t != EnumBillAllType.ADVANCE) { - tmap.put(t.getCode(), t.getMessage()); - } - } - return new ResultData(tmap); - } +// @GetMapping("billTypes") +// public ResultData billTypes() { +// Map tmap = new HashMap(); +// for (EnumBillAllType t : EnumBillAllType.values()) { +// if (t != EnumBillAllType.ADVANCE) { +// tmap.put(t.getCode(), t.getMessage()); +// } +// } +// return new ResultData(tmap); +// } /** * 账单查询范围 @@ -395,10 +394,10 @@ public class WxAllBillController extends BillBaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData feesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { + public ResultData feesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); + PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); return new ResultData(page); } @@ -408,16 +407,11 @@ public class WxAllBillController extends BillBaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), }) - public ResultData otherFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { + public ResultData otherFeesList(@ModelAttribute WxFinanceFees record, Integer pageNum, Integer pageSize) { record.updateTenantInfo(getTenantInfo()); record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); - List typeList = new ArrayList(); - typeList.add(EnumBillAllType.OTHER.getCode()); - typeList.add(EnumBillAllType.OTHER_DEPOSIT.getCode()); - typeList.add(EnumBillAllType.ADVANCE.getCode()); - record.setBillTypeList(typeList); record.setIsDel(EnumYesOrNo.NO.getCode()); - PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); + PageInfo page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); return new ResultData(page); } @@ -592,9 +586,9 @@ public class WxAllBillController extends BillBaseController { public ResultData notify(@RequestBody WxBillPayDTO dto) { dto.updateTenantInfo(getTenantInfo()); //如果是管理费,默认一个商业管理费 - if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { - dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - } +// if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { +// dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); +// } billAllHelper.notify(dto, getUser()); return new ResultData(); } @@ -603,9 +597,9 @@ public class WxAllBillController extends BillBaseController { public ResultData updateReceivePay(@RequestBody WxBillReceiveUpdateDTO dto) { dto.updateTenantInfo(getTenantInfo()); //如果是管理费,默认一个商业管理费 - if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { - dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - } +// if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { +// dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); +// } billAllHelper.updateReceivePay(dto, getUser(), false); return new ResultData(); //return wxBillAllService.updateReceivePay(wxBillAll, getUser(),false); @@ -615,9 +609,9 @@ public class WxAllBillController extends BillBaseController { public ResultData pay(@RequestBody WxBillPayDTO dto) { dto.updateTenantInfo(getTenantInfo()); //如果是管理费,默认一个商业管理费 - if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { - dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - } +// if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { +// dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); +// } WxBillPayWay payWay = wxFinanceService.getPayWayById(dto, dto.getPayWay()); if (null == payWay) { return new ResultData(Result.ERROR,"支付方式未查询到"); @@ -631,45 +625,45 @@ public class WxAllBillController extends BillBaseController { //减免统计 - @GetMapping("jianmiantj") - public ResultData jianmiantj(@ModelAttribute WxBillAction wxBillAction) { - wxBillAction.updateTenantInfo(getTenantInfo()); - List jList = wxBillActionService.findJianMian(wxBillAction); - Map map = new HashMap(); - if (null != jList && jList.size() > 0 ) { - for (int i = 0 ; i < jList.size() ; i++) { - WxBillJianMian jm = jList.get(i); - map.put(jm.getBillType(), jm.getTotal()); - } - } - Map retMap = new HashMap(); - BigDecimal total = new BigDecimal("0.00"); - List retList = new ArrayList(); - for (EnumBillAllType at : EnumBillAllType.values()) { - String money = map.get(at.getCode()); - if (StringUtils.isBlank(money)) { - money = "0.00"; - } - WxBillJianMian bjm = new WxBillJianMian(); - bjm.setBillType(at.getCode()); - bjm.setTotal(money); - retList.add(bjm); - total = total.add(new BigDecimal(money)); - } - - retMap.put("total", total.toPlainString()); - retMap.put("list", retList); - return new ResultData(retMap); - } +// @GetMapping("jianmiantj") +// public ResultData jianmiantj(@ModelAttribute WxBillAction wxBillAction) { +// wxBillAction.updateTenantInfo(getTenantInfo()); +// List jList = wxBillActionService.findJianMian(wxBillAction); +// Map map = new HashMap(); +// if (null != jList && jList.size() > 0 ) { +// for (int i = 0 ; i < jList.size() ; i++) { +// WxBillJianMian jm = jList.get(i); +// map.put(jm.getBillType(), jm.getTotal()); +// } +// } +// Map retMap = new HashMap(); +// BigDecimal total = new BigDecimal("0.00"); +// List retList = new ArrayList(); +// for (EnumBillAllType at : EnumBillAllType.values()) { +// String money = map.get(at.getCode()); +// if (StringUtils.isBlank(money)) { +// money = "0.00"; +// } +// WxBillJianMian bjm = new WxBillJianMian(); +// bjm.setBillType(at.getCode()); +// bjm.setTotal(money); +// retList.add(bjm); +// total = total.add(new BigDecimal(money)); +// } +// +// retMap.put("total", total.toPlainString()); +// retMap.put("list", retList); +// return new ResultData(retMap); +// } //坏账 @PostMapping("bad") public ResultData bad(@RequestBody WxBillPayDTO dto) { dto.updateTenantInfo(getTenantInfo()); //如果是管理费,默认一个商业管理费 - if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { - dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - } +// if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { +// dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); +// } billAllHelper.bad(dto, getUser()); return new ResultData(); //return wxBillAllService.updateReceivePay(wxBillAll, getUser(),false); @@ -745,9 +739,9 @@ public class WxAllBillController extends BillBaseController { List list = billAllHelper.getMerchantBillList(wxShop); if (null != list && list.size() > 0 ) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(wxShop); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < list.size(); i++) { WxAllBill be = list.get(i); if (null != shopMap) { @@ -758,7 +752,7 @@ public class WxAllBillController extends BillBaseController { } if (null != feesMap) { - WxEnergyFees fees = feesMap.get(be.getEnergyFeesId()); + WxFinanceFees fees = feesMap.get(be.getEnergyFeesId()); if (null != fees) { be.setEnergyFeesName(fees.getName()); } @@ -816,9 +810,9 @@ public class WxAllBillController extends BillBaseController { Map shopMap = wxShopSerivce.findShopMap(sq); if (null != list && list.size() > 0 ) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(wxShop); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < list.size(); i++) { WxAllBill be = list.get(i); if (null != shopMap) { @@ -828,7 +822,7 @@ public class WxAllBillController extends BillBaseController { } } if (null != feesMap) { - WxEnergyFees fees = feesMap.get(be.getEnergyFeesId()); + WxFinanceFees fees = feesMap.get(be.getEnergyFeesId()); if (null != fees) { be.setEnergyFeesName(fees.getName()); } diff --git a/mallinkAdmin/src/main/java/com/iformall/flowable/ContractTaskFinishHandler.java b/mallinkAdmin/src/main/java/com/iformall/flowable/ContractTaskFinishHandler.java index 4ec15fe03..752993588 100644 --- a/mallinkAdmin/src/main/java/com/iformall/flowable/ContractTaskFinishHandler.java +++ b/mallinkAdmin/src/main/java/com/iformall/flowable/ContractTaskFinishHandler.java @@ -1,7 +1,6 @@ package com.iformall.flowable; import com.iformall.service.WxFlowService; -import com.iformall.service.WxPropertyContractService; import org.flowable.engine.delegate.TaskListener; import org.flowable.task.service.delegate.DelegateTask; import org.springframework.beans.factory.annotation.Autowired; @@ -15,8 +14,6 @@ import org.springframework.stereotype.Component; public class ContractTaskFinishHandler implements TaskListener { @Autowired private WxFlowService wxFlowService; - @Autowired - private WxPropertyContractService wxPropertyContractService; @Override public void notify(DelegateTask delegateTask) { diff --git a/mallinkAdmin/src/main/resources/db/migration/V202504000000002.sql b/mallinkAdmin/src/main/resources/db/migration/V202504000000002.sql new file mode 100644 index 000000000..8e740aff4 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202504000000002.sql @@ -0,0 +1,872 @@ +alter table wx_rent_contract drop column adjust_period; +alter table wx_rent_contract drop column operation_type; +alter table wx_rent_contract drop column cashtype_lsit; +alter table wx_rent_contract drop column adjust_ratio; +alter table wx_rent_contract drop column revenue_ratio_set; +alter table wx_rent_contract drop column pay_ratio; +alter table wx_rent_contract drop column revenue; +alter table wx_rent_contract drop column limit_revenue; +alter table wx_rent_contract drop column revenue_fixed_rent_price; +alter table wx_rent_contract drop column revenue_rent_price; +alter table wx_rent_contract drop column revenue_minimum_method; +alter table wx_rent_contract drop column revenue_ratio; +alter table wx_rent_contract drop column business_type; +alter table wx_rent_contract drop column filename; +alter table wx_rent_contract drop column price_unit; +alter table wx_rent_contract drop column rent_price; +alter table wx_rent_contract drop column price_detail; +alter table wx_rent_contract drop column other_rent_price_info; +alter table wx_rent_contract drop column subject_name; +alter table wx_rent_contract drop column rent_start_type; +alter table wx_rent_contract drop column rent_input_way; +alter table wx_rent_contract drop column adjust_ratio_way; +alter table wx_rent_contract drop column revenue_ratio_way; +alter table wx_rent_contract drop column late_pay_ratio; +alter table wx_rent_contract drop column late_pay_day; +alter table wx_rent_contract drop column bussiness_management_fee; +alter table wx_rent_contract drop column bussiness_management_fee_ratio_way; +alter table wx_rent_contract drop column bussiness_management_fee_ratio; +alter table wx_rent_contract drop column operating_management_fee; +alter table wx_rent_contract drop column operating_management_fee_ratio_way; +alter table wx_rent_contract drop column operating_management_fee_ratio; +alter table wx_rent_contract drop column out_date_notify_days; +alter table wx_rent_contract drop column out_date_notify_phone; +alter table wx_rent_contract drop column despoit; +alter table wx_rent_contract drop column price; +alter table wx_rent_contract drop column first_bill_date_start; +alter table wx_rent_contract drop column first_bill_date_end; +alter table wx_rent_contract drop column first_bill_receive_date; +alter table wx_rent_contract drop column agile_type; + + + + + + + + +alter table wx_energy_fees_0 drop column type; +alter table wx_energy_fees_0 drop column bill_type; +alter table wx_energy_fees_0 drop column is_public; +alter table wx_energy_fees_0 drop column is_system; +alter table wx_energy_fees_0 drop column price; +alter table wx_energy_fees_0 drop column fixed_price; +alter table wx_energy_fees_0 drop column calcute_unit; +alter table wx_energy_fees_0 drop column time_unit; +alter table wx_energy_fees_0 drop column cashier_type; +alter table wx_energy_fees_0 add column fees_type int(1) comment '类型'; + +CREATE TABLE wx_finance_fees LIKE wx_energy_fees_0; +drop table wx_energy_fees_0 ; +drop table wx_energy_fees_1 ; +drop table wx_energy_fees_2 ; +drop table wx_energy_fees_3 ; +drop table wx_energy_fees_4 ; +drop table wx_energy_fees_5 ; +drop table wx_energy_fees_6 ; +drop table wx_energy_fees_7 ; +drop table wx_energy_fees_8 ; +drop table wx_energy_fees_9 ; +drop table wx_energy_fees_10 ; +drop table wx_energy_fees_11 ; +drop table wx_energy_fees_12 ; +drop table wx_energy_fees_13 ; +drop table wx_energy_fees_14 ; +drop table wx_energy_fees_15 ; +drop table wx_energy_fees_16 ; +drop table wx_energy_fees_17 ; +drop table wx_energy_fees_18 ; +drop table wx_energy_fees_19 ; +drop table wx_energy_fees_20 ; +drop table wx_energy_fees_21 ; +drop table wx_energy_fees_22 ; +drop table wx_energy_fees_23 ; +drop table wx_energy_fees_24 ; +drop table wx_energy_fees_25 ; +drop table wx_energy_fees_26 ; +drop table wx_energy_fees_27 ; +drop table wx_energy_fees_28 ; +drop table wx_energy_fees_29 ; +drop table wx_energy_fees_30 ; +drop table wx_energy_fees_31 ; +drop table wx_energy_fees_32 ; +drop table wx_energy_fees_33 ; +drop table wx_energy_fees_34 ; +drop table wx_energy_fees_35 ; +drop table wx_energy_fees_36 ; +drop table wx_energy_fees_37 ; +drop table wx_energy_fees_38 ; +drop table wx_energy_fees_39 ; +drop table wx_energy_fees_40 ; +drop table wx_energy_fees_41 ; +drop table wx_energy_fees_42 ; +drop table wx_energy_fees_43 ; +drop table wx_energy_fees_44 ; +drop table wx_energy_fees_45 ; +drop table wx_energy_fees_46 ; +drop table wx_energy_fees_47 ; +drop table wx_energy_fees_48 ; +drop table wx_energy_fees_49 ; +drop table wx_energy_fees_50 ; +drop table wx_energy_fees_51 ; +drop table wx_energy_fees_52 ; +drop table wx_energy_fees_53 ; +drop table wx_energy_fees_54 ; +drop table wx_energy_fees_55 ; +drop table wx_energy_fees_56 ; +drop table wx_energy_fees_57 ; +drop table wx_energy_fees_58 ; +drop table wx_energy_fees_59 ; +drop table wx_energy_fees_60 ; +drop table wx_energy_fees_61 ; +drop table wx_energy_fees_62 ; +drop table wx_energy_fees_63 ; +drop table wx_energy_fees_64 ; +drop table wx_energy_fees_65 ; +drop table wx_energy_fees_66 ; +drop table wx_energy_fees_67 ; +drop table wx_energy_fees_68 ; +drop table wx_energy_fees_69 ; +drop table wx_energy_fees_70 ; +drop table wx_energy_fees_71 ; +drop table wx_energy_fees_72 ; +drop table wx_energy_fees_73 ; +drop table wx_energy_fees_74 ; +drop table wx_energy_fees_75 ; +drop table wx_energy_fees_76 ; +drop table wx_energy_fees_77 ; +drop table wx_energy_fees_78 ; +drop table wx_energy_fees_79 ; +drop table wx_energy_fees_80 ; +drop table wx_energy_fees_81 ; +drop table wx_energy_fees_82 ; +drop table wx_energy_fees_83 ; +drop table wx_energy_fees_84 ; +drop table wx_energy_fees_85 ; +drop table wx_energy_fees_86 ; +drop table wx_energy_fees_87 ; +drop table wx_energy_fees_88 ; +drop table wx_energy_fees_89 ; +drop table wx_energy_fees_90 ; +drop table wx_energy_fees_91 ; +drop table wx_energy_fees_92 ; +drop table wx_energy_fees_93 ; +drop table wx_energy_fees_94 ; +drop table wx_energy_fees_95 ; +drop table wx_energy_fees_96 ; +drop table wx_energy_fees_97 ; +drop table wx_energy_fees_98 ; +drop table wx_energy_fees_99 ; + +create table wx_finance_fees_0 like wx_finance_fees; +create table wx_finance_fees_1 like wx_finance_fees; +create table wx_finance_fees_2 like wx_finance_fees; +create table wx_finance_fees_3 like wx_finance_fees; +create table wx_finance_fees_4 like wx_finance_fees; +create table wx_finance_fees_5 like wx_finance_fees; +create table wx_finance_fees_6 like wx_finance_fees; +create table wx_finance_fees_7 like wx_finance_fees; +create table wx_finance_fees_8 like wx_finance_fees; +create table wx_finance_fees_9 like wx_finance_fees; +create table wx_finance_fees_10 like wx_finance_fees; +create table wx_finance_fees_11 like wx_finance_fees; +create table wx_finance_fees_12 like wx_finance_fees; +create table wx_finance_fees_13 like wx_finance_fees; +create table wx_finance_fees_14 like wx_finance_fees; +create table wx_finance_fees_15 like wx_finance_fees; +create table wx_finance_fees_16 like wx_finance_fees; +create table wx_finance_fees_17 like wx_finance_fees; +create table wx_finance_fees_18 like wx_finance_fees; +create table wx_finance_fees_19 like wx_finance_fees; +create table wx_finance_fees_20 like wx_finance_fees; +create table wx_finance_fees_21 like wx_finance_fees; +create table wx_finance_fees_22 like wx_finance_fees; +create table wx_finance_fees_23 like wx_finance_fees; +create table wx_finance_fees_24 like wx_finance_fees; +create table wx_finance_fees_25 like wx_finance_fees; +create table wx_finance_fees_26 like wx_finance_fees; +create table wx_finance_fees_27 like wx_finance_fees; +create table wx_finance_fees_28 like wx_finance_fees; +create table wx_finance_fees_29 like wx_finance_fees; +create table wx_finance_fees_30 like wx_finance_fees; +create table wx_finance_fees_31 like wx_finance_fees; +create table wx_finance_fees_32 like wx_finance_fees; +create table wx_finance_fees_33 like wx_finance_fees; +create table wx_finance_fees_34 like wx_finance_fees; +create table wx_finance_fees_35 like wx_finance_fees; +create table wx_finance_fees_36 like wx_finance_fees; +create table wx_finance_fees_37 like wx_finance_fees; +create table wx_finance_fees_38 like wx_finance_fees; +create table wx_finance_fees_39 like wx_finance_fees; +create table wx_finance_fees_40 like wx_finance_fees; +create table wx_finance_fees_41 like wx_finance_fees; +create table wx_finance_fees_42 like wx_finance_fees; +create table wx_finance_fees_43 like wx_finance_fees; +create table wx_finance_fees_44 like wx_finance_fees; +create table wx_finance_fees_45 like wx_finance_fees; +create table wx_finance_fees_46 like wx_finance_fees; +create table wx_finance_fees_47 like wx_finance_fees; +create table wx_finance_fees_48 like wx_finance_fees; +create table wx_finance_fees_49 like wx_finance_fees; +create table wx_finance_fees_50 like wx_finance_fees; +create table wx_finance_fees_51 like wx_finance_fees; +create table wx_finance_fees_52 like wx_finance_fees; +create table wx_finance_fees_53 like wx_finance_fees; +create table wx_finance_fees_54 like wx_finance_fees; +create table wx_finance_fees_55 like wx_finance_fees; +create table wx_finance_fees_56 like wx_finance_fees; +create table wx_finance_fees_57 like wx_finance_fees; +create table wx_finance_fees_58 like wx_finance_fees; +create table wx_finance_fees_59 like wx_finance_fees; +create table wx_finance_fees_60 like wx_finance_fees; +create table wx_finance_fees_61 like wx_finance_fees; +create table wx_finance_fees_62 like wx_finance_fees; +create table wx_finance_fees_63 like wx_finance_fees; +create table wx_finance_fees_64 like wx_finance_fees; +create table wx_finance_fees_65 like wx_finance_fees; +create table wx_finance_fees_66 like wx_finance_fees; +create table wx_finance_fees_67 like wx_finance_fees; +create table wx_finance_fees_68 like wx_finance_fees; +create table wx_finance_fees_69 like wx_finance_fees; +create table wx_finance_fees_70 like wx_finance_fees; +create table wx_finance_fees_71 like wx_finance_fees; +create table wx_finance_fees_72 like wx_finance_fees; +create table wx_finance_fees_73 like wx_finance_fees; +create table wx_finance_fees_74 like wx_finance_fees; +create table wx_finance_fees_75 like wx_finance_fees; +create table wx_finance_fees_76 like wx_finance_fees; +create table wx_finance_fees_77 like wx_finance_fees; +create table wx_finance_fees_78 like wx_finance_fees; +create table wx_finance_fees_79 like wx_finance_fees; +create table wx_finance_fees_80 like wx_finance_fees; +create table wx_finance_fees_81 like wx_finance_fees; +create table wx_finance_fees_82 like wx_finance_fees; +create table wx_finance_fees_83 like wx_finance_fees; +create table wx_finance_fees_84 like wx_finance_fees; +create table wx_finance_fees_85 like wx_finance_fees; +create table wx_finance_fees_86 like wx_finance_fees; +create table wx_finance_fees_87 like wx_finance_fees; +create table wx_finance_fees_88 like wx_finance_fees; +create table wx_finance_fees_89 like wx_finance_fees; +create table wx_finance_fees_90 like wx_finance_fees; +create table wx_finance_fees_91 like wx_finance_fees; +create table wx_finance_fees_92 like wx_finance_fees; +create table wx_finance_fees_93 like wx_finance_fees; +create table wx_finance_fees_94 like wx_finance_fees; +create table wx_finance_fees_95 like wx_finance_fees; +create table wx_finance_fees_96 like wx_finance_fees; +create table wx_finance_fees_97 like wx_finance_fees; +create table wx_finance_fees_98 like wx_finance_fees; +create table wx_finance_fees_99 like wx_finance_fees; + + +alter table wx_bill_action_0 drop column bill_type; +alter table wx_bill_action_1 drop column bill_type; +alter table wx_bill_action_2 drop column bill_type; +alter table wx_bill_action_3 drop column bill_type; +alter table wx_bill_action_4 drop column bill_type; +alter table wx_bill_action_5 drop column bill_type; +alter table wx_bill_action_6 drop column bill_type; +alter table wx_bill_action_7 drop column bill_type; +alter table wx_bill_action_8 drop column bill_type; +alter table wx_bill_action_9 drop column bill_type; +alter table wx_bill_action_10 drop column bill_type; +alter table wx_bill_action_11 drop column bill_type; +alter table wx_bill_action_12 drop column bill_type; +alter table wx_bill_action_13 drop column bill_type; +alter table wx_bill_action_14 drop column bill_type; +alter table wx_bill_action_15 drop column bill_type; +alter table wx_bill_action_16 drop column bill_type; +alter table wx_bill_action_17 drop column bill_type; +alter table wx_bill_action_18 drop column bill_type; +alter table wx_bill_action_19 drop column bill_type; +alter table wx_bill_action_20 drop column bill_type; +alter table wx_bill_action_21 drop column bill_type; +alter table wx_bill_action_22 drop column bill_type; +alter table wx_bill_action_23 drop column bill_type; +alter table wx_bill_action_24 drop column bill_type; +alter table wx_bill_action_25 drop column bill_type; +alter table wx_bill_action_26 drop column bill_type; +alter table wx_bill_action_27 drop column bill_type; +alter table wx_bill_action_28 drop column bill_type; +alter table wx_bill_action_29 drop column bill_type; +alter table wx_bill_action_30 drop column bill_type; +alter table wx_bill_action_31 drop column bill_type; +alter table wx_bill_action_32 drop column bill_type; +alter table wx_bill_action_33 drop column bill_type; +alter table wx_bill_action_34 drop column bill_type; +alter table wx_bill_action_35 drop column bill_type; +alter table wx_bill_action_36 drop column bill_type; +alter table wx_bill_action_37 drop column bill_type; +alter table wx_bill_action_38 drop column bill_type; +alter table wx_bill_action_39 drop column bill_type; +alter table wx_bill_action_40 drop column bill_type; +alter table wx_bill_action_41 drop column bill_type; +alter table wx_bill_action_42 drop column bill_type; +alter table wx_bill_action_43 drop column bill_type; +alter table wx_bill_action_44 drop column bill_type; +alter table wx_bill_action_45 drop column bill_type; +alter table wx_bill_action_46 drop column bill_type; +alter table wx_bill_action_47 drop column bill_type; +alter table wx_bill_action_48 drop column bill_type; +alter table wx_bill_action_49 drop column bill_type; +alter table wx_bill_action_50 drop column bill_type; +alter table wx_bill_action_51 drop column bill_type; +alter table wx_bill_action_52 drop column bill_type; +alter table wx_bill_action_53 drop column bill_type; +alter table wx_bill_action_54 drop column bill_type; +alter table wx_bill_action_55 drop column bill_type; +alter table wx_bill_action_56 drop column bill_type; +alter table wx_bill_action_57 drop column bill_type; +alter table wx_bill_action_58 drop column bill_type; +alter table wx_bill_action_59 drop column bill_type; +alter table wx_bill_action_60 drop column bill_type; +alter table wx_bill_action_61 drop column bill_type; +alter table wx_bill_action_62 drop column bill_type; +alter table wx_bill_action_63 drop column bill_type; +alter table wx_bill_action_64 drop column bill_type; +alter table wx_bill_action_65 drop column bill_type; +alter table wx_bill_action_66 drop column bill_type; +alter table wx_bill_action_67 drop column bill_type; +alter table wx_bill_action_68 drop column bill_type; +alter table wx_bill_action_69 drop column bill_type; +alter table wx_bill_action_70 drop column bill_type; +alter table wx_bill_action_71 drop column bill_type; +alter table wx_bill_action_72 drop column bill_type; +alter table wx_bill_action_73 drop column bill_type; +alter table wx_bill_action_74 drop column bill_type; +alter table wx_bill_action_75 drop column bill_type; +alter table wx_bill_action_76 drop column bill_type; +alter table wx_bill_action_77 drop column bill_type; +alter table wx_bill_action_78 drop column bill_type; +alter table wx_bill_action_79 drop column bill_type; +alter table wx_bill_action_80 drop column bill_type; +alter table wx_bill_action_81 drop column bill_type; +alter table wx_bill_action_82 drop column bill_type; +alter table wx_bill_action_83 drop column bill_type; +alter table wx_bill_action_84 drop column bill_type; +alter table wx_bill_action_85 drop column bill_type; +alter table wx_bill_action_86 drop column bill_type; +alter table wx_bill_action_87 drop column bill_type; +alter table wx_bill_action_88 drop column bill_type; +alter table wx_bill_action_89 drop column bill_type; +alter table wx_bill_action_90 drop column bill_type; +alter table wx_bill_action_91 drop column bill_type; +alter table wx_bill_action_92 drop column bill_type; +alter table wx_bill_action_93 drop column bill_type; +alter table wx_bill_action_94 drop column bill_type; +alter table wx_bill_action_95 drop column bill_type; +alter table wx_bill_action_96 drop column bill_type; +alter table wx_bill_action_97 drop column bill_type; +alter table wx_bill_action_98 drop column bill_type; +alter table wx_bill_action_99 drop column bill_type; + + +rename table wx_energy_fees_setoff_0 to wx_finance_fees_setoff_0 ; +rename table wx_energy_fees_setoff_1 to wx_finance_fees_setoff_1 ; +rename table wx_energy_fees_setoff_2 to wx_finance_fees_setoff_2 ; +rename table wx_energy_fees_setoff_3 to wx_finance_fees_setoff_3 ; +rename table wx_energy_fees_setoff_4 to wx_finance_fees_setoff_4 ; +rename table wx_energy_fees_setoff_5 to wx_finance_fees_setoff_5 ; +rename table wx_energy_fees_setoff_6 to wx_finance_fees_setoff_6 ; +rename table wx_energy_fees_setoff_7 to wx_finance_fees_setoff_7 ; +rename table wx_energy_fees_setoff_8 to wx_finance_fees_setoff_8 ; +rename table wx_energy_fees_setoff_9 to wx_finance_fees_setoff_9 ; +rename table wx_energy_fees_setoff_10 to wx_finance_fees_setoff_10 ; +rename table wx_energy_fees_setoff_11 to wx_finance_fees_setoff_11 ; +rename table wx_energy_fees_setoff_12 to wx_finance_fees_setoff_12 ; +rename table wx_energy_fees_setoff_13 to wx_finance_fees_setoff_13 ; +rename table wx_energy_fees_setoff_14 to wx_finance_fees_setoff_14 ; +rename table wx_energy_fees_setoff_15 to wx_finance_fees_setoff_15 ; +rename table wx_energy_fees_setoff_16 to wx_finance_fees_setoff_16 ; +rename table wx_energy_fees_setoff_17 to wx_finance_fees_setoff_17 ; +rename table wx_energy_fees_setoff_18 to wx_finance_fees_setoff_18 ; +rename table wx_energy_fees_setoff_19 to wx_finance_fees_setoff_19 ; +rename table wx_energy_fees_setoff_20 to wx_finance_fees_setoff_20 ; +rename table wx_energy_fees_setoff_21 to wx_finance_fees_setoff_21 ; +rename table wx_energy_fees_setoff_22 to wx_finance_fees_setoff_22 ; +rename table wx_energy_fees_setoff_23 to wx_finance_fees_setoff_23 ; +rename table wx_energy_fees_setoff_24 to wx_finance_fees_setoff_24 ; +rename table wx_energy_fees_setoff_25 to wx_finance_fees_setoff_25 ; +rename table wx_energy_fees_setoff_26 to wx_finance_fees_setoff_26 ; +rename table wx_energy_fees_setoff_27 to wx_finance_fees_setoff_27 ; +rename table wx_energy_fees_setoff_28 to wx_finance_fees_setoff_28 ; +rename table wx_energy_fees_setoff_29 to wx_finance_fees_setoff_29 ; +rename table wx_energy_fees_setoff_30 to wx_finance_fees_setoff_30 ; +rename table wx_energy_fees_setoff_31 to wx_finance_fees_setoff_31 ; +rename table wx_energy_fees_setoff_32 to wx_finance_fees_setoff_32 ; +rename table wx_energy_fees_setoff_33 to wx_finance_fees_setoff_33 ; +rename table wx_energy_fees_setoff_34 to wx_finance_fees_setoff_34 ; +rename table wx_energy_fees_setoff_35 to wx_finance_fees_setoff_35 ; +rename table wx_energy_fees_setoff_36 to wx_finance_fees_setoff_36 ; +rename table wx_energy_fees_setoff_37 to wx_finance_fees_setoff_37 ; +rename table wx_energy_fees_setoff_38 to wx_finance_fees_setoff_38 ; +rename table wx_energy_fees_setoff_39 to wx_finance_fees_setoff_39 ; +rename table wx_energy_fees_setoff_40 to wx_finance_fees_setoff_40 ; +rename table wx_energy_fees_setoff_41 to wx_finance_fees_setoff_41 ; +rename table wx_energy_fees_setoff_42 to wx_finance_fees_setoff_42 ; +rename table wx_energy_fees_setoff_43 to wx_finance_fees_setoff_43 ; +rename table wx_energy_fees_setoff_44 to wx_finance_fees_setoff_44 ; +rename table wx_energy_fees_setoff_45 to wx_finance_fees_setoff_45 ; +rename table wx_energy_fees_setoff_46 to wx_finance_fees_setoff_46 ; +rename table wx_energy_fees_setoff_47 to wx_finance_fees_setoff_47 ; +rename table wx_energy_fees_setoff_48 to wx_finance_fees_setoff_48 ; +rename table wx_energy_fees_setoff_49 to wx_finance_fees_setoff_49 ; +rename table wx_energy_fees_setoff_50 to wx_finance_fees_setoff_50 ; +rename table wx_energy_fees_setoff_51 to wx_finance_fees_setoff_51 ; +rename table wx_energy_fees_setoff_52 to wx_finance_fees_setoff_52 ; +rename table wx_energy_fees_setoff_53 to wx_finance_fees_setoff_53 ; +rename table wx_energy_fees_setoff_54 to wx_finance_fees_setoff_54 ; +rename table wx_energy_fees_setoff_55 to wx_finance_fees_setoff_55 ; +rename table wx_energy_fees_setoff_56 to wx_finance_fees_setoff_56 ; +rename table wx_energy_fees_setoff_57 to wx_finance_fees_setoff_57 ; +rename table wx_energy_fees_setoff_58 to wx_finance_fees_setoff_58 ; +rename table wx_energy_fees_setoff_59 to wx_finance_fees_setoff_59 ; +rename table wx_energy_fees_setoff_60 to wx_finance_fees_setoff_60 ; +rename table wx_energy_fees_setoff_61 to wx_finance_fees_setoff_61 ; +rename table wx_energy_fees_setoff_62 to wx_finance_fees_setoff_62 ; +rename table wx_energy_fees_setoff_63 to wx_finance_fees_setoff_63 ; +rename table wx_energy_fees_setoff_64 to wx_finance_fees_setoff_64 ; +rename table wx_energy_fees_setoff_65 to wx_finance_fees_setoff_65 ; +rename table wx_energy_fees_setoff_66 to wx_finance_fees_setoff_66 ; +rename table wx_energy_fees_setoff_67 to wx_finance_fees_setoff_67 ; +rename table wx_energy_fees_setoff_68 to wx_finance_fees_setoff_68 ; +rename table wx_energy_fees_setoff_69 to wx_finance_fees_setoff_69 ; +rename table wx_energy_fees_setoff_70 to wx_finance_fees_setoff_70 ; +rename table wx_energy_fees_setoff_71 to wx_finance_fees_setoff_71 ; +rename table wx_energy_fees_setoff_72 to wx_finance_fees_setoff_72 ; +rename table wx_energy_fees_setoff_73 to wx_finance_fees_setoff_73 ; +rename table wx_energy_fees_setoff_74 to wx_finance_fees_setoff_74 ; +rename table wx_energy_fees_setoff_75 to wx_finance_fees_setoff_75 ; +rename table wx_energy_fees_setoff_76 to wx_finance_fees_setoff_76 ; +rename table wx_energy_fees_setoff_77 to wx_finance_fees_setoff_77 ; +rename table wx_energy_fees_setoff_78 to wx_finance_fees_setoff_78 ; +rename table wx_energy_fees_setoff_79 to wx_finance_fees_setoff_79 ; +rename table wx_energy_fees_setoff_80 to wx_finance_fees_setoff_80 ; +rename table wx_energy_fees_setoff_81 to wx_finance_fees_setoff_81 ; +rename table wx_energy_fees_setoff_82 to wx_finance_fees_setoff_82 ; +rename table wx_energy_fees_setoff_83 to wx_finance_fees_setoff_83 ; +rename table wx_energy_fees_setoff_84 to wx_finance_fees_setoff_84 ; +rename table wx_energy_fees_setoff_85 to wx_finance_fees_setoff_85 ; +rename table wx_energy_fees_setoff_86 to wx_finance_fees_setoff_86 ; +rename table wx_energy_fees_setoff_87 to wx_finance_fees_setoff_87 ; +rename table wx_energy_fees_setoff_88 to wx_finance_fees_setoff_88 ; +rename table wx_energy_fees_setoff_89 to wx_finance_fees_setoff_89 ; +rename table wx_energy_fees_setoff_90 to wx_finance_fees_setoff_90 ; +rename table wx_energy_fees_setoff_91 to wx_finance_fees_setoff_91 ; +rename table wx_energy_fees_setoff_92 to wx_finance_fees_setoff_92 ; +rename table wx_energy_fees_setoff_93 to wx_finance_fees_setoff_93 ; +rename table wx_energy_fees_setoff_94 to wx_finance_fees_setoff_94 ; +rename table wx_energy_fees_setoff_95 to wx_finance_fees_setoff_95 ; +rename table wx_energy_fees_setoff_96 to wx_finance_fees_setoff_96 ; +rename table wx_energy_fees_setoff_97 to wx_finance_fees_setoff_97 ; +rename table wx_energy_fees_setoff_98 to wx_finance_fees_setoff_98 ; +rename table wx_energy_fees_setoff_99 to wx_finance_fees_setoff_99 ; + +RENAME TABLE wx_energy_fees_shop TO wx_fees_calcute_shop; + +alter table wx_all_bill_0 drop column bill_type; +alter table wx_all_bill_1 drop column bill_type; +alter table wx_all_bill_2 drop column bill_type; +alter table wx_all_bill_3 drop column bill_type; +alter table wx_all_bill_4 drop column bill_type; +alter table wx_all_bill_5 drop column bill_type; +alter table wx_all_bill_6 drop column bill_type; +alter table wx_all_bill_7 drop column bill_type; +alter table wx_all_bill_8 drop column bill_type; +alter table wx_all_bill_9 drop column bill_type; +alter table wx_all_bill_10 drop column bill_type; +alter table wx_all_bill_11 drop column bill_type; +alter table wx_all_bill_12 drop column bill_type; +alter table wx_all_bill_13 drop column bill_type; +alter table wx_all_bill_14 drop column bill_type; +alter table wx_all_bill_15 drop column bill_type; +alter table wx_all_bill_16 drop column bill_type; +alter table wx_all_bill_17 drop column bill_type; +alter table wx_all_bill_18 drop column bill_type; +alter table wx_all_bill_19 drop column bill_type; +alter table wx_all_bill_20 drop column bill_type; +alter table wx_all_bill_21 drop column bill_type; +alter table wx_all_bill_22 drop column bill_type; +alter table wx_all_bill_23 drop column bill_type; +alter table wx_all_bill_24 drop column bill_type; +alter table wx_all_bill_25 drop column bill_type; +alter table wx_all_bill_26 drop column bill_type; +alter table wx_all_bill_27 drop column bill_type; +alter table wx_all_bill_28 drop column bill_type; +alter table wx_all_bill_29 drop column bill_type; +alter table wx_all_bill_30 drop column bill_type; +alter table wx_all_bill_31 drop column bill_type; +alter table wx_all_bill_32 drop column bill_type; +alter table wx_all_bill_33 drop column bill_type; +alter table wx_all_bill_34 drop column bill_type; +alter table wx_all_bill_35 drop column bill_type; +alter table wx_all_bill_36 drop column bill_type; +alter table wx_all_bill_37 drop column bill_type; +alter table wx_all_bill_38 drop column bill_type; +alter table wx_all_bill_39 drop column bill_type; +alter table wx_all_bill_40 drop column bill_type; +alter table wx_all_bill_41 drop column bill_type; +alter table wx_all_bill_42 drop column bill_type; +alter table wx_all_bill_43 drop column bill_type; +alter table wx_all_bill_44 drop column bill_type; +alter table wx_all_bill_45 drop column bill_type; +alter table wx_all_bill_46 drop column bill_type; +alter table wx_all_bill_47 drop column bill_type; +alter table wx_all_bill_48 drop column bill_type; +alter table wx_all_bill_49 drop column bill_type; +alter table wx_all_bill_50 drop column bill_type; +alter table wx_all_bill_51 drop column bill_type; +alter table wx_all_bill_52 drop column bill_type; +alter table wx_all_bill_53 drop column bill_type; +alter table wx_all_bill_54 drop column bill_type; +alter table wx_all_bill_55 drop column bill_type; +alter table wx_all_bill_56 drop column bill_type; +alter table wx_all_bill_57 drop column bill_type; +alter table wx_all_bill_58 drop column bill_type; +alter table wx_all_bill_59 drop column bill_type; +alter table wx_all_bill_60 drop column bill_type; +alter table wx_all_bill_61 drop column bill_type; +alter table wx_all_bill_62 drop column bill_type; +alter table wx_all_bill_63 drop column bill_type; +alter table wx_all_bill_64 drop column bill_type; +alter table wx_all_bill_65 drop column bill_type; +alter table wx_all_bill_66 drop column bill_type; +alter table wx_all_bill_67 drop column bill_type; +alter table wx_all_bill_68 drop column bill_type; +alter table wx_all_bill_69 drop column bill_type; +alter table wx_all_bill_70 drop column bill_type; +alter table wx_all_bill_71 drop column bill_type; +alter table wx_all_bill_72 drop column bill_type; +alter table wx_all_bill_73 drop column bill_type; +alter table wx_all_bill_74 drop column bill_type; +alter table wx_all_bill_75 drop column bill_type; +alter table wx_all_bill_76 drop column bill_type; +alter table wx_all_bill_77 drop column bill_type; +alter table wx_all_bill_78 drop column bill_type; +alter table wx_all_bill_79 drop column bill_type; +alter table wx_all_bill_80 drop column bill_type; +alter table wx_all_bill_81 drop column bill_type; +alter table wx_all_bill_82 drop column bill_type; +alter table wx_all_bill_83 drop column bill_type; +alter table wx_all_bill_84 drop column bill_type; +alter table wx_all_bill_85 drop column bill_type; +alter table wx_all_bill_86 drop column bill_type; +alter table wx_all_bill_87 drop column bill_type; +alter table wx_all_bill_88 drop column bill_type; +alter table wx_all_bill_89 drop column bill_type; +alter table wx_all_bill_90 drop column bill_type; +alter table wx_all_bill_91 drop column bill_type; +alter table wx_all_bill_92 drop column bill_type; +alter table wx_all_bill_93 drop column bill_type; +alter table wx_all_bill_94 drop column bill_type; +alter table wx_all_bill_95 drop column bill_type; +alter table wx_all_bill_96 drop column bill_type; +alter table wx_all_bill_97 drop column bill_type; +alter table wx_all_bill_98 drop column bill_type; +alter table wx_all_bill_99 drop column bill_type; + +alter table wx_finance_receive_bill_0 drop column bill_type; +alter table wx_finance_receive_bill_1 drop column bill_type; +alter table wx_finance_receive_bill_2 drop column bill_type; +alter table wx_finance_receive_bill_3 drop column bill_type; +alter table wx_finance_receive_bill_4 drop column bill_type; +alter table wx_finance_receive_bill_5 drop column bill_type; +alter table wx_finance_receive_bill_6 drop column bill_type; +alter table wx_finance_receive_bill_7 drop column bill_type; +alter table wx_finance_receive_bill_8 drop column bill_type; +alter table wx_finance_receive_bill_9 drop column bill_type; +alter table wx_finance_receive_bill_10 drop column bill_type; +alter table wx_finance_receive_bill_11 drop column bill_type; +alter table wx_finance_receive_bill_12 drop column bill_type; +alter table wx_finance_receive_bill_13 drop column bill_type; +alter table wx_finance_receive_bill_14 drop column bill_type; +alter table wx_finance_receive_bill_15 drop column bill_type; +alter table wx_finance_receive_bill_16 drop column bill_type; +alter table wx_finance_receive_bill_17 drop column bill_type; +alter table wx_finance_receive_bill_18 drop column bill_type; +alter table wx_finance_receive_bill_19 drop column bill_type; +alter table wx_finance_receive_bill_20 drop column bill_type; +alter table wx_finance_receive_bill_21 drop column bill_type; +alter table wx_finance_receive_bill_22 drop column bill_type; +alter table wx_finance_receive_bill_23 drop column bill_type; +alter table wx_finance_receive_bill_24 drop column bill_type; +alter table wx_finance_receive_bill_25 drop column bill_type; +alter table wx_finance_receive_bill_26 drop column bill_type; +alter table wx_finance_receive_bill_27 drop column bill_type; +alter table wx_finance_receive_bill_28 drop column bill_type; +alter table wx_finance_receive_bill_29 drop column bill_type; +alter table wx_finance_receive_bill_30 drop column bill_type; +alter table wx_finance_receive_bill_31 drop column bill_type; +alter table wx_finance_receive_bill_32 drop column bill_type; +alter table wx_finance_receive_bill_33 drop column bill_type; +alter table wx_finance_receive_bill_34 drop column bill_type; +alter table wx_finance_receive_bill_35 drop column bill_type; +alter table wx_finance_receive_bill_36 drop column bill_type; +alter table wx_finance_receive_bill_37 drop column bill_type; +alter table wx_finance_receive_bill_38 drop column bill_type; +alter table wx_finance_receive_bill_39 drop column bill_type; +alter table wx_finance_receive_bill_40 drop column bill_type; +alter table wx_finance_receive_bill_41 drop column bill_type; +alter table wx_finance_receive_bill_42 drop column bill_type; +alter table wx_finance_receive_bill_43 drop column bill_type; +alter table wx_finance_receive_bill_44 drop column bill_type; +alter table wx_finance_receive_bill_45 drop column bill_type; +alter table wx_finance_receive_bill_46 drop column bill_type; +alter table wx_finance_receive_bill_47 drop column bill_type; +alter table wx_finance_receive_bill_48 drop column bill_type; +alter table wx_finance_receive_bill_49 drop column bill_type; +alter table wx_finance_receive_bill_50 drop column bill_type; +alter table wx_finance_receive_bill_51 drop column bill_type; +alter table wx_finance_receive_bill_52 drop column bill_type; +alter table wx_finance_receive_bill_53 drop column bill_type; +alter table wx_finance_receive_bill_54 drop column bill_type; +alter table wx_finance_receive_bill_55 drop column bill_type; +alter table wx_finance_receive_bill_56 drop column bill_type; +alter table wx_finance_receive_bill_57 drop column bill_type; +alter table wx_finance_receive_bill_58 drop column bill_type; +alter table wx_finance_receive_bill_59 drop column bill_type; +alter table wx_finance_receive_bill_60 drop column bill_type; +alter table wx_finance_receive_bill_61 drop column bill_type; +alter table wx_finance_receive_bill_62 drop column bill_type; +alter table wx_finance_receive_bill_63 drop column bill_type; +alter table wx_finance_receive_bill_64 drop column bill_type; +alter table wx_finance_receive_bill_65 drop column bill_type; +alter table wx_finance_receive_bill_66 drop column bill_type; +alter table wx_finance_receive_bill_67 drop column bill_type; +alter table wx_finance_receive_bill_68 drop column bill_type; +alter table wx_finance_receive_bill_69 drop column bill_type; +alter table wx_finance_receive_bill_70 drop column bill_type; +alter table wx_finance_receive_bill_71 drop column bill_type; +alter table wx_finance_receive_bill_72 drop column bill_type; +alter table wx_finance_receive_bill_73 drop column bill_type; +alter table wx_finance_receive_bill_74 drop column bill_type; +alter table wx_finance_receive_bill_75 drop column bill_type; +alter table wx_finance_receive_bill_76 drop column bill_type; +alter table wx_finance_receive_bill_77 drop column bill_type; +alter table wx_finance_receive_bill_78 drop column bill_type; +alter table wx_finance_receive_bill_79 drop column bill_type; +alter table wx_finance_receive_bill_80 drop column bill_type; +alter table wx_finance_receive_bill_81 drop column bill_type; +alter table wx_finance_receive_bill_82 drop column bill_type; +alter table wx_finance_receive_bill_83 drop column bill_type; +alter table wx_finance_receive_bill_84 drop column bill_type; +alter table wx_finance_receive_bill_85 drop column bill_type; +alter table wx_finance_receive_bill_86 drop column bill_type; +alter table wx_finance_receive_bill_87 drop column bill_type; +alter table wx_finance_receive_bill_88 drop column bill_type; +alter table wx_finance_receive_bill_89 drop column bill_type; +alter table wx_finance_receive_bill_90 drop column bill_type; +alter table wx_finance_receive_bill_91 drop column bill_type; +alter table wx_finance_receive_bill_92 drop column bill_type; +alter table wx_finance_receive_bill_93 drop column bill_type; +alter table wx_finance_receive_bill_94 drop column bill_type; +alter table wx_finance_receive_bill_95 drop column bill_type; +alter table wx_finance_receive_bill_96 drop column bill_type; +alter table wx_finance_receive_bill_97 drop column bill_type; +alter table wx_finance_receive_bill_98 drop column bill_type; +alter table wx_finance_receive_bill_99 drop column bill_type; + +alter table wx_finance_receive_setoff_0 drop column bill_type; +alter table wx_finance_receive_setoff_1 drop column bill_type; +alter table wx_finance_receive_setoff_2 drop column bill_type; +alter table wx_finance_receive_setoff_3 drop column bill_type; +alter table wx_finance_receive_setoff_4 drop column bill_type; +alter table wx_finance_receive_setoff_5 drop column bill_type; +alter table wx_finance_receive_setoff_6 drop column bill_type; +alter table wx_finance_receive_setoff_7 drop column bill_type; +alter table wx_finance_receive_setoff_8 drop column bill_type; +alter table wx_finance_receive_setoff_9 drop column bill_type; +alter table wx_finance_receive_setoff_10 drop column bill_type; +alter table wx_finance_receive_setoff_11 drop column bill_type; +alter table wx_finance_receive_setoff_12 drop column bill_type; +alter table wx_finance_receive_setoff_13 drop column bill_type; +alter table wx_finance_receive_setoff_14 drop column bill_type; +alter table wx_finance_receive_setoff_15 drop column bill_type; +alter table wx_finance_receive_setoff_16 drop column bill_type; +alter table wx_finance_receive_setoff_17 drop column bill_type; +alter table wx_finance_receive_setoff_18 drop column bill_type; +alter table wx_finance_receive_setoff_19 drop column bill_type; +alter table wx_finance_receive_setoff_20 drop column bill_type; +alter table wx_finance_receive_setoff_21 drop column bill_type; +alter table wx_finance_receive_setoff_22 drop column bill_type; +alter table wx_finance_receive_setoff_23 drop column bill_type; +alter table wx_finance_receive_setoff_24 drop column bill_type; +alter table wx_finance_receive_setoff_25 drop column bill_type; +alter table wx_finance_receive_setoff_26 drop column bill_type; +alter table wx_finance_receive_setoff_27 drop column bill_type; +alter table wx_finance_receive_setoff_28 drop column bill_type; +alter table wx_finance_receive_setoff_29 drop column bill_type; +alter table wx_finance_receive_setoff_30 drop column bill_type; +alter table wx_finance_receive_setoff_31 drop column bill_type; +alter table wx_finance_receive_setoff_32 drop column bill_type; +alter table wx_finance_receive_setoff_33 drop column bill_type; +alter table wx_finance_receive_setoff_34 drop column bill_type; +alter table wx_finance_receive_setoff_35 drop column bill_type; +alter table wx_finance_receive_setoff_36 drop column bill_type; +alter table wx_finance_receive_setoff_37 drop column bill_type; +alter table wx_finance_receive_setoff_38 drop column bill_type; +alter table wx_finance_receive_setoff_39 drop column bill_type; +alter table wx_finance_receive_setoff_40 drop column bill_type; +alter table wx_finance_receive_setoff_41 drop column bill_type; +alter table wx_finance_receive_setoff_42 drop column bill_type; +alter table wx_finance_receive_setoff_43 drop column bill_type; +alter table wx_finance_receive_setoff_44 drop column bill_type; +alter table wx_finance_receive_setoff_45 drop column bill_type; +alter table wx_finance_receive_setoff_46 drop column bill_type; +alter table wx_finance_receive_setoff_47 drop column bill_type; +alter table wx_finance_receive_setoff_48 drop column bill_type; +alter table wx_finance_receive_setoff_49 drop column bill_type; +alter table wx_finance_receive_setoff_50 drop column bill_type; +alter table wx_finance_receive_setoff_51 drop column bill_type; +alter table wx_finance_receive_setoff_52 drop column bill_type; +alter table wx_finance_receive_setoff_53 drop column bill_type; +alter table wx_finance_receive_setoff_54 drop column bill_type; +alter table wx_finance_receive_setoff_55 drop column bill_type; +alter table wx_finance_receive_setoff_56 drop column bill_type; +alter table wx_finance_receive_setoff_57 drop column bill_type; +alter table wx_finance_receive_setoff_58 drop column bill_type; +alter table wx_finance_receive_setoff_59 drop column bill_type; +alter table wx_finance_receive_setoff_60 drop column bill_type; +alter table wx_finance_receive_setoff_61 drop column bill_type; +alter table wx_finance_receive_setoff_62 drop column bill_type; +alter table wx_finance_receive_setoff_63 drop column bill_type; +alter table wx_finance_receive_setoff_64 drop column bill_type; +alter table wx_finance_receive_setoff_65 drop column bill_type; +alter table wx_finance_receive_setoff_66 drop column bill_type; +alter table wx_finance_receive_setoff_67 drop column bill_type; +alter table wx_finance_receive_setoff_68 drop column bill_type; +alter table wx_finance_receive_setoff_69 drop column bill_type; +alter table wx_finance_receive_setoff_70 drop column bill_type; +alter table wx_finance_receive_setoff_71 drop column bill_type; +alter table wx_finance_receive_setoff_72 drop column bill_type; +alter table wx_finance_receive_setoff_73 drop column bill_type; +alter table wx_finance_receive_setoff_74 drop column bill_type; +alter table wx_finance_receive_setoff_75 drop column bill_type; +alter table wx_finance_receive_setoff_76 drop column bill_type; +alter table wx_finance_receive_setoff_77 drop column bill_type; +alter table wx_finance_receive_setoff_78 drop column bill_type; +alter table wx_finance_receive_setoff_79 drop column bill_type; +alter table wx_finance_receive_setoff_80 drop column bill_type; +alter table wx_finance_receive_setoff_81 drop column bill_type; +alter table wx_finance_receive_setoff_82 drop column bill_type; +alter table wx_finance_receive_setoff_83 drop column bill_type; +alter table wx_finance_receive_setoff_84 drop column bill_type; +alter table wx_finance_receive_setoff_85 drop column bill_type; +alter table wx_finance_receive_setoff_86 drop column bill_type; +alter table wx_finance_receive_setoff_87 drop column bill_type; +alter table wx_finance_receive_setoff_88 drop column bill_type; +alter table wx_finance_receive_setoff_89 drop column bill_type; +alter table wx_finance_receive_setoff_90 drop column bill_type; +alter table wx_finance_receive_setoff_91 drop column bill_type; +alter table wx_finance_receive_setoff_92 drop column bill_type; +alter table wx_finance_receive_setoff_93 drop column bill_type; +alter table wx_finance_receive_setoff_94 drop column bill_type; +alter table wx_finance_receive_setoff_95 drop column bill_type; +alter table wx_finance_receive_setoff_96 drop column bill_type; +alter table wx_finance_receive_setoff_97 drop column bill_type; +alter table wx_finance_receive_setoff_98 drop column bill_type; +alter table wx_finance_receive_setoff_99 drop column bill_type; + +alter table wx_all_bill_0 add column fees_type int(1); +alter table wx_all_bill_1 add column fees_type int(1); +alter table wx_all_bill_2 add column fees_type int(1); +alter table wx_all_bill_3 add column fees_type int(1); +alter table wx_all_bill_4 add column fees_type int(1); +alter table wx_all_bill_5 add column fees_type int(1); +alter table wx_all_bill_6 add column fees_type int(1); +alter table wx_all_bill_7 add column fees_type int(1); +alter table wx_all_bill_8 add column fees_type int(1); +alter table wx_all_bill_9 add column fees_type int(1); +alter table wx_all_bill_10 add column fees_type int(1); +alter table wx_all_bill_11 add column fees_type int(1); +alter table wx_all_bill_12 add column fees_type int(1); +alter table wx_all_bill_13 add column fees_type int(1); +alter table wx_all_bill_14 add column fees_type int(1); +alter table wx_all_bill_15 add column fees_type int(1); +alter table wx_all_bill_16 add column fees_type int(1); +alter table wx_all_bill_17 add column fees_type int(1); +alter table wx_all_bill_18 add column fees_type int(1); +alter table wx_all_bill_19 add column fees_type int(1); +alter table wx_all_bill_20 add column fees_type int(1); +alter table wx_all_bill_21 add column fees_type int(1); +alter table wx_all_bill_22 add column fees_type int(1); +alter table wx_all_bill_23 add column fees_type int(1); +alter table wx_all_bill_24 add column fees_type int(1); +alter table wx_all_bill_25 add column fees_type int(1); +alter table wx_all_bill_26 add column fees_type int(1); +alter table wx_all_bill_27 add column fees_type int(1); +alter table wx_all_bill_28 add column fees_type int(1); +alter table wx_all_bill_29 add column fees_type int(1); +alter table wx_all_bill_30 add column fees_type int(1); +alter table wx_all_bill_31 add column fees_type int(1); +alter table wx_all_bill_32 add column fees_type int(1); +alter table wx_all_bill_33 add column fees_type int(1); +alter table wx_all_bill_34 add column fees_type int(1); +alter table wx_all_bill_35 add column fees_type int(1); +alter table wx_all_bill_36 add column fees_type int(1); +alter table wx_all_bill_37 add column fees_type int(1); +alter table wx_all_bill_38 add column fees_type int(1); +alter table wx_all_bill_39 add column fees_type int(1); +alter table wx_all_bill_40 add column fees_type int(1); +alter table wx_all_bill_41 add column fees_type int(1); +alter table wx_all_bill_42 add column fees_type int(1); +alter table wx_all_bill_43 add column fees_type int(1); +alter table wx_all_bill_44 add column fees_type int(1); +alter table wx_all_bill_45 add column fees_type int(1); +alter table wx_all_bill_46 add column fees_type int(1); +alter table wx_all_bill_47 add column fees_type int(1); +alter table wx_all_bill_48 add column fees_type int(1); +alter table wx_all_bill_49 add column fees_type int(1); +alter table wx_all_bill_50 add column fees_type int(1); +alter table wx_all_bill_51 add column fees_type int(1); +alter table wx_all_bill_52 add column fees_type int(1); +alter table wx_all_bill_53 add column fees_type int(1); +alter table wx_all_bill_54 add column fees_type int(1); +alter table wx_all_bill_55 add column fees_type int(1); +alter table wx_all_bill_56 add column fees_type int(1); +alter table wx_all_bill_57 add column fees_type int(1); +alter table wx_all_bill_58 add column fees_type int(1); +alter table wx_all_bill_59 add column fees_type int(1); +alter table wx_all_bill_60 add column fees_type int(1); +alter table wx_all_bill_61 add column fees_type int(1); +alter table wx_all_bill_62 add column fees_type int(1); +alter table wx_all_bill_63 add column fees_type int(1); +alter table wx_all_bill_64 add column fees_type int(1); +alter table wx_all_bill_65 add column fees_type int(1); +alter table wx_all_bill_66 add column fees_type int(1); +alter table wx_all_bill_67 add column fees_type int(1); +alter table wx_all_bill_68 add column fees_type int(1); +alter table wx_all_bill_69 add column fees_type int(1); +alter table wx_all_bill_70 add column fees_type int(1); +alter table wx_all_bill_71 add column fees_type int(1); +alter table wx_all_bill_72 add column fees_type int(1); +alter table wx_all_bill_73 add column fees_type int(1); +alter table wx_all_bill_74 add column fees_type int(1); +alter table wx_all_bill_75 add column fees_type int(1); +alter table wx_all_bill_76 add column fees_type int(1); +alter table wx_all_bill_77 add column fees_type int(1); +alter table wx_all_bill_78 add column fees_type int(1); +alter table wx_all_bill_79 add column fees_type int(1); +alter table wx_all_bill_80 add column fees_type int(1); +alter table wx_all_bill_81 add column fees_type int(1); +alter table wx_all_bill_82 add column fees_type int(1); +alter table wx_all_bill_83 add column fees_type int(1); +alter table wx_all_bill_84 add column fees_type int(1); +alter table wx_all_bill_85 add column fees_type int(1); +alter table wx_all_bill_86 add column fees_type int(1); +alter table wx_all_bill_87 add column fees_type int(1); +alter table wx_all_bill_88 add column fees_type int(1); +alter table wx_all_bill_89 add column fees_type int(1); +alter table wx_all_bill_90 add column fees_type int(1); +alter table wx_all_bill_91 add column fees_type int(1); +alter table wx_all_bill_92 add column fees_type int(1); +alter table wx_all_bill_93 add column fees_type int(1); +alter table wx_all_bill_94 add column fees_type int(1); +alter table wx_all_bill_95 add column fees_type int(1); +alter table wx_all_bill_96 add column fees_type int(1); +alter table wx_all_bill_97 add column fees_type int(1); +alter table wx_all_bill_98 add column fees_type int(1); +alter table wx_all_bill_99 add column fees_type int(1); + + diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java index f7b40983a..c0522aeab 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java @@ -21,7 +21,6 @@ import com.iformall.domain.po.WxShopUsersInfo; import com.iformall.domain.po.WxUserDataRule; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillOweOrNearType; import com.iformall.enums.EnumBillPayChannel; import com.iformall.enums.EnumBillUpdateType; @@ -92,14 +91,14 @@ public class WxBillController extends BaseController { * 账单类型 * @return */ - @GetMapping("billTypes") - public ResultData billTypes() { - Map tmap = new HashMap(); - for (EnumBillAllType t : EnumBillAllType.values()) { - tmap.put(t.getCode(), t.getMessage()); - } - return new ResultData(tmap); - } +// @GetMapping("billTypes") +// public ResultData billTypes() { +// Map tmap = new HashMap(); +// for (EnumBillAllType t : EnumBillAllType.values()) { +// tmap.put(t.getCode(), t.getMessage()); +// } +// return new ResultData(tmap); +// } /** * 账单查询范围 @@ -276,15 +275,6 @@ public class WxBillController extends BaseController { Integer billTypeValue = Integer.parseInt(billTypeValueStr); Long billId = Long.parseLong(billIdStr); - EnumBillAllType btype; - if (billTypeValue.intValue() == Constant.bill_all_type_manage_fee) { - btype = EnumBillAllType.RENT_BUSSINESS_MANAGE; - }else { - btype = EnumBillAllType.getEnum(billTypeValue); - if (null == btype) { - return new ResultData(Result.ERROR,"分类非法"); - } - } TenantEntity tenantEntity = getTenantInfo(); WxAllBill billdetail = billAllHelper.getBillDetail(tenantEntity,billId); if (null == billdetail) { diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java index 96035d976..5dbe97911 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java @@ -29,7 +29,6 @@ import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxBillHotNotify; import com.iformall.domain.vo.WxBillSum; import com.iformall.domain.vo.WxCouponOrderSumVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillDailyBuildWay; import com.iformall.enums.EnumBillDailyType; import com.iformall.enums.EnumBillOweOrNearType; diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java index 3e689dfa2..a42f1eb14 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/ContractSchedule.java @@ -1,13 +1,11 @@ package com.iformall.schedule; import com.iformall.domain.po.WxMall; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.msg.WxMsgRecord; import com.iformall.enums.*; import com.iformall.mapper.WxMallMapper; import com.iformall.mq.MqBaseProducer; -import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; import com.iformall.utils.DateUtils; import lombok.extern.slf4j.Slf4j; @@ -29,9 +27,6 @@ public class ContractSchedule { @Autowired private WxRentContractService wxRentContractService; - @Autowired - private WxPropertyContractService wxPropertyContractService; - @Autowired private WxMallMapper wxMallMapper; @@ -41,32 +36,32 @@ public class ContractSchedule { /** * 凌晨5分 */ - @Async - @Scheduled(cron = "0 5 0 * * ?") - public void updateContractStatus() { - //更新合同状态,正常到期 - - //查询计租中的合同,找到商户,然后根据商户,如果商户有到期的(租金、物业)合同,则合同状态更新为到期。 - //如果店铺没有有效合同,则不释放店铺,不停用商户 - List wxMalls = wxMallMapper.findList(null); - for (WxMall wxMall : wxMalls) { - try { - //租金合同 - wxRentContractService.outDateContract(wxMall); - wxRentContractService.readyToNomal(wxMall); - }catch(Exception e) { - log.error("rentcontract outDate error.",e); - } - - try { - //物业合同 - wxPropertyContractService.outDateContract(wxMall); - wxPropertyContractService.readyToNomal(wxMall); - }catch(Exception e) { - log.error("propertycontract outDate error.",e); - } - - } +// @Async +// @Scheduled(cron = "0 5 0 * * ?") +// public void updateContractStatus() { +// //更新合同状态,正常到期 +// +// //查询计租中的合同,找到商户,然后根据商户,如果商户有到期的(租金、物业)合同,则合同状态更新为到期。 +// //如果店铺没有有效合同,则不释放店铺,不停用商户 +// List wxMalls = wxMallMapper.findList(null); +// for (WxMall wxMall : wxMalls) { +// try { +// //租金合同 +// wxRentContractService.outDateContract(wxMall); +// wxRentContractService.readyToNomal(wxMall); +// }catch(Exception e) { +// log.error("rentcontract outDate error.",e); +// } +// +// try { +// //物业合同 +// wxPropertyContractService.outDateContract(wxMall); +// wxPropertyContractService.readyToNomal(wxMall); +// }catch(Exception e) { +// log.error("propertycontract outDate error.",e); +// } +// +// } // log.info("合同状态更新开始"); // List wxMalls = wxMallMapper.findList(null); @@ -84,8 +79,8 @@ public class ContractSchedule { // wxPropertyContractService.updateStatus(wxPropertyContract); // log.info("物业合同状态更新结束"); // } - log.info("合同状态更新结束"); - } +// log.info("合同状态更新结束"); +// } /** * 凌晨5分,定时终止租金合同 @@ -109,128 +104,40 @@ public class ContractSchedule { } } - /** - * 凌晨5分,定时终止物业合同 - */ - @Async - @Scheduled(cron = "0 5 0 * * ?") - public void endProperyContract() { - List wxMalls = wxMallMapper.findList(null); - for (WxMall wxMall : wxMalls) { - //物业合同 - WxPropertyContract record = new WxPropertyContract(); - record.updateTenantInfo(wxMall); - List contractList = wxPropertyContractService.findToEndContractList(record); - for (WxPropertyContract rent:contractList) { - try { - wxPropertyContractService.endContract(rent,null); - }catch(Exception e) { - log.error("rentcontract outDate error.",e); - } - } - } - } - - /** - * 凌晨5分,定时过期提醒租金合同到期 - */ - @Async - @Scheduled(cron = "0 5 0 * * ?") - public void notifyRentContractOutDate() { - List wxMalls = wxMallMapper.findList(null); - Date date = new Date(); - for (WxMall wxMall : wxMalls) { - //物业合同 - List contractList = wxRentContractService.findToOutDateContracts(wxMall); - for (WxRentContract rent:contractList) { - try { - Date endDate = DateUtils.stringToDate(DateUtils.getTimeBefore(rent.getOutDateNotifyDays(),rent.getRentalEndDate(),DateUtils.DATE_TIME_PATTERN), DateUtils.DATE_TIME_PATTERN); - if (endDate.after(date)) { - continue; - } - WxMsgRecord msgRecord = new WxMsgRecord(); - msgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); - msgRecord.updateTenantInfo(wxMall); - msgRecord.setReceiver(rent.getOutDateNotifyPhone()); - msgRecord.setModelType(32); - Map dynamicContentMap = new HashMap(); - dynamicContentMap.put("id", String.valueOf(rent.getId())); - dynamicContentMap.put("contractType", "租金"); - dynamicContentMap.put("contract", rent.getContractNumber()); - msgRecord.setDynamicContentMap(dynamicContentMap); - mqBaseProducer.sendMessage(msgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - }catch(Exception e) { - log.error("rentcontract outDate error.",e); - } - } - } - } - - /** - * 凌晨5分,定时过期提醒物业合同到期 - */ - @Async - @Scheduled(cron = "0 5 0 * * ?") - public void notifyPropertyContractOutDate() { - List wxMalls = wxMallMapper.findList(null); - Date date = new Date(); - for (WxMall wxMall : wxMalls) { - //物业合同 - List contractList = wxPropertyContractService.findToOutDateContracts(wxMall); - for (WxPropertyContract rent:contractList) { - try { - Date endDate = DateUtils.stringToDate(DateUtils.getTimeBefore(rent.getOutDateNotifyDays(),rent.getRentalEndDate(),DateUtils.DATE_TIME_PATTERN), DateUtils.DATE_TIME_PATTERN); - if (endDate.after(date)) { - continue; - } - WxMsgRecord msgRecord = new WxMsgRecord(); - msgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); - msgRecord.updateTenantInfo(wxMall); - msgRecord.setReceiver(rent.getOutDateNotifyPhone()); - msgRecord.setModelType(32); - Map dynamicContentMap = new HashMap(); - dynamicContentMap.put("id", String.valueOf(rent.getId())); - dynamicContentMap.put("contractType", "物业"); - dynamicContentMap.put("contract", rent.getContractNumber()); - msgRecord.setDynamicContentMap(dynamicContentMap); - mqBaseProducer.sendMessage(msgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - }catch(Exception e) { - log.error("rentcontract outDate error.",e); - } - } - } - } - - // /** -// * 凌晨5分,联营扣点和面积联营取高的需要根据接单数据来更新账单,取高的那一个 +// * 凌晨5分,定时过期提醒租金合同到期 // */ // @Async // @Scheduled(cron = "0 5 0 * * ?") -// //@Scheduled(cron = "0 */2 * * * *?") -// public void updateRentBill() { -// //查询记租中的联营扣点或者取高的合同,每天更新账单截止时间为前一天的账单。 +// public void notifyRentContractOutDate() { // List wxMalls = wxMallMapper.findList(null); +// Date date = new Date(); // for (WxMall wxMall : wxMalls) { -// WxRentContract rentContract = new WxRentContract(); -// rentContract.updateTenantInfo(wxMall); -// List typeList = new ArrayList(); -// typeList.add(EnumRentContractType.RENT_BY_JOINT.getCode()); -// typeList.add(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode()); -// rentContract.setTypeList(typeList); -// rentContract.setStatus(EnumRentContractStatus.PAING.getCode()); -// List contractList = wxRentContractService.findList(rentContract); -// if (null != contractList && contractList.size() > 0 ) { -// for (int i = 0 ; i < contractList.size(); i++ ) { -// WxRentContract rc = contractList.get(i); -// try { -// wxRentContractService.calcuteByTradeDaily(rc); -// }catch(Exception e) { -// log.error("rentcontract updateRentBill error.",e); -// } -// } -// } +// //物业合同 +// List contractList = wxRentContractService.findToOutDateContracts(wxMall); +// for (WxRentContract rent:contractList) { +// try { +// Date endDate = DateUtils.stringToDate(DateUtils.getTimeBefore(rent.getOutDateNotifyDays(),rent.getRentalEndDate(),DateUtils.DATE_TIME_PATTERN), DateUtils.DATE_TIME_PATTERN); +// if (endDate.after(date)) { +// continue; +// } +// WxMsgRecord msgRecord = new WxMsgRecord(); +// msgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); +// msgRecord.updateTenantInfo(wxMall); +// msgRecord.setReceiver(rent.getOutDateNotifyPhone()); +// msgRecord.setModelType(32); +// Map dynamicContentMap = new HashMap(); +// dynamicContentMap.put("id", String.valueOf(rent.getId())); +// dynamicContentMap.put("contractType", "租金"); +// dynamicContentMap.put("contract", rent.getContractNumber()); +// msgRecord.setDynamicContentMap(dynamicContentMap); +// mqBaseProducer.sendMessage(msgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); +// }catch(Exception e) { +// log.error("rentcontract outDate error.",e); +// } +// } // } // } + } \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java index 0cddc1540..f1904b2e9 100644 --- a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java +++ b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java @@ -388,14 +388,14 @@ public class BaseMyBatisConfiguration { ShardingSphere wxEnergyFeesSharding = new ShardingSphere(); wxEnergyFeesSharding.setColumn("tenant_id"); - wxEnergyFeesSharding.setTableName("wx_energy_fees"); + wxEnergyFeesSharding.setTableName("wx_finance_fees"); wxEnergyFeesSharding.setCount(100); wxEnergyFeesSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(wxEnergyFeesSharding); ShardingSphere wxEnergyFeesSetoffSharding = new ShardingSphere(); wxEnergyFeesSetoffSharding.setColumn("tenant_id"); - wxEnergyFeesSetoffSharding.setTableName("wx_energy_fees_setoff"); + wxEnergyFeesSetoffSharding.setTableName("wx_finance_fees_setoff"); wxEnergyFeesSetoffSharding.setCount(100); wxEnergyFeesSetoffSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(wxEnergyFeesSetoffSharding); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java index e52a924b8..27ce4179c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java @@ -1,16 +1,12 @@ package com.iformall.domain.po; import cn.afterturn.easypoi.excel.annotation.Excel; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.FinanceSetOffDetailVo; import com.iformall.domain.vo.WxBillFeesStandardsListVo; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumBillStatus; +import com.iformall.enums.EnumFeesType; import com.iformall.utils.DateUtils; import lombok.Data; @@ -89,17 +85,15 @@ public class WxAllBill extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") public String pay; - @io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType") - public Integer billType; - @Excel(name = "账单类型名称", width = 20, orderNum = "8") - @io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName") - @TableField(exist = false) - public String billTypeName; - public String getBillTypeName() { - if (null != billType) { - billTypeName = EnumBillAllType.getEnum(billType).getMessage(); + @io.swagger.annotations.ApiModelProperty(value = "类型EnumFeesType", name = "feesType") + private Integer feesType; + @TableField(exist = false) + private String feesTypeName; + public String getFeesTypeName() { + if (null != feesType) { + return EnumFeesType.getEnum(feesType).getMessage(); } - return billTypeName; + return null; } @io.swagger.annotations.ApiModelProperty(value = "支付方式", name = "payWay") @@ -189,24 +183,25 @@ public class WxAllBill extends TenantEntity { if (StringUtils.isBlank(returnPay)) { returnPay = "0"; } - //如果是押金,则不计算已退金额 - boolean isDeposit = false; - if (null != billType) { - for (EnumBillAllType types : EnumBillAllType.getDepositTypes()) { - if (types.getCode().intValue() == billType.intValue()) { - isDeposit = true; - break; - } - } - - } +// //如果是押金,则不计算已退金额 +// boolean isDeposit = false; +// if (null != billType) { +// for (EnumBillAllType types : EnumBillAllType.getDepositTypes()) { +// if (types.getCode().intValue() == billType.intValue()) { +// isDeposit = true; +// break; +// } +// } +// +// } + //退回的只记录,不算 if (StringUtils.isNotBlank(receivePay) && StringUtils.isNotBlank(pay)) { String o = "0"; - if (isDeposit) { + //if (isDeposit) { o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).subtract(new BigDecimal(setOff)).toPlainString(); - }else { - o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).add(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); - } +// }else { +// o = new BigDecimal(receivePay).subtract(new BigDecimal(pay)).add(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); +// } return o; } return "0"; @@ -317,25 +312,20 @@ public class WxAllBill extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="楼座号",name="building") @TableField(exist = false) public Long building; - @io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor") @TableField(exist = false) public Long floor; - @io.swagger.annotations.ApiModelProperty(value="实际应收金额(加上了滞纳金服务费等费用)",name="realReceivePay") @TableField(exist = false) public String realReceivePay; - //滞纳金 @TableField(exist = false) public String billLatePay; //服务费 @TableField(exist = false) public String serviceChargePay; - @TableField(exist = false) public String billAllNeedPay; - public String getBillAllNeedPay() { String bl = this.getBillLatePay(); if (StringUtils.isBlank(bl)) { @@ -357,47 +347,34 @@ public class WxAllBill extends TenantEntity { @TableField(exist = false) public String month; - //EnumBillOweOrNearType 逾期 1, 临期 2 @TableField(exist = false) public Integer onlyOweOrNear; - //账单逾期计算截止时间 @TableField(exist = false) public Date oweBillLastTime; - //临期计算截止时间 @TableField(exist = false) public Date nearBillLastTime; - //临期计算截止时间 @TableField(exist = false) public Integer notifyed; - @TableField(exist = false) private Date needPayStartDay; - @TableField(exist = false) private List setOffDetailList; - @TableField(exist = false) private String currentSetOff; - @TableField(exist = false) private String currentReceive; - @TableField(exist = false) private String currentCut; - @TableField(exist = false) private Date shopEndtime; - @TableField(exist = false) public List childList; - @TableField(exist = false) List unFixedbillFeesStandardsList; - @TableField(exist = false) private Integer hasParentBillId; @TableField(exist = false) @@ -428,8 +405,8 @@ public class WxAllBill extends TenantEntity { public List energyFeesIds; @TableField(exist = false) public Integer advanceHasMoney; - @TableField(exist = false) - private Integer depositHasMoney; +// @TableField(exist = false) +// private Integer depositHasMoney; @TableField(exist = false) private String energyFeesIdStr; @TableField(exist = false) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java index b3500e897..de06b2f4f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java @@ -18,9 +18,6 @@ public class WxBillAction extends TenantEntity { protected Long id; - @io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType") - private Integer billType; - @io.swagger.annotations.ApiModelProperty(value = "账单ID", name = "billId") private Long billId; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java deleted file mode 100644 index 0a75763ee..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFees.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.iformall.domain.po; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumContractReceivePeriodUnit; -import com.iformall.enums.EnumEnergyMeterType; -import com.iformall.enums.EnumFeesStandardsCalcuteUnit; -import com.iformall.enums.EnumFeesStandardsTimeUnit; -import com.iformall.enums.EnumRentDayPriceCalcute; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.helper.WxRentContractHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - */ -@TableName(value = "wx_energy_fees") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxEnergyFees extends TenantEntity { - - private static final long serialVersionUID = 7009117540201976664L; - - @io.swagger.annotations.ApiModelProperty(value="id",name="id") - private Long id; - - @io.swagger.annotations.ApiModelProperty(value="name",name="name") - private String name; - - @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") - private Date createTime; - - @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") - private Date updateTime; - - @io.swagger.annotations.ApiModelProperty(value = "isDel", name = "isDel") - private Integer isDel; - - @io.swagger.annotations.ApiModelProperty(value = "收款还是付款EnumFinanceCashierType", name = "cashierType") - private Integer cashierType; - - @io.swagger.annotations.ApiModelProperty(value = "单价", name = "price") - private String price; - - @io.swagger.annotations.ApiModelProperty(value = "税率", name = "taxRate") - private String taxRate; - - @io.swagger.annotations.ApiModelProperty(value = "表类型EnumEnergyMeterType", name = "type") - private Integer type; - @TableField(exist = false) - private String typeName; - public String getTypeName() { - if (null != type) { - return EnumEnergyMeterType.getEnum(type).getMessage(); - } - return null; - } - - @io.swagger.annotations.ApiModelProperty(value = "是否公摊", name = "isPublic") - private Integer isPublic; - - @io.swagger.annotations.ApiModelProperty(value = "所属账单类型EnumBillAllType", name = "billType") - private Integer billType; - @TableField(exist = false) - private String billTypeName; - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return null; - } - - @io.swagger.annotations.ApiModelProperty(value = "是否系统内置", name = "isSystem") - private Integer isSystem; - - @io.swagger.annotations.ApiModelProperty(value = "是否一次性费用EnumYesOrNo", name = "fixedPrice") - private Integer fixedPrice; - @TableField(exist = false) - private String fixedPriceName; - public String getFixedPriceName() { - if (null != fixedPrice) { - if (fixedPrice.intValue() == EnumYesOrNo.YES.getCode().intValue()) { - return "一次性费用"; - }else { - return "非一次性费用"; - } - } - return ""; - } - - @io.swagger.annotations.ApiModelProperty(value = "计量单位EnumFeesStandardsCalcuteUnit【非固定费用使用】", name = "calcuteUnit") - private Integer calcuteUnit; - @TableField(exist = false) - private String calcuteUnitName; - public String getCalcuteUnitName() { - if (null != calcuteUnit) { - return EnumFeesStandardsCalcuteUnit.getEnum(calcuteUnit).getMessage(); - } - return ""; - } - - @io.swagger.annotations.ApiModelProperty(value = "时间单位EnumFeesStandardsTimeUnit【非固定费用使用】", name = "timeUnit") - private Integer timeUnit; - @TableField(exist = false) - private String timeUnitName; - public String getTimeUnitName() { - if (null != timeUnit) { - return EnumFeesStandardsTimeUnit.getEnum(timeUnit).getMessage(); - } - return ""; - } - - - @io.swagger.annotations.ApiModelProperty(value = "是否押金类,押金类是需要退回的", name = "isDespoit") - private Integer isDespoit; - - - public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays, - EnumContractReceivePeriodUnit dayType,Integer receivePeriod ) { - if (StringUtils.isBlank(count)) { - count = "1"; - } - - if (isFixed) { - //如果是按计量单位计算的 - BigDecimal priceD = new BigDecimal(this.price); - priceD = priceD.multiply(new BigDecimal(count)); - return priceD.toPlainString(); - } - //按天计算 - if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { - BigDecimal priceD = new BigDecimal(this.price); - priceD = priceD.multiply(new BigDecimal(count)); - return WxRentContractHelper.getNeedPay(null,decimalSize,priceD,start,end,priceCalcute,monthDays); - }else { - //按月计算 - BigDecimal priceMonth = new BigDecimal(this.price); - if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.YEAR.getCode().intValue()) { - priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - priceMonth = priceMonth.multiply(new BigDecimal(count)); - return WxRentContractHelper.getMonthNeedPay(null,decimalSize,priceMonth, start, end,dayType.getCode(),receivePeriod,priceCalcute.getCode(),monthDays); - } - } - - @TableField(exist = false) - private List feesIds;//冲抵科目 - @TableField(exist = false) - private String feesName; - public String getFeesIdsName(Map feesMap) { - if (null != feesIds) { - StringBuffer sb= new StringBuffer(); - for (int i = 0 ; i < feesIds.size(); i++) { - Long feid = feesIds.get(i); - WxEnergyFees f = feesMap.get(feid); - if (null != f) { - sb.append(f.getName()).append(","); - } - } - return sb.toString(); - } - return null; - } - - @TableField(exist = false) - private Integer notSetOff; - @TableField(exist = false) - private List billTypeList; - @TableField(exist = false) - private Integer isAllList; - @TableField(exist = false) - private Integer isFeesShopQuery; - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java index b6c9875f6..41249313e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.common.IdWorker; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillDailyBuildWay; import com.iformall.enums.EnumBillRentApplyStatus; import com.iformall.enums.EnumBillStatus; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java index 0e4ceff7f..a293b5d9b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.common.IdWorker; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumYesOrNo; import com.iformall.utils.DateUtils; @@ -114,7 +113,7 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity { daily.setOwe(needPay); daily.setShopId(this.shopId); daily.setShopNumber(shop.getShopNumber()); - daily.setBillType(EnumBillAllType.DAILY.getCode()); + //daily.setBillType(EnumBillAllType.DAILY.getCode()); daily.setEnergyFeesId(calcute.getFeesId()); daily.setPriceDetail(detail); daily.setServiceChargePay("0"); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesShop.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFeesCalcuteShop.java similarity index 94% rename from mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesShop.java rename to mallinkService/src/main/java/com/iformall/domain/po/WxFeesCalcuteShop.java index 923ec46bc..64beaff1f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesShop.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFeesCalcuteShop.java @@ -23,11 +23,11 @@ import java.util.List; /** */ -@TableName(value = "wx_energy_fees_shop") +@TableName(value = "wx_fees_calcute_shop") @Data @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) -public class WxEnergyFeesShop extends TenantEntity { +public class WxFeesCalcuteShop extends TenantEntity { private static final long serialVersionUID = 7009117540201976664L; @@ -99,13 +99,13 @@ public class WxEnergyFeesShop extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") private Date endTime; - @io.swagger.annotations.ApiModelProperty(value = "公摊计算公司", name = "formula") + @io.swagger.annotations.ApiModelProperty(value = "计算公司", name = "formula") private String formula; - @io.swagger.annotations.ApiModelProperty(value = "公摊计算公式数组字符串", name = "formula") + @io.swagger.annotations.ApiModelProperty(value = "计算公式数组字符串", name = "formula") private String formulaListStr; @TableField(exist = false) private List formulaList; - @io.swagger.annotations.ApiModelProperty(value = "公摊计算公司", name = "formulaContent") + @io.swagger.annotations.ApiModelProperty(value = "计算公司", name = "formulaContent") private String formulaContent; @TableField(exist = false) private List formulaContentList; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFees.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFees.java new file mode 100644 index 000000000..b1d1e20c0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFees.java @@ -0,0 +1,114 @@ +package com.iformall.domain.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumFeesType; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + */ +@TableName(value = "wx_finance_fees") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxFinanceFees extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="name",name="name") + private String name; + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + + @io.swagger.annotations.ApiModelProperty(value = "isDel", name = "isDel") + private Integer isDel; + + @io.swagger.annotations.ApiModelProperty(value = "类型EnumFeesType", name = "feesType") + private Integer feesType; + @TableField(exist = false) + private String feesTypeName; + public String getFeesTypeName() { + if (null != feesType) { + return EnumFeesType.getEnum(feesType).getMessage(); + } + return null; + } + + @io.swagger.annotations.ApiModelProperty(value = "税率", name = "taxRate") + private String taxRate; + + @io.swagger.annotations.ApiModelProperty(value = "是否押金类,押金类是需要退回的", name = "isDespoit") + private Integer isDespoit; + + +// public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays, +// EnumContractReceivePeriodUnit dayType,Integer receivePeriod ) { +// if (StringUtils.isBlank(count)) { +// count = "1"; +// } +// +// if (isFixed) { +// //如果是按计量单位计算的 +// BigDecimal priceD = new BigDecimal(this.price); +// priceD = priceD.multiply(new BigDecimal(count)); +// return priceD.toPlainString(); +// } +// //按天计算 +// if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.DAY.getCode().intValue()) { +// BigDecimal priceD = new BigDecimal(this.price); +// priceD = priceD.multiply(new BigDecimal(count)); +// return WxRentContractHelper.getNeedPay(null,decimalSize,priceD,start,end,priceCalcute,monthDays); +// }else { +// //按月计算 +// BigDecimal priceMonth = new BigDecimal(this.price); +// if (this.timeUnit.intValue() == EnumFeesStandardsTimeUnit.YEAR.getCode().intValue()) { +// priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// } +// priceMonth = priceMonth.multiply(new BigDecimal(count)); +// //return WxRentContractAgileHelper.getMonthNeedPay(null,decimalSize,priceMonth, start, end,dayType.getCode(),receivePeriod,priceCalcute.getCode(),monthDays); +// return ""; +// } +// } + + @TableField(exist = false) + private List feesIds;//冲抵科目 + @TableField(exist = false) + private String feesName; + public String getFeesIdsName(Map feesMap) { + if (null != feesIds) { + StringBuffer sb= new StringBuffer(); + for (int i = 0 ; i < feesIds.size(); i++) { + Long feid = feesIds.get(i); + WxFinanceFees f = feesMap.get(feid); + if (null != f) { + sb.append(f.getName()).append(","); + } + } + return sb.toString(); + } + return null; + } + + @TableField(exist = false) + private Integer notSetOff; +// @TableField(exist = false) +// private List billTypeList; + @TableField(exist = false) + private Integer isAllList; + @TableField(exist = false) + private Integer isFeesShopQuery; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesSetoff.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFeesSetoff.java similarity index 90% rename from mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesSetoff.java rename to mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFeesSetoff.java index 4b1a18466..c338c0906 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyFeesSetoff.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceFeesSetoff.java @@ -9,11 +9,11 @@ import java.util.Date; /** */ -@TableName(value = "wx_energy_fees_setoff") +@TableName(value = "wx_finance_fees_setoff") @Data @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) -public class WxEnergyFeesSetoff extends TenantEntity { +public class WxFinanceFeesSetoff extends TenantEntity { private static final long serialVersionUID = 7009117540201976664L; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java index 6658e1620..2cb33eafc 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveBill.java @@ -4,7 +4,6 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumFinanceCashierType; import com.iformall.utils.Constant; @@ -48,18 +47,6 @@ public class WxFinanceReceiveBill extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") private Long billId; - @io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType") - private Integer billType; - //@Excel(name = "账单类型", width = 20, orderNum = "9") - @TableField(exist = false) - private String billTypeName; - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return null; - } - @io.swagger.annotations.ApiModelProperty(value = "账单客户名称", name = "billCusName") private String billCusName; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceivePayway.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceivePayway.java index b6cb74799..742ac2d6e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceivePayway.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceivePayway.java @@ -3,7 +3,6 @@ package com.iformall.domain.po; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveSetoff.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveSetoff.java index 6246ba246..82213268e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveSetoff.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceiveSetoff.java @@ -3,7 +3,6 @@ package com.iformall.domain.po; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import lombok.Data; import lombok.EqualsAndHashCode; @@ -38,14 +37,6 @@ public class WxFinanceReceiveSetoff extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") private Long billId; - @io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType") - private Integer billType; - @TableField(exist = false) - private String billTypeName; - public String getBillTypeName() { - return EnumBillAllType.getEnum(billType).getMessage(); - } - @io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId") private Long feesId; @TableField(exist = false) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java deleted file mode 100644 index e062e8b98..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ /dev/null @@ -1,387 +0,0 @@ -package com.iformall.domain.po; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumPriceUnit; -import com.iformall.enums.EnumPropertyCreateType; -import com.iformall.enums.EnumRentContractAdjustPeriod; -import com.iformall.enums.EnumRentContractStatus; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.utils.Constant; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.commons.compress.utils.Lists; -import org.apache.commons.lang3.StringUtils; - -/** - * @author gongbiao - */ -@TableName(value = "wx_property_contract") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxPropertyContract extends TenantEntity { - - protected Long id; - - private Long customersId; - @TableField(exist = false) - private Integer customerType; - @TableField(exist = false) - private String customerName; - @TableField(exist = false) - private String customerLinkPerson; - @TableField(exist = false) - private String customerPhone; - @TableField(exist = false) - private String customerLegalPerson; - - @io.swagger.annotations.ApiModelProperty(value="审核状态,0未审核 1审核中 2审核完成 3驳回 4合同作废",name="applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value="审批流1合同2账单3终止审批",name="businessType") - private Integer businessType; - - @io.swagger.annotations.ApiModelProperty(value = "金额小数点位数", name = "decimalSize") - private Integer decimalSize = 2; - /*月租金/分成(分)**/ - @io.swagger.annotations.ApiModelProperty(value="物业费(分)",name="price") - private String price; - - @io.swagger.annotations.ApiModelProperty(value="起租开始时间",name="rentalStartDate") - private Date rentalStartDate; - - @io.swagger.annotations.ApiModelProperty(value="起租结束时间",name="rentalEndDate") - private Date rentalEndDate; - - @io.swagger.annotations.ApiModelProperty(value="签定合同时间",name="signDate") - private Date signDate; - - @io.swagger.annotations.ApiModelProperty(value="计费周期",name="receivePeriod") - private Integer receivePeriod; - @io.swagger.annotations.ApiModelProperty(value = "付款周期(计费周期的倍数)", name = "receivePeriod") - private Integer payPeriodRate; - @io.swagger.annotations.ApiModelProperty(value = "计费周期单位EnumContractReceivePeriodUnit", name = "receivePeriodUnit") - private Integer receivePeriodUnit; - - @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="filepath") - private String filepath; - - @io.swagger.annotations.ApiModelProperty(value="合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期EnumRentContractStatus",name="status") - private Integer status; - @TableField(exist = false) - private List statuss; - @TableField(exist = false) - private String statusName; - public String getStatusName() { - if (null != status) { - return EnumRentContractStatus.getEnum(status).getMessage(); - } - return null; - } - - @io.swagger.annotations.ApiModelProperty(value="是否固定价格",name="0:按面积计算,1:固定价格") - private Integer fixedPrice; - - @io.swagger.annotations.ApiModelProperty(value="合同编号",name="contractNumber") - private String contractNumber; - - @io.swagger.annotations.ApiModelProperty(value="押金",name="deposit") - private String deposit; - - @io.swagger.annotations.ApiModelProperty(value="是否删除1是0否",name="isDel") - private Integer isDel; - - @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") - private Date updatetime; - @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") - private Long updateBy; - @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") - private String updateByName; - @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") - private Date createtime; - @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") - private Long createBy; - @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createBy") - private String createByName; - - @io.swagger.annotations.ApiModelProperty(value="计租面积",name="rentArea") - private String rentArea; - - @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") - private String linkPerson; - - @io.swagger.annotations.ApiModelProperty(value="联系电话",name="linkPhone") - private String linkPhone; - - @io.swagger.annotations.ApiModelProperty(value="支付账号",name="payAccount") - private String payAccount; - - @io.swagger.annotations.ApiModelProperty(value="上传文件名",name="filename") - private String filename; - - @io.swagger.annotations.ApiModelProperty(value="租期:月",name="lease") - private Integer lease; - - @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") - private Long rentContractId; - - @io.swagger.annotations.ApiModelProperty(value = "计租日", name = "startDate") - private Date startDate; - - @io.swagger.annotations.ApiModelProperty(value = "", name = "endDate") - private Date endDate; - - @io.swagger.annotations.ApiModelProperty(value = "终止时间", name = "endContractTime") - private Date endContractTime; - - @io.swagger.annotations.ApiModelProperty(value = "计租周期EnumRentContractAdjustPeriod", name = "计租周期") - private Integer adjustPeriod; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") - private Map flowParams; - - @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") - private String adjustRatio; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") - private String latePayRatio; - - @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayDay") - private Integer latePayDay; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value = "物业预账单列表", name = "previewBillRentList") - private List previewBillRentList; - - @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") - private String rentInfo; - - @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") - private String fileNames; - - @io.swagger.annotations.ApiModelProperty(value = "每天价格计算规则EnumRentDayPriceCalcute", name = "dayPriceCalcute") - private Integer dayPriceCalcute; - @io.swagger.annotations.ApiModelProperty(value = "每月平均天数", name = "monthAverageDays") - private Integer monthAverageDays; - - @TableField(exist = false) - private String building; - - @TableField(exist = false) - private String floor; - @TableField(exist = false) - private String floorName; - @TableField(exist = false) - private String buildingName; - - @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年EnumPriceUnit", name = "priceUnit") - private Integer priceUnit; - @TableField(exist = false) - private String priceUnitName; - public String getPriceUnitName() { - if (null != priceUnit) { - EnumPriceUnit eu = EnumPriceUnit.getEnum(priceUnit); - if (null != eu) { - return eu.getMessage(); - }else { - return null; - } - } - return null; - } - - @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") - private String rentPrice; - - @io.swagger.annotations.ApiModelProperty(value = "费用详细说明", name = "priceDetail") - private String priceDetail; - - @io.swagger.annotations.ApiModelProperty(value = "主体名称", name = "subjectName") - private String subjectName; - - - @io.swagger.annotations.ApiModelProperty(value = "1按租赁日生产2按计租日生成账单EnumRentStartType", name = "rentStartType") - private Integer rentStartType; - - @io.swagger.annotations.ApiModelProperty(value = "操作类型1区分租赁物业2合并租赁物业", name = "operationType") - private Integer operationType; - - @io.swagger.annotations.ApiModelProperty(value = "租金录入方式1合铺录入2分铺录入", name = "rent_input_way") - private Integer rentInputWay; - - @io.swagger.annotations.ApiModelProperty(value = "年租金调整方式1按比例2按金额", name = "adjust_ratio_way") - private Integer adjustRatioWay; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value = "审批备注", name = "remark") - private String remark; - - @io.swagger.annotations.ApiModelProperty(value = "是否有工作流 1:有 0:无", name = "flowHas") - @TableField(exist = false) - private Integer flowHas; - - @io.swagger.annotations.ApiModelProperty(value = "其他标准费用信息", name = "feesStandardsInfo") - private String feesStandardsInfo; - - @io.swagger.annotations.ApiModelProperty(value = "到期提醒提前天数", name = "outDateNotifyDays") - private Integer outDateNotifyDays; - - @io.swagger.annotations.ApiModelProperty(value = "到期提醒手机号", name = "outDateNotifyPhone") - private String outDateNotifyPhone; - - @io.swagger.annotations.ApiModelProperty(value = "创建方式EnumPropertyCreateType", name = "createType") - private Integer createType; - - @io.swagger.annotations.ApiModelProperty(value = "首期账单开始时间", name = "firstBillDateStart") - private Date firstBillDateStart; - - @io.swagger.annotations.ApiModelProperty(value = "首期账单结束时间", name = "firstBillDateEnd") - private Date firstBillDateEnd; - - @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; - - public void setAdjustPeriodHandle() { - if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ - this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); - } - } - - public void calcutePrice(String rentArea) { - //如果是固定的,则不计算 - if (null != fixedPrice && fixedPrice.equals(EnumYesOrNo.YES.getCode())) { - }else { - if (StringUtils.isNotBlank(rentArea) && StringUtils.isNotBlank(this.rentPrice)) { - this.price = new BigDecimal(rentArea).multiply(new BigDecimal(this.rentPrice)).setScale(this.decimalSize, RoundingMode.HALF_UP).toPlainString(); - this.rentArea = rentArea; - } - } - } - - public Map getRentShopArea() { - String rentInfo = this.getRentInfo(); - if (!StringUtils.isBlank(rentInfo)) { - Map shopAreaMap = new HashMap(); - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - BigDecimal total = new BigDecimal(0); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - Long shopId = rentInfoObject.getLong("id"); - String rentArea = rentInfoObject.getString("operationArea"); - if (StringUtils.isBlank(rentArea)) { - shopAreaMap.put(shopId, new BigDecimal("0")); - }else { - shopAreaMap.put(shopId, new BigDecimal(rentArea)); - total = total.add(new BigDecimal(rentArea)); - } - } - return shopAreaMap; - } - return null; - } - - public List shopIdsByShop() { - String rentInfo = this.getRentInfo(); - if (!StringUtils.isBlank(rentInfo)) { - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - List shopIdList = new ArrayList(); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - Long shopId = rentInfoObject.getLong("id"); - shopIdList.add(shopId); - } - return shopIdList; - } - return null; - } - - public String getRentInfoShopNumber() { - StringBuffer sb = new StringBuffer(""); - String rentInfo = this.getRentInfo(); - if (!StringUtils.isBlank(rentInfo)) { - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String shopNumber = rentInfoObject.getString("shopNumber"); - if (StringUtils.isNotBlank(shopNumber)) { - sb.append(shopNumber).append(","); - } - } - } - return sb.toString(); - } - - public List getFeesStardarsList() { - if (StringUtils.isNotBlank(feesStandardsInfo)) { - return JSON.parseArray(feesStandardsInfo, WxEnergyFees.class); - } - return null; - } - - @TableField(exist = false) - List unFixedfeeStandards; - public List getUnFixedfeeStandards() { - List fees = this.getFeesStardarsList(); - if (null != fees && fees.size() > 0 ) { - List unfixed = new ArrayList(); - for (int i = 0 ; i < fees.size() ; i++ ) { - WxEnergyFees fs = fees.get(i); - if (fs.getFixedPrice().intValue() == EnumYesOrNo.NO.getCode().intValue()) { - unfixed.add(fs); - } - } - if (unfixed.size() <= 0 ) { - return null; - } - return unfixed; - } - return null; - } - - @TableField(exist = false) - List feeStandards; - - @TableField(exist = false) - private Long queryShopId; - @TableField(exist = false) - private String merchantName; - @TableField(exist = false) - private String queryShopIdStr; - @TableField(exist = false) - private List customersIdList; - @TableField(exist = false) - private String shopNumbers; - @TableField(exist = false) - private Date useStartTime; - @TableField(exist = false) - private Date useEndTime; - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 2bcbaa419..51c97dacb 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -73,9 +73,6 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "租期总月数(月)", name = "lease") private Integer lease; - @io.swagger.annotations.ApiModelProperty(value = "账单生成方式EnumRentContractAdjustPeriod", name = "adjustPeriod") - private Integer adjustPeriod; - @io.swagger.annotations.ApiModelProperty(value = "来源ID,针对续签,从哪个合同续签", name = "fromId") private Long fromId; @@ -96,8 +93,6 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "金额小数点位数", name = "decimalSize") private Integer decimalSize = Constant.default_short_decimal_size ; - @io.swagger.annotations.ApiModelProperty(value = "月租金/分成(元)", name = "price") - private String price; @TableField(exist = false) private String priceTwoDecimal;//2位小数 @@ -109,7 +104,7 @@ public class WxRentContract extends TenantEntity { private Integer receivePeriodUnit; @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath") private String filepath; - @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期EnumRentContractStatus", name = "status") + @io.swagger.annotations.ApiModelProperty(value = "EnumRentContractStatus", name = "status") private Integer status; @TableField(exist = false) private List statuss; @@ -122,28 +117,23 @@ public class WxRentContract extends TenantEntity { return null; } - @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") - private String deposit; - @io.swagger.annotations.ApiModelProperty(value = "押金金额详细", name = "cashtypeContentLsit") private String cashtypeContentLsit; - @io.swagger.annotations.ApiModelProperty(value = "押金科目详细(弃用)", name = "cashtypeLsit") - private String cashtypeLsit; - public void calcuteDepositTotal() { - if (StringUtils.isNotBlank(cashtypeContentLsit)) { - JSONArray rentInfoArray = JSONArray.parseArray(cashtypeContentLsit); - int size = rentInfoArray.size(); - BigDecimal dt = new BigDecimal(0); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String deposit = rentInfoObject.getString("deposit"); - if (StringUtils.isNotBlank(deposit)) { - dt = dt.add(new BigDecimal(deposit)); - } - } - this.deposit = dt.toPlainString(); - } - } +// public void calcuteDepositTotal() { +// if (StringUtils.isNotBlank(cashtypeContentLsit)) { +// JSONArray rentInfoArray = JSONArray.parseArray(cashtypeContentLsit); +// int size = rentInfoArray.size(); +// BigDecimal dt = new BigDecimal(0); +// for (int i = 0; i < size; i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// String deposit = rentInfoObject.getString("deposit"); +// if (StringUtils.isNotBlank(deposit)) { +// dt = dt.add(new BigDecimal(deposit)); +// } +// } +// //this.deposit = dt.toPlainString(); +// } +// } @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") @@ -162,17 +152,9 @@ public class WxRentContract extends TenantEntity { private String createByName; @io.swagger.annotations.ApiModelProperty(value = "计租面积", name = "rentArea") private String rentArea; - @TableField(exist = false) - private String operationArea; - public String getOperationArea() { - operationArea = rentArea; - return operationArea; - } @io.swagger.annotations.ApiModelProperty(value = "店铺编号串", name = "shopIdStr") private String shopIdStr; - @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "filename") - private String filename; @io.swagger.annotations.ApiModelProperty(value = "类型EnumRentContractType", name = "type") private Integer type; @@ -181,49 +163,15 @@ public class WxRentContract extends TenantEntity { @TableField(exist = false) private List typeList; - @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") - private String adjustRatio; - - @io.swagger.annotations.ApiModelProperty(value = "联营扣点调整比率", name = "revenueRatioSet") - private String revenueRatioSet; - @TableField(exist = false) - private String revenueYear; - public String getRevenueYear() { - return revenueRatioSet; - } - - @io.swagger.annotations.ApiModelProperty(value = "联营扣点比率", name = "payRatio") - private String payRatio; - - @io.swagger.annotations.ApiModelProperty(value = "保底营业额", name = "revenue") - private String revenue; - - @io.swagger.annotations.ApiModelProperty(value = "最低扣点营业额(达到此营业额才会扣点)", name = "limitRevenue") - private String limitRevenue; - - @io.swagger.annotations.ApiModelProperty(value = "联营扣点租金取高租金价格是否固定", name = "revenueFixedRentPrice") - private Integer revenueFixedRentPrice; - @io.swagger.annotations.ApiModelProperty(value = "联营扣点租金取高租金固定价格", name = "revenueRentPrice") - private String revenueRentPrice; - - @io.swagger.annotations.ApiModelProperty(value = "取高时保底方式EnumRentRenevueMinimunMethod", name = "revenueMinimumMethod") - private Integer revenueMinimumMethod; - - @io.swagger.annotations.ApiModelProperty(value = "是否设置保底营业额", name = "revenueRatio") - private Integer revenueRatio; +// @io.swagger.annotations.ApiModelProperty(value = "取高时保底方式EnumRentRenevueMinimunMethod", name = "revenueMinimumMethod") +// private Integer revenueMinimumMethod; @io.swagger.annotations.ApiModelProperty(value = "审核状态, 0未审核 1审核中 2审核通过 3驳回", name = "applyStatus") private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "审批流类型: 审批流1合同2账单3终止审批", name = "businessType") - private Integer businessType; - @io.swagger.annotations.ApiModelProperty(value = "终止时间", name = "endContractTime") private Date endContractTime; -// @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") -// private Integer rentShopType; - @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") private Map flowParams; @@ -232,151 +180,24 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "租赁合同预账单列表", name = "previewBillRentList") private List previewBillRentList; - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList") - private List reviewBillPropertyPList; - @io.swagger.annotations.ApiModelProperty(value = "审批说明", name = "remark") private String remark; - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value = "审批时带的物业合同编号,租金+物业时用", name = "propertyId") - private Long propertyId; - @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") private String rentInfo; @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") private String fileNames; - @io.swagger.annotations.ApiModelProperty(value = "租金单位1日2月3年EnumPriceUnit", name = "priceUnit") - private Integer priceUnit; - @TableField(exist = false) - private String priceUnitName; - public String getPriceUnitName() { - if (null != priceUnit) { - return EnumPriceUnit.getEnum(priceUnit).getMessage(); - } - return null; - } - - @io.swagger.annotations.ApiModelProperty(value = "租金租赁单价(其他放rentInfo)", name = "priceUnit") - private String rentPrice; - - @io.swagger.annotations.ApiModelProperty(value = "费用详细说明", name = "priceDetail") - private String priceDetail; - - @io.swagger.annotations.ApiModelProperty(value = "其他多径租赁单价", name = "otherRentPriceInfo") - private String otherRentPriceInfo; - - @io.swagger.annotations.ApiModelProperty(value = "主体名称", name = "subjectName") - private String subjectName; - - @io.swagger.annotations.ApiModelProperty(value = "1按租赁日生产2按计租日生成账单EnumRentStartType", name = "rentStartType") - private Integer rentStartType; - - @io.swagger.annotations.ApiModelProperty(value = "租金录入方式1合铺录入2分铺录入", name = "rent_input_way") - private Integer rentInputWay; - - @io.swagger.annotations.ApiModelProperty(value = "年租金调整方式1按比例2按金额", name = "adjust_ratio_way") - private Integer adjustRatioWay; - - @io.swagger.annotations.ApiModelProperty(value = "联营扣点调整方式1按比例2按金额(仅联营面积取高时用)", name = "revenueRatioWay") - private Integer revenueRatioWay; - - @io.swagger.annotations.ApiModelProperty(value = "操作类型1区分租赁物业2合并租赁物业3金茂", name = "operationType") - private Integer operationType; - @io.swagger.annotations.ApiModelProperty(value = "每天价格计算规则EnumRentDayPriceCalcute", name = "dayPriceCalcute") private Integer dayPriceCalcute; @io.swagger.annotations.ApiModelProperty(value = "每月平均天数", name = "monthAverageDays") private Integer monthAverageDays; - @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") - private String latePayRatio; - - @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayDay") - private Integer latePayDay; - @io.swagger.annotations.ApiModelProperty(value = "是否有工作流 1:有 0:无", name = "flowHas") @TableField(exist = false) private Integer flowHas; - @io.swagger.annotations.ApiModelProperty(value = "商业管理费单价", name = "bussinessManagementFee") - private String bussinessManagementFee; - - @io.swagger.annotations.ApiModelProperty(value = "商业管理费调整方式1按比例2按金额", name = "bussinessManagementFeeRatioWay") - private Integer bussinessManagementFeeRatioWay; - - @io.swagger.annotations.ApiModelProperty(value = "商业管理费调整方式1按比例2按金额", name = "bussinessManagementFeeRatio") - private String bussinessManagementFeeRatio; - - @io.swagger.annotations.ApiModelProperty(value = "营业管理费单价", name = "operatingManagementFee") - private String operatingManagementFee; - - @io.swagger.annotations.ApiModelProperty(value = "营业管理费调整方式1按比例2按金额", name = "operatingManagementFeeRatioWay") - private Integer operatingManagementFeeRatioWay; - - @io.swagger.annotations.ApiModelProperty(value = "营业管理费调整方式1按比例2按金额", name = "operatingManagementFeeRatio") - private String operatingManagementFeeRatio; - - @io.swagger.annotations.ApiModelProperty(value = "到期提醒提前天数", name = "outDateNotifyDays") - private Integer outDateNotifyDays; - - @io.swagger.annotations.ApiModelProperty(value = "到期提醒手机号", name = "outDateNotifyPhone") - private String outDateNotifyPhone; - - @io.swagger.annotations.ApiModelProperty(value = "首期账单开始时间", name = "firstBillDateStart") - private Date firstBillDateStart; - - @io.swagger.annotations.ApiModelProperty(value = "首期账单结束时间", name = "firstBillDateEnd") - private Date firstBillDateEnd; - - @io.swagger.annotations.ApiModelProperty(value = "首期账单收款截止日期", name = "firstBillReceiveDate") - private Date firstBillReceiveDate; - - - //查询过期提醒 - @TableField(exist = false) - private Integer outDateNofity; - - public void setAdjustPeriodHandle() { - if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ - this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); - } - } - -// public void setRentPriceHandle() { -// if(StringUtils.isBlank(rentPrice)) { -// rentPrice = "0"; -// } -// } - - public void calcutePrice() { - //如果是按铺位数算,price不用计算,是填写的值 - if (this.type.equals(EnumRentContractType.RENT_BY_AREA.getCode()) || this.type.equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - if (StringUtils.isNotBlank(this.rentArea) && StringUtils.isNotBlank(this.rentPrice)) { - this.price = new BigDecimal(this.rentArea).multiply(new BigDecimal(this.rentPrice)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - } - } - - public String getPriceTwoDecimal() { - if (StringUtils.isNotBlank(price)) { - if (null == decimalSize || decimalSize <= 0 ) { - this.priceTwoDecimal = new BigDecimal(price).setScale(Constant.default_short_decimal_size, RoundingMode.HALF_UP).toPlainString(); - }else { - this.priceTwoDecimal = new BigDecimal(price).setScale(this.decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - - } - return priceTwoDecimal; - } - - -// @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") -// private Integer contractType; - //联营扣点跳点设置 @TableField(exist = false) private List revenueJumps; @@ -386,16 +207,8 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "免租期说明", name = "freePeriodRemark") private String freePeriodRemark; - @io.swagger.annotations.ApiModelProperty(value = "合同类型EnumRentAgileType", name = "agileType") - private Integer agileType; - @TableField(exist = false) - private String agileTypeName; - public String getAgileTypeName() { - if (null != agileType) { - return EnumRentAgileType.getEnum(agileType).getMessage(); - } - return null; - } +// @io.swagger.annotations.ApiModelProperty(value = "合同类型EnumRentAgileType", name = "agileType") +// private Integer agileType = EnumRentAgileType.AGILE.getCode(); public List shopIdsByRentInfo() { @@ -471,35 +284,29 @@ public class WxRentContract extends TenantEntity { } - public Map getDepositEnergyFees(Map feesMap) { - String dsdstr = this.getCashtypeContentLsit(); - if (!StringUtils.isBlank(dsdstr)) { - Map retMap = new HashMap(); - JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); - int size = rentInfoArray.size(); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String depositType = rentInfoObject.getString("value"); - String deposit = rentInfoObject.getString("deposit"); - Long dt = Long.parseLong(depositType); - WxEnergyFees fees = feesMap.get(dt); - WxEnergyFees nfees = new WxEnergyFees(); - nfees.setId(fees.getId()); - nfees.setName(fees.getName()); - nfees.setCalcuteUnit(fees.getCalcuteUnit()); - nfees.setPrice(deposit); - retMap.put(dt, nfees); - } - return retMap; - } - return null; - } - - @TableField(exist = false) - private String onlyPropertyContractId; - - @TableField(exist = false) - private Long propertyContractId; +// public Map getDepositEnergyFees(Map feesMap) { +// String dsdstr = this.getCashtypeContentLsit(); +// if (!StringUtils.isBlank(dsdstr)) { +// Map retMap = new HashMap(); +// JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); +// int size = rentInfoArray.size(); +// for (int i = 0; i < size; i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// String depositType = rentInfoObject.getString("value"); +// String deposit = rentInfoObject.getString("deposit"); +// Long dt = Long.parseLong(depositType); +// WxEnergyFees fees = feesMap.get(dt); +// WxEnergyFees nfees = new WxEnergyFees(); +// nfees.setId(fees.getId()); +// nfees.setName(fees.getName()); +// nfees.setCalcuteUnit(fees.getCalcuteUnit()); +// nfees.setPrice(deposit); +// retMap.put(dt, nfees); +// } +// return retMap; +// } +// return null; +// } @TableField(exist = false) private List freePeriods; @@ -553,13 +360,6 @@ public class WxRentContract extends TenantEntity { private Integer owe; @TableField(exist = false) private String receiveDate; - @TableField(exist = false) - @SortColumn(column = "latePayPrice") - private Integer latePayPrice; - @io.swagger.annotations.ApiModelProperty(value = "是否同时终止物业", name = "endProperty") - @TableField(exist = false) - private Integer endProperty; - @TableField(exist = false) private String salesMoney; @TableField(exist = false) diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillBad.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillBad.java index 68fdef866..5ccc0fa2d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillBad.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillBad.java @@ -8,7 +8,6 @@ import java.util.Date; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.baomidou.mybatisplus.annotation.TableField; -import com.iformall.enums.EnumBillAllType; @Data public class WxBillBad implements Serializable { @@ -22,11 +21,11 @@ public class WxBillBad implements Serializable { //减免总金额 private String total = "0"; - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return ""; - } +// public String getBillTypeName() { +// if (null != billType) { +// return EnumBillAllType.getEnum(billType).getMessage(); +// } +// return ""; +// } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java index aa1a3261c..19770d6ee 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java @@ -4,7 +4,7 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; @Data public class WxBillFeesStandardsListVo implements Serializable { @@ -14,7 +14,7 @@ public class WxBillFeesStandardsListVo implements Serializable { private Date start; private Date end; private Date receiveDate; - private WxEnergyFees feeStandards; + private WxFinanceFees feeStandards; private Long parentBillId; private boolean isDeposit; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java index 0b56cd68b..2192619c2 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java @@ -7,7 +7,6 @@ import java.math.RoundingMode; import java.util.Date; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.iformall.enums.EnumBillAllType; @Data public class WxBillHotNotify implements Serializable { diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillJianMian.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillJianMian.java index 130255e4c..accffa838 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillJianMian.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillJianMian.java @@ -8,7 +8,6 @@ import java.util.Date; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.baomidou.mybatisplus.annotation.TableField; -import com.iformall.enums.EnumBillAllType; @Data public class WxBillJianMian implements Serializable { @@ -22,11 +21,11 @@ public class WxBillJianMian implements Serializable { //减免总金额 private String total = "0"; - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return ""; - } +// public String getBillTypeName() { +// if (null != billType) { +// return EnumBillAllType.getEnum(billType).getMessage(); +// } +// return ""; +// } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java index a85eb061c..262b66283 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillNotify.java @@ -7,7 +7,6 @@ import java.math.RoundingMode; import java.util.Date; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.iformall.enums.EnumBillAllType; @Data public class WxBillNotify implements Serializable { @@ -15,8 +14,8 @@ public class WxBillNotify implements Serializable { private static final long serialVersionUID = 1L; //EnumBillAllType - private Integer billType; - private String billTypeName; + //private Integer billType; + //private String billTypeName; private Long billId; private Date starttime; private Date endtime; @@ -32,10 +31,10 @@ public class WxBillNotify implements Serializable { return new BigDecimal(receivePay).subtract(new BigDecimal(pay)).toPlainString(); } - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return null; - } +// public String getBillTypeName() { +// if (null != billType) { +// return EnumBillAllType.getEnum(billType).getMessage(); +// } +// return null; +// } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java index 0f6f5653c..aaff02a89 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxFinanceReceiveVo.java @@ -8,7 +8,6 @@ import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxFinanceReceive; import com.iformall.domain.po.WxFinanceReceiveBill; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumFinanceReceiveStatus; import lombok.Data; @@ -96,17 +95,6 @@ public class WxFinanceReceiveVo implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") private Long billId; - @io.swagger.annotations.ApiModelProperty(value = "账单类型EnumBillAllType", name = "billType") - private Integer billType; - @TableField(exist = false) - private String billTypeName; - public String getBillTypeName() { - if (null != billType) { - return EnumBillAllType.getEnum(billType).getMessage(); - } - return null; - } - @io.swagger.annotations.ApiModelProperty(value="科目编号",name="feesId") private Long feesId; @TableField(exist = false) @@ -167,7 +155,7 @@ public class WxFinanceReceiveVo implements Serializable { this.rid = receiveBill.getId(); this.receiveId = receiveBill.getReceiveId(); this.billId = receiveBill.getBillId(); - this.billType = receiveBill.getBillType(); + //this.billType = receiveBill.getBillType(); this.feesId = receiveBill.getFeesId(); this.payWay = receiveBill.getPayWay(); this.billReceive = receiveBill.getReceive(); diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java b/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java deleted file mode 100644 index 91b8acf2b..000000000 --- a/mallinkService/src/main/java/com/iformall/enums/EnumBillAllType.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.iformall.enums; - -import java.util.ArrayList; -import java.util.List; - -public enum EnumBillAllType { - - RENT(1,"租金",1L,false,false), - RENT_BUSSINESS_MANAGE(11,"商业管理费",2L,false,false), - RENT_OPERATION_MANAGE(12,"运营管理费",3L,false,false), - RENT_DEPOSIT(13,"租赁押金",null,true,true), - PROPERTY(2,"物业",5L,false,false), - PROPERTY_DEPOSIT(21,"物业押金",6L,true,true), - DAILY(3, "能耗(水电空调)费",null,false,false), - OTHER(4, "临时费用",null,false,false), - OTHER_DEPOSIT(5, "临时押金",null,true,true), - ADVANCE(6,"预收",null,true,false), - TEMP_TO_PAYMERCHANT(7,"临时付款给商户",null,false,false) - ; - - public static EnumBillAllType getEnum(Integer code) { - for (EnumBillAllType value : values()) { - if (value.getCode().equals(code)) { - return value; - } - } - return null; - } - - private Integer code; - private String message; - private Long energyFeesId;//wx_energy_fees(费用科目)里的id,不可配置的有这个 - private boolean isFixedPrice;//是否强制为一次性费用 - private boolean isDeposit;//是否强制是押金类型 - - - EnumBillAllType(Integer code, String message,Long energyFeesId,boolean isFixedPrice,boolean isDeposit) { - this.code = code; - this.message = message; - this.energyFeesId = energyFeesId; - this.isFixedPrice = isFixedPrice; - this.isDeposit = isDeposit; - } - - public Integer getCode() { - return code; - } - - public String getMessage() { - return message; - } - - public Long getEnergyFeesId() { - return energyFeesId; - } - - public boolean isFixedPrice() { - return isFixedPrice; - } - - public boolean isDeposit() { - return isDeposit; - } - - public static EnumBillAllType[] getDepositTypes() { - EnumBillAllType[] ret = new EnumBillAllType[] {RENT_DEPOSIT,PROPERTY_DEPOSIT,OTHER_DEPOSIT}; - return ret; - } - - public static EnumBillAllType[] getSystemTypes() { - EnumBillAllType[] ret = new EnumBillAllType[] {RENT,RENT_BUSSINESS_MANAGE,RENT_OPERATION_MANAGE, - PROPERTY,PROPERTY_DEPOSIT}; - return ret; - } - - public static List getCalucuteUnites(Integer type) { - //需要计算的费用,非一次性费用 - List retList = new ArrayList(); - if (type.intValue() == RENT.getCode().intValue() || type.intValue() == RENT_BUSSINESS_MANAGE.getCode().intValue() - || type.intValue() == RENT_OPERATION_MANAGE.getCode().intValue() || type.intValue() == PROPERTY.getCode().intValue() - || type.intValue() == RENT_DEPOSIT.getCode().intValue() || type.intValue() == OTHER.getCode().intValue() - || type.intValue() == OTHER_DEPOSIT.getCode().intValue()) { - retList.add(EnumFeesStandardsCalcuteUnit.MM); - retList.add(EnumFeesStandardsCalcuteUnit.HU); - }else if (type.intValue() == DAILY.getCode().intValue()) { - retList.add(EnumFeesStandardsCalcuteUnit.DIAN_DU); - retList.add(EnumFeesStandardsCalcuteUnit.SHUI_DUN); - } - if (retList.size() > 0 ) { - return retList; - } - return null; - } - - public static List getTimeUnites(Integer type) { - List retList = new ArrayList(); - retList.add(EnumFeesStandardsTimeUnit.DAY); - retList.add(EnumFeesStandardsTimeUnit.MONTH); - retList.add(EnumFeesStandardsTimeUnit.YEAR); - return retList; - } -} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumFeesType.java b/mallinkService/src/main/java/com/iformall/enums/EnumFeesType.java new file mode 100644 index 000000000..8f47984be --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumFeesType.java @@ -0,0 +1,36 @@ +package com.iformall.enums; + + +/** + */ + +public enum EnumFeesType { + + NOMAL(1,"常规科目"), + ADVANCE(2,"预收科目"); + + public static EnumFeesType getEnum(Integer code) { + for (EnumFeesType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumFeesType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java index 3386fe72a..2277505fa 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java @@ -2,7 +2,6 @@ package com.iformall.mapper; import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.WxBillHotNotify; import com.iformall.domain.vo.WxBillNotify; @@ -31,7 +30,6 @@ public interface WxAllBillMapper extends CommonMapper { List getBillNotifyList(WxAllBill record); void deleteBillByContract(WxRentContract wxRentContract); - void deleteBillByPropertyContract(WxPropertyContract wxPropertyContract); void deletePreviewBill(WxAllBill wxBillRent); void deleteNoNeedPayBill(WxAllBill wxBillRent); void deleteByRentHuiSuan(WxAllBill wxBillRent); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java index f0e5d4b57..0e37920b2 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillActionMapper.java @@ -17,7 +17,7 @@ public interface WxBillActionMapper extends CommonMapper { List findBillActionList(WxBillAction wxBillAction); - List findJianMian(WxBillAction record); + //List findJianMian(WxBillAction record); - List findBad(WxBillAction record); + //List findBad(WxBillAction record); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesMapper.java deleted file mode 100644 index cd795847c..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxEnergyFees; -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - */ -public interface WxEnergyFeesMapper extends CommonMapper { - - List findList(WxEnergyFees wxBillRent); - - WxEnergyFees selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); - - List findIdList(WxEnergyFees wxBillRent); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesSetoffMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesSetoffMapper.java deleted file mode 100644 index 8cc1a2b0e..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesSetoffMapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxEnergyFeesSetoff; - -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - */ -public interface WxEnergyFeesSetoffMapper extends CommonMapper { - - List findList(WxEnergyFeesSetoff wxBillRent); - - List findFeesIdList(WxEnergyFeesSetoff wxBillRent); - - List findadvanceFeesIdList(WxEnergyFeesSetoff wxBillRent); - - WxEnergyFeesSetoff selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteByAdvanceId(WxEnergyFeesSetoff wxBillRent); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesShopMapper.java deleted file mode 100644 index 9c0900443..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxEnergyFeesShopMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxEnergyFeesShop; - -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - */ -public interface WxEnergyFeesShopMapper extends CommonMapper { - - List findList(WxEnergyFeesShop wxBillRent); - - List findFeesIdList(WxEnergyFeesShop wxBillRent); - - WxEnergyFeesShop selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void updateTimes(@Param("tenantId")String tenantId, @Param("list")List resultList); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFeesCalcuteShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFeesCalcuteShopMapper.java new file mode 100644 index 000000000..363fe9dfa --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxFeesCalcuteShopMapper.java @@ -0,0 +1,21 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxFeesCalcuteShop; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxFeesCalcuteShopMapper extends CommonMapper { + + List findList(WxFeesCalcuteShop wxBillRent); + + List findFeesIdList(WxFeesCalcuteShop wxBillRent); + + WxFeesCalcuteShop selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + void updateTimes(@Param("tenantId")String tenantId, @Param("list")List resultList); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesMapper.java new file mode 100644 index 000000000..3b3e2b4c8 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesMapper.java @@ -0,0 +1,20 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxFinanceFees; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxFinanceFeesMapper extends CommonMapper { + + List findList(WxFinanceFees wxBillRent); + + WxFinanceFees selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); + + List findIdList(WxFinanceFees wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesSetoffMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesSetoffMapper.java new file mode 100644 index 000000000..50ef6dbdb --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceFeesSetoffMapper.java @@ -0,0 +1,23 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxFinanceFeesSetoff; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxFinanceFeesSetoffMapper extends CommonMapper { + + List findList(WxFinanceFeesSetoff wxBillRent); + + List findFeesIdList(WxFinanceFeesSetoff wxBillRent); + + List findadvanceFeesIdList(WxFinanceFeesSetoff wxBillRent); + + WxFinanceFeesSetoff selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + void deleteByAdvanceId(WxFinanceFeesSetoff wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java deleted file mode 100644 index 74a2fd715..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.WxRentContract; - -import java.util.List; - -/** - * @author gongbiao - */ -public interface WxPropertyContractMapper extends CommonMapper { - - List findList(WxPropertyContract wxPropertyContract); - - List findIdList(WxPropertyContract wxPropertyContract); - - //List> queryPropertyContractData(WxPropertyContract wxRentContract); - - int queryRentContractWaitSignStatus(WxPropertyContract wxRentContract); - - int queryRentContractEndSoonStatus(WxPropertyContract wxRentContract); - - int queryRentContractPaidStatus(WxPropertyContract wxRentContract); - - int queryRentContractEndStatus(WxPropertyContract wxRentContract); - - int updateRentContractEndSoonStatus(WxPropertyContract wxRentContract); - - int updateRentContractPaidStatus(WxPropertyContract wxRentContract); - - int updateRentContractEndStatus(WxPropertyContract wxRentContract); - - //void updateRentInvalidStatus(WxPropertyContract wxRentContract); - - //List getRentContractListByShop(Map params); - - //List getRentContractListByPoint(Map params); - - void updateApplyStatus(WxPropertyContract wxPropertyContract); - - void updateApplyStatusByRentContractId(WxPropertyContract wxPropertyContract); - - void updateStatus(WxPropertyContract wxPropertyContract); - - long queryOweCount(WxPropertyContract wxPropertyContract); - - void updateStatusByRentContractId(WxPropertyContract wxPropertyContract); - - WxPropertyContract findOneByRentId(WxRentContract wxRentContract); - - WxPropertyContract getByBill(WxAllBill billRent); - - void endContract(WxPropertyContract wxPropertyContract); - - void setEndContractTime(WxPropertyContract wxPropertyContract); - - List findToEndContractList(WxPropertyContract rentContract); -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java index 5896f71fb..8855c922a 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java @@ -4,7 +4,6 @@ import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBusiness; import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.vo.WxRentPropertyContractVo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -28,8 +27,6 @@ public interface WxRentContractMapper extends CommonMapper int hasContractNumber(WxRentContract wxRentContract); - List listContractVo(WxRentPropertyContractVo record); - WxRentContract getByBill(WxAllBill billRent); int getShopCountMax(); diff --git a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintBillDataHandler.java b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintBillDataHandler.java index 5187522c0..6fd0558a3 100644 --- a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintBillDataHandler.java +++ b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintBillDataHandler.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxMerchant; import com.iformall.print.data.PrintDataParser; import com.iformall.utils.DateUtils; @@ -18,7 +18,7 @@ public class PrintBillDataHandler implements PrintDataParser{ @Override public Object getObjectValue(String name, Object o,Object... params) { Map merchantMap = (Map) params[0]; - Map feesMap = (Map) params[1]; + Map feesMap = (Map) params[1]; Map shopNumber = (Map) params[2]; WxAllBill receive = (WxAllBill) o; if (name.equals("id")) { @@ -57,7 +57,7 @@ public class PrintBillDataHandler implements PrintDataParser{ return receive.getEnergyFeesName(); } if (null != feesMap && null != receive.getEnergyFeesId()) { - WxEnergyFees f = feesMap.get(receive.getEnergyFeesId()); + WxFinanceFees f = feesMap.get(receive.getEnergyFeesId()); if (null != f) { return f.getName(); } diff --git a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintFinanceReceiveDataHandler.java b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintFinanceReceiveDataHandler.java index 2405d65b6..40bb3e77a 100644 --- a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintFinanceReceiveDataHandler.java +++ b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintFinanceReceiveDataHandler.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSONObject; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinanceReceive; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxShop; @@ -33,7 +33,7 @@ public class PrintFinanceReceiveDataHandler implements PrintDataParser{ @Override public Object getObjectValue(String name, Object o, Object... params) { Map shopMap = (Map) params[0]; - Map feesMap = (Map) params[1]; + Map feesMap = (Map) params[1]; Map shopUserMap = (Map) params[2]; WxFinanceReceive receive = (WxFinanceReceive) o; if (name.equals("id")) { diff --git a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleDataHandler.java b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleDataHandler.java index f07661b59..0ad2415b8 100644 --- a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleDataHandler.java +++ b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleDataHandler.java @@ -6,7 +6,7 @@ import java.util.Map; import org.springframework.stereotype.Service; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinanceReceive; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxShop; @@ -21,7 +21,7 @@ public class PrintMerchantSettleDataHandler implements PrintDataParser{ @Override public Object getObjectValue(String name, Object o,Object... params) { Map shopMap = (Map) params[0]; - Map feesMap = (Map) params[1]; + Map feesMap = (Map) params[1]; Map shopUserMap = (Map) params[2]; WxShopBillVo receive = (WxShopBillVo) o; //根据科目来查询对应的信息 diff --git a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleItemDataHandler.java b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleItemDataHandler.java index b3ed58f92..942b10cb5 100644 --- a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleItemDataHandler.java +++ b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintMerchantSettleItemDataHandler.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinanceReceiveBill; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.vo.WxBillSum; @@ -20,12 +20,12 @@ public class PrintMerchantSettleItemDataHandler implements PrintDataParser{ @Override public Object getObjectValue(String name, Object o,Object... params) { Map merchantMap = (Map) params[0]; - Map feesMap = (Map) params[1]; + Map feesMap = (Map) params[1]; Map shopNumber = (Map) params[2]; WxBillSum receive = (WxBillSum) o; if (name.equals("energyFeesId")) { if (null != feesMap && null != receive.getEnergyFeesId()) { - WxEnergyFees f = feesMap.get(receive.getEnergyFeesId()); + WxFinanceFees f = feesMap.get(receive.getEnergyFeesId()); if (null != f) { return f.getName(); } diff --git a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintReceiveBillDataHandler.java b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintReceiveBillDataHandler.java index a9ab16075..2d1a3a3d4 100644 --- a/mallinkService/src/main/java/com/iformall/print/data/impl/PrintReceiveBillDataHandler.java +++ b/mallinkService/src/main/java/com/iformall/print/data/impl/PrintReceiveBillDataHandler.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinanceReceiveBill; import com.iformall.domain.po.WxMerchant; import com.iformall.print.data.PrintDataParser; @@ -19,7 +19,7 @@ public class PrintReceiveBillDataHandler implements PrintDataParser{ @Override public Object getObjectValue(String name, Object o,Object... params) { Map merchantMap = (Map) params[0]; - Map feesMap = (Map) params[1]; + Map feesMap = (Map) params[1]; Map shopNumber = (Map) params[2]; WxFinanceReceiveBill receive = (WxFinanceReceiveBill) o; if (name.equals("id")) { @@ -38,7 +38,7 @@ public class PrintReceiveBillDataHandler implements PrintDataParser{ return receive.getFeesName(); } if (null != feesMap && null != receive.getFeesId()) { - WxEnergyFees f = feesMap.get(receive.getFeesId()); + WxFinanceFees f = feesMap.get(receive.getFeesId()); if (null != f) { return f.getName(); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java b/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java index 374c804c5..5a73fef01 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java @@ -8,7 +8,6 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.TenantEntity; @@ -76,8 +75,6 @@ public interface WxAllBillService { void rentContractStop(WxRentContract rentContract,MallUserInfo user); - void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); - void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo); void insertBills(String tenantId,List bills); diff --git a/mallinkService/src/main/java/com/iformall/service/WxEnergyService.java b/mallinkService/src/main/java/com/iformall/service/WxEnergyService.java index e7f25bbc9..9876539af 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxEnergyService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxEnergyService.java @@ -12,9 +12,9 @@ import org.springframework.web.multipart.MultipartFile; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxEnergyFeesSetoff; -import com.iformall.domain.po.WxEnergyFeesShop; +import com.iformall.domain.po.WxFinanceFees; +import com.iformall.domain.po.WxFinanceFeesSetoff; +import com.iformall.domain.po.WxFeesCalcuteShop; import com.iformall.domain.po.WxEnergyFeesTime; import com.iformall.domain.po.WxEnergyMeter; import com.iformall.domain.po.WxEnergyMeterChild; @@ -53,23 +53,23 @@ public interface WxEnergyService { List findLastTimeEndGroup(WxEnergyFeesTime record); //费用科目 - PageInfo feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize,boolean isSetOff); - void saveOrUpdateFees(WxEnergyFees record); - WxEnergyFees getFeesById(Long id,String tenantId); - void setFeesIsDel(WxEnergyFees record); - Map getFeesMap(WxEnergyFees record); + PageInfo feesListAsPage(WxFinanceFees record, Integer pageIndex, Integer pageSize,boolean isSetOff); + void saveOrUpdateFees(WxFinanceFees record); + WxFinanceFees getFeesById(Long id,String tenantId); + void setFeesIsDel(WxFinanceFees record); + Map getFeesMap(WxFinanceFees record); void initEnergyFees(TenantEntity tenantEntity); - List getAdvanceSetoffFeesids(WxEnergyFeesSetoff setoff); - List getFeesIdList(WxEnergyFees record); + List getAdvanceSetoffFeesids(WxFinanceFeesSetoff setoff); + List getFeesIdList(WxFinanceFees record); //计算标砖 - List> getFeesShopComponentList(WxEnergyFeesShop record); - void createFeesShop(WxEnergyFeesShop record); - void deleteFeesShop(WxEnergyFeesShop record); - WxEnergyFeesShop getFeesShop(Long id,String tenantId); - void updateFeesShop(WxEnergyFeesShop record); - PageInfo feesShopListAsPage(WxEnergyFeesShop record, Integer pageIndex, Integer pageSize); - void exportFeesShop(WxEnergyFeesShop record,HttpServletRequest request, HttpServletResponse response); + List> getFeesShopComponentList(WxFeesCalcuteShop record); + void createFeesShop(WxFeesCalcuteShop record); + void deleteFeesShop(WxFeesCalcuteShop record); + WxFeesCalcuteShop getFeesShop(Long id,String tenantId); + void updateFeesShop(WxFeesCalcuteShop record); + PageInfo feesShopListAsPage(WxFeesCalcuteShop record, Integer pageIndex, Integer pageSize); + void exportFeesShop(WxFeesCalcuteShop record,HttpServletRequest request, HttpServletResponse response); void importFeesShop(MultipartFile mFile, MallUserInfo user, HttpServletRequest request, HttpServletResponse response); //抄表数据 diff --git a/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java b/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java index 905d7e206..3ec415970 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java @@ -16,7 +16,7 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxEnergyFeesShop; +import com.iformall.domain.po.WxFeesCalcuteShop; import com.iformall.domain.po.WxFinanceCheckOut; import com.iformall.domain.po.WxFinanceFinish; import com.iformall.domain.po.WxFinanceFinishReceive; diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java deleted file mode 100644 index 3eb9e5a88..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import org.apache.ibatis.annotations.Param; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - */ -public interface WxPropertyContractService { - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize); - - List findList(WxPropertyContract record); - - List findIdList(WxPropertyContract record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - Map getById(Long id); - - /** - * 保存或更新实体 - * @param record - * @param userId - * @param userName - * @return - */ - ResultData save(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate); - - ResultData updateMoney(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate); - - ResultData updateFile(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate); - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(Long id); - - void download(HttpServletRequest request, HttpServletResponse response); - - ResultData updatePropertyContractStatus(Long id); - - void endContract(WxPropertyContract wxPropertyContract,MallUserInfo userInfo); - - void updatePropertyPreviewBill(WxPropertyContract record); - - List getWxBillPropertyPreview(TenantEntity tenantEntity,Long id); - - WxPropertyContract getByBill(WxAllBill billRent); - - ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); - - void renewal(WxPropertyContract wxPropertyContract,MallUserInfo user,boolean aliasRentContract); - - void transfer(WxPropertyContract wxPropertyContract,MallUserInfo user); - - void outDateContract(WxMall wxMall); - - void readyToNomal(WxMall wxMall); - - WxPropertyContract getSimpleDetail(@Param("id") Long id); - - void updatePropertyContract(WxPropertyContract record); - - void deletePreviewBill(WxPropertyContract record); - - void setEndContractTime(WxPropertyContract proertyContract); - - List findToEndContractList(WxPropertyContract record); - - //查询还有多少天到期的合同 - List findToOutDateContracts(TenantEntity tenantEntity); - - BigDecimal calcuteContractUsedShopArea(WxPropertyContract record); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index 4720d74c4..624da67d7 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -5,7 +5,6 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxMall; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxRentContractFreePeriod; import com.iformall.domain.po.WxRentContractRevenueJump; @@ -49,7 +48,7 @@ public interface WxRentContractService { * @param id * @return */ - Map getById(Long id,Integer noBillList); + //Map getById(Long id,Integer noBillList); WxRentContract selectById(Long id); /** @@ -59,13 +58,13 @@ public interface WxRentContractService { * @param userName * @return */ - ResultData save(WxRentContract record,MallUserInfo user,String userName,Date oldRentStartDate); + //ResultData save(WxRentContract record,MallUserInfo user,String userName,Date oldRentStartDate); - ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps); + //ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps); - ResultData updateOneStep(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate); + //ResultData updateOneStep(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate); - ResultData updateRentStartTime(WxRentContract record, MallUserInfo user); + //ResultData updateRentStartTime(WxRentContract record, MallUserInfo user); /** * 根据Id删除实体 @@ -81,11 +80,11 @@ public interface WxRentContractService { ResultData updateRentContract(WxRentContract wxRentContract); - PageInfo getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); + //PageInfo getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); //void exportContract(HttpServletRequest request, HttpServletResponse response, Long rentId,Long propertyId); - ResultData updateFile(WxRentContract wxRentContract, MallUserInfo user,String userName,boolean writeComplate); + //ResultData updateFile(WxRentContract wxRentContract, MallUserInfo user,String userName,boolean writeComplate); ResultData updateRentContractStatus(Long id,boolean buildPropertyBill); @@ -93,22 +92,22 @@ public interface WxRentContractService { void updateApplyStatus(WxRentContract wxRentContract); - public List getYearList(int years,int month,Date rentalStartDate,Date endContractTime ); - List buildRent(MallUserInfo user,WxRentContract rentContract,Integer isPreview,boolean saveDb); + List getYearList(int years,int month,Date rentalStartDate,Date endContractTime ); + //List buildRent(MallUserInfo user,WxRentContract rentContract,Integer isPreview,boolean saveDb); - void buildDeposit( TenantEntity tenantEntity,MallUserInfo user,Long rentContractId); + //void buildDeposit( TenantEntity tenantEntity,MallUserInfo user,Long rentContractId); //void updateInvalidContract(Long rentContractId); - ResultData hasRentStatus(WxRentContract wxRentContract); + //ResultData hasRentStatus(WxRentContract wxRentContract); - ResultData hasContractNumber(WxRentContract wxRentContract); + //ResultData hasContractNumber(WxRentContract wxRentContract); //Integer getShopType(WxRentContract wxRentContract); ResultData endContract(WxRentContract wxRentContract,MallUserInfo userInfo); - void updatePropertyPreviewBill(WxRentContract record); + //void updatePropertyPreviewBill(WxRentContract record); //Map updateStatus(WxRentContract record); @@ -118,11 +117,11 @@ public interface WxRentContractService { //int selectContractCountByShopId(WxRentContract wxRentContract); - ResultData getContractByContractNumber(WxRentContract wxRentContract); + //ResultData getContractByContractNumber(WxRentContract wxRentContract); ResultData apply(WxRentContract wxRentContract,MallUserInfo user); - void renewal(WxRentContract wxRentContract,WxPropertyContract property,MallUserInfo user); + void renewal(WxRentContract wxRentContract,MallUserInfo user); void transfer(WxRentContract wxRentContract,MallUserInfo user); @@ -133,7 +132,7 @@ public interface WxRentContractService { void outDateContract(WxMall wxMall); //查询还有多少天到期的合同 - List findToOutDateContracts(TenantEntity tenantEntity); + //List findToOutDateContracts(TenantEntity tenantEntity); /** * 已签约未计租 变为计租中 @@ -155,11 +154,11 @@ public interface WxRentContractService { List getFreePeriods(WxRentContract wxRentContract); - void saveFreePeriods(WxRentContract wxRentContract); + //void saveFreePeriods(WxRentContract wxRentContract); List getContractSales(WxRentContract wxRentContract); - WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract,String sales,Date startime, Date endtime,Long propertyContractId); + WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract,String sales,Date startime, Date endtime); void setContractSalesConfirm(WxRentContract wxRentContract); @@ -167,7 +166,7 @@ public interface WxRentContractService { List findJumpList(WxRentContractRevenueJump jump); - List getRentContractYears(WxRentContract rentContract); + //List getRentContractYears(WxRentContract rentContract); BigDecimal calcuteContractUsedShopArea(WxRentContract wxRentContract,Long shopId); diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java deleted file mode 100644 index 285f4232b..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.vo.WxRentPropertyContractVo; - -/** - * @author gongbiao - */ -public interface WxRentPropertyContractService { - - PageInfo listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize); - - ResultData getContractInfo(Long rentId,Long propertyId); - - ResultData getContractApplyInfo(Long rentId,Long propertyId); - - ResultData insertRentForCreate(WxRentContract wxRentContract); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java index 9dbbad1c8..dd06b716f 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java @@ -25,10 +25,10 @@ import com.iformall.domain.dto.WxBillReceiveUpdateDTO; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxBillAction; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.WxShopUsers; @@ -39,7 +39,6 @@ import com.iformall.domain.vo.WxBillNotify; import com.iformall.domain.vo.WxBillSum; import com.iformall.domain.vo.WxShopVo; import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillDailyType; import com.iformall.enums.EnumBillOweOrNearType; import com.iformall.enums.EnumBillStatus; @@ -50,6 +49,7 @@ import com.iformall.enums.EnumSystemUserType; import com.iformall.enums.EnumYesOrNo; import com.iformall.service.WxAllBillService; import com.iformall.service.WxBillActionService; +import com.iformall.service.WxEnergyService; import com.iformall.service.WxMallService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxShopService; @@ -76,6 +76,9 @@ public class WxBillAllHelper { @Autowired private WxMallService wxMallService; + @Autowired + private WxEnergyService wxEnergyService; + public Date getDateBefore(Integer afterDays) { Date nowBegin = DateUtils.getDayBegin(new Date()); //return DateUtils.getDateTimeBefore(afterDays*3600*24, nowBegin); @@ -202,8 +205,8 @@ public class WxBillAllHelper { bq.updateTenantInfo(tenantEntity); bq.setRentContractId(rentContractId); bq.setIsPreview(EnumYesOrNo.NO.getCode()); - bq.setBillType(EnumBillAllType.RENT.getCode()); - bq.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); + //bq.setBillType(EnumBillAllType.RENT.getCode()); + //bq.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); //bq.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); bq.setStarttimeEqual(starttime); bq.setEndtimeEqual(endtime); @@ -311,8 +314,8 @@ public class WxBillAllHelper { exportFileName = exportFileName+"_"+su.getName(); } } - result.put("billTypeName", bill.getBillTypeName()); - exportFileName = exportFileName +"_"+ bill.getBillTypeName(); + //result.put("billTypeName", bill.getName()); + //exportFileName = exportFileName +"_"+ bill.getBillTypeName(); result.put("billRemark", bill.getBillRemark()); result.put("receivePay", bill.getReceivePay()); result.put("pay", bill.getPay()); @@ -396,10 +399,11 @@ public class WxBillAllHelper { String endTimeStr = DateUtils.date2String(endTime,DateUtils.DATE_TIME_PATTERN); boolean isUpdate = false; action.setBillId(bill.getId()); - action.setBillType(bill.getBillType()); + WxFinanceFees fees = wxEnergyService.getFeesById(bill.getEnergyFeesId(), bill.getTenantId()); + //action.setBillType(bill.getBillType()); String oldReceivePay = bill.getReceivePay(); boolean isAllReturn = false; - if (EnumBillAllType.getEnum(bill.getBillType()).isDeposit()) { + if (fees.getIsDespoit().intValue() == EnumYesOrNo.YES.getCode().intValue()) { isAllReturn = true; } //如果账单的开始时间在结束时间之后,已经支付了的要退回。 @@ -462,15 +466,6 @@ public class WxBillAllHelper { wxAllBillService.rentContractStop(rentContract, user); } - //物业合同终止,物业押金需全额退回,物业账单需重新计算 - public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user) { - if (null == user) { - user = getSystemUser(propertyContract); - } - //物业账单 - wxAllBillService.propertyContractStop(propertyContract, user); - } - public void saveOrUpdateBill(WxAllBill bill,MallUserInfo user) { wxAllBillService.saveOrUpdate(bill, user); } diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java index cb4f24c0a..830f99475 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java @@ -12,8 +12,8 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxEnergyFeesShop; +import com.iformall.domain.po.WxFinanceFees; +import com.iformall.domain.po.WxFeesCalcuteShop; import com.iformall.domain.po.WxEnergyFeesTime; import com.iformall.domain.po.WxEnergyMeter; import com.iformall.domain.po.WxEnergyMeterReading; @@ -21,7 +21,6 @@ import com.iformall.domain.po.WxMallBuilding; import com.iformall.domain.po.WxMallFloor; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumEnergyMeterPhysicsType; import com.iformall.enums.EnumYesOrNo; import com.iformall.mapper.WxEnergyMeterMapper; @@ -194,60 +193,61 @@ public class WxEnergyHelper { * @param shopfee * @return */ - public String calcuteMoney(StringBuffer sb,BigDecimal totalArea,WxShop shop,WxEnergyFeesTime time,WxEnergyFees fees, WxEnergyFeesShop shopfee, + public String calcuteMoney(StringBuffer sb,BigDecimal totalArea,WxShop shop,WxEnergyFeesTime time,WxFinanceFees fees, WxFeesCalcuteShop shopfee, List userMeterList,Map> summaryMeterMap,Map buildingAreaMap,Map floorAreaMap) { if (StringUtils.isBlank(shopfee.getPrice())) { return "0"; } - //如果是公摊,或者非能源费用,则用公式计算 - if (shopfee.getIsPublic() == EnumYesOrNo.YES.getCode() || fees.getBillType() != EnumBillAllType.DAILY.getCode()) { - //替代占位符为真实数据 - //公摊总表数据,根据公摊总表下的公共表来查询所有的读数 - Map meterNumberMap = null; - if (null != summaryMeterMap) { - meterNumberMap = new HashMap(); - for (Iterator it = summaryMeterMap.keySet().iterator(); it.hasNext();) { - Long sumaryMeterId = it.next(); - List childmids = summaryMeterMap.get(sumaryMeterId); - //查询子表的总读数 - WxEnergyMeterReading mrq = new WxEnergyMeterReading(); - mrq.updateTenantInfo(shopfee); - mrq.setMeterIds(childmids); - mrq.setStartTime(time.getStartTime()); - mrq.setEndTime(time.getEndTime()); - mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); - BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); - if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { - totalNumber = new BigDecimal(0); - } - meterNumberMap.put(sumaryMeterId, totalNumber); - } - } - String formula = replaceFormulaData(shopfee.getFormula(),totalArea,shop,buildingAreaMap,floorAreaMap,meterNumberMap); - if (null != formula) { - return new BigDecimal(FormulaParser.evaluate(formula)).multiply(new BigDecimal(shopfee.getPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); - } - return "0"; - }else { - //如果是用户能耗 - if (null == userMeterList || userMeterList.size() <= 0 ) { - return "0"; - } - //根据表,区间的开始日期,结束日期来查询抄表数据。 - WxEnergyMeterReading mrq = new WxEnergyMeterReading(); - mrq.updateTenantInfo(shopfee); - mrq.setMeterIds(userMeterList); - mrq.setStartTime(time.getStartTime()); - mrq.setEndTime(time.getEndTime()); - mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); - BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); - if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { - return "0"; - } - sb.append("表总度数"+totalNumber.toPlainString()+",单价:"+shopfee.getPrice()); - return totalNumber.multiply(new BigDecimal(shopfee.getPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); - - } +// //如果是公摊,或者非能源费用,则用公式计算 +// if (shopfee.getIsPublic() == EnumYesOrNo.YES.getCode() || fees.getBillType() != EnumBillAllType.DAILY.getCode()) { +// //替代占位符为真实数据 +// //公摊总表数据,根据公摊总表下的公共表来查询所有的读数 +// Map meterNumberMap = null; +// if (null != summaryMeterMap) { +// meterNumberMap = new HashMap(); +// for (Iterator it = summaryMeterMap.keySet().iterator(); it.hasNext();) { +// Long sumaryMeterId = it.next(); +// List childmids = summaryMeterMap.get(sumaryMeterId); +// //查询子表的总读数 +// WxEnergyMeterReading mrq = new WxEnergyMeterReading(); +// mrq.updateTenantInfo(shopfee); +// mrq.setMeterIds(childmids); +// mrq.setStartTime(time.getStartTime()); +// mrq.setEndTime(time.getEndTime()); +// mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); +// BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); +// if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { +// totalNumber = new BigDecimal(0); +// } +// meterNumberMap.put(sumaryMeterId, totalNumber); +// } +// } +// String formula = replaceFormulaData(shopfee.getFormula(),totalArea,shop,buildingAreaMap,floorAreaMap,meterNumberMap); +// if (null != formula) { +// return new BigDecimal(FormulaParser.evaluate(formula)).multiply(new BigDecimal(shopfee.getPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); +// } +// return "0"; +// }else { +// //如果是用户能耗 +// if (null == userMeterList || userMeterList.size() <= 0 ) { +// return "0"; +// } +// //根据表,区间的开始日期,结束日期来查询抄表数据。 +// WxEnergyMeterReading mrq = new WxEnergyMeterReading(); +// mrq.updateTenantInfo(shopfee); +// mrq.setMeterIds(userMeterList); +// mrq.setStartTime(time.getStartTime()); +// mrq.setEndTime(time.getEndTime()); +// mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); +// BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); +// if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { +// return "0"; +// } +// sb.append("表总度数"+totalNumber.toPlainString()+",单价:"+shopfee.getPrice()); +// return totalNumber.multiply(new BigDecimal(shopfee.getPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); +// +// } +return "0"; } diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java index 8c564c455..c2439957b 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractAgileHelper.java @@ -20,8 +20,7 @@ import org.slf4j.LoggerFactory; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.iformall.domain.dto.NeedPayDTO; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.BillTimeVo; import com.iformall.domain.vo.WxBillFeesStandardsListVo; diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index 03287cc22..1fc9c993d 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -20,8 +20,7 @@ import org.slf4j.LoggerFactory; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.iformall.domain.dto.NeedPayDTO; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.BillTimeVo; import com.iformall.domain.vo.WxBillFeesStandardsListVo; @@ -40,633 +39,584 @@ import com.iformall.utils.DateUtils; public class WxRentContractHelper { - //计算商业管理费 - public static String[] calcuteBussinessManagementFee(WxRentContract wxRentContract) { -// if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getBussinessManagementFeeRatio()))) { -// return null; +// //计算商业管理费 +// public static String[] calcuteBussinessManagementFee(WxRentContract wxRentContract) { +//// if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getBussinessManagementFeeRatio()))) { +//// return null; +//// } +// return calcuteOtherCanAdjustFeeByArea(wxRentContract,wxRentContract.getBussinessManagementFee(),wxRentContract.getBussinessManagementFeeRatioWay(), +// wxRentContract.getBussinessManagementFeeRatio(),"bussinessManagementFee","bussinessManagementFeeRatio"); +// } +// +// //计算营业管理费 +// public static String[] calcuteOperatingManagementFee(WxRentContract wxRentContract) { +//// if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getOperatingManagementFeeRatio()))) { +//// return null; +//// } +// return calcuteOtherCanAdjustFeeByArea(wxRentContract,wxRentContract.getOperatingManagementFee(),wxRentContract.getOperatingManagementFeeRatioWay(), +// wxRentContract.getOperatingManagementFeeRatio(),"operatingManagementFee","operatingManagementFeeRatio"); +// } +// +// //计算除租金外其他可调整费项(按面积计算) +// private static String[] calcuteOtherCanAdjustFeeByArea(WxRentContract wxRentContract,String fee,Integer ratioWay,String ratio,String feeField,String feeRatioField) { +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || +// wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { +// if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { +// //第一年,根据面积来计算 +// JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); +// String[] priceArr = new String[rentInfoArray.size()]; +// for (int i = 0; i < rentInfoArray.size(); i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// //商业管理费单价 +// String priceStr = rentInfoObject.getString(feeField); +// if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { +// priceStr = "0"; +// } +// //租赁面积 +// String rentArea = rentInfoObject.getString("rentArea"); +// if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { +// rentArea = "0"; +// } +// priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// } +// +// List priceList = computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField,wxRentContract.getRentArea()); +// if (null != priceList) { +// return calcuteRatioByPart(priceList, feeRatioField); +// }else { +// return null; +// } +// }else { +// if (StringUtils.isBlank(fee)) { +// return null; +// } +// String rentArea = wxRentContract.getRentArea(); +// if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { +// rentArea = "0"; +// } +// String ratioFirstYearPrice = new BigDecimal(fee).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// return calcuteRatioByJoin(Constant.default_long_decimal_size,ratioWay, ratio, ratioFirstYearPrice,wxRentContract.getRentArea()); +// } // } - return calcuteOtherCanAdjustFeeByArea(wxRentContract,wxRentContract.getBussinessManagementFee(),wxRentContract.getBussinessManagementFeeRatioWay(), - wxRentContract.getBussinessManagementFeeRatio(),"bussinessManagementFee","bussinessManagementFeeRatio"); - } - - //计算营业管理费 - public static String[] calcuteOperatingManagementFee(WxRentContract wxRentContract) { -// if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getOperatingManagementFeeRatio()))) { -// return null; +// return null; +// } +// +// //计算年租金 +// public static String[] calcuteRentPrice(WxRentContract wxRentContract) { +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || +// wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { +// if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { +//// //计算每年租金基数(按面积,分铺录入) +//// //第一年 +//// List priceList = computeRentPriceByShop(wxRentContract); +//// return calcuteRatioByPart(priceList, "adjustRatio"); +// }else { +// List priceList = calcuteRentPriceByJoin(wxRentContract,true); +// return priceList.get(0); +// } // } - return calcuteOtherCanAdjustFeeByArea(wxRentContract,wxRentContract.getOperatingManagementFee(),wxRentContract.getOperatingManagementFeeRatioWay(), - wxRentContract.getOperatingManagementFeeRatio(),"operatingManagementFee","operatingManagementFeeRatio"); - } - - //计算除租金外其他可调整费项(按面积计算) - private static String[] calcuteOtherCanAdjustFeeByArea(WxRentContract wxRentContract,String fee,Integer ratioWay,String ratio,String feeField,String feeRatioField) { - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || - wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { - //第一年,根据面积来计算 - JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); - String[] priceArr = new String[rentInfoArray.size()]; - for (int i = 0; i < rentInfoArray.size(); i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - //商业管理费单价 - String priceStr = rentInfoObject.getString(feeField); - if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { - priceStr = "0"; - } - //租赁面积 - String rentArea = rentInfoObject.getString("rentArea"); - if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { - rentArea = "0"; - } - priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - - List priceList = computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField,wxRentContract.getRentArea()); - if (null != priceList) { - return calcuteRatioByPart(priceList, feeRatioField); - }else { - return null; - } - }else { - if (StringUtils.isBlank(fee)) { - return null; - } - String rentArea = wxRentContract.getRentArea(); - if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { - rentArea = "0"; - } - String ratioFirstYearPrice = new BigDecimal(fee).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - return calcuteRatioByJoin(Constant.default_long_decimal_size,ratioWay, ratio, ratioFirstYearPrice,wxRentContract.getRentArea()); - } - } - return null; - } - - public static String[] calcutePropertyPrice(WxPropertyContract wxPropertyContract) { - String adjustRatio = wxPropertyContract.getAdjustRatio(); - List integers = JSONArray.parseArray(adjustRatio, Integer.class); - integers.add(0, 0); - int size = integers.size(); - String[] priceArr = new String[size]; - priceArr[0] = wxPropertyContract.getPrice(); - //判断年租金调整方式 - if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - BigDecimal priceD = new BigDecimal(wxPropertyContract.getPrice()); - for (int i = 1; i < size; i++) { - priceD = priceD.add(priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100))); - priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); - } - } else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - BigDecimal priceD = new BigDecimal(wxPropertyContract.getPrice()); - for (int i = 1; i < size; i++) { - priceD = priceD.add(new BigDecimal(integers.get(i))); - priceArr[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); - } - }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ - for (int i = 1; i < size; i++) { - priceArr[i] = new BigDecimal(integers.get(i)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ - BigDecimal priceD = new BigDecimal(wxPropertyContract.getPrice()); - for (int i = 1; i < size; i++) { - priceArr[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ - for (int i = 1; i < size; i++) { - priceArr[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxPropertyContract.getRentArea())).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - }else { - for (int i = 1; i < size; i++) { - priceArr[i] = wxPropertyContract.getPrice(); - } - } - //物业没有4 -// }else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ -// BigDecimal priceD = new BigDecimal(price); -// for (int i = 1; i < size; i++) { -// priceArr[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).toPlainString(); -// } -// } - return priceArr; - } - - - //计算年租金 - public static String[] calcuteRentPrice(WxRentContract wxRentContract) { - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || - wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { -// //计算每年租金基数(按面积,分铺录入) -// //第一年 -// List priceList = computeRentPriceByShop(wxRentContract); -// return calcuteRatioByPart(priceList, "adjustRatio"); - }else { - List priceList = calcuteRentPriceByJoin(wxRentContract,true); - return priceList.get(0); - } - } - List priceList = calcuteRentPriceByJoin(wxRentContract,true); - return priceList.get(0); - } - - public static List calcuteRentAndRevenuePrice(WxRentContract wxRentContract) { - return calcuteRentPriceByJoin(wxRentContract,false); - } - - //计算单个店铺每年租金基数(分铺录入) - public static List computeRentPriceByShop(WxRentContract wxRentContract) { - JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); - String[] priceArr = new String[rentInfoArray.size()]; - for (int i = 0; i < rentInfoArray.size(); i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String priceStr = rentInfoObject.getString("price"); - if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { - priceStr = "0"; - } - priceArr[i] = priceStr; - } - return computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio",wxRentContract.getRentArea()); - } - - //计算每年租金基数值(合铺录入),具体计算在合同创建时,会根据合同的PriceUnit来根据此基数来计算 - private static List calcuteRentPriceByJoin(WxRentContract wxRentContract,boolean isCalcuted) { - List retList = new ArrayList(); - //租金的年调整 - String adjustRatio = wxRentContract.getAdjustRatio(); - List integers = JSONArray.parseArray(adjustRatio, String.class); - integers.add(0, "0"); - int size = integers.size(); - String[] priceArrs = new String[size]; - - priceArrs[0] = wxRentContract.getPrice(); - BigDecimal priceD = new BigDecimal(wxRentContract.getPrice()); - - //联营扣点年调整。 - String revenueYear = wxRentContract.getRevenueRatioSet(); - List revenueYears = null; - if (!StringUtils.isBlank(revenueYear)) { - revenueYears = JSONArray.parseArray(revenueYear, Long.class); - }else { - revenueYears = new ArrayList(); - } - revenueYears.add(0,0L); - - //联营扣点取高单据计算联营扣点方式的,再跟租金的对比取高 - String[] revenuePriceArrs = calcuteRevenuePriceByRentAreaJoint(wxRentContract,revenueYears,size); - - //租金的年调整,联营扣点没有年租金调整,取revenueRatioWay - Integer adjustRatioWay = wxRentContract.getAdjustRatioWay(); - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - adjustRatioWay = wxRentContract.getRevenueRatioWay(); - } - - //计算所有租金的 - if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - for (int i = 1; i < size; i++) { - //如果纯联营扣点,没有租金的年增长,用联营扣点的年增长;联营扣点取高时priceD已是最高值 - String _update = ""; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - _update = String.valueOf(revenueYears.get(i)); - }else { - _update = String.valueOf(integers.get(i)); - } - BigDecimal divide = priceD.multiply(new BigDecimal(_update)).divide(new BigDecimal(100)); - priceD = priceD.add(divide); - priceArrs[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - } else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - for (int i = 1; i < size; i++) { - String _update = ""; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - _update = String.valueOf(revenueYears.get(i)); - }else { - _update = String.valueOf(integers.get(i)); - } - priceD = priceD.add(new BigDecimal(_update)); - priceArrs[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - } else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ - for (int i = 1; i < size; i++) { - String _update = ""; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - _update = String.valueOf(revenueYears.get(i)); - }else { - _update = String.valueOf(integers.get(i)); - } - priceArrs[i] = new BigDecimal(_update).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - }else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ - String renenue = wxRentContract.getRevenue();//联营保底营业额 - if (StringUtils.isBlank(renenue)) { - renenue = "0"; - } - for (int i = 1; i < size; i++) { - //如果是联营扣点,用保底营业额*比例 - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - priceArrs[i] = new BigDecimal(renenue).multiply(new BigDecimal(revenueYears.get(i))).divide(new BigDecimal(100)).toPlainString(); - }else { - priceArrs[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).toPlainString(); - } - - } - }else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ - for (int i = 1; i < size; i++) { - String _update = ""; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - _update = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); - }else { - _update = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); - } - priceArrs[i] = new BigDecimal(_update).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); - } - } - if (isCalcuted) { - //租金和联营取高 - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - if (null != revenuePriceArrs) { - for (int i = 0 ; i < priceArrs.length; i ++) { - if (new BigDecimal(priceArrs[i]).compareTo(new BigDecimal(revenuePriceArrs[i])) < 0) { - priceArrs[i] = revenuePriceArrs[i]; - } - } - } - } - } - retList.add(priceArrs); - if (!isCalcuted && null != revenuePriceArrs) { - retList.add(revenuePriceArrs); - } - return retList; - } - - //联营面积取高计算联营扣点调整。 - private static String[] calcuteRevenuePriceByRentAreaJoint(WxRentContract wxRentContract,List revenueYears,int size) { - //联营面积取高时,联营扣点调整比率设置 - String[] revenuePriceArrs = new String[size]; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - if (StringUtils.isBlank(wxRentContract.getRevenue())) { - return null; - } - String _revenuePriceD = new BigDecimal(wxRentContract.getRevenue()).multiply(new BigDecimal(wxRentContract.getPayRatio())) - .divide(new BigDecimal(100)).toPlainString(); - revenuePriceArrs[0] = _revenuePriceD; - - BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); - if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - for (int i = 1; i < size; i++) { - //联营扣点算法 - if (revenueYears.size() == size) { - BigDecimal _p = new BigDecimal(revenueYears.get(i)).multiply(revenuePriceD).divide(new BigDecimal(100)); - revenuePriceD = revenuePriceD.add(_p); - } - revenuePriceArrs[i] = revenuePriceD.toPlainString(); - } - } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - for (int i = 1; i < size; i++) { - if (revenueYears.size() == size) { - revenuePriceD = revenuePriceD.add(new BigDecimal(revenueYears.get(i))); - } - revenuePriceArrs[i] = revenuePriceD.toPlainString(); - } - } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ - for (int i = 1; i < size; i++) { - revenuePriceArrs[i] = new BigDecimal(revenueYears.get(i)).toPlainString(); - } - }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ - //比例方式直接用保底营业额*比例 - for (int i = 1; i < size; i++) { - BigDecimal _p = new BigDecimal(0) ; - if (revenueYears.size() == size) { - _p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRevenue())).divide(new BigDecimal(100)); - } - revenuePriceArrs[i] = _p.toPlainString(); - } - }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ - for (int i = 1; i < size; i++) { - revenuePriceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRevenue())).toPlainString(); - } - } - } - return revenuePriceArrs; - } - - //合铺计算某项计费 - private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice,String rentArea) { - List integers = JSONArray.parseArray(ratio, String.class); - integers.add(0, "0"); - int size = integers.size(); - String[] priceArrs = new String[size]; - priceArrs[0] = ratioFirstYearPrice; - BigDecimal priceD = new BigDecimal(ratioFirstYearPrice); - - if (ratioWay.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - for (int i = 1; i < size; i++) { - BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); - priceD = priceD.add(divide); - priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - for (int i = 1; i < size; i++) { - priceD = priceD.add(new BigDecimal(integers.get(i))); - priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ - for (int i = 1; i < size; i++) { - priceArrs[i] = new BigDecimal(integers.get(i)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - }else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ - for (int i = 1; i < size; i++) { - BigDecimal _p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); - priceArrs[i] = _p.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - }else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ - for (int i = 1; i < size; i++) { - priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - } - return priceArrs; - } +// List priceList = calcuteRentPriceByJoin(wxRentContract,true); +// return priceList.get(0); +// } +// +// public static List calcuteRentAndRevenuePrice(WxRentContract wxRentContract) { +// return calcuteRentPriceByJoin(wxRentContract,false); +// } - - //分铺汇总计算某项计费 - private static String[] calcuteRatioByPart(List priceList,String ratioKey){ - //通过rentInfo里面分别计算各商铺的金额 - String[] priceArrs = new String[priceList.size()]; - for (int i = 0; i < priceList.size(); i++) { - String[] priceInt = priceList.get(i); - BigDecimal sum = new BigDecimal(0); - for (String p : priceInt) { - sum = sum.add(new BigDecimal(p)); - } - priceArrs[i] = sum.toPlainString(); - } - return priceArrs; - } +// //计算单个店铺每年租金基数(分铺录入) +// public static List computeRentPriceByShop(WxRentContract wxRentContract) { +// JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); +// String[] priceArr = new String[rentInfoArray.size()]; +// for (int i = 0; i < rentInfoArray.size(); i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// String priceStr = rentInfoObject.getString("price"); +// if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { +// priceStr = "0"; +// } +// priceArr[i] = priceStr; +// } +// return computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio",wxRentContract.getRentArea()); +// } +// +// //计算每年租金基数值(合铺录入),具体计算在合同创建时,会根据合同的PriceUnit来根据此基数来计算 +// private static List calcuteRentPriceByJoin(WxRentContract wxRentContract,boolean isCalcuted) { +// List retList = new ArrayList(); +// //租金的年调整 +// String adjustRatio = wxRentContract.getAdjustRatio(); +// List integers = JSONArray.parseArray(adjustRatio, String.class); +// integers.add(0, "0"); +// int size = integers.size(); +// String[] priceArrs = new String[size]; +// +// priceArrs[0] = wxRentContract.getPrice(); +// BigDecimal priceD = new BigDecimal(wxRentContract.getPrice()); +// +// //联营扣点年调整。 +// String revenueYear = wxRentContract.getRevenueRatioSet(); +// List revenueYears = null; +// if (!StringUtils.isBlank(revenueYear)) { +// revenueYears = JSONArray.parseArray(revenueYear, Long.class); +// }else { +// revenueYears = new ArrayList(); +// } +// revenueYears.add(0,0L); +// +// //联营扣点取高单据计算联营扣点方式的,再跟租金的对比取高 +// String[] revenuePriceArrs = calcuteRevenuePriceByRentAreaJoint(wxRentContract,revenueYears,size); +// +// //租金的年调整,联营扣点没有年租金调整,取revenueRatioWay +// Integer adjustRatioWay = wxRentContract.getAdjustRatioWay(); +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// adjustRatioWay = wxRentContract.getRevenueRatioWay(); +// } +// +// //计算所有租金的 +// if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { +// for (int i = 1; i < size; i++) { +// //如果纯联营扣点,没有租金的年增长,用联营扣点的年增长;联营扣点取高时priceD已是最高值 +// String _update = ""; +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// _update = String.valueOf(revenueYears.get(i)); +// }else { +// _update = String.valueOf(integers.get(i)); +// } +// BigDecimal divide = priceD.multiply(new BigDecimal(_update)).divide(new BigDecimal(100)); +// priceD = priceD.add(divide); +// priceArrs[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// } +// } else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { +// for (int i = 1; i < size; i++) { +// String _update = ""; +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// _update = String.valueOf(revenueYears.get(i)); +// }else { +// _update = String.valueOf(integers.get(i)); +// } +// priceD = priceD.add(new BigDecimal(_update)); +// priceArrs[i] = priceD.setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// } +// } else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ +// for (int i = 1; i < size; i++) { +// String _update = ""; +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// _update = String.valueOf(revenueYears.get(i)); +// }else { +// _update = String.valueOf(integers.get(i)); +// } +// priceArrs[i] = new BigDecimal(_update).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// } +// }else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ +// String renenue = wxRentContract.getRevenue();//联营保底营业额 +// if (StringUtils.isBlank(renenue)) { +// renenue = "0"; +// } +// for (int i = 1; i < size; i++) { +// //如果是联营扣点,用保底营业额*比例 +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// priceArrs[i] = new BigDecimal(renenue).multiply(new BigDecimal(revenueYears.get(i))).divide(new BigDecimal(100)).toPlainString(); +// }else { +// priceArrs[i] = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)).toPlainString(); +// } +// +// } +// }else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ +// for (int i = 1; i < size; i++) { +// String _update = ""; +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// _update = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); +// }else { +// _update = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); +// } +// priceArrs[i] = new BigDecimal(_update).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); +// } +// } +// if (isCalcuted) { +// //租金和联营取高 +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { +// if (null != revenuePriceArrs) { +// for (int i = 0 ; i < priceArrs.length; i ++) { +// if (new BigDecimal(priceArrs[i]).compareTo(new BigDecimal(revenuePriceArrs[i])) < 0) { +// priceArrs[i] = revenuePriceArrs[i]; +// } +// } +// } +// } +// } +// retList.add(priceArrs); +// if (!isCalcuted && null != revenuePriceArrs) { +// retList.add(revenuePriceArrs); +// } +// return retList; +// } +// +// //联营面积取高计算联营扣点调整。 +// private static String[] calcuteRevenuePriceByRentAreaJoint(WxRentContract wxRentContract,List revenueYears,int size) { +// //联营面积取高时,联营扣点调整比率设置 +// String[] revenuePriceArrs = new String[size]; +// if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { +// if (StringUtils.isBlank(wxRentContract.getRevenue())) { +// return null; +// } +// String _revenuePriceD = new BigDecimal(wxRentContract.getRevenue()).multiply(new BigDecimal(wxRentContract.getPayRatio())) +// .divide(new BigDecimal(100)).toPlainString(); +// revenuePriceArrs[0] = _revenuePriceD; +// +// BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); +// if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { +// for (int i = 1; i < size; i++) { +// //联营扣点算法 +// if (revenueYears.size() == size) { +// BigDecimal _p = new BigDecimal(revenueYears.get(i)).multiply(revenuePriceD).divide(new BigDecimal(100)); +// revenuePriceD = revenuePriceD.add(_p); +// } +// revenuePriceArrs[i] = revenuePriceD.toPlainString(); +// } +// } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { +// for (int i = 1; i < size; i++) { +// if (revenueYears.size() == size) { +// revenuePriceD = revenuePriceD.add(new BigDecimal(revenueYears.get(i))); +// } +// revenuePriceArrs[i] = revenuePriceD.toPlainString(); +// } +// } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ +// for (int i = 1; i < size; i++) { +// revenuePriceArrs[i] = new BigDecimal(revenueYears.get(i)).toPlainString(); +// } +// }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ +// //比例方式直接用保底营业额*比例 +// for (int i = 1; i < size; i++) { +// BigDecimal _p = new BigDecimal(0) ; +// if (revenueYears.size() == size) { +// _p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRevenue())).divide(new BigDecimal(100)); +// } +// revenuePriceArrs[i] = _p.toPlainString(); +// } +// }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ +// for (int i = 1; i < size; i++) { +// revenuePriceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRevenue())).toPlainString(); +// } +// } +// } +// return revenuePriceArrs; +// } +// +// //合铺计算某项计费 +// private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice,String rentArea) { +// List integers = JSONArray.parseArray(ratio, String.class); +// integers.add(0, "0"); +// int size = integers.size(); +// String[] priceArrs = new String[size]; +// priceArrs[0] = ratioFirstYearPrice; +// BigDecimal priceD = new BigDecimal(ratioFirstYearPrice); +// +// if (ratioWay.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { +// for (int i = 1; i < size; i++) { +// BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); +// priceD = priceD.add(divide); +// priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { +// for (int i = 1; i < size; i++) { +// priceD = priceD.add(new BigDecimal(integers.get(i))); +// priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ +// for (int i = 1; i < size; i++) { +// priceArrs[i] = new BigDecimal(integers.get(i)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// }else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ +// for (int i = 1; i < size; i++) { +// BigDecimal _p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); +// priceArrs[i] = _p.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// }else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ +// for (int i = 1; i < size; i++) { +// priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// } +// return priceArrs; +// } +// +// +// //分铺汇总计算某项计费 +// private static String[] calcuteRatioByPart(List priceList,String ratioKey){ +// //通过rentInfo里面分别计算各商铺的金额 +// String[] priceArrs = new String[priceList.size()]; +// for (int i = 0; i < priceList.size(); i++) { +// String[] priceInt = priceList.get(i); +// BigDecimal sum = new BigDecimal(0); +// for (String p : priceInt) { +// sum = sum.add(new BigDecimal(p)); +// } +// priceArrs[i] = sum.toPlainString(); +// } +// return priceArrs; +// } +// +// //计算某项金额,每年-每个店铺金额 +// public static List computeRatioByShop(Integer decimalSize,JSONArray rentInfoArray, Integer ratioWayType,String[] firstYearPrces,String ratioKey,String rentArea) { +// List priceList = new ArrayList<>(); +// priceList.add(firstYearPrces); //每个店铺每月租金 +// //大于一年 +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); +// JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey);//[100,200] +// if (null != adjustRatio) { +// return computeRatioFromRentInfo(decimalSize,priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey,rentArea); +// } +// return null; +// } +// +// //计算年调整后的某项计费 +// private static List computeRatioFromRentInfo(Integer decimalSize,List priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey,String rentArea ) { +// //循环多年的调整比例,如3年。[10,20,30] +// for (int i = 0; i < ratioYears; i++) { +// String[] priceArrs = new String[rentInfoArray.size()]; +// //按每个商铺循环 +// for (int j = 0; j < rentInfoArray.size(); j++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); +// JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey); +// if (ratioWayType.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { +// BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); +// BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); +// priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { +// BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100))); +// priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())) { +// BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); +// priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())) { +// BigDecimal price = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); +// priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())) { +// BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); +// priceArrs[j] = price.multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); +// } +// } +// priceList.add(priceArrs); +// } +// return priceList; +// } - //计算某项金额,每年-每个店铺金额 - public static List computeRatioByShop(Integer decimalSize,JSONArray rentInfoArray, Integer ratioWayType,String[] firstYearPrces,String ratioKey,String rentArea) { - List priceList = new ArrayList<>(); - priceList.add(firstYearPrces); //每个店铺每月租金 - //大于一年 - JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); - JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey);//[100,200] - if (null != adjustRatio) { - return computeRatioFromRentInfo(decimalSize,priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey,rentArea); - } - return null; - } +// //查询月账单需要支付的金额 +// public static String getNeedPayMoney(List freeDays,WxRentContract wxRentContract,String price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ +// String needpay; +// if (null == wxRentContract.getDecimalSize()) { +// wxRentContract.setDecimalSize(Constant.default_short_decimal_size); +// } +// EnumRentDayPriceCalcute priceCalcute = EnumRentDayPriceCalcute.getEnum(wxRentContract.getDayPriceCalcute()); +// +// //按日 +// if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ +// BigDecimal priceD = new BigDecimal(price); +// +// String needpayD = WxRentContractHelper.getNeedPay(freeDays,Constant.default_long_decimal_size,priceD,startDate,endDate,priceCalcute,wxRentContract.getMonthAverageDays()); +// //取整 +// //needpay = new Double(needpayD).longValue(); +// //四舍五入 +// needpay = new BigDecimal(needpayD).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); +// }else{ +// BigDecimal priceD = new BigDecimal(price); +// //年 除12 +// if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ +// priceD = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,RoundingMode.HALF_UP).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP); +// } +// +// //生成金额直接计算 +// if(!saveDb){ +// //needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue(); +// needpay = new BigDecimal(getMonthNeedPay(freeDays,Constant.default_long_decimal_size,priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays())).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); +// return needpay; +// } +// +// //判断是否满足整月 +// needpay = new BigDecimal(getMonthNeedPay(freeDays,Constant.default_long_decimal_size,priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays())) +// .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); +// } +// return needpay; +// } - //计算年调整后的某项计费 - private static List computeRatioFromRentInfo(Integer decimalSize,List priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey,String rentArea ) { - //循环多年的调整比例,如3年。[10,20,30] - for (int i = 0; i < ratioYears; i++) { - String[] priceArrs = new String[rentInfoArray.size()]; - //按每个商铺循环 - for (int j = 0; j < rentInfoArray.size(); j++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); - JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey); - if (ratioWayType.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { - BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); - BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); - priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { - BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100))); - priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())) { - BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); - priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())) { - BigDecimal price = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); - priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())) { - BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); - priceArrs[j] = price.multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); - } - } - priceList.add(priceArrs); - } - return priceList; - } +// //其他标准计费项 +// public static List getStandardsBillList(Integer decimalSize,List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed, +// String rentArea,Integer payPeriodRate,Integer adjustPeriod,Integer receivePeriod,Integer dateType) { +// if (null == feesStandarsList || feesStandarsList.size() <= 0 ) { +// return null; +// } +// List retList = new ArrayList(); +// for (int i = 0 ; i < feesStandarsList.size() ; i ++) { +// WxBillFeesStandardsListVo vo = new WxBillFeesStandardsListVo(); +// WxEnergyFees fees = feesStandarsList.get(i); +// vo.setBillName(fees.getName()); +// //如果是一次性的,账单只有一个 +// if (isFixed) { +// if (fees.getFixedPrice().intValue() == EnumYesOrNo.YES.getCode().intValue() && null != billStartDate && null != billEndDate) { +// vo.setStart(billStartDate); +// vo.setEnd(billEndDate); +// String count = "1"; +// if (null != fees.getCalcuteUnit() && fees.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { +// count = rentArea; +// } +// vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, count,true,null,null,null,null)); +// vo.setReceiveDate(WxRentContractHelper.getReceiveDate(null, billStartDate, billEndDate, payPeriodRate,adjustPeriod, receivePeriod, dateType).getStartDate()); +// vo.setFeeStandards(fees); +// +// if(null != fees.getIsDespoit() && fees.getIsDespoit().intValue() == EnumYesOrNo.YES.getCode().intValue()) { +// vo.setDeposit(true); +// }else { +// vo.setDeposit(false); +// } +// retList.add(vo); +// } +// }else { +// if (fees.getFixedPrice().intValue() == EnumYesOrNo.NO.getCode().intValue()) { +// vo.setFeeStandards(fees); +// retList.add(vo); +// } +// } +// } +// return retList; +// } +// +// private static boolean isFirstDay(Date date){ +// int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); +// if(dateInt == 1){ +// return true; +// } +// return false; +// } - //查询月账单需要支付的金额 - public static String getNeedPayMoney(List freeDays,WxRentContract wxRentContract,String price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ - String needpay; - if (null == wxRentContract.getDecimalSize()) { - wxRentContract.setDecimalSize(Constant.default_short_decimal_size); - } - EnumRentDayPriceCalcute priceCalcute = EnumRentDayPriceCalcute.getEnum(wxRentContract.getDayPriceCalcute()); - - //按日 - if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ - BigDecimal priceD = new BigDecimal(price); - - String needpayD = WxRentContractHelper.getNeedPay(freeDays,Constant.default_long_decimal_size,priceD,startDate,endDate,priceCalcute,wxRentContract.getMonthAverageDays()); - //取整 - //needpay = new Double(needpayD).longValue(); - //四舍五入 - needpay = new BigDecimal(needpayD).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); - }else{ - BigDecimal priceD = new BigDecimal(price); - //年 除12 - if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ - priceD = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,RoundingMode.HALF_UP).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP); - } - - //生成金额直接计算 - if(!saveDb){ - //needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue(); - needpay = new BigDecimal(getMonthNeedPay(freeDays,Constant.default_long_decimal_size,priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays())).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); - return needpay; - } - - //判断是否满足整月 - needpay = new BigDecimal(getMonthNeedPay(freeDays,Constant.default_long_decimal_size,priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays())) - .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); - } - return needpay; - } - - //其他标准计费项 - public static List getStandardsBillList(Integer decimalSize,List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed, - String rentArea,Integer payPeriodRate,Integer adjustPeriod,Integer receivePeriod,Integer dateType) { - if (null == feesStandarsList || feesStandarsList.size() <= 0 ) { - return null; - } - List retList = new ArrayList(); - for (int i = 0 ; i < feesStandarsList.size() ; i ++) { - WxBillFeesStandardsListVo vo = new WxBillFeesStandardsListVo(); - WxEnergyFees fees = feesStandarsList.get(i); - vo.setBillName(fees.getName()); - //如果是一次性的,账单只有一个 - if (isFixed) { - if (fees.getFixedPrice().intValue() == EnumYesOrNo.YES.getCode().intValue() && null != billStartDate && null != billEndDate) { - vo.setStart(billStartDate); - vo.setEnd(billEndDate); - String count = "1"; - if (null != fees.getCalcuteUnit() && fees.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { - count = rentArea; - } - vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, count,true,null,null,null,null)); - vo.setReceiveDate(WxRentContractHelper.getReceiveDate(null, billStartDate, billEndDate, payPeriodRate,adjustPeriod, receivePeriod, dateType).getStartDate()); - vo.setFeeStandards(fees); - - if(null != fees.getIsDespoit() && fees.getIsDespoit().intValue() == EnumYesOrNo.YES.getCode().intValue()) { - vo.setDeposit(true); - }else { - vo.setDeposit(false); - } - retList.add(vo); - } - }else { - if (fees.getFixedPrice().intValue() == EnumYesOrNo.NO.getCode().intValue()) { - vo.setFeeStandards(fees); - retList.add(vo); - } - } - } - return retList; - } - - private static boolean isFirstDay(Date date){ - int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); - if(dateInt == 1){ - return true; - } - return false; - } - - /** - * 按月计租 根据每月的日期总数计算needpay - * @param monthPrice - * @param start - * @param end - * @return - */ - public static String getMonthNeedPay(List freeDays,Integer decimalSize,BigDecimal price,Date start,Date end,int dayType,int receivePeriod,Integer dayPriceCalcute,Integer monthAvageDays){ - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); - SimpleDateFormat sdD = new SimpleDateFormat("d"); - BigDecimal total = new BigDecimal(0); - int[] diff; - - //同一天 - if(sd.format(start).equals(sd.format(end))){ - List validDays = getValidDays(start,end,freeDays); - if (null == validDays || validDays.size() <= 0 ) { - return "0"; - } - if (validDays.contains(start)) { - int dayCount = getRealDays(dayPriceCalcute, monthAvageDays, start); - return price.divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP).toPlainString(); - }else { - return "0"; - } - } - - //同月 - if(sdM.format(start).equals(sdM.format(end))){ - List validDays = getValidDays(start,end,freeDays); - if (null == validDays || validDays.size() <= 0 ) { - return "0"; - } - NeedPayDTO np = getCurrentMonthPay(start, end, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); - return np.getMoney().toPlainString(); - } - - //正好是一个周期开始 - boolean isPeriodStart = false; - //如果是按自然季度,如果start不是1号,则也不是一个周期 - if (EnumContractReceivePeriodUnit.QUARTER.getCode().intValue() == dayType) { - String startday = sdD.format(start); - if ("1".equals(startday)) { - isPeriodStart = true; - } - }else { - isPeriodStart = true; - } - if (isPeriodStart) { - Calendar instance = Calendar.getInstance(); - instance.setTime(start); - instance = EnumContractReceivePeriodUnit.getAfterCalendarDay(instance, receivePeriod, dayType); - if(sd.format(instance.getTime()).equals(sd.format(end))){ - List validDays = getValidDays(start,end,freeDays); - if (null == validDays || validDays.size() <= 0 ) { - return "0"; - } - //如果该周期内是全部有效的,则用月份*金额 - int allDays = DateUtils.daysBetween(start,end)+1; - boolean isFull = false; - if (allDays == validDays.size()) { - isFull = true; - } - //不是一个月的。但是按整月算的 - int months = getMonths(sdM.format(start)+"-01",sdM.format(DateUtils.getDaySet(end,Calendar.DATE,1))+"-01"); - if (isFull) { - return price.multiply(new BigDecimal(months)).toPlainString(); - } - //计费每个周期开始时间 - Calendar periodStart = Calendar.getInstance(); - periodStart.setTime(start); - for (int i = 0 ; i < months; i++) { - //每个计费1个月结束时间,可能是跨月的 - Date periodEnd = EnumContractReceivePeriodUnit.getAfterCalendarDay(periodStart, i+1, EnumContractReceivePeriodUnit.MONTH.getCode()).getTime(); - - //当前开始时间到当前月底 - Date currentMonthEnd = DateUtils.getLastDayForMonth(start); - NeedPayDTO np = getCurrentMonthPay(start, currentMonthEnd, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); - total = total.add(np.getMoney()); - - if(periodEnd.after(currentMonthEnd)) { - start = DateUtils.getDaySet(currentMonthEnd,Calendar.DATE,1); - NeedPayDTO lnp = getCurrentMonthPay(start, periodEnd, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); - total = total.add(lnp.getMoney()); - }else { - start = DateUtils.getDaySet(currentMonthEnd,Calendar.DATE,1); - periodStart.setTime(start); - } - - } - return total.toPlainString(); - } - } - - //开始到这个月底 - Date lastMonthDay = DateUtils.getLastDayForMonth(start); - List currValidDays = getValidDays(start,lastMonthDay,freeDays); - if (null == currValidDays || currValidDays.size() <= 0 ) { - }else { - NeedPayDTO np = getCurrentMonthPay(start, lastMonthDay, price, decimalSize, currValidDays, dayPriceCalcute, monthAvageDays); - total = total.add(np.getMoney()); - System.out.println("首1月>>>>"+DateUtils.date2String(start)+">>>"+DateUtils.date2String(lastMonthDay)+">>>>"+total.toPlainString()); - } - - //中间月份 - Date newStartDate = DateUtils.getDaySet(lastMonthDay,Calendar.SECOND,1); - int months = getMonths(sdM.format(newStartDate)+"-01",sdM.format(end)+"-01"); - for (int i = 0 ; i < months; i++) { - Date currentMonthEnd = DateUtils.getLastDayForMonth(newStartDate); - List _validDays = getValidDays(newStartDate,currentMonthEnd,freeDays); - if (null == _validDays ||_validDays.size() <= 0 ) { - }else { - NeedPayDTO _np = getCurrentMonthPay(newStartDate, currentMonthEnd, price, decimalSize, _validDays, dayPriceCalcute, monthAvageDays); - System.out.println(i+2+"月>>>>"+DateUtils.date2String(newStartDate)+">>>>"+DateUtils.date2String(currentMonthEnd)+">>>>"+_np.getMoney().toPlainString()); - newStartDate = DateUtils.getDaySet(currentMonthEnd,Calendar.SECOND,1); - total = total.add(_np.getMoney()); - } - } - - //最后一个月 - if (newStartDate.before(end)) { - List lastValidDays = getValidDays(newStartDate,end,freeDays); - if (null == lastValidDays || lastValidDays.size() <= 0 ) { - }else { - NeedPayDTO enp = getCurrentMonthPay(newStartDate, end, price, decimalSize, lastValidDays, dayPriceCalcute, monthAvageDays); - total = total.add(enp.getMoney()); - System.out.println("末月>>>>"+DateUtils.date2String(newStartDate)+">>>"+DateUtils.date2String(end)+">>>>"+enp.getMoney().toPlainString()); - } - } - return total.toPlainString(); - } +// /** +// * 按月计租 根据每月的日期总数计算needpay +// * @param monthPrice +// * @param start +// * @param end +// * @return +// */ +// public static String getMonthNeedPay(List freeDays,Integer decimalSize,BigDecimal price,Date start,Date end,int dayType,int receivePeriod,Integer dayPriceCalcute,Integer monthAvageDays){ +// SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); +// SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); +// SimpleDateFormat sdD = new SimpleDateFormat("d"); +// BigDecimal total = new BigDecimal(0); +// int[] diff; +// +// //同一天 +// if(sd.format(start).equals(sd.format(end))){ +// List validDays = getValidDays(start,end,freeDays); +// if (null == validDays || validDays.size() <= 0 ) { +// return "0"; +// } +// if (validDays.contains(start)) { +// int dayCount = getRealDays(dayPriceCalcute, monthAvageDays, start); +// return price.divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP).toPlainString(); +// }else { +// return "0"; +// } +// } +// +// //同月 +// if(sdM.format(start).equals(sdM.format(end))){ +// List validDays = getValidDays(start,end,freeDays); +// if (null == validDays || validDays.size() <= 0 ) { +// return "0"; +// } +// NeedPayDTO np = getCurrentMonthPay(start, end, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); +// return np.getMoney().toPlainString(); +// } +// +// //正好是一个周期开始 +// boolean isPeriodStart = false; +// //如果是按自然季度,如果start不是1号,则也不是一个周期 +// if (EnumContractReceivePeriodUnit.QUARTER.getCode().intValue() == dayType) { +// String startday = sdD.format(start); +// if ("1".equals(startday)) { +// isPeriodStart = true; +// } +// }else { +// isPeriodStart = true; +// } +// if (isPeriodStart) { +// Calendar instance = Calendar.getInstance(); +// instance.setTime(start); +// instance = EnumContractReceivePeriodUnit.getAfterCalendarDay(instance, receivePeriod, dayType); +// if(sd.format(instance.getTime()).equals(sd.format(end))){ +// List validDays = getValidDays(start,end,freeDays); +// if (null == validDays || validDays.size() <= 0 ) { +// return "0"; +// } +// //如果该周期内是全部有效的,则用月份*金额 +// int allDays = DateUtils.daysBetween(start,end)+1; +// boolean isFull = false; +// if (allDays == validDays.size()) { +// isFull = true; +// } +// //不是一个月的。但是按整月算的 +// int months = getMonths(sdM.format(start)+"-01",sdM.format(DateUtils.getDaySet(end,Calendar.DATE,1))+"-01"); +// if (isFull) { +// return price.multiply(new BigDecimal(months)).toPlainString(); +// } +// //计费每个周期开始时间 +// Calendar periodStart = Calendar.getInstance(); +// periodStart.setTime(start); +// for (int i = 0 ; i < months; i++) { +// //每个计费1个月结束时间,可能是跨月的 +// Date periodEnd = EnumContractReceivePeriodUnit.getAfterCalendarDay(periodStart, i+1, EnumContractReceivePeriodUnit.MONTH.getCode()).getTime(); +// +// //当前开始时间到当前月底 +// Date currentMonthEnd = DateUtils.getLastDayForMonth(start); +// NeedPayDTO np = getCurrentMonthPay(start, currentMonthEnd, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); +// total = total.add(np.getMoney()); +// +// if(periodEnd.after(currentMonthEnd)) { +// start = DateUtils.getDaySet(currentMonthEnd,Calendar.DATE,1); +// NeedPayDTO lnp = getCurrentMonthPay(start, periodEnd, price, decimalSize, validDays, dayPriceCalcute, monthAvageDays); +// total = total.add(lnp.getMoney()); +// }else { +// start = DateUtils.getDaySet(currentMonthEnd,Calendar.DATE,1); +// periodStart.setTime(start); +// } +// +// } +// return total.toPlainString(); +// } +// } +// +// //开始到这个月底 +// Date lastMonthDay = DateUtils.getLastDayForMonth(start); +// List currValidDays = getValidDays(start,lastMonthDay,freeDays); +// if (null == currValidDays || currValidDays.size() <= 0 ) { +// }else { +// NeedPayDTO np = getCurrentMonthPay(start, lastMonthDay, price, decimalSize, currValidDays, dayPriceCalcute, monthAvageDays); +// total = total.add(np.getMoney()); +// System.out.println("首1月>>>>"+DateUtils.date2String(start)+">>>"+DateUtils.date2String(lastMonthDay)+">>>>"+total.toPlainString()); +// } +// +// //中间月份 +// Date newStartDate = DateUtils.getDaySet(lastMonthDay,Calendar.SECOND,1); +// int months = getMonths(sdM.format(newStartDate)+"-01",sdM.format(end)+"-01"); +// for (int i = 0 ; i < months; i++) { +// Date currentMonthEnd = DateUtils.getLastDayForMonth(newStartDate); +// List _validDays = getValidDays(newStartDate,currentMonthEnd,freeDays); +// if (null == _validDays ||_validDays.size() <= 0 ) { +// }else { +// NeedPayDTO _np = getCurrentMonthPay(newStartDate, currentMonthEnd, price, decimalSize, _validDays, dayPriceCalcute, monthAvageDays); +// System.out.println(i+2+"月>>>>"+DateUtils.date2String(newStartDate)+">>>>"+DateUtils.date2String(currentMonthEnd)+">>>>"+_np.getMoney().toPlainString()); +// newStartDate = DateUtils.getDaySet(currentMonthEnd,Calendar.SECOND,1); +// total = total.add(_np.getMoney()); +// } +// } +// +// //最后一个月 +// if (newStartDate.before(end)) { +// List lastValidDays = getValidDays(newStartDate,end,freeDays); +// if (null == lastValidDays || lastValidDays.size() <= 0 ) { +// }else { +// NeedPayDTO enp = getCurrentMonthPay(newStartDate, end, price, decimalSize, lastValidDays, dayPriceCalcute, monthAvageDays); +// total = total.add(enp.getMoney()); +// System.out.println("末月>>>>"+DateUtils.date2String(newStartDate)+">>>"+DateUtils.date2String(end)+">>>>"+enp.getMoney().toPlainString()); +// } +// } +// return total.toPlainString(); +// } public static List getValidDays(Date start,Date end,List freeDays) { List allDays = DateUtils.getAllDays(start, end); @@ -684,49 +634,49 @@ public class WxRentContractHelper { return validDays; } - //查询当前月内的金额 - private static NeedPayDTO getCurrentMonthPay(Date start,Date end, BigDecimal priceMonth,Integer decimalSize,List validDays,Integer dayPriceCalcute,Integer monthAvageDays) { - NeedPayDTO np = new NeedPayDTO(); - //当月实际天数 - int md = DateUtils.getMonthDayCount(start);; - //在有效的时间里面有多少天 - int ms = getDays(start,end,validDays); - - //计算天数 - int dayCount = getRealDays(dayPriceCalcute, monthAvageDays, start); - int sed = DateUtils.daysBetween(start,end)+1; - - //满月 - if (md == sed) { - //如果有免租的,则按天算 - if (ms == md) { - np.setFullMonth(true); - np.setMoney(priceMonth); - }else { - np.setFullMonth(false); - np.setMoney(new BigDecimal(ms).multiply(priceMonth).divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP)); - } - }else { - np.setFullMonth(false); - np.setMoney(new BigDecimal(ms).multiply(priceMonth).divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP)); - } - return np; - } +// //查询当前月内的金额 +// private static NeedPayDTO getCurrentMonthPay(Date start,Date end, BigDecimal priceMonth,Integer decimalSize,List validDays,Integer dayPriceCalcute,Integer monthAvageDays) { +// NeedPayDTO np = new NeedPayDTO(); +// //当月实际天数 +// int md = DateUtils.getMonthDayCount(start);; +// //在有效的时间里面有多少天 +// int ms = getDays(start,end,validDays); +// +// //计算天数 +// int dayCount = getRealDays(dayPriceCalcute, monthAvageDays, start); +// int sed = DateUtils.daysBetween(start,end)+1; +// +// //满月 +// if (md == sed) { +// //如果有免租的,则按天算 +// if (ms == md) { +// np.setFullMonth(true); +// np.setMoney(priceMonth); +// }else { +// np.setFullMonth(false); +// np.setMoney(new BigDecimal(ms).multiply(priceMonth).divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP)); +// } +// }else { +// np.setFullMonth(false); +// np.setMoney(new BigDecimal(ms).multiply(priceMonth).divide(new BigDecimal(dayCount),decimalSize,BigDecimal.ROUND_HALF_UP)); +// } +// return np; +// } - private static int getRealDays(Integer dayPriceCalcute,Integer monthAvageDays,Date start) { - //是不是按实际天数来计算 - boolean isRealDays = true; - if (dayPriceCalcute.intValue() == EnumRentDayPriceCalcute.REAL_DAYS.getCode().intValue()) { - }else { - isRealDays = false; - } - if (isRealDays) { - return DateUtils.getMonthDayCount(start); - }else { - return monthAvageDays; - } - - } +// private static int getRealDays(Integer dayPriceCalcute,Integer monthAvageDays,Date start) { +// //是不是按实际天数来计算 +// boolean isRealDays = true; +// if (dayPriceCalcute.intValue() == EnumRentDayPriceCalcute.REAL_DAYS.getCode().intValue()) { +// }else { +// isRealDays = false; +// } +// if (isRealDays) { +// return DateUtils.getMonthDayCount(start); +// }else { +// return monthAvageDays; +// } +// +// } public static int getMonths(String startStr,String endStr){ DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java index 281b75496..0a7a2f9d8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java @@ -12,9 +12,8 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxContractCustomers; import com.iformall.domain.po.WxContractShop; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; 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; @@ -25,7 +24,6 @@ import com.iformall.domain.po.WxShop; import com.iformall.domain.po.WxShopUsers; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.BillTimeVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillExtraCreateFrom; import com.iformall.enums.EnumContractCustomersStatus; import com.iformall.enums.EnumFeesShopTimeType; @@ -241,12 +239,6 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { record.setUpdatetime(new Date()); record.setUpdateBy(user.getId()); record.setUpdateByName(user.getName()); - if (StringUtils.isEmpty(record.getPrice())) { - record.setPrice("0"); - } - if (StringUtils.isEmpty(record.getDeposit())) { - record.setDeposit("0"); - } List shopList = record.shopIdsByRentInfo(); setShops(record,shopList); //关联客户 @@ -525,13 +517,13 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { if (null == list || list.size() <= 0 ) { return null; } - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(unDeposit); fq.setIsDel(EnumYesOrNo.NO.getCode()); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < list.size() ; i ++) { WxRentContractAgileUnDeposit ud = list.get(i); - WxEnergyFees fees = feesMap.get(ud.getFeesId()); + WxFinanceFees fees = feesMap.get(ud.getFeesId()); if (null != fees) { ud.setFeesName(fees.getName()); } @@ -553,9 +545,9 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { if (null == depositList || depositList.size() <= 0 ) { return; } - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(wxRentContract); - Map typeMap = wxEnergyService.getFeesMap(fq); + Map typeMap = wxEnergyService.getFeesMap(fq); //根据关联的店铺面积来分金额 Map shopAreaRateMap = wxRentContract.getRentShopArea(); @@ -574,7 +566,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { final IdWorker idWorker = IdWorker.get(); for (int i = 0 ; i < depositList.size(); i++) { WxRentContractAgileDeposit deposit = depositList.get(i); - WxEnergyFees fees = typeMap.get(deposit.getFeesId()); + WxFinanceFees fees = typeMap.get(deposit.getFeesId()); List depositShopIdList = deposit.getShopIdList(); for (int j = 0 ; j < depositShopIdList.size(); j++ ) { @@ -598,7 +590,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { wxBillDeposit.setId(idWorker.nextId()); wxBillDeposit.updateTenantInfo(wxRentContract); wxBillDeposit.setRentContractId(wxRentContract.getId()); - wxBillDeposit.setBillType(fees.getBillType()); + //wxBillDeposit.setBillType(fees.getBillType()); wxBillDeposit.setIsPreview(EnumYesOrNo.YES.getCode()); wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); wxBillDeposit.setPriceDetail(fees.getName()); @@ -649,7 +641,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { if (null == unDeposit.getItems() || unDeposit.getItems().size() <= 0 ) { return; } - WxEnergyFees fees = wxEnergyService.getFeesById(unDeposit.getFeesId(), unDeposit.getTenantId()); + WxFinanceFees fees = wxEnergyService.getFeesById(unDeposit.getFeesId(), unDeposit.getTenantId()); EnumFeesShopTimeType creatRule = EnumFeesShopTimeType.getEnum(unDeposit.getFeesCreateRule()); EnumRentContractAgilTimeUnit timeUnit = EnumRentContractAgilTimeUnit.getEnum(unDeposit.getTimeUnit()); WxRentContract contract = wxRentContractMapper.selectById(unDeposit.getRentContractId()); @@ -705,7 +697,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { } private List generateUnDepositBill(List shopIdList,Map shopAreaMap,Map shopUserMap,WxRentContract contract, - final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit,WxEnergyFees fees,Date start,Date end,Date receiveDate,String needpay, + final IdWorker idWorker,WxRentContractAgileUnDeposit unDeposit,WxFinanceFees fees,Date start,Date end,Date receiveDate,String needpay, WxRentContractAgileUnDepositItem item,MallUserInfo user) { List billList = new ArrayList(); //如果是按合同,则按照铺来分 @@ -740,7 +732,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { return billList; } - private WxAllBill buildUnDepositBill(TenantEntity tenantEntity,final IdWorker idWorker,Long rentContractId,WxEnergyFees fees, + private WxAllBill buildUnDepositBill(TenantEntity tenantEntity,final IdWorker idWorker,Long rentContractId,WxFinanceFees fees, Long shopId,String cusName,Date start,Date end,Date receiveDate,String needpay,String rentArea,MallUserInfo user) { WxAllBill wxBillRent = new WxAllBill(); wxBillRent.setIsPreview(EnumYesOrNo.YES.getCode()); @@ -748,7 +740,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { wxBillRent.setRentContractId(rentContractId); wxBillRent.setRentContractAgileFeesType(EnumRentContractAgileFeesType.UN_DEPOSIT.getCode()); wxBillRent.setEnergyFeesId(fees.getId()); - wxBillRent.setBillType(fees.getBillType()); + //wxBillRent.setBillType(fees.getBillType()); wxBillRent.setPay("0"); wxBillRent.setStarttime(start); wxBillRent.setEndtime(end); @@ -926,9 +918,9 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { rentContract.setStatus(EnumRentContractStatus.DRAFT.getCode()); rentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); rentContract.setEndContractTime(null); - rentContract.setFirstBillDateStart(null); - rentContract.setFirstBillDateEnd(null); - rentContract.setFirstBillReceiveDate(null); + //rentContract.setFirstBillDateStart(null); + //rentContract.setFirstBillDateEnd(null); + //rentContract.setFirstBillReceiveDate(null); int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); rentContract.setLease(array[0]); //rentContract.setAdjustRatio(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java index 1a6a11548..c237858d3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java @@ -13,10 +13,9 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillAction; import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxShop; import com.iformall.domain.po.WxShopUsers; @@ -27,7 +26,6 @@ import com.iformall.domain.vo.WxBillHotNotify; import com.iformall.domain.vo.WxBillNotify; import com.iformall.domain.vo.WxBillSum; import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillStatus; import com.iformall.enums.EnumRentShopType; import com.iformall.enums.EnumShopUsersStatus; @@ -199,9 +197,9 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill shopUserMap = wxShopService.getShopUserMap(suq); } - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < page.getList().size() ; i ++) { WxAllBill e = page.getList().get(i); if (null != e.getShopId()) { @@ -224,7 +222,7 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill } } if (null != feesMap) { - WxEnergyFees f = feesMap.get(e.getEnergyFeesId()); + WxFinanceFees f = feesMap.get(e.getEnergyFeesId()); if (null != f) { e.setEnergyFeesName(f.getName()); } @@ -245,13 +243,13 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill updateQueryParam(wxBillRent); List list = wxAllBillMapper.getBillHotNotify(wxBillRent); if (null != list && list.size() > 0 ){ - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(wxBillRent); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < list.size() ; i ++) { WxBillHotNotify hn = list.get(i); if (null != feesMap) { - WxEnergyFees fees = feesMap.get(hn.getEnergyFeesId()); + WxFinanceFees fees = feesMap.get(hn.getEnergyFeesId()); if (null != fees) { hn.setFeesName(fees.getName()); } @@ -534,7 +532,7 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill WxBillAction wxBillAction = new WxBillAction(); wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); + //wxBillAction.setBillType(b.getBillType()); wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); //wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); wxBillAction.setRemark(wxShop.getBillCompleteRemark()); @@ -688,47 +686,6 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill } } - @Override - public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) { - WxAllBill brDel = new WxAllBill(); - brDel.setPropertyContractId(propertyContract.getId()); - brDel.setIsPreview(EnumYesOrNo.YES.getCode()); - brDel.updateTenantInfo(propertyContract); - wxAllBillMapper.deletePreviewBill(brDel); - - brDel.setShopEndtime(propertyContract.getEndContractTime()); - wxAllBillMapper.deleteNoNeedPayBill(brDel); - - WxAllBill br = new WxAllBill(); - br.setPropertyContractId(propertyContract.getId()); - //br.setIsPreview(EnumYesOrNo.NO.getCode()); - br.updateTenantInfo(propertyContract); - List brList = wxAllBillMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxAllBill brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize() ,propertyContract.getEndContractTime(), brent, action); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxAllBill rbrent = realRentList.get(i); - rbrent.setEndtime(propertyContract.getEndContractTime()); - wxAllBillMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } @Override public void stopMerchantBills(WxMerchant wxMerchant, MallUserInfo userInfo) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java index cfd748da8..840634729 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java @@ -61,7 +61,7 @@ public class WxBillActionServiceImpl implements WxBillActionService { WxBillAction wxBillAction = new WxBillAction(); wxBillAction.setId(idWorker.nextId()); wxBillAction.setBillId(action.getBillId()); - wxBillAction.setBillType(action.getBillType()); + //wxBillAction.setBillType(action.getBillType()); wxBillAction.setOldMoney(action.getOldMoney()); wxBillAction.setNewMoney(action.getNewMoney()); wxBillAction.setDetails(action.getDetails()); @@ -87,12 +87,14 @@ public class WxBillActionServiceImpl implements WxBillActionService { @Override public List findJianMian(WxBillAction record) { - return wxBillActionMapper.findJianMian(record); + //return wxBillActionMapper.findJianMian(record); + return null; } @Override public List findBad(WxBillAction record) { - return wxBillActionMapper.findBad(record); + //return wxBillActionMapper.findBad(record); + return null; } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillBaseService.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillBaseService.java index 2c2dc7544..1ad0e3bf8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillBaseService.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillBaseService.java @@ -27,7 +27,7 @@ public class WxBillBaseService{ protected void addBillAction(EnumBillAction billAction, Integer billType,Long billId, String oldMoney, String newMoney,String setoff,Date payDate,Long payWayId,String payWayName,String remark, EnumBillStatus oldStatus,EnumBillStatus newStatus,MallUserInfo mallUserInfo) { WxBillAction wxBillAction = new WxBillAction(); wxBillAction.setBillId(billId); - wxBillAction.setBillType(billType); + //wxBillAction.setBillType(billType); wxBillAction.setOldMoney(oldMoney); wxBillAction.setNewMoney(newMoney); wxBillAction.setDetails(billAction.getDescription(oldMoney, newMoney,setoff,payWayName,oldStatus,newStatus)); @@ -42,7 +42,7 @@ public class WxBillBaseService{ protected void addBillAction(EnumBillAction billAction, Integer billType,Long billId, String oldMoney, String newMoney,String setoff,Date payDate,Long payWayId,String payWayName,String remark,EnumBillStatus oldStatus,EnumBillStatus newStatus, WxMerchantBUser bUser) { WxBillAction wxBillAction = new WxBillAction(); wxBillAction.setBillId(billId); - wxBillAction.setBillType(billType); + //wxBillAction.setBillType(billType); wxBillAction.setOldMoney(oldMoney); wxBillAction.setNewMoney(newMoney); wxBillAction.setDetails(billAction.getDescription(oldMoney, newMoney,setoff,payWayName,oldStatus,newStatus)); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index 524952f8c..4ad0009d1 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -5,13 +5,11 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.WxBusiness; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxScoreRules; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.*; import com.iformall.mapper.WxBusinessMapper; -import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractMapper; import com.iformall.service.WxBusinessService; import com.iformall.service.WxMallService; @@ -38,8 +36,6 @@ public class WxBusinessServiceImpl implements WxBusinessService { WxBusinessMapper wxBusinessMapper; @Autowired private WxRentContractMapper wxRentContractMapper; - @Autowired - private WxPropertyContractMapper wxPropertyContractMapper; @Autowired private WxMallService wxMallService; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java index ed8646e58..9d483bede 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java @@ -14,9 +14,9 @@ import com.iformall.domain.dto.FloorBuildingIdDTO; import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxShopBillVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumEnergyMeterPhysicsType; import com.iformall.enums.EnumEnergyMeterShopFloorType; +import com.iformall.enums.EnumFeesType; import com.iformall.enums.EnumFinanceCashierType; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; @@ -67,11 +67,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { @Autowired WxEnergyFeesTimeShopMapper wxEnergyFeesTimeShopMapper; @Autowired - WxEnergyFeesMapper wxEnergyFeesMapper; + WxFinanceFeesMapper wxEnergyFeesMapper; @Autowired - WxEnergyFeesShopMapper wxEnergyFeesShopMapper; + WxFeesCalcuteShopMapper wxEnergyFeesShopMapper; @Autowired - WxEnergyFeesSetoffMapper wxEnergyFeesSetoffMapper; + WxFinanceFeesSetoffMapper wxEnergyFeesSetoffMapper; @Autowired WxEnergyReadingCalcuteMapper wxEnergyReadingCalcuteMapper; @Autowired @@ -576,21 +576,21 @@ public class WxEnergyServiceImpl implements WxEnergyService { @Override - public PageInfo feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize,boolean isSetOff) { - if (null == record.getCashierType()) { - record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); - } - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesMapper.findList(record)); + public PageInfo feesListAsPage(WxFinanceFees record, Integer pageIndex, Integer pageSize,boolean isSetOff) { +// if (null == record.getCashierType()) { +// record.setCashierType(EnumFinanceCashierType.RECEIVE.getCode()); +// } + PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesMapper.findList(record)); //如果是预充费用,还需要查询可冲抵科目 if (isSetOff) { if (null != page && null != page.getList()) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map feesMap = this.getFeesMap(fq); + Map feesMap = this.getFeesMap(fq); for (int i = 0 ; i < page.getList().size() ; i++) { - WxEnergyFees at = page.getList().get(i); + WxFinanceFees at = page.getList().get(i); - WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); + WxFinanceFeesSetoff tf = new WxFinanceFeesSetoff(); tf.updateTenantInfo(at); tf.setAdvanceFeesId(at.getId()); at.setFeesIds(wxEnergyFeesSetoffMapper.findFeesIdList(tf)); @@ -602,25 +602,25 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public void saveOrUpdateFees(WxEnergyFees record) { + public void saveOrUpdateFees(WxFinanceFees record) { Date date = new Date(); final IdWorker idWorker = IdWorker.get(); if (record.getId() == null) { record.setId(idWorker.nextId()); record.setCreateTime(date); record.setUpdateTime(date); - record.setIsSystem(EnumYesOrNo.NO.getCode()); + //record.setIsSystem(EnumYesOrNo.NO.getCode()); try { wxEnergyFeesMapper.insert(record); } catch (Exception e) { logger.error("保存租赁账单失败,e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); } - if (record.getBillType().intValue() == EnumBillAllType.ADVANCE.getCode().intValue()) { + if (record.getFeesType().intValue() == EnumFeesType.ADVANCE.getCode().intValue()) { if (null != record.getFeesIds()) { for (int i = 0 ; i < record.getFeesIds().size(); i++) { Long feeid = record.getFeesIds().get(i); - WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); + WxFinanceFeesSetoff tf = new WxFinanceFeesSetoff(); tf.updateTenantInfo(record); tf.setId(idWorker.nextId()); tf.setAdvanceFeesId(record.getId()); @@ -632,71 +632,59 @@ public class WxEnergyServiceImpl implements WxEnergyService { } } } else { - WxEnergyFees fees = this.getFeesById(record.getId(),record.getTenantId()); + WxFinanceFees fees = this.getFeesById(record.getId(),record.getTenantId()); if (null == fees) { throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); } - if (fees.getIsSystem().intValue() == EnumYesOrNo.YES.getCode().intValue() && StringUtils.isNotBlank(record.getTaxRate())) { - WxEnergyFees updatefees = new WxEnergyFees(); - updatefees.updateTenantInfo(record); - updatefees.setId(fees.getId()); - updatefees.setTaxRate(record.getTaxRate()); - updatefees.setUpdateTime(date); - wxEnergyFeesMapper.updateById(updatefees);; - }else { - record.setUpdateTime(date); - wxEnergyFeesMapper.updateById(record); - - //如果是预充的,则需处理管理科目 - if (fees.getBillType().intValue() == EnumBillAllType.ADVANCE.getCode().intValue()) { - //先删掉之前的关联 - WxEnergyFeesSetoff fd = new WxEnergyFeesSetoff(); - fd.updateTenantInfo(record); - fd.setAdvanceFeesId(record.getId()); - wxEnergyFeesSetoffMapper.deleteByAdvanceId(fd); - - if (null != record.getFeesIds()) { - for (int i = 0 ; i < record.getFeesIds().size(); i++) { - Long feeid = record.getFeesIds().get(i); - WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); - tf.updateTenantInfo(record); - tf.setId(idWorker.nextId()); - tf.setAdvanceFeesId(record.getId()); - tf.setFeesId(feeid); - tf.setCreateTime(new Date()); - tf.setUpdateTime(new Date()); - wxEnergyFeesSetoffMapper.insert(tf); - } - } - } + record.setUpdateTime(date); + wxEnergyFeesMapper.updateById(record); + + //如果是预充的,则需处理管理科目 + if (fees.getFeesType().intValue() == EnumFeesType.ADVANCE.getCode().intValue()) { + //先删掉之前的关联 + WxFinanceFeesSetoff fd = new WxFinanceFeesSetoff(); + fd.updateTenantInfo(record); + fd.setAdvanceFeesId(record.getId()); + wxEnergyFeesSetoffMapper.deleteByAdvanceId(fd); + + if (null != record.getFeesIds()) { + for (int i = 0 ; i < record.getFeesIds().size(); i++) { + Long feeid = record.getFeesIds().get(i); + WxFinanceFeesSetoff tf = new WxFinanceFeesSetoff(); + tf.updateTenantInfo(record); + tf.setId(idWorker.nextId()); + tf.setAdvanceFeesId(record.getId()); + tf.setFeesId(feeid); + tf.setCreateTime(new Date()); + tf.setUpdateTime(new Date()); + wxEnergyFeesSetoffMapper.insert(tf); + } + } } } } @Override - public WxEnergyFees getFeesById(Long id,String tenantId) { + public WxFinanceFees getFeesById(Long id,String tenantId) { return wxEnergyFeesMapper.selectById(id, tenantId); } @Override - public void setFeesIsDel(WxEnergyFees record) { - WxEnergyFees fees = this.getFeesById(record.getId(),record.getTenantId()); + public void setFeesIsDel(WxFinanceFees record) { + WxFinanceFees fees = this.getFeesById(record.getId(),record.getTenantId()); if (null == fees) { throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "记录未查询到"); - } - if (fees.getIsSystem().intValue() == EnumYesOrNo.YES.getCode().intValue()) { - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "系统内置不能修改"); } wxEnergyFeesMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); } @Override - public Map getFeesMap(WxEnergyFees record) { - List list = wxEnergyFeesMapper.findList(record); + public Map getFeesMap(WxFinanceFees record) { + List list = wxEnergyFeesMapper.findList(record); if (null != list && list.size() > 0 ) { - Map retMap = new HashMap(); + Map retMap = new HashMap(); for (int i = 0 ; i> getFeesShopComponentList(WxEnergyFeesShop record) { + public List> getFeesShopComponentList(WxFeesCalcuteShop record) { WxShop shop = null; if (null != record.getId()) { - WxEnergyFeesShop data = wxEnergyFeesShopMapper.selectById(record.getId(),record.getTenantId()); + WxFeesCalcuteShop data = wxEnergyFeesShopMapper.selectById(record.getId(),record.getTenantId()); if (null != data) { shop = wxShopService.getById(data.getShopId()); } @@ -760,11 +725,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Override - public void createFeesShop(WxEnergyFeesShop record) { + public void createFeesShop(WxFeesCalcuteShop record) { //新增关联 final IdWorker idWorker = IdWorker.get(); Date date = new Date(); - WxEnergyFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); + WxFinanceFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); WxShop sq = new WxShop(); sq.updateTenantInfo(record); sq.setIds(record.getShopIds()); @@ -772,23 +737,23 @@ public class WxEnergyServiceImpl implements WxEnergyService { for (int i = 0 ; i < record.getShopIds().size(); i ++) { Long shopId = record.getShopIds().get(i); WxShop shop = shopMap.get(shopId); - if (fees.getIsPublic() == EnumYesOrNo.YES.getCode() && StringUtils.isBlank(shop.getPulicRate())) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数"); - } - WxEnergyFeesShop msf = new WxEnergyFeesShop(); +// if (fees.getIsPublic() == EnumYesOrNo.YES.getCode() && StringUtils.isBlank(shop.getPulicRate())) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺未设置公摊系数"); +// } + WxFeesCalcuteShop msf = new WxFeesCalcuteShop(); msf.updateTenantInfo(record); msf.setId(idWorker.nextId()); msf.setCreateTime(date); msf.setUpdateTime(date); msf.setShopId(shopId); - msf.setIsPublic(fees.getIsPublic()); + //msf.setIsPublic(fees.getIsPublic()); msf.setFeesId(fees.getId()); msf.setPrice(record.getPrice()); - if (fees.getIsPublic() == EnumYesOrNo.YES.getCode()) { - if (null == record.getFormulaList() || record.getFormulaList().size() <= 0 || StringUtils.isBlank(record.getFormula())) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请设置公式"); - } - } +// if (fees.getIsPublic() == EnumYesOrNo.YES.getCode()) { +// if (null == record.getFormulaList() || record.getFormulaList().size() <= 0 || StringUtils.isBlank(record.getFormula())) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请设置公式"); +// } +// } if (null != record.getFormulaContentList() && record.getFormulaContentList().size() > 0 ) { msf.setFormulaContent(JSON.toJSONString(record.getFormulaContentList())); } @@ -806,13 +771,13 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public void deleteFeesShop(WxEnergyFeesShop record) { + public void deleteFeesShop(WxFeesCalcuteShop record) { wxEnergyFeesShopMapper.deleteById(record.getId()); } @Override - public WxEnergyFeesShop getFeesShop(Long id,String tenantId) { - WxEnergyFeesShop fs = wxEnergyFeesShopMapper.selectById(id,tenantId); + public WxFeesCalcuteShop getFeesShop(Long id,String tenantId) { + WxFeesCalcuteShop fs = wxEnergyFeesShopMapper.selectById(id,tenantId); if (StringUtils.isNotBlank(fs.getFormulaContent())) { fs.setFormulaContentList(JSON.parseArray(fs.getFormulaContent(), String.class)); } @@ -823,8 +788,8 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public void updateFeesShop(WxEnergyFeesShop record) { - WxEnergyFeesShop fessShop = wxEnergyFeesShopMapper.selectById(record.getId(), record.getTenantId()); + public void updateFeesShop(WxFeesCalcuteShop record) { + WxFeesCalcuteShop fessShop = wxEnergyFeesShopMapper.selectById(record.getId(), record.getTenantId()); Date date = new Date(); record.setUpdateTime(date); if (record.getIsPublic() == EnumYesOrNo.YES.getCode()) { @@ -851,20 +816,20 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public PageInfo feesShopListAsPage(WxEnergyFeesShop record, Integer pageIndex, Integer pageSize) { - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesShopMapper.findList(record)); + public PageInfo feesShopListAsPage(WxFeesCalcuteShop record, Integer pageIndex, Integer pageSize) { + PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesShopMapper.findList(record)); if (null != page && null != page.getList() && page.getList().size() > 0 ) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); fq.setIsDel(EnumYesOrNo.NO.getCode()); - Map feesMap = this.getFeesMap(fq); + Map feesMap = this.getFeesMap(fq); Map floorMap = wxMallFloorService.getFloorMap(record); Map buildingMap = wxMallBuildingService.getBuildingMap(record); List shopIdList = new ArrayList(); for (int i = 0 ; i < page.getList().size() ; i++) { - WxEnergyFeesShop fs = page.getList().get(i); + WxFeesCalcuteShop fs = page.getList().get(i); if (null != feesMap && null != fs.getFeesId()) { - WxEnergyFees fee = feesMap.get(fs.getFeesId()); + WxFinanceFees fee = feesMap.get(fs.getFeesId()); if (null != fee) { fs.setFeesName(fee.getName()); } @@ -879,7 +844,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { shopMap = wxShopService.findShopMap(sq); } for (int i = 0 ; i < page.getList().size(); i++) { - WxEnergyFeesShop c = page.getList().get(i); + WxFeesCalcuteShop c = page.getList().get(i); if (null != shopMap && null != c.getShopId()) { WxShop s = shopMap.get(c.getShopId()); if (null != s) { @@ -898,15 +863,15 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public void exportFeesShop(WxEnergyFeesShop record, HttpServletRequest request, HttpServletResponse response) { - PageInfo page = feesShopListAsPage(record, 1, 10000); - List list = null; + public void exportFeesShop(WxFeesCalcuteShop record, HttpServletRequest request, HttpServletResponse response) { + PageInfo page = feesShopListAsPage(record, 1, 10000); + List list = null; if (null == page || null == page.getList()) { - list = new ArrayList(); + list = new ArrayList(); }else { list = page.getList(); } - excelService.exportExcel(list, null, "计算标准", WxEnergyFeesShop.class, "计算标准.xlsx", response, false); + excelService.exportExcel(list, null, "计算标准", WxFeesCalcuteShop.class, "计算标准.xlsx", response, false); } @Override @@ -916,17 +881,17 @@ public class WxEnergyServiceImpl implements WxEnergyService { // 需要验证 String[] needFields = new String[]{"ID", "科目","店铺ID", "单价"}; String[] allFields = new String[] {"ID","科目","店铺ID","店铺号","楼栋","楼层","单价","是否公摊","创建时间"}; - ExcelImportResult datalist = handleImportFile(file,WxEnergyFeesShop.class,allFields,needFields,new ReadingExcelHandler()); + ExcelImportResult datalist = handleImportFile(file,WxFeesCalcuteShop.class,allFields,needFields,new ReadingExcelHandler()); if (null == datalist) { return ; } - List successList = datalist.getList(); + List successList = datalist.getList(); if(successList.size() > 0) { boolean allSuccess = true; try { successList.parallelStream().forEach(reading -> { - WxEnergyFeesShop r = new WxEnergyFeesShop(); + WxFeesCalcuteShop r = new WxFeesCalcuteShop(); r.updateTenantInfo(user); r.setId(reading.getId()); r.setPrice(reading.getPrice()); @@ -941,12 +906,12 @@ public class WxEnergyServiceImpl implements WxEnergyService { } @Override - public List getAdvanceSetoffFeesids(WxEnergyFeesSetoff setoff) { + public List getAdvanceSetoffFeesids(WxFinanceFeesSetoff setoff) { return wxEnergyFeesSetoffMapper.findFeesIdList(setoff); } @Override - public List getFeesIdList(WxEnergyFees record) { + public List getFeesIdList(WxFinanceFees record) { return wxEnergyFeesMapper.findIdList(record); } @@ -1179,13 +1144,13 @@ public class WxEnergyServiceImpl implements WxEnergyService { Integer pageSize) { PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyReadingCalcuteMapper.findList(record)); if (null != page && null != page.getList()) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map fessMap = this.getFeesMap(fq); + Map fessMap = this.getFeesMap(fq); for (int i = 0 ; i < page.getList().size(); i++) { WxEnergyReadingCalcute c = page.getList().get(i); if (null != fessMap) { - WxEnergyFees fees = fessMap.get(c.getFeesId()); + WxFinanceFees fees = fessMap.get(c.getFeesId()); if (null != fees) { c.setFeesName(fees.getName()); c.setFeesPhysicsTypeName(null); @@ -1232,7 +1197,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { record.setShop(JSON.toJSONString(record.getShopIds())); try { wxEnergyReadingCalcuteMapper.insert(record); - WxEnergyFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); + WxFinanceFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); generateCalcuteResult(fees, record, record.getShopIds()); } catch (Exception e) { logger.error("保存租赁账单失败,e:" + e.getMessage()); @@ -1253,150 +1218,150 @@ public class WxEnergyServiceImpl implements WxEnergyService { * 如果是非能源科目数据,则从公式计算。按照费用标准的时间来设置账单的时间 * */ - public void generateCalcuteResult(WxEnergyFees fees,WxEnergyReadingCalcute record,List shopIds) { - final IdWorker idWorker = IdWorker.get(); - WxShop shq = new WxShop(); - shq.updateTenantInfo(record); - shq.setIds(shopIds); - Map shopMap = wxShopService.findShopMap(shq); - // 总共面积 - BigDecimal totalArea = new BigDecimal(0); - // 楼栋的面积 - Map buildingAreaMap = null; - //楼层 - Map floorAreaMap = null; - WxMallFloor fq = new WxMallFloor(); - fq.updateTenantInfo(record); - List floorList = wxMallFloorService.getBudingFloorList(fq, null); - if (null != floorList && floorList.size() > 0 ) { - floorAreaMap = new HashMap(); - buildingAreaMap = new HashMap(); - for (int i = 0 ; i < floorList.size() ; i ++) { - WxMallFloor floor = floorList.get(i); - if (null != floor.getOperatingArea()) { - floorAreaMap.put(floor.getId(), floor.getOperatingArea()); - BigDecimal bud = buildingAreaMap.get(floor.getBuildingId()); - if (null == bud) { - bud = new BigDecimal(0); - } - bud = bud.add(floor.getOperatingArea()); - buildingAreaMap.put(floor.getBuildingId(), bud); - totalArea = totalArea.add(floor.getOperatingArea()); - } - } - } - //查询公摊表 - Map> summaryMeterMap = null; - if (fees.getIsPublic() == EnumYesOrNo.YES.getCode()) { - WxEnergyMeter sumq = new WxEnergyMeter(); - sumq.updateTenantInfo(record); - sumq.setType(fees.getType()); - sumq.setPhysicsType(EnumEnergyMeterPhysicsType.SUMMARY.getCode()); - List sumeterList = wxEnergyMeterMapper.findList(sumq); - if (null != sumeterList && sumeterList.size() > 0 ) { - summaryMeterMap = new HashMap>(); - for (int i = 0 ; i < sumeterList.size(); i ++) { - WxEnergyMeter summaryMeter = sumeterList.get(i); - //查询总表下的子表 - WxEnergyMeterChild mcq = new WxEnergyMeterChild(); - mcq.updateTenantInfo(record); - mcq.setParentMeterId(summaryMeter.getId()); - List childMeterIds = wxEnergyMeterChildMapper.findChildMeterIdList(mcq); - if (null != childMeterIds && childMeterIds.size() > 0 ) { - summaryMeterMap.put(summaryMeter.getId(), childMeterIds); - } - } - } - } - - List resultList = new ArrayList(); - for (int i = 0 ; i < shopIds.size(); i ++) { - Long shopId= shopIds.get(i); - WxShop shop = shopMap.get(shopId); - - //查询用户表 - WxEnergyMeterShopFloor sfq = new WxEnergyMeterShopFloor(); - sfq.updateTenantInfo(record); - sfq.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); - sfq.setAliseId(shopId); - List meterList = wxEnergyMeterShopFloorMapper.findMeterIdList(sfq); - - //如果店铺已经存在了计算,则不允许重复 - WxEnergyReadingCalcuteResult crq = new WxEnergyReadingCalcuteResult(); - crq.updateTenantInfo(record); - crq.setShopId(shopId); - crq.setPeriod(record.getPeriod()); - crq.setFeesId(record.getFeesId()); - List list = wxEnergyReadingCalcuteResultMapper.findList(crq); - if (null != list && list.size() > 0 ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"科目["+fees.getName()+"]该年月已存在计算记录,不能重复计算"); - } - - //一个年月,一个店铺应该只有一个抄表周期 - WxEnergyFeesTime time = null; - if (fees.getBillType() == EnumBillAllType.DAILY.getCode()) { - - //根据店铺,所属年月去查询时间区间.根据店铺,时间区间去查对应的抄表数据,根据表来计算总和 - WxEnergyFeesTimeShop sq = new WxEnergyFeesTimeShop(); - sq.updateTenantInfo(record); - sq.setShopId(shopId); - List timeIds = wxEnergyFeesTimeShopMapper.findTimeIdList(sq); - if (null == timeIds || timeIds.size() <= 0 ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置抄表区间"); - } - - WxEnergyFeesTime tq = new WxEnergyFeesTime(); - tq.updateTenantInfo(record); - tq.setIds(timeIds); - tq.setPeriod(record.getPeriod()); - List timelist = wxEnergyFeesTimeMapper.findList(tq); - if (null == timelist || timelist.size() <= 0 ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置抄表区间"); - } - time = timelist.get(0); - } - - //根据店铺查询绑定的科目 - WxEnergyFeesShop csq = new WxEnergyFeesShop(); - csq.updateTenantInfo(record); - csq.setFeesId(fees.getId()); - csq.setShopId(shopId); - List shopFeesList = wxEnergyFeesShopMapper.findList(csq); - if (null == shopFeesList || shopFeesList.size() <= 0 ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置该科目费用标准"); - } - - //循环店铺科目, - for (int j = 0 ; j < shopFeesList.size() ; j ++) { - WxEnergyFeesShop shopfee = shopFeesList.get(j); - WxEnergyReadingCalcuteResult cs = new WxEnergyReadingCalcuteResult(); - cs.updateTenantInfo(record); - cs.setId(idWorker.nextId()); - cs.setCalcuteId(record.getId()); - cs.setShopId(shopId); - cs.setCreateTime(new Date()); - cs.setUpdateTime(new Date()); - cs.setFeesId(shopfee.getFeesId()); - cs.setFeesPrice(shopfee.getPrice()); - cs.setFeesShopId(shopfee.getId()); - StringBuffer sb = new StringBuffer(); - cs.setMoney(wxEnergyHelper.calcuteMoney(sb,totalArea,shop,time, fees, shopfee,meterList,summaryMeterMap,buildingAreaMap,floorAreaMap)); - cs.setPeriod(record.getPeriod()); - cs.setMoneyDeail(sb.toString()); - //如果是能源的,从抄表周期里面取 - if (null != time) { - cs.setBeginTime(time.getStartTime()); - cs.setEndTime(time.getEndTime()); - }else { - cs.setBeginTime(shopfee.getBeginTime()); - cs.setEndTime(shopfee.getEndTime()); - } - resultList.add(cs); - } - } - if (resultList.size() > 0 ) { - wxEnergyReadingCalcuteResultMapper.insertResults(record.getTenantId(),resultList); - } + public void generateCalcuteResult(WxFinanceFees fees,WxEnergyReadingCalcute record,List shopIds) { +// final IdWorker idWorker = IdWorker.get(); +// WxShop shq = new WxShop(); +// shq.updateTenantInfo(record); +// shq.setIds(shopIds); +// Map shopMap = wxShopService.findShopMap(shq); +// // 总共面积 +// BigDecimal totalArea = new BigDecimal(0); +// // 楼栋的面积 +// Map buildingAreaMap = null; +// //楼层 +// Map floorAreaMap = null; +// WxMallFloor fq = new WxMallFloor(); +// fq.updateTenantInfo(record); +// List floorList = wxMallFloorService.getBudingFloorList(fq, null); +// if (null != floorList && floorList.size() > 0 ) { +// floorAreaMap = new HashMap(); +// buildingAreaMap = new HashMap(); +// for (int i = 0 ; i < floorList.size() ; i ++) { +// WxMallFloor floor = floorList.get(i); +// if (null != floor.getOperatingArea()) { +// floorAreaMap.put(floor.getId(), floor.getOperatingArea()); +// BigDecimal bud = buildingAreaMap.get(floor.getBuildingId()); +// if (null == bud) { +// bud = new BigDecimal(0); +// } +// bud = bud.add(floor.getOperatingArea()); +// buildingAreaMap.put(floor.getBuildingId(), bud); +// totalArea = totalArea.add(floor.getOperatingArea()); +// } +// } +// } +// //查询公摊表 +// Map> summaryMeterMap = null; +// if (fees.getIsPublic() == EnumYesOrNo.YES.getCode()) { +// WxEnergyMeter sumq = new WxEnergyMeter(); +// sumq.updateTenantInfo(record); +// sumq.setType(fees.getType()); +// sumq.setPhysicsType(EnumEnergyMeterPhysicsType.SUMMARY.getCode()); +// List sumeterList = wxEnergyMeterMapper.findList(sumq); +// if (null != sumeterList && sumeterList.size() > 0 ) { +// summaryMeterMap = new HashMap>(); +// for (int i = 0 ; i < sumeterList.size(); i ++) { +// WxEnergyMeter summaryMeter = sumeterList.get(i); +// //查询总表下的子表 +// WxEnergyMeterChild mcq = new WxEnergyMeterChild(); +// mcq.updateTenantInfo(record); +// mcq.setParentMeterId(summaryMeter.getId()); +// List childMeterIds = wxEnergyMeterChildMapper.findChildMeterIdList(mcq); +// if (null != childMeterIds && childMeterIds.size() > 0 ) { +// summaryMeterMap.put(summaryMeter.getId(), childMeterIds); +// } +// } +// } +// } +// +// List resultList = new ArrayList(); +// for (int i = 0 ; i < shopIds.size(); i ++) { +// Long shopId= shopIds.get(i); +// WxShop shop = shopMap.get(shopId); +// +// //查询用户表 +// WxEnergyMeterShopFloor sfq = new WxEnergyMeterShopFloor(); +// sfq.updateTenantInfo(record); +// sfq.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); +// sfq.setAliseId(shopId); +// List meterList = wxEnergyMeterShopFloorMapper.findMeterIdList(sfq); +// +// //如果店铺已经存在了计算,则不允许重复 +// WxEnergyReadingCalcuteResult crq = new WxEnergyReadingCalcuteResult(); +// crq.updateTenantInfo(record); +// crq.setShopId(shopId); +// crq.setPeriod(record.getPeriod()); +// crq.setFeesId(record.getFeesId()); +// List list = wxEnergyReadingCalcuteResultMapper.findList(crq); +// if (null != list && list.size() > 0 ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"科目["+fees.getName()+"]该年月已存在计算记录,不能重复计算"); +// } +// +// //一个年月,一个店铺应该只有一个抄表周期 +// WxEnergyFeesTime time = null; +// if (fees.getBillType() == EnumBillAllType.DAILY.getCode()) { +// +// //根据店铺,所属年月去查询时间区间.根据店铺,时间区间去查对应的抄表数据,根据表来计算总和 +// WxEnergyFeesTimeShop sq = new WxEnergyFeesTimeShop(); +// sq.updateTenantInfo(record); +// sq.setShopId(shopId); +// List timeIds = wxEnergyFeesTimeShopMapper.findTimeIdList(sq); +// if (null == timeIds || timeIds.size() <= 0 ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置抄表区间"); +// } +// +// WxEnergyFeesTime tq = new WxEnergyFeesTime(); +// tq.updateTenantInfo(record); +// tq.setIds(timeIds); +// tq.setPeriod(record.getPeriod()); +// List timelist = wxEnergyFeesTimeMapper.findList(tq); +// if (null == timelist || timelist.size() <= 0 ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置抄表区间"); +// } +// time = timelist.get(0); +// } +// +// //根据店铺查询绑定的科目 +// WxFeesCalcuteShop csq = new WxFeesCalcuteShop(); +// csq.updateTenantInfo(record); +// csq.setFeesId(fees.getId()); +// csq.setShopId(shopId); +// List shopFeesList = wxEnergyFeesShopMapper.findList(csq); +// if (null == shopFeesList || shopFeesList.size() <= 0 ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"未设置该科目费用标准"); +// } +// +// //循环店铺科目, +// for (int j = 0 ; j < shopFeesList.size() ; j ++) { +// WxFeesCalcuteShop shopfee = shopFeesList.get(j); +// WxEnergyReadingCalcuteResult cs = new WxEnergyReadingCalcuteResult(); +// cs.updateTenantInfo(record); +// cs.setId(idWorker.nextId()); +// cs.setCalcuteId(record.getId()); +// cs.setShopId(shopId); +// cs.setCreateTime(new Date()); +// cs.setUpdateTime(new Date()); +// cs.setFeesId(shopfee.getFeesId()); +// cs.setFeesPrice(shopfee.getPrice()); +// cs.setFeesShopId(shopfee.getId()); +// StringBuffer sb = new StringBuffer(); +// cs.setMoney(wxEnergyHelper.calcuteMoney(sb,totalArea,shop,time, fees, shopfee,meterList,summaryMeterMap,buildingAreaMap,floorAreaMap)); +// cs.setPeriod(record.getPeriod()); +// cs.setMoneyDeail(sb.toString()); +// //如果是能源的,从抄表周期里面取 +// if (null != time) { +// cs.setBeginTime(time.getStartTime()); +// cs.setEndTime(time.getEndTime()); +// }else { +// cs.setBeginTime(shopfee.getBeginTime()); +// cs.setEndTime(shopfee.getEndTime()); +// } +// resultList.add(cs); +// } +// } +// if (resultList.size() > 0 ) { +// wxEnergyReadingCalcuteResultMapper.insertResults(record.getTenantId(),resultList); +// } } private void initReadingCalcuteResultQueryParam(WxEnergyReadingCalcuteResult record) { @@ -1419,16 +1384,16 @@ public class WxEnergyServiceImpl implements WxEnergyService { initReadingCalcuteResultQueryParam(record); PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyReadingCalcuteResultMapper.findList(record)); if (null != page && null != page.getList()) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map fessMap = this.getFeesMap(fq); + Map fessMap = this.getFeesMap(fq); Map floorMap = wxMallFloorService.getFloorMap(record); Map buildingMap = wxMallBuildingService.getBuildingMap(record); List shopIdList = new ArrayList(); for (int i = 0 ; i < page.getList().size(); i++) { WxEnergyReadingCalcuteResult c = page.getList().get(i); if (null != fessMap) { - WxEnergyFees fees = fessMap.get(c.getFeesId()); + WxFinanceFees fees = fessMap.get(c.getFeesId()); if (null != fees) { c.setFeesName(fees.getName()); } @@ -1577,12 +1542,12 @@ public class WxEnergyServiceImpl implements WxEnergyService { shopMap = wxShopService.findShopMap(sq); } - WxEnergyFees fees = this.getFeesById(calcute.getFeesId(), record.getTenantId()); + WxFinanceFees fees = this.getFeesById(calcute.getFeesId(), record.getTenantId()); List resultList = wxEnergyReadingCalcuteResultMapper.findList(crq); if (null != resultList && resultList.size() > 0 ) { List billList = new ArrayList(); - List feesShopList = new ArrayList(); + List feesShopList = new ArrayList(); for (int i = 0 ; i < resultList.size(); i++) { WxEnergyReadingCalcuteResult result = resultList.get(i); WxShop shop = null; @@ -1592,17 +1557,17 @@ public class WxEnergyServiceImpl implements WxEnergyService { if (null == shop) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺ID["+result.getShopId()+"]未查询到店铺"); } - WxEnergyFeesShop feesShop = wxEnergyFeesShopMapper.selectById(result.getFeesShopId(), result.getTenantId()); + WxFeesCalcuteShop feesShop = wxEnergyFeesShopMapper.selectById(result.getFeesShopId(), result.getTenantId()); if (null == feesShop) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"店铺"+shop.getShopNumber()+"该科目费用标准未查询到"); } //非能耗费的费用标准更新开始日期和结束日期,能耗的是使用的抄表区间的时间。 - if (fees.getBillType() != EnumBillAllType.DAILY.getCode()) { - feesShop.setBeginTime(DateUtils.getSecondsTimeAfter(1, feesShop.getEndTime())); - feesShop.setEndTime(feesShop.calcuteEndTime()); - feesShopList.add(feesShop); - } +// if (fees.getBillType() != EnumBillAllType.DAILY.getCode()) { +// feesShop.setBeginTime(DateUtils.getSecondsTimeAfter(1, feesShop.getEndTime())); +// feesShop.setEndTime(feesShop.calcuteEndTime()); +// feesShopList.add(feesShop); +// } WxAllBill bill = result.generateBill(calcute, shop, user,result.getBeginTime(),result.getEndTime(), result.getMoney(), result.getMoneyDeail(), "能源计算自动生成"); billList.add(bill); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFinancePrintServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFinancePrintServiceImpl.java index f9fe252e3..b78410e2e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFinancePrintServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFinancePrintServiceImpl.java @@ -13,7 +13,7 @@ import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFinancePrintData; import com.iformall.domain.po.WxFinancePrintTemplate; import com.iformall.domain.po.WxFinanceReceive; @@ -265,9 +265,9 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { suq.setTenantId(tenantId); suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); Map shopUserMap = wxShopService.getShopUserMap(suq); - WxEnergyFees feq = new WxEnergyFees(); + WxFinanceFees feq = new WxFinanceFees(); feq.setTenantId(tenantId); - Map feesMap = wxEnergyService.getFeesMap(feq); + Map feesMap = wxEnergyService.getFeesMap(feq); //收付款单 if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { WxFinanceReceive receiveq = new WxFinanceReceive(); @@ -327,7 +327,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { for (int k = 0 ; k< bq.getBillSumList().size() ; k++) { WxBillSum billSum = bq.getBillSumList().get(k); if (feesId.contains(billSum.getEnergyFeesId())) { - WxEnergyFees fee = feesMap.get(billSum.getEnergyFeesId()); + WxFinanceFees fee = feesMap.get(billSum.getEnergyFeesId()); billSum.setTaxRate(fee.getTaxRate()); sumlist.add(billSum); receiveTotal = receiveTotal.add(billSum.getNeedPayNumber()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java index 09f8971fe..b86af9c06 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java @@ -15,9 +15,9 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxEnergyFees; -import com.iformall.domain.po.WxEnergyFeesSetoff; -import com.iformall.domain.po.WxEnergyFeesShop; +import com.iformall.domain.po.WxFinanceFees; +import com.iformall.domain.po.WxFinanceFeesSetoff; +import com.iformall.domain.po.WxFeesCalcuteShop; import com.iformall.domain.po.WxFinanceCheckOut; import com.iformall.domain.po.WxFinanceFinish; import com.iformall.domain.po.WxFinanceFinishReceive; @@ -41,8 +41,8 @@ import com.iformall.domain.vo.WxFinanceReceiveBillSum; import com.iformall.domain.vo.WxFinanceReceiveCountVo; import com.iformall.domain.vo.WxFinanceReceiveSumVo; import com.iformall.domain.vo.WxFinanceReceiveVo; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillStatus; +import com.iformall.enums.EnumFeesType; import com.iformall.enums.EnumFinanceCashierType; import com.iformall.enums.EnumFinanceFinishStatus; import com.iformall.enums.EnumFinanceReceiveStatus; @@ -50,7 +50,7 @@ import com.iformall.enums.EnumShopUsersStatus; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillPayWayMapper; -import com.iformall.mapper.WxEnergyFeesSetoffMapper; +import com.iformall.mapper.WxFinanceFeesSetoffMapper; import com.iformall.mapper.WxFinanceCheckOutMapper; import com.iformall.mapper.WxFinanceFinishMapper; import com.iformall.mapper.WxFinanceFinishReceiveMapper; @@ -103,7 +103,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { @Autowired WxBillPayWayMapper wxBillPayWayMapper; @Autowired - WxEnergyFeesSetoffMapper wxEnergyFeesSetoffMapper; + WxFinanceFeesSetoffMapper wxEnergyFeesSetoffMapper; @Autowired WxFinanceReceiveMapper wxFinanceReceiveMapper; @Autowired @@ -260,7 +260,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxAllBill abq = new WxAllBill(); abq.updateTenantInfo(record); abq.setShopId(record.getId()); - abq.setDepositHasMoney(EnumYesOrNo.YES.getCode()); + //abq.setDepositHasMoney(EnumYesOrNo.YES.getCode()); BigDecimal total = wxAllBillService.getRemainAdvanceSum(abq); if (null == total) { total = new BigDecimal(0); @@ -274,7 +274,8 @@ public class WxFinanceServiceImpl implements WxFinanceService { //查询预存账单 WxAllBill abq = new WxAllBill(); abq.updateTenantInfo(record); - abq.setBillType(EnumBillAllType.ADVANCE.getCode()); + //TODO 查预存的科目 + //abq.setBillType(EnumBillAllType.ADVANCE.getCode()); abq.setShopId(record.getId()); abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode()); BigDecimal total = wxAllBillService.getRemainAdvanceSum(abq); @@ -301,21 +302,22 @@ public class WxFinanceServiceImpl implements WxFinanceService { //查询预存账单 WxAllBill abq = new WxAllBill(); abq.updateTenantInfo(record); - abq.setBillType(EnumBillAllType.ADVANCE.getCode()); + //TODO 查预存的科目 + //abq.setBillType(EnumBillAllType.ADVANCE.getCode()); abq.setShopId(record.getId()); abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode()); List advanceList = wxAllBillService.getMerchantAdvanceGroupSumList(abq); if (null != advanceList && advanceList.size() > 0 ) { - WxEnergyFees fat = new WxEnergyFees(); + WxFinanceFees fat = new WxFinanceFees(); fat.updateTenantInfo(record); - Map advanceTypMap = wxEnergyService.getFeesMap(fat); + Map advanceTypMap = wxEnergyService.getFeesMap(fat); for (int i = 0 ; i < advanceList.size() ; i++) { WxAllBill at = advanceList.get(i); FinanceAdvanceBillVo vo = new FinanceAdvanceBillVo(); vo.setFeesId(at.getEnergyFeesId()); vo.setRemain(at.getRemain()); if (null != at.getEnergyFeesId() && null != advanceTypMap) { - WxEnergyFees wfat = advanceTypMap.get(at.getEnergyFeesId()); + WxFinanceFees wfat = advanceTypMap.get(at.getEnergyFeesId()); if (null != wfat) { vo.setFeesName(wfat.getName()); } @@ -412,13 +414,8 @@ public class WxFinanceServiceImpl implements WxFinanceService { List advanceList = null; //如果是押金 if (dto.getFeesId().longValue() == Constant.bill_all_deposit_id.longValue()){ - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(dto); - List depositTypes = new ArrayList(); - depositTypes.add(EnumBillAllType.RENT_DEPOSIT.getCode()); - depositTypes.add(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); - depositTypes.add(EnumBillAllType.OTHER_DEPOSIT.getCode()); - fq.setBillTypeList(depositTypes); setOffFeesIds = wxEnergyService.getFeesIdList(fq); if (null == setOffFeesIds || setOffFeesIds.size() <= 0 ) { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"未查询到押金科目"); @@ -427,7 +424,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxAllBill abq = new WxAllBill(); abq.updateTenantInfo(dto); abq.setNotInIds(billIdList); - abq.setDepositHasMoney(EnumYesOrNo.YES.getCode()); + //abq.setDepositHasMoney(EnumYesOrNo.YES.getCode()); abq.setSortColumns(SortField.Createtime_ASC); abq.setShopId(shopId);; advanceList = wxAllBillService.list(abq); @@ -436,7 +433,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { } }else { //查询预收科目可冲抵的科目 - WxEnergyFeesSetoff fsq = new WxEnergyFeesSetoff(); + WxFinanceFeesSetoff fsq = new WxFinanceFeesSetoff(); fsq.updateTenantInfo(dto); fsq.setAdvanceFeesId(dto.getFeesId()); setOffFeesIds = wxEnergyService.getAdvanceSetoffFeesids(fsq); @@ -448,7 +445,8 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxAllBill abq = new WxAllBill(); abq.updateTenantInfo(dto); abq.setEnergyFeesId(dto.getFeesId()); - abq.setBillType(EnumBillAllType.ADVANCE.getCode()); + //TODO 查预存的科目 + //abq.setBillType(EnumBillAllType.ADVANCE.getCode()); abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode()); abq.setSortColumns(SortField.Createtime_ASC); abq.setShopId(shopId);; @@ -519,9 +517,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { pq.updateTenantInfo(record); Map paywayMap = this.getPayWayMap(pq); - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map fmap = wxEnergyService.getFeesMap(fq); + Map fmap = wxEnergyService.getFeesMap(fq); List volist = new ArrayList(); for (int i = 0 ; i < page.getList().size() ; i++) { WxFinanceReceive fr = page.getList().get(i); @@ -553,7 +551,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { } } if (null != fmap && null != vo.getFeesId()) { - WxEnergyFees ef = fmap.get(vo.getFeesId()); + WxFinanceFees ef = fmap.get(vo.getFeesId()); if (null != ef) { vo.setFeesName(ef.getName()); } @@ -597,9 +595,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { pq.updateTenantInfo(record); Map paywayMap = this.getPayWayMap(pq); - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map fmap = wxEnergyService.getFeesMap(fq); + Map fmap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < page.getList().size() ; i++) { WxFinanceReceiveBill fr = page.getList().get(i); if (null != shopMap) { @@ -615,7 +613,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { } } if (null != fmap && null != fr.getFeesId()) { - WxEnergyFees ef = fmap.get(fr.getFeesId()); + WxFinanceFees ef = fmap.get(fr.getFeesId()); if (null != ef) { fr.setFeesName(ef.getName()); } @@ -894,7 +892,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(addreceive); payDto.setId(be.getId()); - payDto.setBillTypeValue(be.getBillType()); + //payDto.setBillTypeValue(be.getBillType()); payDto.setAddpay(money); payDto.setPayWay(payway0.getId()); payDto.setPayWayName(payway0.getPayWayName()); @@ -935,7 +933,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(addreceive); payDto.setId(be.getId()); - payDto.setBillTypeValue(be.getBillType()); + //payDto.setBillTypeValue(be.getBillType()); payDto.setAddpay("0"); payDto.setSetOff(be.getCurrentSetOff()); payDto.setCut(be.getCurrentCut()); @@ -979,7 +977,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { frbs.setReceiveId(addreceive.getId()); frbs.setReceiveDate(addreceive.getReceiveDate()); frbs.setBillId(bill.getId()); - frbs.setBillType(bill.getBillType()); + //frbs.setBillType(bill.getBillType()); frbs.setFeesId(bill.getEnergyFeesId()); frbs.setType(addreceive.getType()); frbs.setPayWay(payway); @@ -1000,19 +998,15 @@ public class WxFinanceServiceImpl implements WxFinanceService { for (int j = 0 ; j < be.getSetOffDetailList().size(); j ++ ) { FinanceSetOffDetailVo setoffdetail = be.getSetOffDetailList().get(j); WxAllBill advance = wxAllBillService.getById(addreceive, setoffdetail.getAdvanceId()); - EnumBillAllType billType = EnumBillAllType.getEnum(advance.getBillType()); - + WxFinanceFees fees = wxEnergyService.getFeesById(advance.getEnergyFeesId(), addreceive.getTenantId()); //如果是预冲 - if (billType == EnumBillAllType.ADVANCE){ + if (fees.getFeesType().intValue() == EnumFeesType.ADVANCE.getCode().intValue()){ advanceMoney = advanceMoney.add(new BigDecimal(setoffdetail.getSetoff())); }else { //如果是押金 boolean isDeposit = false; - for (EnumBillAllType bt : EnumBillAllType.getDepositTypes()) { - if (bt == billType) { - isDeposit = true; - break; - } + if (fees.getIsDespoit().intValue() == EnumYesOrNo.YES.getCode().intValue()) { + isDeposit = true; } if (isDeposit) { depositMoney = depositMoney.add(new BigDecimal(setoffdetail.getSetoff())); @@ -1034,7 +1028,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { rb.setAdvanceId(advance.getId()); rb.setReceiveId(addreceive.getId()); rb.setBillId(bill.getId()); - rb.setBillType(bill.getBillType()); + //rb.setBillType(bill.getBillType()); rb.setFeesId(bill.getEnergyFeesId()); rb.setSetoff(setoffdetail.getSetoff()); rb.setStarttime(bill.getStarttime()); @@ -1140,7 +1134,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(addreceive); payDto.setId(be.getId()); - payDto.setBillTypeValue(be.getBillType()); + //payDto.setBillTypeValue(be.getBillType()); payDto.setCut(be.getCurrentCut()); payDto.setRemark("减免,关联收款单["+addreceive.getId()+"]"); //创建一个减免收款单 @@ -1324,7 +1318,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(addreceive); payDto.setId(be.getId()); - payDto.setBillTypeValue(be.getBillType()); + //payDto.setBillTypeValue(be.getBillType()); payDto.setPayToMerchant(money); payDto.setPayWay(payway0.getId()); payDto.setPayWayName(payway0.getPayWayName()); @@ -1353,27 +1347,21 @@ public class WxFinanceServiceImpl implements WxFinanceService { @Override public void createTempFees(WxAllBill record,MallUserInfo user) { - WxEnergyFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; - record.setBillType(fees.getBillType()); + //WxFinanceFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; + //record.setBillType(fees.getBillType()); WxShop shop = wxShopService.getById(record.getShopId()); - if (fees.getBillType().intValue() == EnumBillAllType.ADVANCE.getCode().intValue()) { - generateTempBill(record, shop, user,EnumBillAllType.ADVANCE,record.getReceivePay(),"0",record.getStarttime(),record.getEndtime()); - }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER_DEPOSIT.getCode().intValue()) { - generateTempBill(record, shop, user,EnumBillAllType.OTHER_DEPOSIT,record.getReceivePay(),"0",record.getStarttime(),record.getEndtime()); - }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER.getCode().intValue()) { - generateTempBill(record, shop, user,EnumBillAllType.OTHER,record.getReceivePay(),"0",record.getStarttime(),record.getEndtime()); - } + generateTempBill(record, shop, user,record.getReceivePay(),"0",record.getStarttime(),record.getEndtime()); } @Override public void createTempToPay(WxAllBill record,MallUserInfo user) { - WxEnergyFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; - record.setBillType(fees.getBillType()); + //WxFinanceFees fees = wxEnergyService.getFeesById(record.getEnergyFeesId(),record.getTenantId()) ; + //record.setBillType(fees.getBillType()); WxShop shop = wxShopService.getById(record.getShopId()); - generateTempBill(record, shop, user,EnumBillAllType.TEMP_TO_PAYMERCHANT,"0",record.getReceivePay(),record.getStarttime(),record.getEndtime()); + generateTempBill(record, shop, user,"0",record.getReceivePay(),record.getStarttime(),record.getEndtime()); } - public void generateTempBill(WxAllBill record,WxShop wxShop,MallUserInfo user, EnumBillAllType billType,String receivePay,String pay,Date starttime,Date endtime) { + public void generateTempBill(WxAllBill record,WxShop wxShop,MallUserInfo user, String receivePay,String pay,Date starttime,Date endtime) { if (null == endtime) { if (null == starttime) { Date cur = new Date(); @@ -1406,7 +1394,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { advanceBill.setReceivePay(receivePay); advanceBill.setPay(pay); advanceBill.setUseMoney("0"); - advanceBill.setBillType(billType.getCode()); + //advanceBill.setBillType(billType.getCode()); //advanceBill.setPayWay(); //advanceBill.setPayDate(new Date()); advanceBill.setStarttime(starttime); @@ -1478,7 +1466,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxFinanceReceiveSetoff rsq = new WxFinanceReceiveSetoff(); rsq.updateTenantInfo(record); rsq.setBillId(bill.getId()); - rsq.setBillType(bill.getBillType()); + //rsq.setBillType(bill.getBillType()); rsq.setReceiveId(rb.getReceiveId()); List setoffList = wxFinanceReceiveSetoffMapper.findList(rsq); if (null != setoffList) { @@ -1505,7 +1493,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(record); payDto.setId(bill.getId()); - payDto.setBillTypeValue(bill.getBillType()); + //payDto.setBillTypeValue(bill.getBillType()); payDto.setAddpay("0"); payDto.setSetOff(rb.getReceive()); if (isRedSetoff) { @@ -1523,7 +1511,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(record); payDto.setId(bill.getId()); - payDto.setBillTypeValue(bill.getBillType()); + //payDto.setBillTypeValue(bill.getBillType()); if (record.getType().intValue() == EnumFinanceCashierType.RECEIVE.getCode().intValue()) { payDto.setCut(rb.getReceive()); if (isRedSetoff) { @@ -1548,7 +1536,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { WxBillPayDTO payDto = new WxBillPayDTO(); payDto.updateTenantInfo(record); payDto.setId(bill.getId()); - payDto.setBillTypeValue(bill.getBillType()); + //payDto.setBillTypeValue(bill.getBillType()); if (record.getType().intValue() == EnumFinanceCashierType.RECEIVE.getCode().intValue()) { payDto.setAddpay(rb.getReceive()); if (isRedSetoff) { @@ -1676,13 +1664,13 @@ public class WxFinanceServiceImpl implements WxFinanceService { rsq.setAdvanceId(record.getId()); PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceReceiveSetoffMapper.findList(rsq)); if (null != page && null != page.getList()) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < page.getList().size(); i++ ) { WxFinanceReceiveSetoff frs = page.getList().get(i); if (null != feesMap && null != frs.getFeesId()) { - WxEnergyFees ef = feesMap.get(frs.getFeesId()); + WxFinanceFees ef = feesMap.get(frs.getFeesId()); if (null != ef) { frs.setFeesName(ef.getName()); } @@ -1911,13 +1899,13 @@ public class WxFinanceServiceImpl implements WxFinanceService { pays = wxFinanceReceiveMapper.getReceiveFeesPaySum(fr); } if (null != pays) { - WxEnergyFees fq = new WxEnergyFees(); + WxFinanceFees fq = new WxFinanceFees(); fq.updateTenantInfo(record); - Map feesMap = wxEnergyService.getFeesMap(fq); + Map feesMap = wxEnergyService.getFeesMap(fq); for (int i = 0 ; i < pays.size() ; i ++) { WxFinanceReceiveBill rpw = pays.get(i); if (null != feesMap && null != rpw.getFeesId()) { - WxEnergyFees pw = feesMap.get(rpw.getFeesId()); + WxFinanceFees pw = feesMap.get(rpw.getFeesId()); if (null != pw) { rpw.setFeesName(pw.getName()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index f639fbeb1..515dd0c35 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -73,10 +73,6 @@ public class WxFlowServiceImpl implements WxFlowService { @Autowired private MallUserInfoService mallUserInfoService; @Autowired - private WxPropertyContractMapper wxPropertyContractMapper; - @Autowired - private WxPropertyContractService wxPropertyContractService; - @Autowired private WxFlowRecordMapper wxFlowRecordMapper; @Autowired private MqBaseProducer mqBaseProducer; @@ -202,16 +198,16 @@ public class WxFlowServiceImpl implements WxFlowService { } rent.setId(bsId); rent.setApplyStatus(applyStatus); - rent.setBusinessType(flowType); + //rent.setBusinessType(flowType); WxRentContract record = wxRentContractMapper.selectById(bsId); boolean isrentproperty = false; Integer propertyStatus = null; //合并的合同-审批时 物业合同的状态肯定不在 签约中 避免更新物业合同时提示店铺存在 - if(record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())){ - isrentproperty = true; - } + //if(record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())){ + // isrentproperty = true; + //} //String wholeProperyId = (String)mapInfo.get("wholeProperyId"); //如果是提交审批 , 审批驳回状态不变 if (EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { @@ -227,7 +223,7 @@ public class WxFlowServiceImpl implements WxFlowService { }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { wxRentContractService.updateRentContractStatus(bsId,false); if (isrentproperty) { - wxPropertyContractService.updatePropertyContractStatus(propetyId); + //wxPropertyContractService.updatePropertyContractStatus(propetyId); } //如果是审批撤回,或者驳回,改回草稿状态 }else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() @@ -239,34 +235,8 @@ public class WxFlowServiceImpl implements WxFlowService { } } wxRentContractService.updateApplyStatus(rent); - if (isrentproperty) { - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setId(propetyId); - wxPropertyContract.setRentContractId(record.getId()); - wxPropertyContract.setStatus(propertyStatus); - wxPropertyContract.setApplyStatus(applyStatus); - wxPropertyContract.setBusinessType(flowType); - wxPropertyContractMapper.updateApplyStatusByRentContractId(wxPropertyContract); - } }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType)){ - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setId(Long.parseLong(businessId)); - wxPropertyContract.setApplyStatus(applyStatus); - wxPropertyContract.setBusinessType(flowType); - - //如果是提交审批 - if (EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { - wxPropertyContract.setStatus(EnumRentContractStatus.PERFORMANCE.getCode()); - // 审批完成 - }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { - wxPropertyContractService.updatePropertyContractStatus(Long.parseLong(businessId)); - //如果是审批撤回,或者驳回,改回草稿状态 - }else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() - || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { - wxPropertyContract.setStatus(EnumRentContractStatus.DRAFT.getCode()); - } - wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); } }else if(EnumFlowKey.END_CONTRACT.getCode().equals(flowType) @@ -289,30 +259,18 @@ public class WxFlowServiceImpl implements WxFlowService { rent.setId(bsId); rent.setApplyStatus(applyStatus); - rent.setBusinessType(flowType); + //rent.setBusinessType(flowType); if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { rent.setStatus(EnumRentContractStatus.TERMINATE.getCode()); //终止租赁合同,同时终止物业合同 Integer endProperty = getIngeter(getVariableByKey(variables,"endProperty")); - rent.setEndProperty(endProperty); + //rent.setEndProperty(endProperty); wxRentContractService.endContract(rent,null); } wxRentContractService.updateApplyStatus(rent); }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType)){ - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setId(Long.parseLong(businessId)); - wxPropertyContract.setApplyStatus(applyStatus); - wxPropertyContract.setBusinessType(flowType); - - if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { - wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); - - //账单失效 - wxPropertyContractService.endContract(wxPropertyContract,null); - } - wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); } } else if (EnumFlowKey.BILL.getCode().equals(flowType) || EnumFlowKey.NEW_BILL_CHANGE.getCode().equals(flowType) || EnumFlowKey.BILL_FINISH.getCode().equals(flowType)) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index c7e1fbc61..aad4c787c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -110,16 +110,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired ExcelService excelService; - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - @Autowired WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; - @Lazy - @Autowired - WxPropertyContractService wxPropertyContractService; - @Lazy @Autowired WxMallService wxMallService; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java deleted file mode 100644 index 7f75ba438..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ /dev/null @@ -1,1597 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.BillTimeVo; -import com.iformall.domain.vo.WxBillFeesStandardsListVo; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.*; -import com.iformall.service.*; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.service.helper.WxRentContractHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.collections.map.HashedMap; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.HttpURLConnection; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.*; - -/** - * @author gongbiao - */ -@Service -public class WxPropertyContractServiceImpl implements WxPropertyContractService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private String fmUploadDir; - - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - - @Autowired - WxShopMapper wxShopMapper; - - @Autowired - WxMerchantMapper wxMerchantMapper; - - @Autowired - WxRentContractMapper wxRentContractMapper; - - @Autowired - private WxContractCustomersMapper wxContractCustomersMapper; - - @Autowired - private WxContractShopMapper wxContractShopMapper; - - @Lazy - @Autowired - WxFlowService wxFlowService; - - @Lazy - @Autowired - WxFlowRecordService wxFlowRecordService; - - @Lazy - @Autowired - WxRentContractService wxRentContractService; - - @Lazy - @Autowired - WxAgileContractService wxAgileContractService; - - @Lazy - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Autowired - WxAllBillMapper wxAllBillMapper; - - @Override - public PageInfo listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { - if (StringUtils.isNotBlank(record.getFloorForRule()) || StringUtils.isNotBlank(record.getQueryShopIdStr())) { - List shopIdList = null; - if (StringUtils.isNotBlank(record.getQueryShopIdStr())) { - String[] qsids = record.getQueryShopIdStr().split(","); - if (null != qsids && qsids.length > 0 ) { - shopIdList = new ArrayList(); - 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 contractIds = wxAgileContractService.findBuildingFloorContractIds(record, record.getFloorForRule(), null, null, shopIdList, 0); - //List mids = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule() , null, null,record.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 customersIdList = wxContractCustomersMapper.findIdList(ccq); - if (null != customersIdList && customersIdList.size() > 0 ) { - record.setCustomersIdList(customersIdList); - }else { - record.setId(-1L); - } - } - - PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPropertyContractMapper.findList(record)); - if (null != pageInfo && null != pageInfo.getList() && pageInfo.getList().size() > 0 ) { - List customersIdList = new ArrayList(); - for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){ - WxPropertyContract contract = pageInfo.getList().get(i); - if (null != contract.getCustomersId()) { - customersIdList.add(contract.getCustomersId()); - } - } - - Map 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); - contract.setShopNumbers(contract.getRentInfoShopNumber()); - } - } - return pageInfo; - } - - private Map getContractCustomersMap(TenantEntity tenantEntity,List customerIds) { - WxContractCustomers ccq = new WxContractCustomers(); - ccq.updateTenantInfo(tenantEntity); - ccq.setIds(customerIds); - List cclist = wxContractCustomersMapper.findList(ccq); - if (null != cclist && cclist.size() > 0 ){ - Map map = new HashMap(); - 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 findList(WxPropertyContract record) { - return wxPropertyContractMapper.findList(record); - } - - @Override - public List findIdList(WxPropertyContract record) { - return wxPropertyContractMapper.findIdList(record); - } - - @Override - public Map getById(Long id) { - - Map result = new HashMap<>(); - WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(id); - if (wxPropertyContract == null) { - throw new MallinkException(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); - } - - WxContractCustomers customers = wxContractCustomersMapper.selectById(wxPropertyContract.getCustomersId(),wxPropertyContract.getTenantId()); - wxPropertyContract.setCustomerType(customers.getPrincipalType()); - wxPropertyContract.setCustomerLinkPerson(customers.getLinkPerson()); - wxPropertyContract.setCustomerName(customers.getName()); - wxPropertyContract.setCustomerPhone(customers.getPhone()); - wxPropertyContract.setCustomerLegalPerson(customers.getLegalPerson()); - - //init dateDiff - if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ - //加1天 - Date newEndDate = DateUtils.getDaySet(wxPropertyContract.getRentalEndDate(),Calendar.DATE,1); - int[] array = DateUtils.getDiff(wxPropertyContract.getRentalStartDate(),newEndDate); - result.put("totalPeriodMonth",array[0]); - result.put("totalPeriodDay",array[1]); - } - - //init 租赁单价 - String rentInfo = wxPropertyContract.getRentInfo(); - if(StringUtils.isNotBlank(rentInfo)){ - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - //查询rent_info 包括shopId - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String rentPrice = rentInfoObject.getString("rentPrice"); - String price = wxPropertyContract.getPrice(); - if (StringUtils.isBlank(price)) { - price = "0"; - } - if(rentPrice == null){ - if(StringUtils.isNotBlank(wxPropertyContract.getRentArea()) && !"0".equals(wxPropertyContract.getRentArea()) && !"0.00".equals(wxPropertyContract.getRentArea())&& !"0.0".equals(wxPropertyContract.getRentArea()) ) { - Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); - rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxPropertyContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP).toPlainString(); - rentInfoObject.put("rentPrice", rentPrice); - } - } - } - wxPropertyContract.setRentInfo(rentInfoArray.toJSONString()); - }else{ - if(StringUtils.isNotBlank(wxPropertyContract.getRentArea()) && !"0".equals(wxPropertyContract.getRentArea()) && !"0.00".equals(wxPropertyContract.getRentArea())&& !"0.0".equals(wxPropertyContract.getRentArea()) ) { - if(StringUtils.isNotBlank(wxPropertyContract.getRentArea()) && !"0".equals(wxPropertyContract.getRentArea()) && !"0.00".equals(wxPropertyContract.getRentArea())) { - String price = wxPropertyContract.getPrice(); - if (StringUtils.isBlank(price)) { - price = "0"; - } - Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()) * 100; - BigDecimal rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxPropertyContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - if (rentPrice.compareTo(new BigDecimal(0)) > 0) { - wxPropertyContract.setRentPrice(rentPrice.toPlainString()); - } else { - wxPropertyContract.setRentPrice("0"); - } - } - } - } - if(wxPropertyContract.getPriceUnit() == null){ - wxPropertyContract.setPriceUnit(EnumPriceUnit.M.getCode()); - } - if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ - wxPropertyContract.setAdjustPeriod(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()); - wxPropertyContract.setPriceUnit(EnumPriceUnit.D.getCode()); - } - - wxPropertyContract.setPrice(StringUtils.isNotBlank(wxPropertyContract.getPrice()) ? wxPropertyContract.getPrice() : "0"); - wxPropertyContract.setDeposit(StringUtils.isNotBlank(wxPropertyContract.getDeposit()) ? wxPropertyContract.getDeposit() : "0"); - - result.put("wxPropertyContract", wxPropertyContract); - - //关联的店铺 - WxShop record = new WxShop(); - record.updateTenantInfo(wxPropertyContract); - if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - record.setIds(wxPropertyContract.shopIdsByShop()); - }else { - WxRentContract wrc = wxRentContractMapper.selectById(wxPropertyContract.getRentContractId()); - if (wrc != null) { - if (null != wrc.shopIdsByRentInfo() && wrc.shopIdsByRentInfo().size()>0) { - record.setIds(wrc.shopIdsByRentInfo()); - } - } - } - if (null == record.getIds() || record.getIds().size() <= 0 ) { - result.put("wxShops", Collections.EMPTY_LIST); - }else { - PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); - List> list = shopPageInfo.getList(); - result.put("wxShops", list); - } - - //发起人备注 - WxFlowRecord wxFlowRecord = new WxFlowRecord(); - wxFlowRecord.setBusinessId(String.valueOf(id)); - wxFlowRecord.setStatus(EnumFlowRecordStatus.NEW.getCode()); - wxFlowRecord.updateTenantInfo(wxPropertyContract); - List flowRecordList = wxFlowRecordService.findList(wxFlowRecord); - if(!CollectionUtils.isEmpty(flowRecordList)){ - result.put("remark",flowRecordList.get(0).getRemark()); - } - - //查询预账单用于展示 - List resultList = getWxBillPropertyPreview(wxPropertyContract,id); - result.put("previewBillRentList", resultList); - - return result; - } - - @Override - public List getWxBillPropertyPreview(TenantEntity tenantEntity,Long id) { - //查询主账单列表,排除其他标砖费用,包括一次性费用,非一次性费用 - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setPropertyContractId(id); - wxBillRent.updateTenantInfo(tenantEntity); - //物业主账单 - wxBillRent.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); - List retList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent); - - //获取非一次性的, - wxBillRent.setEnergyFeesId(null); - wxBillRent.setBillType(EnumBillAllType.PROPERTY.getCode()); - wxBillRent.setHasParentBillId(EnumYesOrNo.YES.getCode()); - List unFixedList = wxAllBillMapper.findContractFeesSamePeriodSum(wxBillRent); - Map> childMap = null; - if (null != unFixedList && unFixedList.size() > 0 ) { - childMap = new HashMap>(); - for (int i = 0 ; i < unFixedList.size(); i++) { - WxAllBill ub = unFixedList.get(i); - if (null != ub) { - List childList = childMap.get(ub.getParentVirtualComposeId()); - if (null == childList) { - childList = new ArrayList(); - childMap.put(ub.getParentVirtualComposeId(), childList); - } - ub.setFeesStandarsId(ub.getEnergyFeesId()); - childList.add(ub); - } - } - } - if (null != childMap ) { - for (int i = 0 ; i < retList.size(); i ++) { - WxAllBill ub = retList.get(i); - List childList = childMap.get(ub.getVirtualComposeId()); - ub.setChildList(childList); - } - } - - return retList; - } - - /** - * 重新生成账单(预账单调整) - */ - public void savePreviewBill(WxPropertyContract record,MallUserInfo user){ - if(CollectionUtils.isEmpty(record.getPreviewBillRentList())){ - return; - } - wxAllBillMapper.deleteBillByPropertyContract(record); - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - final IdWorker idWorker = IdWorker.get(); - int count = 1; - for (WxAllBill bill:record.getPreviewBillRentList()) { - bill.setId(idWorker.nextId()); - Date date = new Date(); - bill.setPropertyContractId(record.getId()); - bill.setCreatetime(date); - bill.setCreateBy(user.getId()); - bill.setCreateByName(user.getName()); - bill.updateTenantInfo(wxPayAccountBill); - bill.setNeedPay(bill.getNeedPay()); - bill.setUpdatetime(date); - bill.setUpdateBy(user.getId()); - bill.setUpdateByName(user.getName()); - bill.setIsPreview(EnumIsPreview.YES.getCode()); - bill.setShopInfo(getShopInfoStr(record)); - bill.setPay("0"); - bill.setBillType(EnumBillAllType.PROPERTY.getCode()); - //bill.setShopId(record.getShopId()); - if (bill.getReceivePay().equals("0")) { - bill.setPayDate(date); - } - //BigDecimal servicePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), record.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - //bill.setServiceChargePay(servicePay.toPlainString()); - //bill.setOwe(new BigDecimal(bill.getReceivePay()).add(new BigDecimal(bill.getServiceChargePay())).toPlainString()); - //bill.setOwe(new BigDecimal(bill.getReceivePay()).toPlainString()); - count++; - } - wxAllBillMapper.insertBills(record.getTenantId(),record.getPreviewBillRentList()); - } - - @Override - //@Transactional(rollbackFor = {Exception.class}) - public ResultData save(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate) { - //保存物业合同信息 - if (record.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - record.setEndDate(setEndDate(record.getStartDate(),record.getRentalStartDate())); - } - - Date date = new Date(); - - if (record.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - Map areaMap = record.getRentShopArea(); - BigDecimal rentArea = new BigDecimal(0); - for (Iterator it = areaMap.keySet().iterator();it.hasNext();) { - Long sid = it.next(); - BigDecimal sa = areaMap.get(sid); - rentArea = rentArea.add(sa); - } - record.setRentArea(rentArea.toPlainString()); - } - - try { - if (null == record.getId()) { - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); - record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); - - setShops(record,record.shopIdsByShop()); - //关联客户 - setCustomers(record); - - wxPropertyContractMapper.insert(record); - - //编辑 - }else { - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - wxPropertyContractMapper.updateById(record); - - setShops(record,record.shopIdsByShop()); - //关联客户 - setCustomers(record); - } - } catch (Exception e) { - logger.error("保存物业合同信息失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - if (null != record.getId()) { - WxPropertyContract _r = wxPropertyContractMapper.selectById(record.getId()); - return new ResultData(Result.SUCCESS, "保存物业合同信息成功", _r); - }else { - return new ResultData(Result.SUCCESS, "保存物业合同信息成功", record); - } - - } - - public void setCustomers(WxPropertyContract record) { - WxContractCustomers cq = new WxContractCustomers(); - cq.updateTenantInfo(record); - cq.setPrincipalType(record.getCustomerType()); - cq.setNameEqal(record.getCustomerName()); - cq.setPhoneEqal(record.getCustomerPhone()); - List list = wxContractCustomersMapper.findList(cq); - WxContractCustomers cus = null; - if (null != list && list.size() > 0 ){ - cus = list.get(0); - } - if (null == cus) { - final IdWorker idWorker = IdWorker.get(); - cus = new WxContractCustomers(); - cus.updateTenantInfo(record); - cus.setId(idWorker.nextId()); - cus.setPrincipalType(record.getCustomerType()); - cus.setName(record.getCustomerName()); - cus.setPhone(record.getCustomerPhone()); - cus.setLegalPerson(record.getCustomerLegalPerson()); - cus.setLinkPerson(record.getCustomerLinkPerson()); - cus.setCreateDate(new Date()); - cus.setUpdateDate(new Date()); - cus.setStatus(EnumContractCustomersStatus.TEMP.getCode()); - wxContractCustomersMapper.insert(cus); - }else { - cus.setLinkPerson(record.getCustomerLinkPerson()); - cus.setLegalPerson(record.getCustomerLegalPerson()); - cus.setUpdateDate(new Date()); - wxContractCustomersMapper.updateById(cus); - } - record.setCustomersId(cus.getId()); - } - - public void setShops(WxPropertyContract record,List shopIdList) { - WxContractShop sdel = new WxContractShop(); - sdel.updateTenantInfo(record); - sdel.setContractId(record.getId()); - wxContractShopMapper.deleteByCondition(sdel); - Map shopAreaMap = record.getRentShopArea(); - if (null != shopIdList && shopIdList.size() > 0 ) { - final IdWorker idWorker = IdWorker.get(); - for ( int i = 0 ; i < shopIdList.size(); i ++) { - Long shopId = shopIdList.get(i); - WxContractShop s = new WxContractShop(); - s.updateTenantInfo(record); - s.setContractId(record.getId()); - s.setShopId(shopId); - s.setRentArea(shopAreaMap.get(shopId).toPlainString()); - s.setCreateDate(new Date()); - s.setUpdateDate(new Date()); - s.setId(idWorker.nextId()); - wxContractShopMapper.insert(s); - } - } - - } - - - @Override - //@Transactional(rollbackFor = {Exception.class}) - public ResultData updateMoney(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate) { - //保存物业合同信息 - WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(record.getId()); - if (wxPropertyContract == null) { - return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); - } - if (StringUtils.isNotBlank(wxPropertyContract.getContractNumber())) { - record.setContractNumber(null); - } - - if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - record.calcutePrice(wxPropertyContract.getRentArea()); - }else { - WxRentContract rentContract = wxRentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId()); - record.calcutePrice(rentContract.getRentArea()); - } - - //record.setPrice(StringUtils.isNotBlank(record.getPrice()) ? record.getPrice() : "0"); - record.setDeposit(StringUtils.isNotBlank(record.getDeposit()) ? record.getDeposit() : "0"); - record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId()); - //如果是合并合同 物业合同的状态为 意向 - if (writeComplate) { - record.setStatus(EnumRentContractStatus.DRAFT.getCode()); - }else { - record.setStatus(wxPropertyContract.getStatus()); - } - record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); - try { - wxPropertyContractMapper.updateById(record); - } catch (Exception e) { - logger.error("更新物业合同信息失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - record.setFeeStandards(record.getFeesStardarsList()); - record.setLease(wxPropertyContract.getLease()); - //更新物业合同信息 - if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null - && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals("0")) { - //删除预账单,重新生成 - wxAllBillMapper.deleteBillByPropertyContract(record); - //重新生成 - record.setRentalStartDate(wxPropertyContract.getRentalStartDate()); - record.setRentalEndDate(wxPropertyContract.getRentalEndDate()); - //切换的时候需要用传过来的类型 - if (null == record.getRentStartType()) { - record.setRentStartType(wxPropertyContract.getRentStartType()); - } - record.setStartDate(wxPropertyContract.getStartDate()); - record.setEndDate(wxPropertyContract.getEndDate()); - record.setAdjustPeriod(wxPropertyContract.getAdjustPeriod()); - record.setCreateType(wxPropertyContract.getCreateType()); - record.setFeeStandards(wxPropertyContract.getFeesStardarsList()); - record.setRentInfo(wxPropertyContract.getRentInfo()); - record.setRentArea(wxPropertyContract.getRentArea()); - List billList = buildProperty(user,record,EnumIsPreview.YES.getCode(),true); - record.setPreviewBillRentList(billList); - } - - return new ResultData(Result.SUCCESS, "更新物业合同信息成功", record); - } - - @Override - public void deletePreviewBill(WxPropertyContract record) { - wxAllBillMapper.deleteBillByPropertyContract(record); - } - - - @Override - //@Transactional(rollbackFor = {Exception.class}) - public ResultData updateFile(WxPropertyContract record, MallUserInfo user, String userName,boolean writeComplate) { - WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(record.getId()); - if (wxPropertyContract == null) { - return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); - } - record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId()); - //如果是合并合同 物业合同的状态为 意向 - if (writeComplate) { - record.setStatus(EnumRentContractStatus.DRAFT.getCode()); - }else { - record.setStatus(wxPropertyContract.getStatus()); - } - record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); - try { - wxPropertyContractMapper.updateById(record); - } catch (Exception e) { - logger.error("更新物业合同信息失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "更新物业合同信息成功", record); - } - - //跟租金合同保持逻辑一致 - private Date setEndDate(Date startDate, Date rentalStartDate) { - //计租结束时间 - if (!startDate.equals(rentalStartDate)) { - Calendar instance = Calendar.getInstance(); - instance.setTime(rentalStartDate); - instance.add(Calendar.DAY_OF_MONTH, -1); - return instance.getTime(); - } else { - return startDate; - } - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public ResultData updatePropertyContractStatus(Long id) { - if (id == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); - } - WxPropertyContract record = wxPropertyContractMapper.selectById(id); - //更新合同状态为签约 - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setId(id); - if (record.getRentalStartDate().before(new Date())) { - wxPropertyContract.setStatus(EnumRentContractStatus.PAING.getCode()); - } else { - 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 - updatePropertyPreviewBill(record); - } - return new ResultData(Result.SUCCESS, "操作成功"); - } - - public String castCustomersToShopUsers(WxContractCustomers customers,List shopIdList) { - WxShopUsersInfo suiq = new WxShopUsersInfo(); - suiq.updateTenantInfo(customers); - suiq.setPrincipalType(customers.getPrincipalType()); - suiq.setName(customers.getName()); - suiq.setPhone(customers.getPhone()); - List 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 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) { - WxAllBill billProperty = new WxAllBill(); - billProperty.setPropertyContractId(record.getId()); - billProperty.setIsPreview(EnumIsPreview.NO.getCode()); - billProperty.updateTenantInfo(record); - wxAllBillMapper.updatePreviewStatus(billProperty); - if(new BigDecimal(record.getDeposit()).compareTo(new BigDecimal(0)) > 0) { - buildDeposit(record); - } - } - - @Transactional(rollbackFor = {Exception.class}) - public void buildDeposit(WxPropertyContract record) { - Long propertyContractId = record.getId(); - WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(propertyContractId); - if (wxPropertyContract != null && new BigDecimal(wxPropertyContract.getDeposit()).compareTo(new BigDecimal(0)) > 0) { - //找到计租方式 - int dayType = wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; - final IdWorker idWorker = IdWorker.get(); - - List shopIds = wxPropertyContract.shopIdsByShop(); - Map shopAreaRateMap = wxPropertyContract.getRentShopArea(); - if (null == shopAreaRateMap) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); - } - - WxShopUsers suq = new WxShopUsers(); - suq.updateTenantInfo(wxPropertyContract); - suq.setShopIds(shopIds); - suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); - Map shopUserMap = wxShopService.getShopUserMap(suq); - - 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()),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(); - wxBillDeposit.setId(idWorker.nextId()); - wxBillDeposit.setBillType(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); - wxBillDeposit.setPropertyContractId(wxPropertyContract.getId()); - wxBillDeposit.setPay("0"); - String needpay = wxPropertyContract.getDeposit(); - 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()); - //wxBillDeposit.setOwe(needpay); - Date date = new Date(); - // Calendar instance = Calendar.getInstance(); - // instance.setTime(wxPropertyContract.getRentalStartDate()); - // instance.add(Calendar.DAY_OF_MONTH, -1); - // Date time = instance.getTime(); - // //账单开始时间 - // instance.clear(); - // instance.setTime(time); - // instance.add(Calendar.DAY_OF_MONTH, 1); - // wxBillDeposit.setStarttime(instance.getTime()); - wxBillDeposit.setStarttime(record.getFirstBillDateStart()); - // //账单结束时间 - // instance.clear(); - // instance.setTime(time); - // instance.add(dayType, wxPropertyContract.getLease()); - // wxBillDeposit.setEndtime(instance.getTime()); - wxBillDeposit.setEndtime(record.getFirstBillDateEnd()); - wxBillDeposit.setReceiveDate(record.getFirstBillReceiveDate()); - wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(record.getFirstBillReceiveDate())); - wxBillDeposit.updateTenantInfo(wxPropertyContract); - wxBillDeposit.setShopId(shopId); - wxBillDeposit.setCusName(cusName); - wxBillDeposit.setCreatetime(date); - //wxBillDeposit.setCreateBy(user.getId()); - //wxBillDeposit.setCreateByName(user.getName()); - wxBillDeposit.setUpdatetime(date); - //wxBillDeposit.setUpdateBy(user.getId()); - //wxBillDeposit.setUpdateByName(user.getName()); - wxBillDeposit.setShopInfo(getShopInfoStr(wxPropertyContract)); - wxBillDeposit.setRentArea(shoprentArea.toPlainString()); - wxBillDeposit.setEnergyFeesId(EnumBillAllType.PROPERTY_DEPOSIT.getEnergyFeesId()); - - wxBillDeposit.setCreateBy(wxPropertyContract.getCreateBy()); - wxBillDeposit.setUpdateBy(wxPropertyContract.getCreateBy()); - wxBillDeposit.setCreateByName(wxPropertyContract.getCreateByName()); - wxBillDeposit.setUpdateByName(wxPropertyContract.getCreateByName()); - - try { - wxAllBillMapper.insert(wxBillDeposit); - } catch (Exception e) { - logger.error("添加物业押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - } - } - } - - public String getShopInfoStr(WxPropertyContract wxPropertyContract){ - String rentInfo = wxPropertyContract.getRentInfo(); - Map shopInfo = new HashMap<>(); - if (rentInfo != null) { - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - for (int i = 0, size = rentInfoArray.size(); i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("buildArea")); - } - } - return JSONObject.toJSONString(shopInfo); - } - - public List buildRentMonth( MallUserInfo user,WxPropertyContract wxPropertyContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview,boolean saveDb) { - // - Map shopInfo = new HashMap<>(); - if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) { - List shopids = wxPropertyContract.shopIdsByShop(); - WxShop sq = new WxShop(); - sq.updateTenantInfo(wxPropertyContract); - sq.setIds(shopids); - List shs = wxShopMapper.findList(sq); - if (null != shs && shs.size() > 0 ) { - for (int i = 0 ; i < shs.size() ; i ++) { - WxShop s = shs.get(i); - shopInfo.put(s.getShopNumber(), s.getOperationArea()); - } - } - - }else { - String rentInfo = wxPropertyContract.getRentInfo(); - if (rentInfo != null) { - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - for (int i = 0, size = rentInfoArray.size(); i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("buildArea")); - } - } - } - - String[] priceArr = WxRentContractHelper.calcutePropertyPrice(wxPropertyContract); - - int size = priceArr.length; - int month = 12; - int billcount = 0; - List resultList = new ArrayList(); - - List yearList = new ArrayList<>(); - for (int i = 0; i < size; i++) { - Calendar instance = Calendar.getInstance(); - Date startDate; -// //自然月 -// if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ -// if(i == 0){ //第一期 -// startDate = rentalStartDate; -// }else{ -// instance.setTime(rentalStartDate); -// instance.add(Calendar.MONTH, month * i); -// startDate = DateUtils.getFirstDayForCurrMonth(instance.getTime()); -// } -// }else{ - instance.setTime(rentalStartDate); - instance.set(Calendar.MILLISECOND, 0); - instance.add(Calendar.MONTH, month * i); - startDate = instance.getTime(); -// } - yearList.add(startDate); - } - Map resultMap = buildRent(receivePeriod, priceArr, yearList, wxPropertyContract.getReceivePeriodUnit(), wxPropertyContract, user, billcount, isPreview, shopInfo,saveDb); - List billRentList = (List)resultMap.get("billList"); - resultList.addAll(billRentList); - return resultList; - } - - public Map buildRent(int receivePeriod,String[] priceArrs, List yearList,int dayType, WxPropertyContract wxPropertyContract, MallUserInfo user, int billcount, Integer isPreview,Map shopInfo,boolean saveDb) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxPropertyContract); - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - Map resultMap = new HashedMap(); - List propertyResultList = new ArrayList(); - List fixedResultList = new ArrayList(); - - Date endDate = null; - if(yearList.size() > 1){ - endDate = yearList.get(1); - } - - List shopIdList = wxPropertyContract.shopIdsByShop(); - Map shopAreaRateMap = wxPropertyContract.getRentShopArea(); - if (null == shopAreaRateMap) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); - } - - List billTimeVoList = new ArrayList<>(); - if(saveDb){ - billTimeVoList = WxRentContractServiceImpl.initBillTimeList(yearList,wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod,wxPropertyContract.getPayPeriodRate()); - }else{ - //预账单编辑账期,生成金额 - for (WxAllBill rent:wxPropertyContract.getPreviewBillRentList()) { - BillTimeVo billTimeVo = new BillTimeVo(); - billTimeVo.setStartDate(rent.getStarttime()); - billTimeVo.setEndDate(rent.getEndtime()); - billTimeVo.setReceiveDate(DateUtils.getDaySet(rent.getStarttime(),Calendar.DATE,-1)); - billTimeVoList.add(billTimeVo); - } - } - - Date firstBillStartDate = null; - Date firstBillEndDate = null; - if (null != billTimeVoList && billTimeVoList.size() > 0 ) { - BillTimeVo firstBillTime = billTimeVoList.get(0); - WxPropertyContract cupdate = new WxPropertyContract(); - cupdate.updateTenantInfo(wxPropertyContract); - cupdate.setId(wxPropertyContract.getId()); - cupdate.setFirstBillDateStart(firstBillTime.getStartDate()); - cupdate.setFirstBillDateEnd(firstBillTime.getEndDate()); - cupdate.setFirstBillReceiveDate(firstBillTime.getReceiveDate()); - cupdate.setDecimalSize(null);//去掉默认的,避免更新 - wxPropertyContractMapper.updateById(cupdate); - firstBillStartDate = firstBillTime.getStartDate(); - firstBillEndDate = firstBillTime.getEndDate(); - } - - //结算其他金额 - //一次性费用的,只有一个账单。 - List fixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),firstBillStartDate, - firstBillEndDate,true,wxPropertyContract.getRentArea(),wxPropertyContract.getPayPeriodRate(),wxPropertyContract.getAdjustPeriod(),wxPropertyContract.getReceivePeriod(), - wxPropertyContract.getReceivePeriodUnit()); - - - int index = 0; - for (int i = 0; i < billTimeVoList.size(); i++) { - BillTimeVo billTimeVo = billTimeVoList.get(i); - //计算金额 - String needpay = "0"; - String standarsTotal = "0"; - - //非一次性费用的,跟随物业账单的周期 - List unFixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),null,null,false,null,null, - null,null,null); - - - boolean flag = false; - //超过1年 - if(yearList.size() > 1) { - //从第二年开始 - if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { - //logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); - - index++; - - //如果是计算账单金额&cross 拆分日期进行计算 - if(!saveDb && billTimeVo.getEndDate().after(endDate)) { - String needpayFront = "0"; - String needpayAfter = "0"; - //同一天,算一天 - if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ - needpayFront = getNeedPayMoney(wxPropertyContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); - standarsTotal = calcuteStandardsFee(unFixedList, billTimeVo.getStartDate(), endDate, wxPropertyContract); - }else{ - if(billTimeVo.getStartDate().before(endDate)){ - needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate,Calendar.SECOND,-1), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - needpayAfter = getNeedPayMoney(wxPropertyContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - }else{ - needpayFront = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - } - standarsTotal = calcuteStandardsFee(unFixedList, billTimeVo.getStartDate(), billTimeVo.getEndDate(), wxPropertyContract); - } - needpay = needpayFront+needpayAfter; - flag = true; - } - if(index >= yearList.size()-1){ - endDate = null; - }else{ - endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 - //logger.info("==========cross:"+sd.format(endDate)); - } - } - } - - //第一年的,计算金额 - if(!flag){ - needpay = getNeedPayMoney(wxPropertyContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); - standarsTotal = calcuteStandardsFee(unFixedList, billTimeVo.getStartDate(), billTimeVo.getEndDate(), wxPropertyContract); - } - - ++billcount; - //物业主账单 - WxAllBill wxBillProperty = generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,billTimeVo.getStartDate(),billTimeVo.getEndDate(),billTimeVo.getReceiveDate(),needpay,user,billcount,shopInfo,standarsTotal,"",null,null,false); - //设置物业科目 - wxBillProperty.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); - //非一次性账单 - wxBillProperty.setUnFixedbillFeesStandardsList(unFixedList); - List childList = null; - //每个非从一次性都要创建账单 - if (null != unFixedList && unFixedList.size() > 0 ) { - childList = new ArrayList(); - for (int j = 0 ; j < unFixedList.size(); j ++ ) { - WxBillFeesStandardsListVo svo = unFixedList.get(j); - svo.setParentBillId(wxBillProperty.getId()); - WxAllBill property = generateBillPropertyByBillStandards(wxBillProperty,wxPayAccountBill,wxPropertyContract,isPreview,user,svo,billcount,shopInfo); - //设置科目 - property.setEnergyFeesId(svo.getFeeStandards().getId()); - property.setFeesStandarsId(property.getEnergyFeesId());//合同动态表格需要。 - childList.add(property); - } - } - wxBillProperty.setChildList(childList); - //主账单列表 - propertyResultList.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); - fixedResultList.add(property); - } - } - - //批量生成预账单 - if(saveDb) { - WxShopUsers suq = new WxShopUsers(); - suq.updateTenantInfo(wxPropertyContract); - suq.setShopIds(shopIdList); - suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); - Map shopUserMap = wxShopService.getShopUserMap(suq); - //根据店铺来拆分 - List shopAllBillList = new ArrayList(); - - 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); - } - } - } - - if (shopAllBillList.size() > 0 ) { - wxAllBillMapper.insertBills(wxPropertyContract.getTenantId() ,shopAllBillList); - } - //for (int i = 0 ; i < resultList.size() ; i++) { - // wxBillPropertyMapper.insert(resultList.get(i)); - //} - } - resultMap.put("billcount",billcount); - resultMap.put("billList",propertyResultList); - return resultMap; - } - - private void setNewsBills(WxPropertyContract wxPropertyContract,WxAllBill newBill,WxAllBill oldBill,Long shopId,Map shopAreaRateMap,Map 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 shopInfo) { - Long feesStandardsId = svo.getFeeStandards().getId(); - boolean isDeposit = svo.isDeposit(); - Date receiveDate = svo.getReceiveDate(); - if (null != wxBillProperty) { - receiveDate = wxBillProperty.getReceiveDate(); - } - return generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,svo.getStart(),svo.getEnd(),receiveDate,svo.getTotal(),user,billcount,shopInfo,"0",svo.getBillName(),svo.getParentBillId(),feesStandardsId,isDeposit); - } - - private WxAllBill generateBillProperty(WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,Date start,Date end,Date receiveDate,String needpay, - MallUserInfo user,Integer billcount,Map shopInfo,String standarsTotal,String remark,Long parentBillId,Long feesStandardsId,boolean isDeposit) { - if (StringUtils.isBlank(needpay)) { - needpay = "0"; - }else { - needpay = new BigDecimal(needpay).setScale(wxPropertyContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString(); - } - final IdWorker idWorker = IdWorker.get(); - WxAllBill wxBillProperty = new WxAllBill(); - wxBillProperty.setIsPreview(isPreview); - wxBillProperty.setId(idWorker.nextId()); - if (isDeposit) { - wxBillProperty.setBillType(EnumBillAllType.PROPERTY_DEPOSIT.getCode()); - }else { - wxBillProperty.setBillType(EnumBillAllType.PROPERTY.getCode()); - } - wxBillProperty.setPropertyContractId(wxPropertyContract.getId()); - wxBillProperty.setPay("0"); - wxBillProperty.setStarttime(start); - wxBillProperty.setEndtime(end); - wxBillProperty.setReceiveDate(receiveDate); - wxBillProperty.setPeriod(WxRentContractHelper.getPeriod(receiveDate)); - wxBillProperty.setCanEdit(EnumYesOrNo.NO.getCode()); - - wxBillProperty.setNeedPay(needpay); - //wxBillProperty.setOwe(needpay); - wxBillProperty.setReceivePay(needpay); - - //截止收租日在当前时间之前 - Date date = new Date(); - //setExpiredDay(wxBillProperty,dayType,receivePeriod); - wxBillProperty.updateTenantInfo(wxPropertyContract); - //wxBillProperty.setUserId(user.getId()); - //wxBillProperty.setShopId(wxPropertyContract.getShopId()); - wxBillProperty.setCreatetime(date); - wxBillProperty.setCreateBy(user.getId()); - wxBillProperty.setCreateByName(user.getName()); - wxBillProperty.setUpdatetime(date); - wxBillProperty.setUpdateBy(user.getId()); - wxBillProperty.setUpdateByName(user.getName()); - //wxBillProperty.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - //wxBillProperty.setPeriod(billcount); - if (shopInfo != null) { - wxBillProperty.setShopInfo(JSONObject.toJSONString(shopInfo)); - } - wxBillProperty.setRentArea(wxPropertyContract.getRentArea()); - //wxBillProperty.setLatePayRatio(0); - wxBillProperty.setTotalFee(new BigDecimal(needpay).add(new BigDecimal(standarsTotal)).toPlainString()); - wxBillProperty.setBillRemark(remark); - wxBillProperty.setParentBillId(parentBillId); - wxBillProperty.setEnergyFeesId(feesStandardsId); - - //计算手续费 - //BigDecimal servicePay = new BigDecimal(wxBillProperty.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), wxPropertyContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - //wxBillProperty.setServiceChargePay(servicePay.toPlainString()); - //wxBillProperty.setOwe(new BigDecimal(wxBillProperty.getReceivePay()).add(new BigDecimal(wxBillProperty.getServiceChargePay())).toPlainString()); - //wxBillProperty.setOwe(new BigDecimal(wxBillProperty.getReceivePay()).toPlainString()); - - return wxBillProperty; - } - - - private String calcuteStandardsFee(List unFixedList,Date start,Date end,WxPropertyContract wxPropertyContract) { - EnumRentDayPriceCalcute dayPrice = EnumRentDayPriceCalcute.getEnum(wxPropertyContract.getDayPriceCalcute()); - if (null != unFixedList) { - BigDecimal total = new BigDecimal(0); - for (int j = 0 ; j < unFixedList.size(); j ++) { - WxBillFeesStandardsListVo bfsvo = unFixedList.get(j); - WxEnergyFees feeStandars = bfsvo.getFeeStandards(); - if(EnumFeesStandardsCalcuteUnit.MM.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { - bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,wxPropertyContract.getRentArea(),false,dayPrice, - wxPropertyContract.getMonthAverageDays(),EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); - }else if (EnumFeesStandardsCalcuteUnit.HU.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { - bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays(), - EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); - }else { - bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays(), - EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); - } - bfsvo.setStart(start); - bfsvo.setEnd(end); - bfsvo.setReceiveDate(DateUtils.getDaySet(start,Calendar.DATE,-1)); - total = total.add(new BigDecimal(bfsvo.getTotal()));; - } - return total.toPlainString(); - } - return "0"; - } - - public String getNeedPayMoney(WxPropertyContract wxRentContract,String price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ - EnumRentDayPriceCalcute dayPrice = EnumRentDayPriceCalcute.getEnum(wxRentContract.getDayPriceCalcute()); - String needpay; - //按日 - if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ - BigDecimal priceD = new BigDecimal(price); - String needpayD = WxRentContractHelper.getNeedPay(null,wxRentContract.getDecimalSize(),priceD,startDate,endDate,dayPrice,wxRentContract.getMonthAverageDays()); - needpay = needpayD; - //按月计算 - }else{ - //年 需要除12 - BigDecimal priceD = new BigDecimal(price); - if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ - priceD = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - - //生成金额直接计算 - if(!saveDb){ - needpay = WxRentContractHelper.getMonthNeedPay(null,wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays()); - return needpay; - } - needpay = WxRentContractHelper.getMonthNeedPay(null,wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,wxRentContract.getDayPriceCalcute(),wxRentContract.getMonthAverageDays()); - } - return needpay; - } - - public boolean isFirstDay(Date date){ - int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); - if(dateInt == 1){ - return true; - } - return false; - } - - /** - * 根据商户/指定物业合同生成物业账单 - * @param wxMerchant - * @param propertyContract - * @return - */ - //@Transactional(rollbackFor = {Exception.class}) - public List buildProperty(MallUserInfo user,WxPropertyContract propertyContract,Integer isPreview,boolean saveDb) { - List result = new ArrayList(); - - int receivePeriod = propertyContract.getReceivePeriod().intValue(); - Integer lease = propertyContract.getLease(); - Date rentalStartDate = propertyContract.getRentalStartDate(); - if (EnumRentStartType.STARTTIME.getCode().equals(propertyContract.getRentStartType())) { - rentalStartDate = propertyContract.getStartDate(); - } - propertyContract.setRentalStartDate(rentalStartDate); - String price = propertyContract.getPrice(); - - //按月计租 - result = buildRentMonth(user, propertyContract, receivePeriod, lease, rentalStartDate,isPreview,saveDb); - //for (int i = 0; i < result.size(); i++) { - // result.get(i).setPeriod(i+1); - //} - return result; - } - - @Override - public void deleteById(Long id) { - wxPropertyContractMapper.deleteById(id); - } - - - @Override - public void download(HttpServletRequest request, HttpServletResponse response) { - String id = request.getParameter("id"); - WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(id); - - String filesuffix = wxPropertyContract.getFilepath().substring(wxPropertyContract.getFilepath().lastIndexOf(".")); - String filename = UUID.randomUUID() + filesuffix; - String filepath = fmUploadDir; - String destPath = filepath + filename; - File dest = new File(destPath); - File pDest = dest.getParentFile(); - if (!pDest.exists()) { - pDest.mkdirs(); - } - try { - String exportFileName = wxPropertyContract.getFilename(); - downLoadFromUrl(wxPropertyContract.getFilepath(), filename, filepath); - downFile(destPath, wxPropertyContract.getFilename(), exportFileName,response, request); - org.apache.commons.io.FileUtils.forceDelete(dest); - } catch (IOException e) { - logger.info("创建本地文件失败" + e.getMessage()); - } - } - - public static void downLoadFromUrl(String urlStr, String fileName, String savePath) throws IOException { - URL url = new URL(urlStr); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - //设置超时间为3秒 - conn.setConnectTimeout(3 * 1000); - //防止屏蔽程序抓取而返回403错误 - conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); - - //得到输入流 - InputStream inputStream = conn.getInputStream(); - //获取自己数组 - byte[] getData = readInputStream(inputStream); - - //文件保存位置 - File saveDir = new File(savePath); - if (!saveDir.exists()) { - saveDir.mkdir(); - } - File file = new File(saveDir + File.separator + fileName); - FileOutputStream fos = new FileOutputStream(file); - fos.write(getData); - if (fos != null) { - fos.close(); - } - if (inputStream != null) { - inputStream.close(); - } - - - System.out.println("info:" + url + " download success"); - - } - - public static byte[] readInputStream(InputStream inputStream) throws IOException { - byte[] buffer = new byte[1024]; - int len = 0; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - while ((len = inputStream.read(buffer)) != -1) { - bos.write(buffer, 0, len); - } - bos.close(); - return bos.toByteArray(); - } - - public void downFile(String filePath, String filename, String exportFileName, HttpServletResponse response, - HttpServletRequest req) { - try { - response.reset(); - response.setContentType("bin"); - String agent = req.getHeader("user-agent"); - if (agent.contains("Firefox")) { - response.setHeader("Content-disposition", "attachment; filename=" + new String(exportFileName.getBytes("GB2312"), "ISO-8859-1")); - } else { - response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode(exportFileName, "UTF-8")); - } - // 循环取出流中的数据 - byte[] b = new byte[1024]; - int len; - InputStream inStream = new FileInputStream(filePath); - while ((len = inStream.read(b)) > 0) - response.getOutputStream().write(b, 0, len); - inStream.close(); - } catch (Exception e) { - logger.info("下载合同失败" + e.getMessage()); - e.printStackTrace(); - } - } - - @Override - public void endContract(WxPropertyContract wxPropertyContract,MallUserInfo userInfo) { - wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); - wxPropertyContractMapper.updateStatus(wxPropertyContract); - -// WxBillProperty wxBillProperty = new WxBillProperty(); -// wxBillProperty.setPropertyContractId(wxPropertyContract.getId()); -// wxBillPropertyMapper.updateInvalidStatus(wxBillProperty); - wxBillAllHelper.propertyContractStop(wxPropertyContract,userInfo); - } - - @Override - public WxPropertyContract getByBill(WxAllBill billRent) { - return wxPropertyContractMapper.getByBill(billRent); - } - - @Override - public ResultData apply(WxPropertyContract record, MallUserInfo user) { - - WxPropertyContract rentContract = wxPropertyContractMapper.selectById(record.getId()); - if (null == rentContract) { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]未找到物业合同"); - } - rentContract.setFlowParams(record.getFlowParams()); - if (CollectionUtils.isEmpty(rentContract.getFlowParams())) { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同没有审批流程."); - } - - if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue()) - || (EnumRentContractStatus.PERFORMANCE.getCode().intValue() == rentContract.getStatus().intValue() - && (EnumRentContractAppStatus.REJECT.getCode().intValue() == rentContract.getApplyStatus().intValue() || - EnumRentContractAppStatus.SETBACK.getCode().intValue() == rentContract.getApplyStatus().intValue())) - ) { - Integer bussinessType = (Integer) rentContract.getFlowParams().get("businessType"); - if (null == bussinessType) { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同FlowParams错误,未找到businessType."); - } - WxFlowModel flowModle = wxFlowService.getModelByType(bussinessType, rentContract); - if (null == flowModle) { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同配置的流程["+String.valueOf(bussinessType)+"]未找到流程模板."); - } - wxFlowService.start(rentContract.getFlowParams(), user.getId(), user.getName(), rentContract); - return new ResultData(Result.SUCCESS,"提交审批成功",rentContract); - }else { - return new ResultData(Result.ERROR, "编号["+record.getId()+"]物业合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); - } - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public void renewal(WxPropertyContract record, MallUserInfo user,boolean aliasRentContract) { - final IdWorker idWorker = IdWorker.get(); - Long newContractId = idWorker.nextId(); - //拷贝 - WxContractShop csq = new WxContractShop(); - csq.updateTenantInfo(record); - csq.setContractId(record.getId()); - List csqlist = wxContractShopMapper.findList(csq); - if (null != csqlist && csqlist.size() > 0 ){ - for ( int i = 0 ; i< csqlist.size() ; i ++) { - WxContractShop cs = csqlist.get(i); - cs.setId(idWorker.nextId()); - cs.setContractId(newContractId); - cs.setCreateDate(new Date()); - cs.setUpdateDate(new Date()); - wxContractShopMapper.insert(cs); - } - } - record.setId(newContractId); - record.setCreatetime(new Date()); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); - record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); - record.setEndContractTime(null); - record.setFirstBillDateStart(null); - record.setFirstBillDateEnd(null); - record.setFirstBillReceiveDate(null); - int[] array = DateUtils.getDiff(record.getRentalStartDate(),record.getRentalEndDate()); - record.setLease(array[0]); - if (aliasRentContract) { - //record.setRentContractId(null); - record.setCreateType(EnumPropertyCreateType.BY_RENT.getCode()); - }else { - record.setRentContractId(null); - record.setCreateType(EnumPropertyCreateType.BY_SHOP.getCode()); - } - wxPropertyContractMapper.insert(record); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public void transfer(WxPropertyContract record, MallUserInfo user) { - this.setCustomers(record); - record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - wxPropertyContractMapper.updateById(record); - - //更新账单归属 - WxAllBill bill = new WxAllBill(); - bill.updateTenantInfo(record); - bill.setPropertyContractId(record.getId()); - bill.setCusName(record.getCustomerName()); - wxAllBillMapper.transferCusName(bill); - } - - @Override - public void outDateContract(WxMall wxMall) { - //查询有计租合同的商户 - WxPropertyContract wr = new WxPropertyContract(); - wr.setStatuss(EnumRentContractStatus.getValidStatus()); - wr.updateTenantInfo(wxMall); - List contractList = wxPropertyContractMapper.findList(wr); - for (WxPropertyContract contract: contractList) { - try { - - if (contract.getRentalEndDate().before(new Date())) { - contract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); - wxPropertyContractMapper.updateById(contract); - } - }catch(Exception e) { - logger.error("WxPropertyContract["+contract.getId()+"] outDateContract error.",e); - } - - } - } - - @Override - public WxPropertyContract getSimpleDetail(Long id) { - return wxPropertyContractMapper.selectById(id); - } - - @Override - public void updatePropertyContract(WxPropertyContract record) { - wxPropertyContractMapper.updateById(record); - } - - @Override - public void readyToNomal(WxMall wxMall) { - WxPropertyContract wr = new WxPropertyContract(); - wr.setStatus(EnumRentContractStatus.READY_FOR_PAING.getCode()); - wr.updateTenantInfo(wxMall); - List contractList = wxPropertyContractMapper.findList(wr); - for (WxPropertyContract contract: contractList) { - try { - - if (contract.getRentalStartDate().before(new Date())) { - contract.setStatus(EnumRentContractStatus.PAING.getCode()); - wxPropertyContractMapper.updateById(contract); - } - }catch(Exception e) { - logger.error("WxPropertyContract["+contract.getId()+"] outDateContract error.",e); - } - - } - } - - @Override - public void setEndContractTime(WxPropertyContract proertyContract) { - wxPropertyContractMapper.setEndContractTime(proertyContract); - } - - @Override - public List findToEndContractList(WxPropertyContract record) { - return wxPropertyContractMapper.findToEndContractList(record); - } - - @Override - public List findToOutDateContracts(TenantEntity tenantEntity) { - WxPropertyContract wrc = new WxPropertyContract(); - wrc.setStatus(EnumRentContractStatus.PAING.getCode()); - wrc.setOutDateNofity(1); - return wxPropertyContractMapper.findList(wrc); - } - - @Override - public BigDecimal calcuteContractUsedShopArea(WxPropertyContract record) { - return null; - } -} - - - - diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 46fc75c0e..fdf5ffbaf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -16,14 +16,13 @@ import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillAction; import com.iformall.domain.po.WxContractCustomers; import com.iformall.domain.po.WxContractShop; -import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFinanceFees; import com.iformall.domain.po.WxFlowModel; import com.iformall.domain.po.WxFlowRecord; import com.iformall.domain.po.WxMall; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantTradeDaily; import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxRentContractFreePeriod; import com.iformall.domain.po.WxRentContractRevenueJump; @@ -40,7 +39,6 @@ import com.iformall.domain.vo.WxRentContractRevenueSetSalesVo; import com.iformall.domain.vo.WxRentContractYearsSumVo; import com.iformall.domain.vo.WxRentContractYearsVo; import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillAllType; import com.iformall.enums.EnumBillExtraCreateFrom; import com.iformall.enums.EnumBillStatus; import com.iformall.enums.EnumContractCustomersStatus; @@ -80,7 +78,6 @@ import com.iformall.mapper.WxFlowRecordMapper; import com.iformall.mapper.WxMerchantMapper; import com.iformall.mapper.WxMerchantShopMapper; import com.iformall.mapper.WxMerchantTradeDailyMapper; -import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractFreePeriodMapper; import com.iformall.mapper.WxRentContractMapper; import com.iformall.mapper.WxRentContractRevenueJumpMapper; @@ -95,10 +92,10 @@ import com.iformall.service.WxFlowService; import com.iformall.service.WxMallService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; import com.iformall.service.WxShopService; import com.iformall.service.helper.WxBillAllHelper; +import com.iformall.service.helper.WxRentContractAgileHelper; import com.iformall.service.helper.WxRentContractHelper; import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; @@ -174,9 +171,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxMerchantService wxMerchantService; - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - @Autowired WxMerchantMapper wxMerchantMapper; @@ -212,10 +206,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxAllBillMapper wxAllBillMapper; - @Lazy - @Autowired - WxPropertyContractService wxPropertyContractService; - @Lazy @Autowired WxAgileContractService wxAgileContractService; @@ -257,216 +247,216 @@ public class WxRentContractServiceImpl implements WxRentContractService { return wxRentContractMapper.findIdList(record); } - @Override - public Map getById(Long id,Integer noBillList) { - Map result = new HashMap<>(); - WxRentContract wxRentContract = wxRentContractMapper.selectById(id); - if (wxRentContract == null) { - throw new MallinkException(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); - } - - WxContractCustomers customers = wxContractCustomersMapper.selectById(wxRentContract.getCustomersId(),wxRentContract.getTenantId()); - wxRentContract.setCustomerType(customers.getPrincipalType()); - wxRentContract.setCustomerLinkPerson(customers.getLinkPerson()); - wxRentContract.setCustomerName(customers.getName()); - wxRentContract.setCustomerPhone(customers.getPhone()); - wxRentContract.setCustomerLegalPerson(customers.getLegalPerson()); - - //init dateDiff - if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ - //加1天 - Date newEndDate = DateUtils.getDaySet(wxRentContract.getRentalEndDate(),Calendar.DATE,1); - int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),newEndDate); - result.put("totalPeriodMonth",array[0]); - result.put("totalPeriodDay",array[1]); - } - - //init 租赁单价 - String rentInfo = wxRentContract.getRentInfo(); - if(StringUtils.isNotBlank(rentInfo)){ - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - //查询rent_info 包括shopId - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - BigDecimal rentPrice = rentInfoObject.getBigDecimal("rentPrice"); - //wxRentContract.setShopId(rentInfoObject.getLong("shopId")); - String price = wxRentContract.getPrice(); - if(rentPrice == null){ - if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { - Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - rentInfoObject.put("rentPrice", rentPrice); - } - } - } - wxRentContract.setRentInfo(rentInfoArray.toJSONString()); - }else{ - if(wxRentContract.getRentPrice() == null || "0".equals(wxRentContract.getRentPrice())){ - if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { - String price = wxRentContract.getPrice(); - Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - BigDecimal rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - if(rentPrice.compareTo(new BigDecimal(0)) > 0){ - wxRentContract.setRentPrice(rentPrice.toString()); - }else{ - wxRentContract.setRentPrice("0"); - } - } - - } - } - if(wxRentContract.getPriceUnit() == null){ - wxRentContract.setPriceUnit(EnumPriceUnit.M.getCode()); - } - if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ - wxRentContract.setAdjustPeriod(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()); - wxRentContract.setPriceUnit(EnumPriceUnit.D.getCode()); - } - - //商场信息 - WxMall wxMall = new WxMall(); - wxMall.setTenantInfo(wxRentContract); - List mallList = wxMallService.findList(wxMall); - if (!mallList.isEmpty()) { - result.put("mall", mallList.get(0)); - } - wxRentContract.setPrice(StringUtils.isNotBlank(wxRentContract.getPrice()) ? wxRentContract.getPrice() : "0"); - wxRentContract.setDeposit(StringUtils.isNotBlank(wxRentContract.getDeposit()) ? wxRentContract.getDeposit() : "0"); - - //免租期 - WxRentContractFreePeriod fpq = new WxRentContractFreePeriod(); - fpq.updateTenantInfo(wxRentContract); - fpq.setRentContractId(wxRentContract.getId()); - fpq.setSortColumn("year_index asc,start_date asc"); - List freePeroids = wxRentContractFreePeriodMapper.findList(fpq); - wxRentContract.setFreeVo(freePeroids); - - //跳点设置 - WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); - jq.updateTenantInfo(wxRentContract); - jq.setRentContractId(wxRentContract.getId()); - wxRentContract.setRevenueJumps(wxRentContractRevenueJumpMapper.findList(jq)); - result.put("wxRentContract", wxRentContract); - //关联的店铺 - if (wxRentContract.shopIdsByRentInfo().size()> 0) { - WxShop record = new WxShop(); - //record.setId(wxRentContract.getShopId()); - record.setIds(wxRentContract.shopIdsByRentInfo()); - record.updateTenantInfo(wxRentContract); - PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); - List> list = shopPageInfo.getList(); - result.put("wxShops", list); - } else { - result.put("wxShops", Collections.EMPTY_LIST); - } - //设置审批流程状态 - result.put("applyStatus", wxRentContract.getApplyStatus()); - - //发起人备注 - WxFlowRecord wxFlowRecord = new WxFlowRecord(); - wxFlowRecord.setBusinessId(String.valueOf(id)); - wxFlowRecord.setStatus(EnumFlowRecordStatus.NEW.getCode()); - List flowRecordList = wxFlowRecordService.findList(wxFlowRecord); - if(!CollectionUtils.isEmpty(flowRecordList)){ - result.put("remark",flowRecordList.get(0).getRemark()); - } - - //查询预账单用于展示 - if (null != noBillList && EnumYesOrNo.YES.getCode().intValue() == noBillList.intValue()) { - }else { - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setRentContractId(id); - wxBillRent.updateTenantInfo(wxRentContract); - wxBillRent.setBillType(EnumBillAllType.RENT.getCode()); - List resultList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent); - result.put("previewBillRentList",resultList); - } - - return result; - } +// @Override +// public Map getById(Long id,Integer noBillList) { +// Map result = new HashMap<>(); +// WxRentContract wxRentContract = wxRentContractMapper.selectById(id); +// if (wxRentContract == null) { +// throw new MallinkException(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); +// } +// +// WxContractCustomers customers = wxContractCustomersMapper.selectById(wxRentContract.getCustomersId(),wxRentContract.getTenantId()); +// wxRentContract.setCustomerType(customers.getPrincipalType()); +// wxRentContract.setCustomerLinkPerson(customers.getLinkPerson()); +// wxRentContract.setCustomerName(customers.getName()); +// wxRentContract.setCustomerPhone(customers.getPhone()); +// wxRentContract.setCustomerLegalPerson(customers.getLegalPerson()); +// +// //init dateDiff +// if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ +// //加1天 +// Date newEndDate = DateUtils.getDaySet(wxRentContract.getRentalEndDate(),Calendar.DATE,1); +// int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),newEndDate); +// result.put("totalPeriodMonth",array[0]); +// result.put("totalPeriodDay",array[1]); +// } +// +// //init 租赁单价 +// String rentInfo = wxRentContract.getRentInfo(); +// if(StringUtils.isNotBlank(rentInfo)){ +// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); +// int size = rentInfoArray.size(); +// //查询rent_info 包括shopId +// for (int i = 0; i < size; i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// BigDecimal rentPrice = rentInfoObject.getBigDecimal("rentPrice"); +// //wxRentContract.setShopId(rentInfoObject.getLong("shopId")); +// String price = wxRentContract.getPrice(); +// if(rentPrice == null){ +// if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { +// Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); +// rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); +// rentInfoObject.put("rentPrice", rentPrice); +// } +// } +// } +// wxRentContract.setRentInfo(rentInfoArray.toJSONString()); +// }else{ +// if(wxRentContract.getRentPrice() == null || "0".equals(wxRentContract.getRentPrice())){ +// if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { +// String price = wxRentContract.getPrice(); +// Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); +// BigDecimal rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea),wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); +// if(rentPrice.compareTo(new BigDecimal(0)) > 0){ +// wxRentContract.setRentPrice(rentPrice.toString()); +// }else{ +// wxRentContract.setRentPrice("0"); +// } +// } +// +// } +// } +// if(wxRentContract.getPriceUnit() == null){ +// wxRentContract.setPriceUnit(EnumPriceUnit.M.getCode()); +// } +// if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ +// wxRentContract.setAdjustPeriod(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()); +// wxRentContract.setPriceUnit(EnumPriceUnit.D.getCode()); +// } +// +// //商场信息 +// WxMall wxMall = new WxMall(); +// wxMall.setTenantInfo(wxRentContract); +// List mallList = wxMallService.findList(wxMall); +// if (!mallList.isEmpty()) { +// result.put("mall", mallList.get(0)); +// } +// wxRentContract.setPrice(StringUtils.isNotBlank(wxRentContract.getPrice()) ? wxRentContract.getPrice() : "0"); +// wxRentContract.setDeposit(StringUtils.isNotBlank(wxRentContract.getDeposit()) ? wxRentContract.getDeposit() : "0"); +// +// //免租期 +// WxRentContractFreePeriod fpq = new WxRentContractFreePeriod(); +// fpq.updateTenantInfo(wxRentContract); +// fpq.setRentContractId(wxRentContract.getId()); +// fpq.setSortColumn("year_index asc,start_date asc"); +// List freePeroids = wxRentContractFreePeriodMapper.findList(fpq); +// wxRentContract.setFreeVo(freePeroids); +// +// //跳点设置 +// WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); +// jq.updateTenantInfo(wxRentContract); +// jq.setRentContractId(wxRentContract.getId()); +// wxRentContract.setRevenueJumps(wxRentContractRevenueJumpMapper.findList(jq)); +// result.put("wxRentContract", wxRentContract); +// //关联的店铺 +// if (wxRentContract.shopIdsByRentInfo().size()> 0) { +// WxShop record = new WxShop(); +// //record.setId(wxRentContract.getShopId()); +// record.setIds(wxRentContract.shopIdsByRentInfo()); +// record.updateTenantInfo(wxRentContract); +// PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); +// List> list = shopPageInfo.getList(); +// result.put("wxShops", list); +// } else { +// result.put("wxShops", Collections.EMPTY_LIST); +// } +// //设置审批流程状态 +// result.put("applyStatus", wxRentContract.getApplyStatus()); +// +// //发起人备注 +// WxFlowRecord wxFlowRecord = new WxFlowRecord(); +// wxFlowRecord.setBusinessId(String.valueOf(id)); +// wxFlowRecord.setStatus(EnumFlowRecordStatus.NEW.getCode()); +// List flowRecordList = wxFlowRecordService.findList(wxFlowRecord); +// if(!CollectionUtils.isEmpty(flowRecordList)){ +// result.put("remark",flowRecordList.get(0).getRemark()); +// } +// +// //查询预账单用于展示 +// if (null != noBillList && EnumYesOrNo.YES.getCode().intValue() == noBillList.intValue()) { +// }else { +// WxAllBill wxBillRent = new WxAllBill(); +// wxBillRent.setRentContractId(id); +// wxBillRent.updateTenantInfo(wxRentContract); +// wxBillRent.setBillType(EnumBillAllType.RENT.getCode()); +// List resultList = wxAllBillMapper.findContractSamePeriodSum(wxBillRent); +// result.put("previewBillRentList",resultList); +// } +// +// return result; +// } @Override public WxRentContract selectById(Long id) { return wxRentContractMapper.selectById(id); } - @Transactional(rollbackFor = {Exception.class}) - @Override - public ResultData save(WxRentContract record,MallUserInfo user,String userName,Date oldRentStartDate) { - //保存租赁合同信息 - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - int dayType = record.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; - //计租开始时间 - Calendar instance = Calendar.getInstance(); - instance.setTime(record.getRentalStartDate()); - instance.add(dayType, record.getLease()); - instance.add(Calendar.DAY_OF_MONTH, -1); - //计租结束时间 - if (!record.getStartDate().equals(record.getRentalStartDate())) { - instance.clear(); - instance.setTime(record.getRentalStartDate()); - instance.add(Calendar.DAY_OF_MONTH, -1); - record.setEndDate(instance.getTime()); - } else { - record.setEndDate(record.getStartDate()); - } - - if (StringUtils.isEmpty(record.getPrice())) { - record.setPrice("0"); - } - if (StringUtils.isEmpty(record.getDeposit())) { - record.setDeposit("0"); - } - - Date date = new Date(); - record.setCreatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - - List shopList = Lists.newArrayList(); - String rentInfo = record.getRentInfo(); - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - if (size == 0) { - return new ResultData(ErrorCode.SHOP_NOT_SELECTED); - } - //查询rent_info 包括 shopId - String shopIdStr = ""; - BigDecimal rentArea = new BigDecimal(0); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - Long shopId = rentInfoObject.getLong("id"); - rentArea = rentArea.add(new BigDecimal(rentInfoObject.getString("operationArea"))); - if (!shopList.contains(shopId)) { - shopList.add(shopId); - shopIdStr = shopIdStr +","+ shopId; - } - } - record.setRentArea(rentArea.toPlainString()); - setShops(record,shopList); - //关联客户 - setCustomers(record); - try { - record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); - record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); - Date tempDate = record.getRentalStartDate(); - record.setRentalStartDate(oldRentStartDate); - record.setShopIdStr(shopIdStr); - record.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); - wxRentContractMapper.insert(record); - record.setRentalStartDate(tempDate); - } catch (Exception e) { - logger.error("保存租赁合同信息失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - - return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); - } +// @Transactional(rollbackFor = {Exception.class}) +// @Override +// public ResultData save(WxRentContract record,MallUserInfo user,String userName,Date oldRentStartDate) { +// //保存租赁合同信息 +// final IdWorker idWorker = IdWorker.get(); +// record.setId(idWorker.nextId()); +// int dayType = record.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; +// //计租开始时间 +// Calendar instance = Calendar.getInstance(); +// instance.setTime(record.getRentalStartDate()); +// instance.add(dayType, record.getLease()); +// instance.add(Calendar.DAY_OF_MONTH, -1); +// //计租结束时间 +// if (!record.getStartDate().equals(record.getRentalStartDate())) { +// instance.clear(); +// instance.setTime(record.getRentalStartDate()); +// instance.add(Calendar.DAY_OF_MONTH, -1); +// record.setEndDate(instance.getTime()); +// } else { +// record.setEndDate(record.getStartDate()); +// } +// +// if (StringUtils.isEmpty(record.getPrice())) { +// record.setPrice("0"); +// } +// if (StringUtils.isEmpty(record.getDeposit())) { +// record.setDeposit("0"); +// } +// +// Date date = new Date(); +// record.setCreatetime(date); +// record.setCreateBy(user.getId()); +// record.setCreateByName(user.getName()); +// record.setUpdatetime(date); +// record.setUpdateBy(user.getId()); +// record.setUpdateByName(user.getName()); +// +// List shopList = Lists.newArrayList(); +// String rentInfo = record.getRentInfo(); +// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); +// int size = rentInfoArray.size(); +// if (size == 0) { +// return new ResultData(ErrorCode.SHOP_NOT_SELECTED); +// } +// //查询rent_info 包括 shopId +// String shopIdStr = ""; +// BigDecimal rentArea = new BigDecimal(0); +// for (int i = 0; i < size; i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// Long shopId = rentInfoObject.getLong("id"); +// rentArea = rentArea.add(new BigDecimal(rentInfoObject.getString("operationArea"))); +// if (!shopList.contains(shopId)) { +// shopList.add(shopId); +// shopIdStr = shopIdStr +","+ shopId; +// } +// } +// record.setRentArea(rentArea.toPlainString()); +// setShops(record,shopList); +// //关联客户 +// setCustomers(record); +// try { +// record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); +// record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); +// Date tempDate = record.getRentalStartDate(); +// record.setRentalStartDate(oldRentStartDate); +// record.setShopIdStr(shopIdStr); +// record.setAgileType(EnumRentAgileType.STANDARDS_YEAR.getCode()); +// wxRentContractMapper.insert(record); +// record.setRentalStartDate(tempDate); +// } catch (Exception e) { +// logger.error("保存租赁合同信息失败,e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +// } +// +// return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); +// } public void setCustomers(WxRentContract record) { WxContractCustomers cq = new WxContractCustomers(); @@ -533,394 +523,394 @@ public class WxRentContractServiceImpl implements WxRentContractService { } //@Transactional(rollbackFor = {Exception.class}) - @Override - public ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps) { - //查询预账单用于展示 - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setRentContractId(record.getId()); - wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); - wxBillRent.updateTenantInfo(record); - List resultList = wxAllBillMapper.findList(wxBillRent); - - //更新 - ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,setRevenJumps); - if (resultData.code != Result.SUCCESS) { - return resultData; - } - - boolean saveBill = true; - if(CollectionUtils.isEmpty(record.getPreviewBillRentList())) { - if (record.getReceivePeriod() != null && record.getLease() != null - && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { - deletePrewBill(record); - //联营扣点,不设置保底营业额,不生成账单 - //if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(record.getType()) && record.getRevenueRatio().equals(0)) { - //do nothing - // saveBill = false; - //}else { - resultList = buildRent(user, record, EnumIsPreview.YES.getCode(),true); - //} - } - } - - WxRentContract wxRentContract = (WxRentContract)resultData.data; - wxRentContract.setPreviewBillRentList(resultList); - return new ResultData(wxRentContract); - } +// @Override +// public ResultData update(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate,boolean setRevenJumps) { +// //查询预账单用于展示 +// WxAllBill wxBillRent = new WxAllBill(); +// wxBillRent.setRentContractId(record.getId()); +// wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); +// wxBillRent.updateTenantInfo(record); +// List resultList = wxAllBillMapper.findList(wxBillRent); +// +// //更新 +// ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,setRevenJumps); +// if (resultData.code != Result.SUCCESS) { +// return resultData; +// } +// +// boolean saveBill = true; +// if(CollectionUtils.isEmpty(record.getPreviewBillRentList())) { +// if (record.getReceivePeriod() != null && record.getLease() != null +// && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { +// deletePrewBill(record); +// //联营扣点,不设置保底营业额,不生成账单 +// //if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(record.getType()) && record.getRevenueRatio().equals(0)) { +// //do nothing +// // saveBill = false; +// //}else { +// resultList = buildRent(user, record, EnumIsPreview.YES.getCode(),true); +// //} +// } +// } +// +// WxRentContract wxRentContract = (WxRentContract)resultData.data; +// wxRentContract.setPreviewBillRentList(resultList); +// return new ResultData(wxRentContract); +// } - @Transactional(rollbackFor = {Exception.class}) - @Override - public ResultData updateOneStep(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate) { - //查询预账单用于展示 - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setRentContractId(record.getId()); - wxBillRent.setSortColumns("starttime asc"); - wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); - wxBillRent.updateTenantInfo(record); - List resultList = wxAllBillMapper.findList(wxBillRent); - - //更新 - setCustomers(record); - ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,false); - if (resultData.code != Result.SUCCESS) { - return resultData; - } - WxRentContract wxRentContract = (WxRentContract)resultData.data; - wxRentContract.setPreviewBillRentList(resultList); - - WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); - jq.updateTenantInfo(record); - jq.setRentContractId(record.getId()); - wxRentContract.setRevenueJumps(wxRentContractRevenueJumpMapper.findList(jq)); - return new ResultData(wxRentContract); - } +// @Transactional(rollbackFor = {Exception.class}) +// @Override +// public ResultData updateOneStep(WxRentContract record, MallUserInfo user,String userName,int from,Date oldRentStartDate,boolean writeComplate) { +// //查询预账单用于展示 +// WxAllBill wxBillRent = new WxAllBill(); +// wxBillRent.setRentContractId(record.getId()); +// wxBillRent.setSortColumns("starttime asc"); +// wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); +// wxBillRent.updateTenantInfo(record); +// List resultList = wxAllBillMapper.findList(wxBillRent); +// +// //更新 +// setCustomers(record); +// ResultData resultData = getResultDataForUpdate(record, user,from,oldRentStartDate,writeComplate,false); +// if (resultData.code != Result.SUCCESS) { +// return resultData; +// } +// WxRentContract wxRentContract = (WxRentContract)resultData.data; +// wxRentContract.setPreviewBillRentList(resultList); +// +// WxRentContractRevenueJump jq = new WxRentContractRevenueJump(); +// jq.updateTenantInfo(record); +// jq.setRentContractId(record.getId()); +// wxRentContract.setRevenueJumps(wxRentContractRevenueJumpMapper.findList(jq)); +// return new ResultData(wxRentContract); +// } - @Override - public ResultData updateRentStartTime(WxRentContract record, MallUserInfo user) { - //查询预账单用于展示 - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setRentContractId(record.getId()); - wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); - wxBillRent.updateTenantInfo(record); - List resultList = wxAllBillMapper.findList(wxBillRent); - - //更新 - WxRentContract contractUpdate = new WxRentContract(); - contractUpdate.setId(record.getId()); - contractUpdate.updateTenantInfo(record); - contractUpdate.setRentStartType(record.getRentStartType()); - contractUpdate.setUpdatetime(new Date()); - contractUpdate.setUpdateBy(user.getId()); - contractUpdate.setUpdateByName(user.getName()); - wxRentContractMapper.updateById(record); - - - WxRentContract rentContract = wxRentContractMapper.selectById(record.getId()); - Date oldDate = record.getRentalStartDate(); - rentContract.setAdjustPeriodHandle(); - if(rentContract.getRentStartType()!=null && rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ - rentContract.setRentalStartDate(rentContract.getStartDate()); - } - - deletePrewBill(record); - resultList = buildRent(user, rentContract, EnumIsPreview.YES.getCode(),true); - rentContract.setPreviewBillRentList(resultList); - rentContract.setRentalStartDate(oldDate); - return new ResultData(rentContract); - } - - public ResultData getResultDataForUpdate(WxRentContract record, MallUserInfo user,int from,Date oldRentStartDate,boolean writeFinal,boolean setRevenJumps) { - //更新租赁合同信息 - WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getId()); - if (wxRentContract == null) { - return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); - } - wxRentContract.setPayRatio(record.getPayRatio()); - - int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; - - Calendar instance = Calendar.getInstance(); - instance.setTime(record.getRentalStartDate()); - instance.add(dayType, record.getLease()); - instance.add(Calendar.DAY_OF_MONTH, -1); - - if(!EnumFromType.SWITCH.getCode().equals(from)){ - //如果是联营扣点,或者联营取高,需要根据保底营业额来计算 - if (record.getType() != null) { - //联营扣点 - if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - String revenue = record.getRevenue(); - if (StringUtils.isBlank(revenue)) { - revenue = "0"; - }else { - if (StringUtils.isNotBlank(record.getLimitRevenue()) && new BigDecimal(record.getLimitRevenue()).compareTo(new BigDecimal(revenue)) > 0) { - revenue = "0"; - } - } - record.setPrice(new BigDecimal(record.getPayRatio()).multiply(new BigDecimal(revenue)).divide(new BigDecimal(100),Constant.default_long_decimal_size,RoundingMode.HALF_UP).toPlainString()); - }else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - BigDecimal rentPrice = null; - //联营取高,如果是固定金额的话,取固定金额. 不固定的金额,会传price. - if (null != record.getRevenueFixedRentPrice() && record.getRevenueFixedRentPrice().intValue() == EnumYesOrNo.YES.getCode()){ - rentPrice = new BigDecimal(record.getRevenueRentPrice()); - }else { - rentPrice = new BigDecimal(record.getPrice()); - } - record.setPrice(rentPrice.toPlainString()); - } - } - } +// @Override +// public ResultData updateRentStartTime(WxRentContract record, MallUserInfo user) { +// //查询预账单用于展示 +// WxAllBill wxBillRent = new WxAllBill(); +// wxBillRent.setRentContractId(record.getId()); +// wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); +// wxBillRent.updateTenantInfo(record); +// List resultList = wxAllBillMapper.findList(wxBillRent); +// +// //更新 +// WxRentContract contractUpdate = new WxRentContract(); +// contractUpdate.setId(record.getId()); +// contractUpdate.updateTenantInfo(record); +// contractUpdate.setRentStartType(record.getRentStartType()); +// contractUpdate.setUpdatetime(new Date()); +// contractUpdate.setUpdateBy(user.getId()); +// contractUpdate.setUpdateByName(user.getName()); +// wxRentContractMapper.updateById(record); +// +// +// WxRentContract rentContract = wxRentContractMapper.selectById(record.getId()); +// Date oldDate = record.getRentalStartDate(); +// rentContract.setAdjustPeriodHandle(); +// if(rentContract.getRentStartType()!=null && rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +// rentContract.setRentalStartDate(rentContract.getStartDate()); +// } +// +// deletePrewBill(record); +// resultList = buildRent(user, rentContract, EnumIsPreview.YES.getCode(),true); +// rentContract.setPreviewBillRentList(resultList); +// rentContract.setRentalStartDate(oldDate); +// return new ResultData(rentContract); +// } - if (StringUtils.isEmpty(record.getPrice())) { - record.setPrice("0"); - } - if (StringUtils.isEmpty(record.getDeposit())) { - record.setDeposit("0"); - } - List shopList = Lists.newArrayList(); - record.setUpdatetime(new Date()); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - String rentInfo = record.getRentInfo(); - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - int size = rentInfoArray.size(); - if (size == 0) { - return new ResultData(ErrorCode.SHOP_NOT_SELECTED); - } - //查询rent_info 包括 shopId - String shopIdStr = ""; - BigDecimal rentArea = new BigDecimal(0); - for (int i = 0; i < size; i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - WxRentContract wxRentContractQuery = new WxRentContract(); - wxRentContractQuery.updateTenantInfo(record); - Long shopId = rentInfoObject.getLong("id"); - String shopNumber = rentInfoObject.getString("shopNumber"); - if (shopId == null) { - return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); - } - rentArea = rentArea.add(new BigDecimal(rentInfoObject.getString("operationArea"))); - wxRentContractQuery.setId(record.getId()); - if (!shopList.contains(shopId)) { - shopList.add(shopId); - shopIdStr = shopIdStr +","+shopId; - } - } - setShops(record,shopList); - record.setRentArea(rentArea.toPlainString()); - try { - Date tempDate = record.getRentalStartDate(); - record.setRentalStartDate(oldRentStartDate); - record.setShopIdStr(shopIdStr); - if (writeFinal) { - record.setStatus(EnumRentContractStatus.DRAFT.getCode()); - }else { - record.setStatus(wxRentContract.getStatus()); - } - record.setApplyStatus(wxRentContract.getApplyStatus()); - if (StringUtils.isBlank(record.getOperatingManagementFee())){ - record.setOperatingManagementFee(null); - } - if (StringUtils.isBlank(record.getBussinessManagementFee())){ - record.setBussinessManagementFee(null); - } - wxRentContractMapper.updateById(record); - record.setRentalStartDate(tempDate); - - if (setRevenJumps) { - WxRentContractRevenueJump jumpsDel = new WxRentContractRevenueJump(); - jumpsDel.updateTenantInfo(record); - jumpsDel.setRentContractId(record.getId()); - wxRentContractRevenueJumpMapper.deleteByContract(jumpsDel); - - if (null != record.getRevenueJumps()) { - final IdWorker idWorker = IdWorker.get(); - List jlist = new ArrayList(); - for (int i = 0 ; i < record.getRevenueJumps().size(); i++) { - WxRentContractRevenueJump jp = record.getRevenueJumps().get(i); - if (StringUtils.isNotBlank(jp.getMinMoney())) { - jp.updateTenantInfo(record); - jp.setId(idWorker.nextId()); - jp.setRentContractId(record.getId()); - jp.setCreateTime(new Date()); - jp.setUpdateTime(new Date()); - jlist.add(jp); - } - } - if (jlist.size() > 0 ) { - wxRentContractRevenueJumpMapper.inertJumps(record.getTenantId(), jlist); - } - } - } - - } catch (Exception e) { - logger.error("更新租赁合同信息失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - //重新查一次 - wxRentContract = wxRentContractMapper.selectById(record.getId()); - return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", wxRentContract); - } +// public ResultData getResultDataForUpdate(WxRentContract record, MallUserInfo user,int from,Date oldRentStartDate,boolean writeFinal,boolean setRevenJumps) { +// //更新租赁合同信息 +// WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getId()); +// if (wxRentContract == null) { +// return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); +// } +// wxRentContract.setPayRatio(record.getPayRatio()); +// +// int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; +// +// Calendar instance = Calendar.getInstance(); +// instance.setTime(record.getRentalStartDate()); +// instance.add(dayType, record.getLease()); +// instance.add(Calendar.DAY_OF_MONTH, -1); +// +// if(!EnumFromType.SWITCH.getCode().equals(from)){ +// //如果是联营扣点,或者联营取高,需要根据保底营业额来计算 +// if (record.getType() != null) { +// //联营扣点 +// if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// String revenue = record.getRevenue(); +// if (StringUtils.isBlank(revenue)) { +// revenue = "0"; +// }else { +// if (StringUtils.isNotBlank(record.getLimitRevenue()) && new BigDecimal(record.getLimitRevenue()).compareTo(new BigDecimal(revenue)) > 0) { +// revenue = "0"; +// } +// } +// record.setPrice(new BigDecimal(record.getPayRatio()).multiply(new BigDecimal(revenue)).divide(new BigDecimal(100),Constant.default_long_decimal_size,RoundingMode.HALF_UP).toPlainString()); +// }else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { +// BigDecimal rentPrice = null; +// //联营取高,如果是固定金额的话,取固定金额. 不固定的金额,会传price. +// if (null != record.getRevenueFixedRentPrice() && record.getRevenueFixedRentPrice().intValue() == EnumYesOrNo.YES.getCode()){ +// rentPrice = new BigDecimal(record.getRevenueRentPrice()); +// }else { +// rentPrice = new BigDecimal(record.getPrice()); +// } +// record.setPrice(rentPrice.toPlainString()); +// } +// } +// } +// +// if (StringUtils.isEmpty(record.getPrice())) { +// record.setPrice("0"); +// } +// if (StringUtils.isEmpty(record.getDeposit())) { +// record.setDeposit("0"); +// } +// List shopList = Lists.newArrayList(); +// record.setUpdatetime(new Date()); +// record.setUpdateBy(user.getId()); +// record.setUpdateByName(user.getName()); +// String rentInfo = record.getRentInfo(); +// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); +// int size = rentInfoArray.size(); +// if (size == 0) { +// return new ResultData(ErrorCode.SHOP_NOT_SELECTED); +// } +// //查询rent_info 包括 shopId +// String shopIdStr = ""; +// BigDecimal rentArea = new BigDecimal(0); +// for (int i = 0; i < size; i++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); +// WxRentContract wxRentContractQuery = new WxRentContract(); +// wxRentContractQuery.updateTenantInfo(record); +// Long shopId = rentInfoObject.getLong("id"); +// String shopNumber = rentInfoObject.getString("shopNumber"); +// if (shopId == null) { +// return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); +// } +// rentArea = rentArea.add(new BigDecimal(rentInfoObject.getString("operationArea"))); +// wxRentContractQuery.setId(record.getId()); +// if (!shopList.contains(shopId)) { +// shopList.add(shopId); +// shopIdStr = shopIdStr +","+shopId; +// } +// } +// setShops(record,shopList); +// record.setRentArea(rentArea.toPlainString()); +// try { +// Date tempDate = record.getRentalStartDate(); +// record.setRentalStartDate(oldRentStartDate); +// record.setShopIdStr(shopIdStr); +// if (writeFinal) { +// record.setStatus(EnumRentContractStatus.DRAFT.getCode()); +// }else { +// record.setStatus(wxRentContract.getStatus()); +// } +// record.setApplyStatus(wxRentContract.getApplyStatus()); +// if (StringUtils.isBlank(record.getOperatingManagementFee())){ +// record.setOperatingManagementFee(null); +// } +// if (StringUtils.isBlank(record.getBussinessManagementFee())){ +// record.setBussinessManagementFee(null); +// } +// wxRentContractMapper.updateById(record); +// record.setRentalStartDate(tempDate); +// +// if (setRevenJumps) { +// WxRentContractRevenueJump jumpsDel = new WxRentContractRevenueJump(); +// jumpsDel.updateTenantInfo(record); +// jumpsDel.setRentContractId(record.getId()); +// wxRentContractRevenueJumpMapper.deleteByContract(jumpsDel); +// +// if (null != record.getRevenueJumps()) { +// final IdWorker idWorker = IdWorker.get(); +// List jlist = new ArrayList(); +// for (int i = 0 ; i < record.getRevenueJumps().size(); i++) { +// WxRentContractRevenueJump jp = record.getRevenueJumps().get(i); +// if (StringUtils.isNotBlank(jp.getMinMoney())) { +// jp.updateTenantInfo(record); +// jp.setId(idWorker.nextId()); +// jp.setRentContractId(record.getId()); +// jp.setCreateTime(new Date()); +// jp.setUpdateTime(new Date()); +// jlist.add(jp); +// } +// } +// if (jlist.size() > 0 ) { +// wxRentContractRevenueJumpMapper.inertJumps(record.getTenantId(), jlist); +// } +// } +// } +// +// } catch (Exception e) { +// logger.error("更新租赁合同信息失败,e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +// } +// //重新查一次 +// wxRentContract = wxRentContractMapper.selectById(record.getId()); +// return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", wxRentContract); +// } @Transactional(rollbackFor = {Exception.class}) - @Override - public void buildDeposit( TenantEntity tenantEntity,MallUserInfo user,Long rentContractId) { - WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); - if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) - && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { - - List shopIdList = wxRentContract.shopIdsByRentInfo(); - - WxShopUsers suq = new WxShopUsers(); - suq.updateTenantInfo(wxRentContract); - suq.setShopIds(shopIdList); - suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); - Map shopUserMap = wxShopService.getShopUserMap(suq); - - WxEnergyFees fq = new WxEnergyFees(); - fq.updateTenantInfo(tenantEntity); - fq.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); - Map typeMap = wxEnergyService.getFeesMap(fq); - - //根据不同的科目生成不同的押金账单 - Map feesMap = wxRentContract.getDepositEnergyFees(typeMap); - Map shopAreaRateMap = wxRentContract.getRentShopArea(); - if (null == shopAreaRateMap) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); - } - List insertList = new ArrayList(); - - for (Iterator it = feesMap.keySet().iterator();it.hasNext();){ - Long energyFeesId = it.next(); - WxEnergyFees depositFee = feesMap.get(energyFeesId); - WxEnergyFees fees = typeMap.get(energyFeesId); - final IdWorker idWorker = IdWorker.get(); - - 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()),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(); - wxBillDeposit.setId(idWorker.nextId()); - wxBillDeposit.setRentContractId(wxRentContract.getId()); - wxBillDeposit.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); - wxBillDeposit.setIsPreview(EnumYesOrNo.NO.getCode()); - wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); - //if (null != fees) { - // wxBillDeposit.setPriceDetail("合同押金项["+fees.getName()+"]"+depositFee.getPrice()+"元"+"/"+fees.getCalcuteUnitName()); - //} - wxBillDeposit.setPay("0"); - String needpay = depositFee.getPrice(); - - // String count = "1"; - // if (null != depositFee.getCalcuteUnit() && depositFee.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { - // count = wxRentContract.getRentArea(); - // } - // String needpay = depositFee.calcuteTotalMoney(wxRentContract.getDecimalSize(), null, null, count, true, null, null); - wxBillDeposit.setReceivePay(new BigDecimal(needpay).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()); - wxBillDeposit.setNeedPay(wxBillDeposit.getReceivePay()); - //wxBillDeposit.setOwe(needpay); - //找到计租方式 - int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; - - Date date = new Date(); - wxBillDeposit.setStarttime(wxRentContract.getFirstBillDateStart()); - wxBillDeposit.setEndtime(wxRentContract.getFirstBillDateEnd()); - wxBillDeposit.setReceiveDate(wxRentContract.getFirstBillReceiveDate()); - wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(wxRentContract.getFirstBillReceiveDate())); - //wxBillDeposit.setExpiredDay(0L); - wxBillDeposit.updateTenantInfo(wxRentContract); - //wxBillDeposit.setIsDel(0); - wxBillDeposit.setShopNumber(wxRentContract.getRentInfoShopNumber()); - if (null != user) { - //wxBillDeposit.setUserId(user.getId()); - } - wxBillDeposit.setShopId(sid); - wxBillDeposit.setCusName(cusName); - wxBillDeposit.setRentArea(shoprentArea.toPlainString()); - wxBillDeposit.setCreatetime(date); - if (null != user) { - wxBillDeposit.setCreateBy(user.getId()); - wxBillDeposit.setCreateByName(user.getName()); - } - wxBillDeposit.setUpdatetime(date); - if (null != user) { - wxBillDeposit.setUpdateBy(user.getId()); - wxBillDeposit.setUpdateByName(user.getName()); - } - //wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - String rentInfo = wxRentContract.getRentInfo(); - if (rentInfo != null) { - JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - Map shopInfo = new HashMap<>(); - for (int j = 0, size = rentInfoArray.size(); j < size; j++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); - shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("deposit")); - } - wxBillDeposit.setShopInfo(JSONObject.toJSONString(shopInfo)); - } - wxBillDeposit.setEnergyFeesId(energyFeesId); - wxBillDeposit.setCreateBy(wxRentContract.getCreateBy()); - wxBillDeposit.setUpdateBy(wxRentContract.getCreateBy()); - wxBillDeposit.setCreateByName(wxRentContract.getCreateByName()); - wxBillDeposit.setUpdateByName(wxRentContract.getCreateByName()); - - insertList.add(wxBillDeposit); - } - } - - try { - if (insertList.size() > 0 ) { - wxAllBillMapper.insertBills(tenantEntity.getTenantId(),insertList); - } - } catch (Exception e) { - logger.error("添加押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - } - } +// @Override +// public void buildDeposit( TenantEntity tenantEntity,MallUserInfo user,Long rentContractId) { +// WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); +// if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) +// && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { +// +// List shopIdList = wxRentContract.shopIdsByRentInfo(); +// +// WxShopUsers suq = new WxShopUsers(); +// suq.updateTenantInfo(wxRentContract); +// suq.setShopIds(shopIdList); +// suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); +// Map shopUserMap = wxShopService.getShopUserMap(suq); +// +// WxEnergyFees fq = new WxEnergyFees(); +// fq.updateTenantInfo(tenantEntity); +// fq.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); +// Map typeMap = wxEnergyService.getFeesMap(fq); +// +// //根据不同的科目生成不同的押金账单 +// Map feesMap = wxRentContract.getDepositEnergyFees(typeMap); +// Map shopAreaRateMap = wxRentContract.getRentShopArea(); +// if (null == shopAreaRateMap) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); +// } +// List insertList = new ArrayList(); +// +// for (Iterator it = feesMap.keySet().iterator();it.hasNext();){ +// Long energyFeesId = it.next(); +// WxEnergyFees depositFee = feesMap.get(energyFeesId); +// WxEnergyFees fees = typeMap.get(energyFeesId); +// final IdWorker idWorker = IdWorker.get(); +// +// 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()),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(); +// wxBillDeposit.setId(idWorker.nextId()); +// wxBillDeposit.setRentContractId(wxRentContract.getId()); +// wxBillDeposit.setBillType(EnumBillAllType.RENT_DEPOSIT.getCode()); +// wxBillDeposit.setIsPreview(EnumYesOrNo.NO.getCode()); +// wxBillDeposit.setCanEdit(EnumYesOrNo.NO.getCode()); +// //if (null != fees) { +// // wxBillDeposit.setPriceDetail("合同押金项["+fees.getName()+"]"+depositFee.getPrice()+"元"+"/"+fees.getCalcuteUnitName()); +// //} +// wxBillDeposit.setPay("0"); +// String needpay = depositFee.getPrice(); +// +// // String count = "1"; +// // if (null != depositFee.getCalcuteUnit() && depositFee.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { +// // count = wxRentContract.getRentArea(); +// // } +// // String needpay = depositFee.calcuteTotalMoney(wxRentContract.getDecimalSize(), null, null, count, true, null, null); +// wxBillDeposit.setReceivePay(new BigDecimal(needpay).multiply(shoprate).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).toPlainString()); +// wxBillDeposit.setNeedPay(wxBillDeposit.getReceivePay()); +// //wxBillDeposit.setOwe(needpay); +// //找到计租方式 +// //int dayType = wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; +// int dayType = Calendar.MONTH; +// Date date = new Date(); +// wxBillDeposit.setStarttime(wxRentContract.getFirstBillDateStart()); +// wxBillDeposit.setEndtime(wxRentContract.getFirstBillDateEnd()); +// wxBillDeposit.setReceiveDate(wxRentContract.getFirstBillReceiveDate()); +// wxBillDeposit.setPeriod(WxRentContractHelper.getPeriod(wxRentContract.getFirstBillReceiveDate())); +// //wxBillDeposit.setExpiredDay(0L); +// wxBillDeposit.updateTenantInfo(wxRentContract); +// //wxBillDeposit.setIsDel(0); +// wxBillDeposit.setShopNumber(wxRentContract.getRentInfoShopNumber()); +// if (null != user) { +// //wxBillDeposit.setUserId(user.getId()); +// } +// wxBillDeposit.setShopId(sid); +// wxBillDeposit.setCusName(cusName); +// wxBillDeposit.setRentArea(shoprentArea.toPlainString()); +// wxBillDeposit.setCreatetime(date); +// if (null != user) { +// wxBillDeposit.setCreateBy(user.getId()); +// wxBillDeposit.setCreateByName(user.getName()); +// } +// wxBillDeposit.setUpdatetime(date); +// if (null != user) { +// wxBillDeposit.setUpdateBy(user.getId()); +// wxBillDeposit.setUpdateByName(user.getName()); +// } +// //wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// String rentInfo = wxRentContract.getRentInfo(); +// if (rentInfo != null) { +// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); +// Map shopInfo = new HashMap<>(); +// for (int j = 0, size = rentInfoArray.size(); j < size; j++) { +// JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); +// shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("deposit")); +// } +// wxBillDeposit.setShopInfo(JSONObject.toJSONString(shopInfo)); +// } +// wxBillDeposit.setEnergyFeesId(energyFeesId); +// wxBillDeposit.setCreateBy(wxRentContract.getCreateBy()); +// wxBillDeposit.setUpdateBy(wxRentContract.getCreateBy()); +// wxBillDeposit.setCreateByName(wxRentContract.getCreateByName()); +// wxBillDeposit.setUpdateByName(wxRentContract.getCreateByName()); +// +// insertList.add(wxBillDeposit); +// } +// } +// +// try { +// if (insertList.size() > 0 ) { +// wxAllBillMapper.insertBills(tenantEntity.getTenantId(),insertList); +// } +// } catch (Exception e) { +// logger.error("添加押金账单失败,e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +// } +// } +// } - @Override - public ResultData hasRentStatus(WxRentContract record) { - String rentInfo = record.getRentInfo(); - if (StringUtils.isEmpty(rentInfo)) { - return new ResultData(ErrorCode.SHOP_NOT_SELECTED); - } - String[] split = rentInfo.split(","); - int size = split.length; - //查询rent_info 包括 shopId - for (int i = 0; i < size; i++) { - String shopId = split[i]; - WxShop wxShop = wxShopMapper.selectById(shopId); - WxRentContract wxRentContractQuery = new WxRentContract(); - wxRentContractQuery.updateTenantInfo(record); - String shopNumber = wxShop.getShopNumber(); - if (shopId == null) { - return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); - } - //wxRentContractQuery.setShopId(Long.valueOf(shopId)); - int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery.getTenantId(),wxRentContractQuery.getParentTenantId(),Long.valueOf(shopId),wxRentContractQuery.getId()); - if (count > 0) { - return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); - } - } - return new ResultData(Result.SUCCESS, "操作成功"); - } +// @Override +// public ResultData hasRentStatus(WxRentContract record) { +// String rentInfo = record.getRentInfo(); +// if (StringUtils.isEmpty(rentInfo)) { +// return new ResultData(ErrorCode.SHOP_NOT_SELECTED); +// } +// String[] split = rentInfo.split(","); +// int size = split.length; +// //查询rent_info 包括 shopId +// for (int i = 0; i < size; i++) { +// String shopId = split[i]; +// WxShop wxShop = wxShopMapper.selectById(shopId); +// WxRentContract wxRentContractQuery = new WxRentContract(); +// wxRentContractQuery.updateTenantInfo(record); +// String shopNumber = wxShop.getShopNumber(); +// if (shopId == null) { +// return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); +// } +// //wxRentContractQuery.setShopId(Long.valueOf(shopId)); +// int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery.getTenantId(),wxRentContractQuery.getParentTenantId(),Long.valueOf(shopId),wxRentContractQuery.getId()); +// if (count > 0) { +// return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); +// } +// } +// return new ResultData(Result.SUCCESS, "操作成功"); +// } - @Override - public ResultData hasContractNumber(WxRentContract wxRentContract) { - int count = wxRentContractMapper.hasContractNumber(wxRentContract); - return new ResultData(Result.SUCCESS, "操作成功", count > 0 ? true : false); - } +// @Override +// public ResultData hasContractNumber(WxRentContract wxRentContract) { +// int count = wxRentContractMapper.hasContractNumber(wxRentContract); +// return new ResultData(Result.SUCCESS, "操作成功", count > 0 ? true : false); +// } public void updateInvalidStatus(WxRentContract record) { Long id = record.getId(); @@ -982,24 +972,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } - @Override - @Transactional(rollbackFor = {Exception.class}) - public List buildRent(MallUserInfo user,WxRentContract wxRentContract,Integer isPreview,boolean saveDb) { - List rentList = new ArrayList<>(); - if (wxRentContract != null) { - int receivePeriod = wxRentContract.getReceivePeriod().intValue(); - Integer lease = wxRentContract.getLease(); - Date rentalStartDate = wxRentContract.getRentalStartDate(); - String price = wxRentContract.getPrice(); - if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ - Date startDate = wxRentContract.getStartDate(); - //rentList = buildRentJinmao(user, wxRentContract, receivePeriod, lease, startDate, price, isPreview,saveDb); - }else{ - rentList = buildRentMonth(user, wxRentContract, receivePeriod, lease, rentalStartDate, isPreview,saveDb); - } - } - return rentList; - } +// @Override +// @Transactional(rollbackFor = {Exception.class}) +// public List buildRent(MallUserInfo user,WxRentContract wxRentContract,Integer isPreview,boolean saveDb) { +// List rentList = new ArrayList<>(); +// if (wxRentContract != null) { +// int receivePeriod = wxRentContract.getReceivePeriod().intValue(); +// Integer lease = wxRentContract.getLease(); +// Date rentalStartDate = wxRentContract.getRentalStartDate(); +// String price = wxRentContract.getPrice(); +// rentList = buildRentMonth(user, wxRentContract, receivePeriod, lease, rentalStartDate, isPreview,saveDb); +// } +// return rentList; +// } @Override public List getYearList(int years,int month,Date rentalStartDate,Date endContractTime ) { @@ -1020,26 +1005,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { return yearList; } - public List buildRentMonth(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview, boolean saveDb) { - int years = 0; - //计算租金每年的计费基数 - String[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); - //计算商业管理费 - String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); - //计算运营管理费 - String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); - int month = 12; - int billcount = 0; - List resultList = new ArrayList(); - years = priceArrs.length; - List yearList = getYearList(years,month,rentalStartDate,null); - - String shopInfoStr = getShopInfoStr(wxRentContract); - Map resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, wxRentContract.getReceivePeriodUnit(), wxRentContract, user, billcount, isPreview, shopInfoStr,saveDb); - List billRentList = (List)resultMap.get("billList"); - resultList.addAll(billRentList); - return resultList; - } +// public List buildRentMonth(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate,Integer isPreview, boolean saveDb) { +// int years = 0; +// //计算租金每年的计费基数 +// String[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); +// //计算商业管理费 +// String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); +// //计算运营管理费 +// String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); +// int month = 12; +// int billcount = 0; +// List resultList = new ArrayList(); +// years = priceArrs.length; +// List yearList = getYearList(years,month,rentalStartDate,null); +// +// String shopInfoStr = getShopInfoStr(wxRentContract); +// Map resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, wxRentContract.getReceivePeriodUnit(), wxRentContract, user, billcount, isPreview, shopInfoStr,saveDb); +// List billRentList = (List)resultMap.get("billList"); +// resultList.addAll(billRentList); +// return resultList; +// } public String getShopInfoStr(WxRentContract wxRentContract){ String shopInfoStr = null; @@ -1057,17 +1042,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { return shopInfoStr; } - private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){ - Calendar calendar = Calendar.getInstance(); - calendar.setTime(yearEndDate); - - Calendar rentCalendar = Calendar.getInstance(); - rentCalendar.setTime(rentDate); - - calendar.set(Calendar.DAY_OF_MONTH,rentCalendar.get(Calendar.DAY_OF_MONTH)); - calendar.set(Calendar.MONTH, rentCalendar.get(Calendar.MONTH)); - return calendar.getTime(); - } +// private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){ +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(yearEndDate); +// +// Calendar rentCalendar = Calendar.getInstance(); +// rentCalendar.setTime(rentDate); +// +// calendar.set(Calendar.DAY_OF_MONTH,rentCalendar.get(Calendar.DAY_OF_MONTH)); +// calendar.set(Calendar.MONTH, rentCalendar.get(Calendar.MONTH)); +// return calendar.getTime(); +// } private List getFreeDays(WxRentContract wxRentContract) { //免租期 @@ -1094,374 +1079,374 @@ public class WxRentContractServiceImpl implements WxRentContractService { return allDate; } - public Map buildRent(int receivePeriod, String[] priceArrs,String[] bussinessManagerPriceArrs,String[] operationManagerPriceArrs, List yearList, int dayType, WxRentContract wxRentContract, MallUserInfo user, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract); - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - Map resultMap = new HashedMap(); - List resultList = new ArrayList(); - List manageList = new ArrayList(); - final IdWorker idWorker = IdWorker.get(); - - Date endDate = null;//每年的截止日期 - if(yearList.size() > 1){ - endDate = yearList.get(1); - } - - List billTimeVoList = new ArrayList<>(); - if(saveDb){ - billTimeVoList = initBillTimeList(yearList,wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate(),wxRentContract.getAdjustPeriod(),dayType,receivePeriod,wxRentContract.getPayPeriodRate()); - }else{ - //预账单编辑账期,生成金额 - for (WxAllBill rent:wxRentContract.getPreviewBillRentList()) { - BillTimeVo billTimeVo = new BillTimeVo(); - billTimeVo.setStartDate(rent.getStarttime()); - billTimeVo.setEndDate(rent.getEndtime()); - billTimeVo.setReceiveDate(DateUtils.getDaySet(rent.getStarttime(),Calendar.DATE,-1)); - billTimeVoList.add(billTimeVo); - } - } - - if (null != billTimeVoList && billTimeVoList.size() > 0 ) { - BillTimeVo firstBillTime = billTimeVoList.get(0); - WxRentContract cupdate = new WxRentContract(); - cupdate.updateTenantInfo(wxRentContract); - cupdate.setId(wxRentContract.getId()); - cupdate.setFirstBillDateStart(firstBillTime.getStartDate()); - cupdate.setFirstBillDateEnd(firstBillTime.getEndDate()); - cupdate.setFirstBillReceiveDate(firstBillTime.getReceiveDate()); - cupdate.setDecimalSize(null);//去掉默认的,避免更新 - wxRentContractMapper.updateById(cupdate); - } - - List shopIdList = wxRentContract.shopIdsByRentInfo(); - Map shopAreaRateMap = wxRentContract.getRentShopArea(); - if (null == shopAreaRateMap) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); - } - - //免租期 - List freePeriods = getFreeDays(wxRentContract); - - int index = 0; - for (int i = 0; i < billTimeVoList.size(); i++) { - BillTimeVo billTimeVo = billTimeVoList.get(i); - //计算金额 - String needpay = "0"; - //商业管理费 - String bussinessManageFeeNeedpay = "0"; - //营业管理费 - String operatingManageFeeNeedpay = "0"; - - boolean flag = false; - //此处逻辑处理这一年和下一年交接那一期账单。 - if(yearList.size() > 1) { - if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { - if(yearList.size() > 1) { - if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { - //logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); - - index++; - //如果是计算账单金额&cross 拆分日期进行计算 - if(billTimeVo.getEndDate().after(endDate)) { - String needpayFront = "0"; - String needpayAfter = "0"; - - //商业管理费 - String bussinessManageFeeNeedpayFront = "0"; - String bussinessManageFeeNeedpayAfter = "0"; - - //营业管理费 - String operatingManageFeeNeedpayFront = "0"; - String operatingManageFeeNeedpayAfter = "0"; - - //同一天,算一天 - if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ - needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,bussinessManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,operationManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); - } - }else{ - //这一年到期和下一年开始的期间,从这一年到期时间分开来进行计算。因为涉及到年租金调整等 TODO 如何把这两块单独生成账单 - if(billTimeVo.getStartDate().before(endDate)){ - if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(0)) { - //设置跳点率为年周期 price不变 - needpayFront = priceArrs[index - 1]; - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = bussinessManagerPriceArrs[index - 1]; - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = operationManagerPriceArrs[index - 1]; - } - }else { - needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - needpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - } - } - //下一年的第一天 - }else if (billTimeVo.getStartDate().equals(endDate)) { - needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - } - }else{ - //如果是按自然月,则这一年和下一年交叉部分需要重新计算 - if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { - Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate()); - needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - needpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); - } - }else { - //按账单日 - needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { - bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); - } - } - } - } - needpay = new BigDecimal(needpayFront).add(new BigDecimal(needpayAfter)).toPlainString(); - bussinessManageFeeNeedpay = new BigDecimal(bussinessManageFeeNeedpayFront).add(new BigDecimal(bussinessManageFeeNeedpayAfter)).toPlainString(); - operatingManageFeeNeedpay = new BigDecimal(operatingManageFeeNeedpayFront).add(new BigDecimal(operatingManageFeeNeedpayAfter)).toPlainString(); - flag = true; - } - if(index >= yearList.size()-1){ - endDate = null; - }else{ - endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 - //logger.info("==========cross:"+sd.format(endDate)); - } - } - } - } - } - - //计算金额 - if(!flag){ - needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0 ) { - bussinessManageFeeNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); - } - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { - operatingManageFeeNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); - } - } - - - WxAllBill wxBillRent = new WxAllBill(); - wxBillRent.setIsPreview(isPreview); - wxBillRent.setId(idWorker.nextId()); - wxBillRent.setRentContractId(wxRentContract.getId()); - wxBillRent.setBillType(EnumBillAllType.RENT.getCode()); - wxBillRent.setPay("0"); - wxBillRent.setStarttime(billTimeVo.getStartDate()); - wxBillRent.setEndtime(billTimeVo.getEndDate()); - wxBillRent.setReceiveDate(billTimeVo.getReceiveDate()); - wxBillRent.setPeriod(WxRentContractHelper.getPeriod(billTimeVo.getReceiveDate())); - wxBillRent.setCanEdit(EnumYesOrNo.NO.getCode());; - //wxBillRent.setContractNeedPay(needpay); - //wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,new BigDecimal(needpay))); - wxBillRent.setNeedPay(needpay); - //wxBillRent.setOwe(needpay); - wxBillRent.setReceivePay(needpay); - logger.debug(">>>>"+DateUtils.date2String(billTimeVo.getStartDate())+">>>>"+DateUtils.date2String(billTimeVo.getEndDate())+">>>>"+needpay); - //商业管理费 - wxBillRent.setBussinessManageFeeNeedPay(bussinessManageFeeNeedpay); - //运营管理费 - wxBillRent.setOperatingManageFeeNeedPay(operatingManageFeeNeedpay); - //截止收租日在当前时间之前 - Date date = new Date(); - //setExpiredDay(wxBillRent,dayType,receivePeriod); - //wxBillRent.setRevenue("0"); - wxBillRent.updateTenantInfo(wxRentContract); - //wxBillRent.setUserId(user.getId()); - if (null != wxRentContract.shopIdsByRentInfo() && wxRentContract.shopIdsByRentInfo().size() == 1) { - wxBillRent.setShopId(wxRentContract.shopIdsByRentInfo().get(0)); - } - wxBillRent.setShopNumber(wxRentContract.getRentInfoShopNumber()); - wxBillRent.setRentArea(wxRentContract.getRentArea()); - wxBillRent.setCreatetime(date); - wxBillRent.setCreateBy(user.getId()); - wxBillRent.setCreateByName(user.getName()); - wxBillRent.setUpdatetime(date); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName());; - //wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - //wxBillRent.setPeriod(++billcount); - wxBillRent.setShopInfo(shopInfoStr); - //wxBillRent.setLatePayRatio(0); - wxBillRent.calcuteTotalFee(wxRentContract.getDecimalSize()); - wxBillRent.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); - - //计算手续费 - //BigDecimal servicePay = new BigDecimal(wxBillRent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())) - // .divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); - //wxBillRent.setServiceChargePay(servicePay.toPlainString()); - //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).add(new BigDecimal(wxBillRent.getServiceChargePay())).toPlainString()); - //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).toPlainString()); - resultList.add(wxBillRent); - - - //商业管理费账单 - if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0 && new BigDecimal(bussinessManageFeeNeedpay).compareTo(new BigDecimal(0)) > 0) { - manageList.add(setManageRent(wxRentContract.getDecimalSize(),wxBillRent,EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE,bussinessManageFeeNeedpay,wxPayAccountBill.getServiceChargeRate(),dayType,receivePeriod)); - } - //营业管理费账单 - if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0 && new BigDecimal(operatingManageFeeNeedpay).compareTo(new BigDecimal(0)) > 0 ) { - manageList.add(setManageRent(wxRentContract.getDecimalSize(),wxBillRent,EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE,operatingManageFeeNeedpay,wxPayAccountBill.getServiceChargeRate(),dayType,receivePeriod)); - } - } - - //批量插入账单 - if(saveDb) { - - WxShopUsers suq = new WxShopUsers(); - suq.updateTenantInfo(wxRentContract); - suq.setShopIds(shopIdList); - suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); - Map shopUserMap = wxShopService.getShopUserMap(suq); - - List rblist = new ArrayList(); - for (int k = 0 ; k < resultList.size(); k++) { - WxAllBill rb = resultList.get(k); - 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(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).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) { - rs.setCusName(wsu.getName()); - } - } - rblist.add(rs); - } catch (IllegalAccessException e) { - logger.error("savePreviewBill error.",e); - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); - } catch (InvocationTargetException e) { - logger.error("savePreviewBill error.",e); - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); - } - } - } - wxAllBillMapper.insertBills(wxRentContract.getTenantId(),rblist); - if (manageList.size() > 0 ) { - List mblist = new ArrayList(); - for (int k = 0 ; k < manageList.size(); k++) { - WxAllBill rb = manageList.get(k); - 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(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).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).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()); - } - } - mblist.add(rs); - } catch (IllegalAccessException e) { - logger.error("savePreviewBill error.",e); - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); - } catch (InvocationTargetException e) { - logger.error("savePreviewBill error.",e); - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); - } - } - } - - wxAllBillMapper.insertBills(wxRentContract.getTenantId(),mblist); - } - } - resultMap.put("billcount",billcount); - resultMap.put("billList",resultList); - return resultMap; - } +// public Map buildRent(int receivePeriod, String[] priceArrs,String[] bussinessManagerPriceArrs,String[] operationManagerPriceArrs, List yearList, int dayType, WxRentContract wxRentContract, MallUserInfo user, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { +// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract); +// SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); +// Map resultMap = new HashedMap(); +// List resultList = new ArrayList(); +// List manageList = new ArrayList(); +// final IdWorker idWorker = IdWorker.get(); +// +// Date endDate = null;//每年的截止日期 +// if(yearList.size() > 1){ +// endDate = yearList.get(1); +// } +// +// List billTimeVoList = new ArrayList<>(); +// if(saveDb){ +// billTimeVoList = initBillTimeList(yearList,wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate(),null,dayType,receivePeriod,wxRentContract.getPayPeriodRate()); +// }else{ +// //预账单编辑账期,生成金额 +// for (WxAllBill rent:wxRentContract.getPreviewBillRentList()) { +// BillTimeVo billTimeVo = new BillTimeVo(); +// billTimeVo.setStartDate(rent.getStarttime()); +// billTimeVo.setEndDate(rent.getEndtime()); +// billTimeVo.setReceiveDate(DateUtils.getDaySet(rent.getStarttime(),Calendar.DATE,-1)); +// billTimeVoList.add(billTimeVo); +// } +// } +// +// if (null != billTimeVoList && billTimeVoList.size() > 0 ) { +// BillTimeVo firstBillTime = billTimeVoList.get(0); +// WxRentContract cupdate = new WxRentContract(); +// cupdate.updateTenantInfo(wxRentContract); +// cupdate.setId(wxRentContract.getId()); +// cupdate.setFirstBillDateStart(firstBillTime.getStartDate()); +// cupdate.setFirstBillDateEnd(firstBillTime.getEndDate()); +// cupdate.setFirstBillReceiveDate(firstBillTime.getReceiveDate()); +// cupdate.setDecimalSize(null);//去掉默认的,避免更新 +// wxRentContractMapper.updateById(cupdate); +// } +// +// List shopIdList = wxRentContract.shopIdsByRentInfo(); +// Map shopAreaRateMap = wxRentContract.getRentShopArea(); +// if (null == shopAreaRateMap) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无店铺信息"); +// } +// +// //免租期 +// List freePeriods = getFreeDays(wxRentContract); +// +// int index = 0; +// for (int i = 0; i < billTimeVoList.size(); i++) { +// BillTimeVo billTimeVo = billTimeVoList.get(i); +// //计算金额 +// String needpay = "0"; +// //商业管理费 +// String bussinessManageFeeNeedpay = "0"; +// //营业管理费 +// String operatingManageFeeNeedpay = "0"; +// +// boolean flag = false; +// //此处逻辑处理这一年和下一年交接那一期账单。 +// if(yearList.size() > 1) { +// if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { +// if(yearList.size() > 1) { +// if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) { +// //logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); +// +// index++; +// //如果是计算账单金额&cross 拆分日期进行计算 +// if(billTimeVo.getEndDate().after(endDate)) { +// String needpayFront = "0"; +// String needpayAfter = "0"; +// +// //商业管理费 +// String bussinessManageFeeNeedpayFront = "0"; +// String bussinessManageFeeNeedpayAfter = "0"; +// +// //营业管理费 +// String operatingManageFeeNeedpayFront = "0"; +// String operatingManageFeeNeedpayAfter = "0"; +// +// //同一天,算一天 +// if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ +// needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,bussinessManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract,operationManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); +// } +// }else{ +// //这一年到期和下一年开始的期间,从这一年到期时间分开来进行计算。因为涉及到年租金调整等 TODO 如何把这两块单独生成账单 +// if(billTimeVo.getStartDate().before(endDate)){ +// if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(0)) { +// //设置跳点率为年周期 price不变 +// needpayFront = priceArrs[index - 1]; +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = bussinessManagerPriceArrs[index - 1]; +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = operationManagerPriceArrs[index - 1]; +// } +// }else { +// needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// needpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.SECOND, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// } +// } +// //下一年的第一天 +// }else if (billTimeVo.getStartDate().equals(endDate)) { +// needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// } +// }else{ +// //如果是按自然月,则这一年和下一年交叉部分需要重新计算 +// if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { +// Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate()); +// needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// needpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); +// } +// }else { +// //按账单日 +// needpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) { +// bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); +// } +// } +// } +// } +// needpay = new BigDecimal(needpayFront).add(new BigDecimal(needpayAfter)).toPlainString(); +// bussinessManageFeeNeedpay = new BigDecimal(bussinessManageFeeNeedpayFront).add(new BigDecimal(bussinessManageFeeNeedpayAfter)).toPlainString(); +// operatingManageFeeNeedpay = new BigDecimal(operatingManageFeeNeedpayFront).add(new BigDecimal(operatingManageFeeNeedpayAfter)).toPlainString(); +// flag = true; +// } +// if(index >= yearList.size()-1){ +// endDate = null; +// }else{ +// endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始 +// //logger.info("==========cross:"+sd.format(endDate)); +// } +// } +// } +// } +// } +// +// //计算金额 +// if(!flag){ +// needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, priceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0 ) { +// bussinessManageFeeNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, bussinessManagerPriceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); +// } +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) { +// operatingManageFeeNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,wxRentContract, operationManagerPriceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); +// } +// } +// +// +// WxAllBill wxBillRent = new WxAllBill(); +// wxBillRent.setIsPreview(isPreview); +// wxBillRent.setId(idWorker.nextId()); +// wxBillRent.setRentContractId(wxRentContract.getId()); +// wxBillRent.setBillType(EnumBillAllType.RENT.getCode()); +// wxBillRent.setPay("0"); +// wxBillRent.setStarttime(billTimeVo.getStartDate()); +// wxBillRent.setEndtime(billTimeVo.getEndDate()); +// wxBillRent.setReceiveDate(billTimeVo.getReceiveDate()); +// wxBillRent.setPeriod(WxRentContractHelper.getPeriod(billTimeVo.getReceiveDate())); +// wxBillRent.setCanEdit(EnumYesOrNo.NO.getCode());; +// //wxBillRent.setContractNeedPay(needpay); +// //wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,new BigDecimal(needpay))); +// wxBillRent.setNeedPay(needpay); +// //wxBillRent.setOwe(needpay); +// wxBillRent.setReceivePay(needpay); +// logger.debug(">>>>"+DateUtils.date2String(billTimeVo.getStartDate())+">>>>"+DateUtils.date2String(billTimeVo.getEndDate())+">>>>"+needpay); +// //商业管理费 +// wxBillRent.setBussinessManageFeeNeedPay(bussinessManageFeeNeedpay); +// //运营管理费 +// wxBillRent.setOperatingManageFeeNeedPay(operatingManageFeeNeedpay); +// //截止收租日在当前时间之前 +// Date date = new Date(); +// //setExpiredDay(wxBillRent,dayType,receivePeriod); +// //wxBillRent.setRevenue("0"); +// wxBillRent.updateTenantInfo(wxRentContract); +// //wxBillRent.setUserId(user.getId()); +// if (null != wxRentContract.shopIdsByRentInfo() && wxRentContract.shopIdsByRentInfo().size() == 1) { +// wxBillRent.setShopId(wxRentContract.shopIdsByRentInfo().get(0)); +// } +// wxBillRent.setShopNumber(wxRentContract.getRentInfoShopNumber()); +// wxBillRent.setRentArea(wxRentContract.getRentArea()); +// wxBillRent.setCreatetime(date); +// wxBillRent.setCreateBy(user.getId()); +// wxBillRent.setCreateByName(user.getName()); +// wxBillRent.setUpdatetime(date); +// wxBillRent.setUpdateBy(user.getId()); +// wxBillRent.setUpdateByName(user.getName());; +// //wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// //wxBillRent.setPeriod(++billcount); +// wxBillRent.setShopInfo(shopInfoStr); +// //wxBillRent.setLatePayRatio(0); +// wxBillRent.calcuteTotalFee(wxRentContract.getDecimalSize()); +// wxBillRent.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); +// +// //计算手续费 +// //BigDecimal servicePay = new BigDecimal(wxBillRent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())) +// // .divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); +// //wxBillRent.setServiceChargePay(servicePay.toPlainString()); +// //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).add(new BigDecimal(wxBillRent.getServiceChargePay())).toPlainString()); +// //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).toPlainString()); +// resultList.add(wxBillRent); +// +// +// //商业管理费账单 +// if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0 && new BigDecimal(bussinessManageFeeNeedpay).compareTo(new BigDecimal(0)) > 0) { +// manageList.add(setManageRent(wxRentContract.getDecimalSize(),wxBillRent,EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE,bussinessManageFeeNeedpay,wxPayAccountBill.getServiceChargeRate(),dayType,receivePeriod)); +// } +// //营业管理费账单 +// if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0 && new BigDecimal(operatingManageFeeNeedpay).compareTo(new BigDecimal(0)) > 0 ) { +// manageList.add(setManageRent(wxRentContract.getDecimalSize(),wxBillRent,EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE,operatingManageFeeNeedpay,wxPayAccountBill.getServiceChargeRate(),dayType,receivePeriod)); +// } +// } +// +// //批量插入账单 +// if(saveDb) { +// +// WxShopUsers suq = new WxShopUsers(); +// suq.updateTenantInfo(wxRentContract); +// suq.setShopIds(shopIdList); +// suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); +// Map shopUserMap = wxShopService.getShopUserMap(suq); +// +// List rblist = new ArrayList(); +// for (int k = 0 ; k < resultList.size(); k++) { +// WxAllBill rb = resultList.get(k); +// 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(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).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) { +// rs.setCusName(wsu.getName()); +// } +// } +// rblist.add(rs); +// } catch (IllegalAccessException e) { +// logger.error("savePreviewBill error.",e); +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); +// } catch (InvocationTargetException e) { +// logger.error("savePreviewBill error.",e); +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); +// } +// } +// } +// wxAllBillMapper.insertBills(wxRentContract.getTenantId(),rblist); +// if (manageList.size() > 0 ) { +// List mblist = new ArrayList(); +// for (int k = 0 ; k < manageList.size(); k++) { +// WxAllBill rb = manageList.get(k); +// 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(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).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP).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()); +// } +// } +// mblist.add(rs); +// } catch (IllegalAccessException e) { +// logger.error("savePreviewBill error.",e); +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); +// } catch (InvocationTargetException e) { +// logger.error("savePreviewBill error.",e); +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"创建账单失败"); +// } +// } +// } +// +// wxAllBillMapper.insertBills(wxRentContract.getTenantId(),mblist); +// } +// } +// resultMap.put("billcount",billcount); +// resultMap.put("billList",resultList); +// return resultMap; +// } - private WxAllBill setManageRent(Integer decimalSize,WxAllBill wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) { - WxAllBill manage = new WxAllBill(); - manage.setRentContractId(wxBillRent.getRentContractId()); - manage.setPay(wxBillRent.getPay()); - manage.setStarttime(wxBillRent.getStarttime()); - manage.setEndtime(wxBillRent.getEndtime()); - manage.setReceiveDate(wxBillRent.getReceiveDate()); - manage.setPeriod(wxBillRent.getPeriod()); - manage.updateTenantInfo(wxBillRent); - manage.setIsPreview(wxBillRent.getIsPreview()); - manage.setCreatetime(wxBillRent.getCreatetime()); - manage.setCreateBy(wxBillRent.getCreateBy()); - manage.setCreateByName(wxBillRent.getCreateByName()); - manage.setUpdateBy(wxBillRent.getUpdateBy()); - manage.setUpdatetime(wxBillRent.getUpdatetime()); - manage.setUpdateByName(wxBillRent.getUpdateByName()); - manage.setRentArea(wxBillRent.getRentArea()); - manage.setShopNumber(wxBillRent.getShopNumber()); - manage.setCanEdit(EnumYesOrNo.NO.getCode()); - manage.setCusName(wxBillRent.getCusName()); - if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode().intValue()){ - manage.setEnergyFeesId(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); - manage.setBillType(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); - }else if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode().intValue()) { - manage.setEnergyFeesId(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId()); - manage.setBillType(EnumBillAllType.RENT_OPERATION_MANAGE.getCode()); - } - final IdWorker idWorker = IdWorker.get(); - wxBillRent.setId(idWorker.nextId()); - manage.setNeedPay(needPay); - manage.setReceivePay(needPay); - //计算手续费 - //BigDecimal servicePay = new BigDecimal(needPay).multiply(new BigDecimal(serviceChargeRate)).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); - //manage.setServiceChargePay(servicePay.toPlainString()); - //manage.setOwe(new BigDecimal(needPay).add(new BigDecimal(manage.getServiceChargePay())).toPlainString()); - //manage.setOwe(new BigDecimal(needPay).toPlainString()); - return manage; - } +// private WxAllBill setManageRent(Integer decimalSize,WxAllBill wxBillRent,EnumRentContractManageFeeType feeType,String needPay,Integer serviceChargeRate,int dayType,int receivePeriod) { +// WxAllBill manage = new WxAllBill(); +// manage.setRentContractId(wxBillRent.getRentContractId()); +// manage.setPay(wxBillRent.getPay()); +// manage.setStarttime(wxBillRent.getStarttime()); +// manage.setEndtime(wxBillRent.getEndtime()); +// manage.setReceiveDate(wxBillRent.getReceiveDate()); +// manage.setPeriod(wxBillRent.getPeriod()); +// manage.updateTenantInfo(wxBillRent); +// manage.setIsPreview(wxBillRent.getIsPreview()); +// manage.setCreatetime(wxBillRent.getCreatetime()); +// manage.setCreateBy(wxBillRent.getCreateBy()); +// manage.setCreateByName(wxBillRent.getCreateByName()); +// manage.setUpdateBy(wxBillRent.getUpdateBy()); +// manage.setUpdatetime(wxBillRent.getUpdatetime()); +// manage.setUpdateByName(wxBillRent.getUpdateByName()); +// manage.setRentArea(wxBillRent.getRentArea()); +// manage.setShopNumber(wxBillRent.getShopNumber()); +// manage.setCanEdit(EnumYesOrNo.NO.getCode()); +// manage.setCusName(wxBillRent.getCusName()); +// if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode().intValue()){ +// manage.setEnergyFeesId(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); +// manage.setBillType(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); +// }else if (feeType.getCode().intValue() == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode().intValue()) { +// manage.setEnergyFeesId(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId()); +// manage.setBillType(EnumBillAllType.RENT_OPERATION_MANAGE.getCode()); +// } +// final IdWorker idWorker = IdWorker.get(); +// wxBillRent.setId(idWorker.nextId()); +// manage.setNeedPay(needPay); +// manage.setReceivePay(needPay); +// //计算手续费 +// //BigDecimal servicePay = new BigDecimal(needPay).multiply(new BigDecimal(serviceChargeRate)).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); +// //manage.setServiceChargePay(servicePay.toPlainString()); +// //manage.setOwe(new BigDecimal(needPay).add(new BigDecimal(manage.getServiceChargePay())).toPlainString()); +// //manage.setOwe(new BigDecimal(needPay).toPlainString()); +// return manage; +// } @Transactional(rollbackFor = {Exception.class}) @Override @@ -1484,7 +1469,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { pDest.mkdirs(); } try { - String exportFileName = wxRentContract.getFilename(); + //String exportFileName = wxRentContract.getFilename(); + String exportFileName = "xxx"; DownFileUtil.downLoadFromUrl(wxRentContract.getFilepath(), filename, filepath); DownFileUtil.downFile(destPath, exportFileName, response, request); org.apache.commons.io.FileUtils.forceDelete(dest); @@ -1507,43 +1493,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { contract.setEndContractTime(wxRentContract.getEndContractTime()); wxRentContractMapper.updateById(contract); - //终止租赁合同,同时终止物业合同 - if(EnumEndProperty.END_RENT_AND_PROPERTY.getCode().equals(wxRentContract.getEndProperty())){ -// WxPropertyContract wxPropertyContract = new WxPropertyContract(); -// wxPropertyContract.setRentContractId(wxRentContract.getId()); -// wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); -// wxPropertyContractMapper.updateStatusByRentContractId(wxPropertyContract); - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxRentContract.updateTenantInfo(wxRentContract); - wxPropertyContract.setRentContractId(wxRentContract.getId()); - - //终止有效的合同 - wxPropertyContract.setStatuss(EnumRentContractStatus.getValidStatus()); - wxPropertyContract.setUpdatetime(new Date()); - wxPropertyContract.setUpdateBy(userInfo.getId()); - wxPropertyContract.setStatus(EnumRentContractStatus.TERMINATE.getCode()); - wxPropertyContractMapper.endContract(wxPropertyContract); - //作废未生效的合同 - List unvalidstatuss = new ArrayList(); - unvalidstatuss.add(EnumRentContractStatus.DRAFT.getCode()); - unvalidstatuss.add(EnumRentContractStatus.PERFORMANCE.getCode()); - wxPropertyContract.setStatuss(unvalidstatuss); - wxPropertyContract.setStatus(EnumRentContractStatus.INVALID.getCode()); - wxPropertyContractMapper.endContract(wxPropertyContract); - - //物业账单失效 - WxPropertyContract pq = new WxPropertyContract(); - pq.updateTenantInfo(wxRentContract); - pq.setRentContractId(wxRentContract.getId()); - List plist = wxPropertyContractMapper.findList(pq); - if (null != plist && plist.size() > 0 ) { - WxPropertyContract pc = plist.get(0); - pc.setEndContractTime(wxRentContract.getEndContractTime()); - wxBillAllHelper.propertyContractStop(pc, userInfo); - wxPropertyContractMapper.updateById(pc); - } - - } //租赁账单失效 wxBillAllHelper.rentContractStop(wxRentContract,userInfo); // WxBillRent wxBillRent = new WxBillRent(); @@ -1575,124 +1524,124 @@ public class WxRentContractServiceImpl implements WxRentContractService { return new ResultData(Result.SUCCESS, "操作成功"); } - @Override - public PageInfo getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { - if (StringUtils.isNotBlank(rentContract.getFloorForRule()) || StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) { - List shopIdList = null; - if (StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) { - String[] qsids = rentContract.getQueryShopIdStr().split(","); - if (null != qsids && qsids.length > 0 ) { - shopIdList = new ArrayList(); - 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 contractIds = wxAgileContractService.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, shopIdList, 0); - //List mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null); - if (null == contractIds || contractIds.size() <= 0 ) { - rentContract.setId(-1L); - } else { - rentContract.setIds(contractIds); - } - } - //根据客户名称查询 - if (StringUtils.isNotBlank(rentContract.getMerchantName())) { - WxContractCustomers ccq = new WxContractCustomers(); - ccq.updateTenantInfo(rentContract); - ccq.setName(rentContract.getMerchantName()); - List customersIdList = wxContractCustomersMapper.findIdList(ccq); - if (null != customersIdList && customersIdList.size() > 0 ) { - rentContract.setCustomersIdList(customersIdList); - }else { - rentContract.setId(-1L); - } - } - - //PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract)); - PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract)); - if (null != pageInfo && null != pageInfo.getList()) { - List customersIdList = new ArrayList(); - for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){ - WxRentContract contract = pageInfo.getList().get(i); - if (null != contract.getCustomersId()) { - customersIdList.add(contract.getCustomersId()); - } - } - - Map 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 getContractCustomersMap(TenantEntity tenantEntity,List customerIds) { - if (null == customerIds || customerIds.size() <= 0 ) { - return null; - } - WxContractCustomers ccq = new WxContractCustomers(); - ccq.updateTenantInfo(tenantEntity); - ccq.setIds(customerIds); - List cclist = wxContractCustomersMapper.findList(ccq); - if (null != cclist && cclist.size() > 0 ){ - Map map = new HashMap(); - 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 PageInfo getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { +// if (StringUtils.isNotBlank(rentContract.getFloorForRule()) || StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) { +// List shopIdList = null; +// if (StringUtils.isNotBlank(rentContract.getQueryShopIdStr())) { +// String[] qsids = rentContract.getQueryShopIdStr().split(","); +// if (null != qsids && qsids.length > 0 ) { +// shopIdList = new ArrayList(); +// 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 contractIds = wxAgileContractService.findBuildingFloorContractIds(rentContract, rentContract.getFloorForRule(), null, null, shopIdList, 0); +// //List mids = wxMerchantService.getFloorBuildMerchantIds(rentContract, rentContract.getFloorForRule() , null, null,rentContract.getShopTypeForRule(), 0, 0,null); +// if (null == contractIds || contractIds.size() <= 0 ) { +// rentContract.setId(-1L); +// } else { +// rentContract.setIds(contractIds); +// } +// } +// //根据客户名称查询 +// if (StringUtils.isNotBlank(rentContract.getMerchantName())) { +// WxContractCustomers ccq = new WxContractCustomers(); +// ccq.updateTenantInfo(rentContract); +// ccq.setName(rentContract.getMerchantName()); +// List customersIdList = wxContractCustomersMapper.findIdList(ccq); +// if (null != customersIdList && customersIdList.size() > 0 ) { +// rentContract.setCustomersIdList(customersIdList); +// }else { +// rentContract.setId(-1L); +// } +// } +// +// //PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract)); +// PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(rentContract)); +// if (null != pageInfo && null != pageInfo.getList()) { +// List customersIdList = new ArrayList(); +// for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){ +// WxRentContract contract = pageInfo.getList().get(i); +// if (null != contract.getCustomersId()) { +// customersIdList.add(contract.getCustomersId()); +// } +// } +// +// Map 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 getContractCustomersMap(TenantEntity tenantEntity,List customerIds) { +// if (null == customerIds || customerIds.size() <= 0 ) { +// return null; +// } +// WxContractCustomers ccq = new WxContractCustomers(); +// ccq.updateTenantInfo(tenantEntity); +// ccq.setIds(customerIds); +// List cclist = wxContractCustomersMapper.findList(ccq); +// if (null != cclist && cclist.size() > 0 ){ +// Map map = new HashMap(); +// 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}) - public ResultData updateFile(WxRentContract record, MallUserInfo user,String userName,boolean writeComplate) { - - WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getId()); - if (null == wxRentContract) { - return new ResultData(Result.ERROR,"id查询不到合同"); - } - WxRentContract rc = new WxRentContract(); - rc.setId(record.getId()); - rc.setDecimalSize(wxRentContract.getDecimalSize()); - if (writeComplate) { - rc.setStatus(EnumRentContractStatus.DRAFT.getCode()); - }else { - rc.setStatus(wxRentContract.getStatus()); - } - rc.setFileNames(record.getFileNames()); - rc.setRemark(record.getRemark()); - wxRentContractMapper.updateById(rc); - if (null != wxRentContract.getOperationType() && EnumContractOperationType.WHOLE.getCode().equals(wxRentContract.getOperationType())) { - WxPropertyContract pc = wxPropertyContractMapper.findOneByRentId(wxRentContract); - if (null != pc) { - wxRentContract.setPropertyContractId(pc.getId()); - } - } - return new ResultData(wxRentContract); - } +// @Override +// @Transactional(rollbackFor = {Exception.class}) +// public ResultData updateFile(WxRentContract record, MallUserInfo user,String userName,boolean writeComplate) { +// +// WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getId()); +// if (null == wxRentContract) { +// return new ResultData(Result.ERROR,"id查询不到合同"); +// } +// WxRentContract rc = new WxRentContract(); +// rc.setId(record.getId()); +// rc.setDecimalSize(wxRentContract.getDecimalSize()); +// if (writeComplate) { +// rc.setStatus(EnumRentContractStatus.DRAFT.getCode()); +// }else { +// rc.setStatus(wxRentContract.getStatus()); +// } +// rc.setFileNames(record.getFileNames()); +// rc.setRemark(record.getRemark()); +// wxRentContractMapper.updateById(rc); +// if (null != wxRentContract.getOperationType() && EnumContractOperationType.WHOLE.getCode().equals(wxRentContract.getOperationType())) { +// WxPropertyContract pc = wxPropertyContractMapper.findOneByRentId(wxRentContract); +// if (null != pc) { +// wxRentContract.setPropertyContractId(pc.getId()); +// } +// } +// return new ResultData(wxRentContract); +// } @Override @Transactional(rollbackFor = {Exception.class}) @@ -1736,43 +1685,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { //如果合同的账单cusName为空的话,则设置为customers name handleContractBillCusName(record,cusName); - //EventUtil.publistRentEvent(this, wxRentContract); - //建立账单 - //自定义账单无单价,为能生成账单,设置该值 - if (EnumRentContractType.RENT_BY_CUSTOMIZE.getCode() == record.getType()) { - record.setPrice("0.01"); - } - if (record != null && (record.getReceivePeriod() != null || - (null != record.getAgileType() && record.getAgileType().intValue() == EnumRentAgileType.AGILE.getCode()))) { - //预览账单改为正式,并写入商户id - WxAllBill billRent = new WxAllBill(); - billRent.setRentContractId(id); - billRent.setIsPreview(EnumIsPreview.NO.getCode()); - billRent.updateTenantInfo(record); - wxAllBillMapper.updatePreviewStatus(billRent); -// WxMerchant wxMerchant = new WxMerchant(); -// wxMerchant.setId(record.getMerchantId()); -// wxMerchant.updateTenantInfo(record); - - //商业管理费,营业管理费 - //WxAllBill billRentManage = new WxAllBill(); - //billRentManage.setRentContractId(id); - //billRentManage.setIsPreview(EnumIsPreview.NO.getCode()); - //billRentManage.updateTenantInfo(record); - //wxAllBillMapper.updatePreviewStatus(billRentManage); - - if(new BigDecimal(record.getDeposit()).compareTo(new BigDecimal(0)) > 0) { - //押金 - buildDeposit(record, null, id); - } - //一起建立物业账单 - if (buildProperyBill) { - updatePropertyPreviewBill(record); - } - - //作废合同 - //updateInvalidContract(id); - } + //预览账单改为正式,并写入商户id + WxAllBill billRent = new WxAllBill(); + billRent.setRentContractId(id); + billRent.setIsPreview(EnumIsPreview.NO.getCode()); + billRent.updateTenantInfo(record); + wxAllBillMapper.updatePreviewStatus(billRent); return new ResultData(Result.SUCCESS, "操作成功"); } @@ -1840,21 +1758,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxAllBillMapper.updateContractCusName(bill); } - @Override - public void updatePropertyPreviewBill(WxRentContract record) { - //合并合同-更新物业账单 - if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { - //查签约 - WxPropertyContract wxPropertyContract = new WxPropertyContract(); - wxPropertyContract.setRentContractId(record.getId()); - WxPropertyContract propertyContract = wxPropertyContractMapper.selectOne(new QueryWrapper(wxPropertyContract)); - logger.info("物业合同状态及账单状态修改:{}",propertyContract); - if (propertyContract != null) { - wxPropertyContractService.updatePropertyContractStatus(propertyContract.getId()); - } - } - } - @Override public void updateApplyStatus(WxRentContract wxRentContract) { wxRentContractMapper.updateApplyStatus(wxRentContract); @@ -1866,90 +1769,93 @@ public class WxRentContractServiceImpl implements WxRentContractService { // } //yearList,每年的合同截止日期,到这个截止日之前之后,需要拆开时间 - public static List initBillTimeList(List yearList,Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod,int payPeriod){ - List list = new ArrayList<>(); - int count = 0; - List yearsEndList = new ArrayList(); - yearsEndList.addAll(yearList); - if (yearsEndList.size() > 0) { - yearsEndList.remove(0); - } - BillTimeVo receiveDate = null; - while (true) { - BillTimeVo timeVo = new BillTimeVo(); - - //账单日 - Calendar instance = Calendar.getInstance(); - instance.setTime(start); - instance.set(Calendar.MILLISECOND, 0); - //开始时间 - timeVo.setStartDate(instance.getTime()); - - //结束时间 - instance.clear(); - instance.setTime(start); - instance.set(Calendar.MILLISECOND, 0); - instance = EnumContractReceivePeriodUnit.getAfterCalendarDay(instance, receivePeriod, dayType); - //instance.add(dayType, receivePeriod); - //instance.add(Calendar.DATE, -1); - timeVo.setEndDate(instance.getTime()); - - //自然月,应该是从本月开始到本月结束 - if(adjustPeriod.equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ - timeVo.setEndDate(EnumContractReceivePeriodUnit.getAfterCalendarNarDay(timeVo.getStartDate(), receivePeriod, dayType)); - } - - //如果是到了每年的截止时间,第一年忽略(是开始时间) - boolean isYearCut = false;//是不是有截断 - if (null != yearsEndList && yearsEndList.size() > 0 ) { - Date yearEndDateStart = yearsEndList.get(0); - //如果开始时间到了年的截止 - if (timeVo.getStartDate().equals(yearEndDateStart)) { - yearsEndList.remove(yearEndDateStart); - }else if (timeVo.getStartDate().after(yearEndDateStart)) { - //do nothing - }else if (timeVo.getStartDate().before(yearEndDateStart)) { - Date yearEndDateEnd = DateUtils.getDayEnd(yearEndDateStart); - if (timeVo.getEndDate().after(yearEndDateEnd)) { - timeVo.setEndDate(DateUtils.getDaySet(yearEndDateEnd,Calendar.DATE,-1)); - yearsEndList.remove(yearEndDateStart); - isYearCut = true; - }else if(timeVo.getEndDate().equals(yearEndDateEnd)) { - yearsEndList.remove(yearEndDateStart); - } - } - } - - if(timeVo.getEndDate().after(end)){ - Calendar endinstance = Calendar.getInstance(); - endinstance.setTime(end); - endinstance.set(Calendar.MILLISECOND, 0); - timeVo.setEndDate(endinstance.getTime()); - } - - list.add(timeVo); - - receiveDate = WxRentContractHelper.getReceiveDate(receiveDate,timeVo.getStartDate(), timeVo.getEndDate(), payPeriod,adjustPeriod,receivePeriod,dayType); - timeVo.setReceiveDate(receiveDate.getStartDate()); - - - //next - start = DateUtils.getDaySet(timeVo.getEndDate(),Calendar.SECOND,1); - - if(start.after(end)) { - break; - } - count ++; - - //预警 - if(count >= 1000){ - Logger logger = LoggerFactory.getLogger(WxRentContractServiceImpl.class); - logger.error("initBillTimeList() warnCount max error !!!"); - break; - } - } - return list; - } +// public static List initBillTimeList(List yearList,Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod,int payPeriod){ +// if (null == adjustPeriod) { +// adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode(); +// } +// List list = new ArrayList<>(); +// int count = 0; +// List yearsEndList = new ArrayList(); +// yearsEndList.addAll(yearList); +// if (yearsEndList.size() > 0) { +// yearsEndList.remove(0); +// } +// BillTimeVo receiveDate = null; +// while (true) { +// BillTimeVo timeVo = new BillTimeVo(); +// +// //账单日 +// Calendar instance = Calendar.getInstance(); +// instance.setTime(start); +// instance.set(Calendar.MILLISECOND, 0); +// //开始时间 +// timeVo.setStartDate(instance.getTime()); +// +// //结束时间 +// instance.clear(); +// instance.setTime(start); +// instance.set(Calendar.MILLISECOND, 0); +// instance = EnumContractReceivePeriodUnit.getAfterCalendarDay(instance, receivePeriod, dayType); +// //instance.add(dayType, receivePeriod); +// //instance.add(Calendar.DATE, -1); +// timeVo.setEndDate(instance.getTime()); +// +// //自然月,应该是从本月开始到本月结束 +// if(adjustPeriod.equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ +// timeVo.setEndDate(EnumContractReceivePeriodUnit.getAfterCalendarNarDay(timeVo.getStartDate(), receivePeriod, dayType)); +// } +// +// //如果是到了每年的截止时间,第一年忽略(是开始时间) +// boolean isYearCut = false;//是不是有截断 +// if (null != yearsEndList && yearsEndList.size() > 0 ) { +// Date yearEndDateStart = yearsEndList.get(0); +// //如果开始时间到了年的截止 +// if (timeVo.getStartDate().equals(yearEndDateStart)) { +// yearsEndList.remove(yearEndDateStart); +// }else if (timeVo.getStartDate().after(yearEndDateStart)) { +// //do nothing +// }else if (timeVo.getStartDate().before(yearEndDateStart)) { +// Date yearEndDateEnd = DateUtils.getDayEnd(yearEndDateStart); +// if (timeVo.getEndDate().after(yearEndDateEnd)) { +// timeVo.setEndDate(DateUtils.getDaySet(yearEndDateEnd,Calendar.DATE,-1)); +// yearsEndList.remove(yearEndDateStart); +// isYearCut = true; +// }else if(timeVo.getEndDate().equals(yearEndDateEnd)) { +// yearsEndList.remove(yearEndDateStart); +// } +// } +// } +// +// if(timeVo.getEndDate().after(end)){ +// Calendar endinstance = Calendar.getInstance(); +// endinstance.setTime(end); +// endinstance.set(Calendar.MILLISECOND, 0); +// timeVo.setEndDate(endinstance.getTime()); +// } +// +// list.add(timeVo); +// +// receiveDate = WxRentContractHelper.getReceiveDate(receiveDate,timeVo.getStartDate(), timeVo.getEndDate(), payPeriod,adjustPeriod,receivePeriod,dayType); +// timeVo.setReceiveDate(receiveDate.getStartDate()); +// +// +// //next +// start = DateUtils.getDaySet(timeVo.getEndDate(),Calendar.SECOND,1); +// +// if(start.after(end)) { +// break; +// } +// count ++; +// +// //预警 +// if(count >= 1000){ +// Logger logger = LoggerFactory.getLogger(WxRentContractServiceImpl.class); +// logger.error("initBillTimeList() warnCount max error !!!"); +// break; +// } +// } +// return list; +// } @Override @@ -1958,11 +1864,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { } - @Override - public ResultData getContractByContractNumber(WxRentContract rentContract) { - WxRentContract wxRentContract = wxRentContractMapper.selectOne(new QueryWrapper<>(rentContract)); - return new ResultData(wxRentContract); - } +// @Override +// public ResultData getContractByContractNumber(WxRentContract rentContract) { +// WxRentContract wxRentContract = wxRentContractMapper.selectOne(new QueryWrapper<>(rentContract)); +// return new ResultData(wxRentContract); +// } @Override public ResultData apply(WxRentContract rentContract,MallUserInfo user) { @@ -1979,19 +1885,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (null != clist && clist.size() > 0 ) { return new ResultData(Result.ERROR, "房间资源存在其他审批中的租金合同。请先作完成。"); } - //如果该合同是租金+物业合同,则还要判断物业合同 - if(rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - WxPropertyContract wpc = new WxPropertyContract(); - wpc.updateTenantInfo(user); - if (null != contractIds && contractIds.size() > 0 ) { - wpc.setIds(contractIds); - } - wpc.setStatus(EnumRentContractStatus.PERFORMANCE.getCode()); - List plist = wxPropertyContractMapper.findList(wpc); - if (null != plist && plist.size() > 0 ) { - return new ResultData(Result.ERROR, "房间资源存在其他审批中的物业合同。请先作完成。"); - } - } // Integer count = wxRentContractMapper.getCanApplyCount(rentContract.getId()); // if (null != count && count.intValue()>0) { // return new ResultData(Result.ERROR, "当前存在其他草稿状态或者履约驳回的合同。请先作废其他草稿或者审批拒绝或者撤回的合同。"); @@ -2024,7 +1917,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Override @Transactional(rollbackFor = {Exception.class}) - public void renewal(WxRentContract rentContract,WxPropertyContract propertyContract,MallUserInfo user) { + public void renewal(WxRentContract rentContract,MallUserInfo user) { final IdWorker idWorker = IdWorker.get(); Long newContractId = idWorker.nextId(); //拷贝 @@ -2073,9 +1966,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { rentContract.setStatus(EnumRentContractStatus.UNWRITE.getCode()); rentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); rentContract.setEndContractTime(null); - rentContract.setFirstBillDateStart(null); - rentContract.setFirstBillDateEnd(null); - rentContract.setFirstBillReceiveDate(null); + //rentContract.setFirstBillDateStart(null); + //rentContract.setFirstBillDateEnd(null); + //rentContract.setFirstBillReceiveDate(null); int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); rentContract.setLease(array[0]); //rentContract.setAdjustRatio(); @@ -2083,15 +1976,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { //rentContract.set wxRentContractMapper.insert(rentContract); - if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue() && null != propertyContract) { - propertyContract.setRentalStartDate(rentContract.getRentalStartDate()); - propertyContract.setRentalEndDate(rentContract.getRentalEndDate()); - propertyContract.setSignDate(rentContract.getSignDate()); - propertyContract.setStartDate(rentContract.getStartDate()); - propertyContract.setEndDate(rentContract.getStartDate()); - propertyContract.setRentContractId(newContractId); - wxPropertyContractService.renewal(propertyContract, user,true); - } } @Transactional(rollbackFor = {Exception.class}) @@ -2110,17 +1994,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { bill.setCusName(rentContract.getCustomerName()); wxAllBillMapper.transferCusName(bill); - if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { - WxPropertyContract pq = new WxPropertyContract(); - pq.updateTenantInfo(rentContract); - pq.setOperationType(EnumContractOperationType.WHOLE.getCode()); - pq.setRentContractId(rentContract.getId()); - List pclist = wxPropertyContractService.findList(pq); - if (null != pclist && pclist.size() > 0 ) { - WxPropertyContract propertyContract = pclist.get(0); - wxPropertyContractService.transfer(propertyContract, user); - } - } } @Override @@ -2188,13 +2061,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { return wxRentContractMapper.findToEndContractList(record); } - @Override - public List findToOutDateContracts(TenantEntity tenantEntity) { - WxRentContract wrc = new WxRentContract(); - wrc.setStatus(EnumRentContractStatus.PAING.getCode()); - wrc.setOutDateNofity(1); - return wxRentContractMapper.findList(wrc); - } +// @Override +// public List findToOutDateContracts(TenantEntity tenantEntity) { +// WxRentContract wrc = new WxRentContract(); +// wrc.setStatus(EnumRentContractStatus.PAING.getCode()); +// wrc.setOutDateNofity(1); +// return wxRentContractMapper.findList(wrc); +// } @Override public void calcuteByTradeDaily(WxRentContract wxRentContract) { @@ -2288,118 +2161,118 @@ public class WxRentContractServiceImpl implements WxRentContractService { return volist; } - @Override - public void saveFreePeriods(WxRentContract wxRentContract) { - WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); - List yearsVo = getRentContractYears(rentContract); - if (null == yearsVo) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无缴费年限"); - } - Map yearsMap = new HashMap(); - for (int i = 0 ; i < yearsVo.size() ; i++) { - WxRentContractYearsVo vo = yearsVo.get(i); - yearsMap.put(vo.getYearIndex(), vo); - } - - WxRentContractFreePeriod del = new WxRentContractFreePeriod(); - del.updateTenantInfo(wxRentContract); - del.setRentContractId(wxRentContract.getId()); - wxRentContractFreePeriodMapper.deleteByContract(del); - List volist = wxRentContract.getFreePeriods(); - if (null != volist && volist.size() > 0 ) { - List fpList = new ArrayList(); - for (int i = 0 ; i < volist.size() ; i ++) { - RentContractFreePeriodVo vo = volist.get(i); - if (null != vo.getPeriods()) { - for (int j = 0 ; j < vo.getPeriods().size(); j++ ){ - WxRentContractFreePeriod fp = vo.getPeriods().get(j); - WxRentContractYearsVo yearVo = yearsMap.get(vo.getYearIndex()); - if ((fp.getStartDate().after(yearVo.getStart()) || fp.getStartDate().equals(yearVo.getStart()) ) && - (fp.getEndDate().before(yearVo.getEnd()) || fp.getEndDate().equals(yearVo.getEnd()))) { - final IdWorker idWorker = IdWorker.get(); - fp.setId(idWorker.nextId()); - fp.updateTenantInfo(wxRentContract); - fp.setYearIndex(vo.getYearIndex()); - fp.setCreateTime(new Date()); - fp.setUpdateTime(new Date()); - fp.setRentContractId(rentContract.getId()); - fpList.add(fp); - }else { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"第"+vo.getYearIndex()+"年度有时间选择有误,不能超过该年度时间范围"); - } - } - } - } - wxRentContractFreePeriodMapper.inertPeriods(wxRentContract.getTenantId(), fpList); - } - } +// @Override +// public void saveFreePeriods(WxRentContract wxRentContract) { +// WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); +// List yearsVo = getRentContractYears(rentContract); +// if (null == yearsVo) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"无缴费年限"); +// } +// Map yearsMap = new HashMap(); +// for (int i = 0 ; i < yearsVo.size() ; i++) { +// WxRentContractYearsVo vo = yearsVo.get(i); +// yearsMap.put(vo.getYearIndex(), vo); +// } +// +// WxRentContractFreePeriod del = new WxRentContractFreePeriod(); +// del.updateTenantInfo(wxRentContract); +// del.setRentContractId(wxRentContract.getId()); +// wxRentContractFreePeriodMapper.deleteByContract(del); +// List volist = wxRentContract.getFreePeriods(); +// if (null != volist && volist.size() > 0 ) { +// List fpList = new ArrayList(); +// for (int i = 0 ; i < volist.size() ; i ++) { +// RentContractFreePeriodVo vo = volist.get(i); +// if (null != vo.getPeriods()) { +// for (int j = 0 ; j < vo.getPeriods().size(); j++ ){ +// WxRentContractFreePeriod fp = vo.getPeriods().get(j); +// WxRentContractYearsVo yearVo = yearsMap.get(vo.getYearIndex()); +// if ((fp.getStartDate().after(yearVo.getStart()) || fp.getStartDate().equals(yearVo.getStart()) ) && +// (fp.getEndDate().before(yearVo.getEnd()) || fp.getEndDate().equals(yearVo.getEnd()))) { +// final IdWorker idWorker = IdWorker.get(); +// fp.setId(idWorker.nextId()); +// fp.updateTenantInfo(wxRentContract); +// fp.setYearIndex(vo.getYearIndex()); +// fp.setCreateTime(new Date()); +// fp.setUpdateTime(new Date()); +// fp.setRentContractId(rentContract.getId()); +// fpList.add(fp); +// }else { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"第"+vo.getYearIndex()+"年度有时间选择有误,不能超过该年度时间范围"); +// } +// } +// } +// } +// wxRentContractFreePeriodMapper.inertPeriods(wxRentContract.getTenantId(), fpList); +// } +// } - @Override - public List getRentContractYears(WxRentContract rentContract) { - //String adjustRatio = rentContract.getAdjustRatio(); - //List integers = JSONArray.parseArray(adjustRatio, String.class); - //integers.add(0, "0"); - //int years = integers.size(); - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - int [] diffs = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); - int months = diffs[0]; - int days = diffs[1]; - int ext = months % 12; - int years = months/12; - if (ext > 0 ) { - years = years + 1; - }else { - if (days > 0 ) { - years = years + 1; - } - } - //合同以什么日期来计算开始计租日期 - if(rentContract.getRentStartType()!=null &&rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ - rentContract.setRentalStartDate(rentContract.getStartDate()); - } - //如果有撤铺日 - Date endcontract = rentContract.getEndContractTime(); - if (null != endcontract) { - endcontract = DateUtils.getDayEnd(endcontract); - } - List yearList = this.getYearList(years, 12, rentContract.getRentalStartDate(),endcontract); - List retList = new ArrayList(); - if (null != yearList && yearList.size() > 0) { - if (yearList.size() == 1) { - WxRentContractYearsVo vo = new WxRentContractYearsVo(); - vo.setStart(yearList.get(0)); - vo.setEnd(rentContract.getRentalEndDate()); - vo.setRemark("第1年度"); - vo.setYearIndex(1); - retList.add(vo); - }else { - Date begin = null; - for (int i = 0 ; i < yearList.size()-1 ; i ++) { - int yearindex = i+1; - begin = yearList.get(i); - Date end = yearList.get(i+1); - Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); - WxRentContractYearsVo vo = new WxRentContractYearsVo(); - vo.setStart(begin); - vo.setEnd(realEnd); - vo.setRemark("第"+yearindex+"年度"); - vo.setYearIndex(yearindex); - retList.add(vo); - begin = end; - } - WxRentContractYearsVo vo = new WxRentContractYearsVo(); - vo.setStart(yearList.get(yearList.size()-1)); - vo.setEnd(rentContract.getRentalEndDate()); - vo.setRemark("第"+yearList.size()+"年度"); - vo.setYearIndex(yearList.size()); - retList.add(vo); - } - } - if (retList.size() > 0 ) { - return retList; - } - return null; - } +// @Override +// public List getRentContractYears(WxRentContract rentContract) { +// //String adjustRatio = rentContract.getAdjustRatio(); +// //List integers = JSONArray.parseArray(adjustRatio, String.class); +// //integers.add(0, "0"); +// //int years = integers.size(); +// SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); +// int [] diffs = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); +// int months = diffs[0]; +// int days = diffs[1]; +// int ext = months % 12; +// int years = months/12; +// if (ext > 0 ) { +// years = years + 1; +// }else { +// if (days > 0 ) { +// years = years + 1; +// } +// } +// //合同以什么日期来计算开始计租日期 +// if(rentContract.getRentStartType()!=null &&rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ +// rentContract.setRentalStartDate(rentContract.getStartDate()); +// } +// //如果有撤铺日 +// Date endcontract = rentContract.getEndContractTime(); +// if (null != endcontract) { +// endcontract = DateUtils.getDayEnd(endcontract); +// } +// List yearList = this.getYearList(years, 12, rentContract.getRentalStartDate(),endcontract); +// List retList = new ArrayList(); +// if (null != yearList && yearList.size() > 0) { +// if (yearList.size() == 1) { +// WxRentContractYearsVo vo = new WxRentContractYearsVo(); +// vo.setStart(yearList.get(0)); +// vo.setEnd(rentContract.getRentalEndDate()); +// vo.setRemark("第1年度"); +// vo.setYearIndex(1); +// retList.add(vo); +// }else { +// Date begin = null; +// for (int i = 0 ; i < yearList.size()-1 ; i ++) { +// int yearindex = i+1; +// begin = yearList.get(i); +// Date end = yearList.get(i+1); +// Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); +// WxRentContractYearsVo vo = new WxRentContractYearsVo(); +// vo.setStart(begin); +// vo.setEnd(realEnd); +// vo.setRemark("第"+yearindex+"年度"); +// vo.setYearIndex(yearindex); +// retList.add(vo); +// begin = end; +// } +// WxRentContractYearsVo vo = new WxRentContractYearsVo(); +// vo.setStart(yearList.get(yearList.size()-1)); +// vo.setEnd(rentContract.getRentalEndDate()); +// vo.setRemark("第"+yearList.size()+"年度"); +// vo.setYearIndex(yearList.size()); +// retList.add(vo); +// } +// } +// if (retList.size() > 0 ) { +// return retList; +// } +// return null; +// } @Override public List getContractSales(WxRentContract wxRentContract) { @@ -2421,6 +2294,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { Integer dayPriceCalcute,Integer mothAverageDays,Integer adjustPeriod,Integer receivePeriodUnit) { BigDecimal unitPrice = new BigDecimal(0); + if (null == adjustPeriod) { + adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode(); + } + Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1); int[] diffs = DateUtils.getDiff(startDate, realEndStart); if (priceUnit.equals(EnumPriceUnit.D.getCode())){ @@ -2531,79 +2408,79 @@ public class WxRentContractServiceImpl implements WxRentContractService { return _months; } - //根据租金合同来计算附加物业费 - private BigDecimal calcuteRentPropertyPrice(WxRentContract rentcontract,WxPropertyContract propertyContract,Date startDate,Date endDate,BigDecimal money) { - //计算物业费的单价 - BigDecimal unitPropertyPrice = calcuteUnitPrice(startDate, endDate,money, - propertyContract.getPriceUnit(),propertyContract.getDayPriceCalcute(),propertyContract.getMonthAverageDays(),propertyContract.getAdjustPeriod(),propertyContract.getReceivePeriodUnit()); - //如果租金是按天计算 - if (rentcontract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ - //物业也是按天 - if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { - return unitPropertyPrice; - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { - if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { - return unitPropertyPrice.divide(new BigDecimal(12*propertyContract.getMonthAverageDays()), - Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - }else { - return unitPropertyPrice.divide(new BigDecimal(365),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { - if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { - return unitPropertyPrice.divide(new BigDecimal(propertyContract.getMonthAverageDays()), - Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - }else { - int allDays = DateUtils.daysBetween(startDate, endDate)+1; - return money.divide(new BigDecimal(allDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - } - } - }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { - if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { - if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { - return unitPropertyPrice.multiply(new BigDecimal(12*propertyContract.getMonthAverageDays())); - }else { - return unitPropertyPrice.multiply(new BigDecimal(365)); - } - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { - return unitPropertyPrice; - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { - return unitPropertyPrice.multiply(new BigDecimal(12)); - } - }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { - if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { - if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { - return unitPropertyPrice.multiply(new BigDecimal(propertyContract.getMonthAverageDays())); - }else { - //此处就无法计算月了。 - //计算月份值。 - Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1); - int[] diffs = DateUtils.getDiff(startDate, realEndStart); - BigDecimal months = new BigDecimal(diffs[0]); - Date preextraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate); - Date extraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(preextraStartDay); - Date extraStartDayMonthEnd = DateUtils.getLastDayForMonth(preextraStartDay); - int monthDays = DateUtils.daysBetween(extraStartDayMonthStart, extraStartDayMonthEnd)+1; - int predays = DateUtils.daysBetween(preextraStartDay, extraStartDayMonthEnd)+1; - months = months.add(new BigDecimal(predays).divide(new BigDecimal(monthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); - //有可能会跨月 - if (extraStartDayMonthEnd.before(endDate)) { - Date lastMonthStart = DateUtils.getDaySet(extraStartDayMonthEnd, Calendar.SECOND, 1); - int lastdays = DateUtils.daysBetween(lastMonthStart, endDate)+1; - Date lastextraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(lastMonthStart); - Date lastextraStartDayMonthEnd = DateUtils.getLastDayForMonth(lastMonthStart); - int lastmonthDays = DateUtils.daysBetween(lastextraStartDayMonthStart, lastextraStartDayMonthEnd)+1; - months = months.add(new BigDecimal(lastdays).divide(new BigDecimal(lastmonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); - } - return unitPropertyPrice.multiply(months); - } - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { - return unitPropertyPrice.divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); - }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { - return unitPropertyPrice; - } - } - return unitPropertyPrice; - } +// //根据租金合同来计算附加物业费 +// private BigDecimal calcuteRentPropertyPrice(WxRentContract rentcontract,Date startDate,Date endDate,BigDecimal money) { +// //计算物业费的单价 +// BigDecimal unitPropertyPrice = calcuteUnitPrice(startDate, endDate,money, +// propertyContract.getPriceUnit(),propertyContract.getDayPriceCalcute(),propertyContract.getMonthAverageDays(),propertyContract.getAdjustPeriod(),propertyContract.getReceivePeriodUnit()); +// //如果租金是按天计算 +// if (rentcontract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ +// //物业也是按天 +// if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { +// return unitPropertyPrice; +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { +// if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { +// return unitPropertyPrice.divide(new BigDecimal(12*propertyContract.getMonthAverageDays()), +// Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// }else { +// return unitPropertyPrice.divide(new BigDecimal(365),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// } +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { +// if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { +// return unitPropertyPrice.divide(new BigDecimal(propertyContract.getMonthAverageDays()), +// Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// }else { +// int allDays = DateUtils.daysBetween(startDate, endDate)+1; +// return money.divide(new BigDecimal(allDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// } +// } +// }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { +// if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { +// if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { +// return unitPropertyPrice.multiply(new BigDecimal(12*propertyContract.getMonthAverageDays())); +// }else { +// return unitPropertyPrice.multiply(new BigDecimal(365)); +// } +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { +// return unitPropertyPrice; +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { +// return unitPropertyPrice.multiply(new BigDecimal(12)); +// } +// }else if (rentcontract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { +// if (propertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())) { +// if (propertyContract.getDayPriceCalcute().intValue() == EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode()) { +// return unitPropertyPrice.multiply(new BigDecimal(propertyContract.getMonthAverageDays())); +// }else { +// //此处就无法计算月了。 +// //计算月份值。 +// Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1); +// int[] diffs = DateUtils.getDiff(startDate, realEndStart); +// BigDecimal months = new BigDecimal(diffs[0]); +// Date preextraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate); +// Date extraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(preextraStartDay); +// Date extraStartDayMonthEnd = DateUtils.getLastDayForMonth(preextraStartDay); +// int monthDays = DateUtils.daysBetween(extraStartDayMonthStart, extraStartDayMonthEnd)+1; +// int predays = DateUtils.daysBetween(preextraStartDay, extraStartDayMonthEnd)+1; +// months = months.add(new BigDecimal(predays).divide(new BigDecimal(monthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); +// //有可能会跨月 +// if (extraStartDayMonthEnd.before(endDate)) { +// Date lastMonthStart = DateUtils.getDaySet(extraStartDayMonthEnd, Calendar.SECOND, 1); +// int lastdays = DateUtils.daysBetween(lastMonthStart, endDate)+1; +// Date lastextraStartDayMonthStart = DateUtils.getFirstDayForCurrMonth(lastMonthStart); +// Date lastextraStartDayMonthEnd = DateUtils.getLastDayForMonth(lastMonthStart); +// int lastmonthDays = DateUtils.daysBetween(lastextraStartDayMonthStart, lastextraStartDayMonthEnd)+1; +// months = months.add(new BigDecimal(lastdays).divide(new BigDecimal(lastmonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP)); +// } +// return unitPropertyPrice.multiply(months); +// } +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.Y.getCode())) { +// return unitPropertyPrice.divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); +// }else if (propertyContract.getPriceUnit().equals(EnumPriceUnit.M.getCode())) { +// return unitPropertyPrice; +// } +// } +// return unitPropertyPrice; +// } private BigDecimal[] calcuteReveneuJump(BigDecimal sales,WxRentContract rentcontract,Date startDate,Date endDate,List freePeriods) { BigDecimal revenueDecimal = new BigDecimal(0); @@ -2673,8 +2550,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { //固定租金需要再计算,因为跳点设置的租金是单价 String rentNeedpay = "0"; if (rentDecimal.compareTo(new BigDecimal(0)) > 0 ) { - rentNeedpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, rentDecimal.toPlainString(),startDate, - endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); +// rentNeedpay = WxRentContractAgileHelper.getNeedPayMoney(freePeriods,rentcontract.getDecimalSize(), rentDecimal.toPlainString(),startDate, +// endDate,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); } rentDecimal = new BigDecimal(rentNeedpay); BigDecimal[] bs = new BigDecimal[] {revenueDecimal,rentDecimal,sales}; @@ -2683,171 +2560,172 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Override - public WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract, String sales, Date startime, Date endtime, Long propertyContractId) { - //如果账单存在缴费,付款,减免,冲抵,等情况,则不允许。 - WxAllBill bq = wxBillAllHelper.generateRentContractQueryBill(rentcontract, rentcontract.getId(),startime,endtime); - List rentBillList = wxAllBillMapper.findList(bq); - if (null == rentBillList || rentBillList.size() <= 0 ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"未查询到账单"); - } - for (int i = 0 ; i < rentBillList.size() ; i ++) { - WxAllBill rentBill = rentBillList.get(i); - if ((StringUtils.isNotBlank(rentBill.getPay()) && new BigDecimal(rentBill.getPay()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(rentBill.getSetOff()) && new BigDecimal(rentBill.getSetOff()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(rentBill.getReturnPay()) && new BigDecimal(rentBill.getReturnPay()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(rentBill.getUseMoney()) && new BigDecimal(rentBill.getUseMoney()).compareTo(new BigDecimal(0)) > 0 ) ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"租金账单存在已经已经缴费或付款,扣减,减免,冲抵的情况,不允许操作"); - } - } - - BigDecimal salesDeciaml = new BigDecimal(sales); - - //删除自动创建的账单 - WxAllBill billDel = new WxAllBill(); - billDel.updateTenantInfo(rentcontract); - billDel.setRentContractId(rentcontract.getId()); - billDel.setExtraCreateFrom(EnumBillExtraCreateFrom.RNET_REVENUE_SALES.getCode()); - billDel.setStarttimeEqual(startime); - wxAllBillMapper.deleteByRentReveneuSales(billDel); - - //上面删除掉生成的账单之后,再重新查询,只剩下主账单 - rentBillList = wxAllBillMapper.findList(bq); - - //加上物业 - List propertyBillList = null; - BigDecimal propertyPrice = new BigDecimal(0); - WxPropertyContract propertyContract = null; - if (null != propertyContractId) { - WxAllBill propertyBillq = new WxAllBill(); - propertyBillq.updateTenantInfo(rentcontract); - propertyBillq.setPropertyContractId(propertyContractId); - propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); - propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); - propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); - propertyBillq.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); - propertyBillq.setStarttimeEqual(startime); - propertyBillq.setEndtimeEqual(endtime); - propertyBillList = wxAllBillMapper.findList(propertyBillq); - for (int i = 0 ; i < propertyBillList.size() ; i ++) { - WxAllBill propertyBill = propertyBillList.get(i); - if ((StringUtils.isNotBlank(propertyBill.getPay()) && new BigDecimal(propertyBill.getPay()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(propertyBill.getSetOff()) && new BigDecimal(propertyBill.getSetOff()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(propertyBill.getReturnPay()) && new BigDecimal(propertyBill.getReturnPay()).compareTo(new BigDecimal(0)) > 0 ) - || (StringUtils.isNotBlank(propertyBill.getUseMoney()) && new BigDecimal(propertyBill.getUseMoney()).compareTo(new BigDecimal(0)) > 0 ) ) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"物业账单存在已经已经缴费或付款,扣减,减免,冲抵的情况,不允许操作"); - } - } - } - - //根据销售额来计算平均每计费周期营业额,相当于设置联营扣点保底营业额 - BigDecimal unitRevenuePrice = new BigDecimal(0); - //如果没达到最低扣点销售额,则不重新计算 - if (StringUtils.isNotBlank(rentcontract.getLimitRevenue()) && new BigDecimal(rentcontract.getLimitRevenue()).compareTo(salesDeciaml) > 0 ){ - //保存销售额 - addRevenueSales(rentcontract,startime,endtime,"0",sales,salesDeciaml,propertyContractId); - WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); - vo.setTotal("0"); - return vo; - }else { - unitRevenuePrice = calcuteUnitPrice(startime, endtime,salesDeciaml, - rentcontract.getPriceUnit(),rentcontract.getDayPriceCalcute(),rentcontract.getMonthAverageDays(),rentcontract.getAdjustPeriod(),rentcontract.getReceivePeriodUnit()); - //设置保底营业额 - rentcontract.setRevenue(unitRevenuePrice.toPlainString()); - //联营扣点 - if (rentcontract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - rentcontract.setPrice(new BigDecimal(rentcontract.getPayRatio()).multiply(unitRevenuePrice).divide(new BigDecimal(100), - Constant.default_long_decimal_size,RoundingMode.HALF_UP).toPlainString()); - }else if (rentcontract.getType().intValue() == EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode()) { - //取高才能加上物业费 - if (null != propertyContractId && null != propertyBillList) { - propertyContract = wxPropertyContractMapper.selectById(propertyContractId); - //有可能物业的单价时间跟租金的不一致,需要根据物业的单价重新计算 - //propertyPrice = calcuteRentPropertyPrice(rentcontract, propertyContract, rentBill.getStarttime(), rentBill.getEndtime(), - //new BigDecimal(propertyBill.getNeedPay())); - } - } - //计算每一年的基数 - List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); - String[] rentPriceArrs = priceArrs.get(0); - String[] revenuePriceArrs = priceArrs.get(1); - //计算商业管理费 - String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); - //计算运营管理费 - String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); - - //物业费单价 - String[] propertyContractArrs = null; - if (null != propertyContract) { - propertyContractArrs = WxRentContractHelper.calcutePropertyPrice(propertyContract); - } - List yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); - int yearIndex = 0; - for( int i = 0 ; i < yearList.size() ; i ++) { - Date yearStartDate = yearList.get(i); - Date yearEndDate = DateUtils.getTimeAfterMonths(12, yearStartDate); - if (startime.equals(yearStartDate) || - (startime.after(yearStartDate) && (endtime.before(yearEndDate) || endtime.equals(yearEndDate)) )) { - yearIndex = i; - break; - } - } - if (yearIndex <= 0 ) { - yearIndex = 0; - } - - //租金+营业管理费+商业管理费+物业 和扣点相比取高。 - BigDecimal rentTotal = new BigDecimal(rentPriceArrs[yearIndex]); - if (null != bussinessManagerPriceArrs) { - rentTotal = rentTotal.add(new BigDecimal(bussinessManagerPriceArrs[yearIndex])); - } - if (null != operationManagerPriceArrs) { - rentTotal = rentTotal.add(new BigDecimal(operationManagerPriceArrs[yearIndex])); - } - //此处需要物业合同合租金合同的计费周期一致,严谨的需要用到上面计算的propertyPrice - if (null != propertyContractArrs) { - rentTotal = rentTotal.add(new BigDecimal(propertyContractArrs[yearIndex])); - } - - //跟扣点相比较 - BigDecimal priceDecimal = rentTotal; - if (null != revenuePriceArrs && null != revenuePriceArrs[yearIndex]) { - BigDecimal revenuePrice = new BigDecimal(revenuePriceArrs[yearIndex]); - if (revenuePrice.compareTo(rentTotal) > 0 ) { - priceDecimal = revenuePrice; - } - } - - //免租期 - List freePeriods = getFreeDays(rentcontract); - - //根据扣点规则和租赁相关费用取高来计算费用 - String needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, priceDecimal.toPlainString(),startime, - endtime,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); - - //计算跳点。 - BigDecimal[] jumppays = calcuteReveneuJump(salesDeciaml, rentcontract,startime, endtime,freePeriods); - BigDecimal jumpRevenuePay = jumppays[0]; - BigDecimal jumpRentPay = jumppays[1]; - BigDecimal saleDecimalValid = jumppays[2]; - BigDecimal jumppay = new BigDecimal(0); - if (jumpRevenuePay.compareTo(jumpRentPay) > 0 ) { - jumppay = jumppay.add(jumpRevenuePay); - }else { - jumppay = jumppay.add(jumpRentPay); - } - StringBuffer sb = new StringBuffer("有效销售额:"+saleDecimalValid.toPlainString()+","); - if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) { - sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+"."); - needpay = jumppay.toPlainString(); - }else { - sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+"."); - } - sb.append("取高后总金额为:["+needpay+"]."); - //保存销售额 - addRevenueSales(rentcontract,startime,endtime,needpay,sales,saleDecimalValid,propertyContractId); - return handleBills(user,sb,rentcontract,propertyContractId,needpay,rentBillList,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES,propertyBillList,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); - - } + public WxRentContractRevenueSetSalesVo setRevenueSales(MallUserInfo user,WxRentContract rentcontract, String sales, Date startime, Date endtime) { +// //如果账单存在缴费,付款,减免,冲抵,等情况,则不允许。 +// WxAllBill bq = wxBillAllHelper.generateRentContractQueryBill(rentcontract, rentcontract.getId(),startime,endtime); +// List rentBillList = wxAllBillMapper.findList(bq); +// if (null == rentBillList || rentBillList.size() <= 0 ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"未查询到账单"); +// } +// for (int i = 0 ; i < rentBillList.size() ; i ++) { +// WxAllBill rentBill = rentBillList.get(i); +// if ((StringUtils.isNotBlank(rentBill.getPay()) && new BigDecimal(rentBill.getPay()).compareTo(new BigDecimal(0)) > 0 ) +// || (StringUtils.isNotBlank(rentBill.getSetOff()) && new BigDecimal(rentBill.getSetOff()).compareTo(new BigDecimal(0)) > 0 ) +// || (StringUtils.isNotBlank(rentBill.getReturnPay()) && new BigDecimal(rentBill.getReturnPay()).compareTo(new BigDecimal(0)) > 0 ) +// || (StringUtils.isNotBlank(rentBill.getUseMoney()) && new BigDecimal(rentBill.getUseMoney()).compareTo(new BigDecimal(0)) > 0 ) ) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"租金账单存在已经已经缴费或付款,扣减,减免,冲抵的情况,不允许操作"); +// } +// } +// +// BigDecimal salesDeciaml = new BigDecimal(sales); +// +// //删除自动创建的账单 +// WxAllBill billDel = new WxAllBill(); +// billDel.updateTenantInfo(rentcontract); +// billDel.setRentContractId(rentcontract.getId()); +// billDel.setExtraCreateFrom(EnumBillExtraCreateFrom.RNET_REVENUE_SALES.getCode()); +// billDel.setStarttimeEqual(startime); +// wxAllBillMapper.deleteByRentReveneuSales(billDel); +// +// //上面删除掉生成的账单之后,再重新查询,只剩下主账单 +// rentBillList = wxAllBillMapper.findList(bq); +// +// //加上物业 +// List propertyBillList = null; +// BigDecimal propertyPrice = new BigDecimal(0); +//// WxPropertyContract propertyContract = null; +//// if (null != propertyContractId) { +//// WxAllBill propertyBillq = new WxAllBill(); +//// propertyBillq.updateTenantInfo(rentcontract); +//// propertyBillq.setPropertyContractId(propertyContractId); +//// propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); +//// propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); +//// propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); +//// propertyBillq.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); +//// propertyBillq.setStarttimeEqual(startime); +//// propertyBillq.setEndtimeEqual(endtime); +//// propertyBillList = wxAllBillMapper.findList(propertyBillq); +//// for (int i = 0 ; i < propertyBillList.size() ; i ++) { +//// WxAllBill propertyBill = propertyBillList.get(i); +//// if ((StringUtils.isNotBlank(propertyBill.getPay()) && new BigDecimal(propertyBill.getPay()).compareTo(new BigDecimal(0)) > 0 ) +//// || (StringUtils.isNotBlank(propertyBill.getSetOff()) && new BigDecimal(propertyBill.getSetOff()).compareTo(new BigDecimal(0)) > 0 ) +//// || (StringUtils.isNotBlank(propertyBill.getReturnPay()) && new BigDecimal(propertyBill.getReturnPay()).compareTo(new BigDecimal(0)) > 0 ) +//// || (StringUtils.isNotBlank(propertyBill.getUseMoney()) && new BigDecimal(propertyBill.getUseMoney()).compareTo(new BigDecimal(0)) > 0 ) ) { +//// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"物业账单存在已经已经缴费或付款,扣减,减免,冲抵的情况,不允许操作"); +//// } +//// } +//// } +// +// //根据销售额来计算平均每计费周期营业额,相当于设置联营扣点保底营业额 +// BigDecimal unitRevenuePrice = new BigDecimal(0); +// //如果没达到最低扣点销售额,则不重新计算 +// if (StringUtils.isNotBlank(rentcontract.getLimitRevenue()) && new BigDecimal(rentcontract.getLimitRevenue()).compareTo(salesDeciaml) > 0 ){ +// //保存销售额 +// addRevenueSales(rentcontract,startime,endtime,"0",sales,salesDeciaml,propertyContractId); +// WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); +// vo.setTotal("0"); +// return vo; +// }else { +// unitRevenuePrice = calcuteUnitPrice(startime, endtime,salesDeciaml, +// rentcontract.getPriceUnit(),rentcontract.getDayPriceCalcute(),rentcontract.getMonthAverageDays(),null,rentcontract.getReceivePeriodUnit()); +// //设置保底营业额 +// rentcontract.setRevenue(unitRevenuePrice.toPlainString()); +// //联营扣点 +// if (rentcontract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { +// rentcontract.setPrice(new BigDecimal(rentcontract.getPayRatio()).multiply(unitRevenuePrice).divide(new BigDecimal(100), +// Constant.default_long_decimal_size,RoundingMode.HALF_UP).toPlainString()); +// }else if (rentcontract.getType().intValue() == EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode()) { +// //取高才能加上物业费 +// if (null != propertyContractId && null != propertyBillList) { +// //propertyContract = wxPropertyContractMapper.selectById(propertyContractId); +// //有可能物业的单价时间跟租金的不一致,需要根据物业的单价重新计算 +// //propertyPrice = calcuteRentPropertyPrice(rentcontract, propertyContract, rentBill.getStarttime(), rentBill.getEndtime(), +// //new BigDecimal(propertyBill.getNeedPay())); +// } +// } +// //计算每一年的基数 +// List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); +// String[] rentPriceArrs = priceArrs.get(0); +// String[] revenuePriceArrs = priceArrs.get(1); +// //计算商业管理费 +// String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); +// //计算运营管理费 +// String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); +// +// //物业费单价 +// String[] propertyContractArrs = null; +//// if (null != propertyContract) { +//// propertyContractArrs = WxRentContractHelper.calcutePropertyPrice(propertyContract); +//// } +// List yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); +// int yearIndex = 0; +// for( int i = 0 ; i < yearList.size() ; i ++) { +// Date yearStartDate = yearList.get(i); +// Date yearEndDate = DateUtils.getTimeAfterMonths(12, yearStartDate); +// if (startime.equals(yearStartDate) || +// (startime.after(yearStartDate) && (endtime.before(yearEndDate) || endtime.equals(yearEndDate)) )) { +// yearIndex = i; +// break; +// } +// } +// if (yearIndex <= 0 ) { +// yearIndex = 0; +// } +// +// //租金+营业管理费+商业管理费+物业 和扣点相比取高。 +// BigDecimal rentTotal = new BigDecimal(rentPriceArrs[yearIndex]); +// if (null != bussinessManagerPriceArrs) { +// rentTotal = rentTotal.add(new BigDecimal(bussinessManagerPriceArrs[yearIndex])); +// } +// if (null != operationManagerPriceArrs) { +// rentTotal = rentTotal.add(new BigDecimal(operationManagerPriceArrs[yearIndex])); +// } +// //此处需要物业合同合租金合同的计费周期一致,严谨的需要用到上面计算的propertyPrice +// if (null != propertyContractArrs) { +// rentTotal = rentTotal.add(new BigDecimal(propertyContractArrs[yearIndex])); +// } +// +// //跟扣点相比较 +// BigDecimal priceDecimal = rentTotal; +// if (null != revenuePriceArrs && null != revenuePriceArrs[yearIndex]) { +// BigDecimal revenuePrice = new BigDecimal(revenuePriceArrs[yearIndex]); +// if (revenuePrice.compareTo(rentTotal) > 0 ) { +// priceDecimal = revenuePrice; +// } +// } +// +// //免租期 +// List freePeriods = getFreeDays(rentcontract); +// +// //根据扣点规则和租赁相关费用取高来计算费用 +// String needpay = WxRentContractHelper.getNeedPayMoney(freePeriods,rentcontract, priceDecimal.toPlainString(),startime, +// endtime,0,0,false,rentcontract.getReceivePeriodUnit(),rentcontract.getReceivePeriod()); +// +// //计算跳点。 +// BigDecimal[] jumppays = calcuteReveneuJump(salesDeciaml, rentcontract,startime, endtime,freePeriods); +// BigDecimal jumpRevenuePay = jumppays[0]; +// BigDecimal jumpRentPay = jumppays[1]; +// BigDecimal saleDecimalValid = jumppays[2]; +// BigDecimal jumppay = new BigDecimal(0); +// if (jumpRevenuePay.compareTo(jumpRentPay) > 0 ) { +// jumppay = jumppay.add(jumpRevenuePay); +// }else { +// jumppay = jumppay.add(jumpRentPay); +// } +// StringBuffer sb = new StringBuffer("有效销售额:"+saleDecimalValid.toPlainString()+","); +// if (jumppay.compareTo(new BigDecimal(needpay)) > 0 ) { +// sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+"."); +// needpay = jumppay.toPlainString(); +// }else { +// sb.append("跳点规则计算金额:"+jumppay.toPlainString()+",合同租金扣点规则计算金额:"+needpay+"."); +// } +// sb.append("取高后总金额为:["+needpay+"]."); +// //保存销售额 +// addRevenueSales(rentcontract,startime,endtime,needpay,sales,saleDecimalValid,propertyContractId); +// return handleBills(user,sb,rentcontract,propertyContractId,needpay,rentBillList,startime,endtime,EnumBillExtraCreateFrom.RNET_REVENUE_SALES,propertyBillList,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); +// +// } +return null; } private void addRevenueSales(WxRentContract rentcontract,Date starttime,Date endtime,String needpay,String sales,BigDecimal saleDecimalValid,Long propertyContractId) { @@ -2942,9 +2820,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { List propeBill = generatePropertyBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, propertyContractId,propertyBillList,startDate,endDate, needpay, propertyRate,createFrom); - List bmbill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); + //List bmbill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, bussinessRate, EnumBillAllType.RENT_BUSSINESS_MANAGE,createFrom); - List ombill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); + //List ombill = generateManageBill(user,shopIdList,shopMap,shopUserMap,shopAreaRateMap,rentcontract, startDate,endDate, needpay, operaterRate, EnumBillAllType.RENT_OPERATION_MANAGE,createFrom); WxRentContractRevenueSetSalesVo vo = new WxRentContractRevenueSetSalesVo(); vo.setTotal(needpay); @@ -2953,12 +2831,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (null != propeBill) { blist.addAll(propeBill); } - if (null != bmbill) { - blist.addAll(bmbill); - } - if (null != ombill) { - blist.addAll(ombill); - } +// if (null != bmbill) { +// blist.addAll(bmbill); +// } +// if (null != ombill) { +// blist.addAll(ombill); +// } vo.setBillList(blist);; return vo; } @@ -2967,7 +2845,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { private void createBillAction(WxAllBill bill,String oldMoney,String newMoney,MallUserInfo user) { WxBillAction wxBillAction = new WxBillAction(); wxBillAction.setBillId(bill.getId()); - wxBillAction.setBillType(bill.getBillType()); + //wxBillAction.setBillType(bill.getBillType()); wxBillAction.setOldMoney(oldMoney); wxBillAction.setNewMoney(newMoney); wxBillAction.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldMoney, newMoney,null,null,null,null)); @@ -2979,11 +2857,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public List generateManageBill(MallUserInfo user,List shopIds,Map shopMap,Map shopUserMap,Map shopAreaRateMap,WxRentContract rentcontract, - Date starttime, Date endtime,String total,String rate,EnumBillAllType type,EnumBillExtraCreateFrom createFrom) { + Date starttime, Date endtime,String total,String rate,EnumBillExtraCreateFrom createFrom) { WxAllBill bussinessmanageBill = new WxAllBill(); bussinessmanageBill.updateTenantInfo(rentcontract); - bussinessmanageBill.setBillType(type.getCode()); - bussinessmanageBill.setEnergyFeesId(type.getEnergyFeesId()); + //bussinessmanageBill.setBillType(type.getCode()); + //bussinessmanageBill.setEnergyFeesId(type.getEnergyFeesId()); bussinessmanageBill.setRentContractId(rentcontract.getId()); bussinessmanageBill.setIsPreview(EnumYesOrNo.NO.getCode()); bussinessmanageBill.setNoExtraCreateFrom(EnumYesOrNo.YES.getCode()); @@ -3021,8 +2899,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { final IdWorker idWorker = IdWorker.get(); b.setId(idWorker.nextId()); b.updateTenantInfo(rentcontract); - b.setBillType(type.getCode()); - b.setEnergyFeesId(type.getEnergyFeesId()); + //b.setBillType(type.getCode()); + //b.setEnergyFeesId(type.getEnergyFeesId()); b.setRentContractId(rentcontract.getId()); b.setIsPreview(EnumYesOrNo.NO.getCode()); b.setCanEdit(EnumYesOrNo.NO.getCode()); @@ -3102,8 +2980,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { final IdWorker idWorker = IdWorker.get(); bmbill.setId(idWorker.nextId()); bmbill.updateTenantInfo(rentcontract); - bmbill.setBillType(EnumBillAllType.PROPERTY.getCode()); - bmbill.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); + //bmbill.setBillType(EnumBillAllType.PROPERTY.getCode()); + //bmbill.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); bmbill.setRentContractId(rentcontract.getId()); bmbill.setPropertyContractId(propertyContractId); bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); @@ -3183,8 +3061,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { final IdWorker idWorker = IdWorker.get(); bmbill.setId(idWorker.nextId()); bmbill.updateTenantInfo(rentcontract); - bmbill.setBillType(EnumBillAllType.RENT.getCode()); - bmbill.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); + //bmbill.setBillType(EnumBillAllType.RENT.getCode()); + //bmbill.setEnergyFeesId(EnumBillAllType.RENT.getEnergyFeesId()); bmbill.setRentContractId(rentcontract.getId()); bmbill.setIsPreview(EnumYesOrNo.NO.getCode()); bmbill.setCanEdit(EnumYesOrNo.NO.getCode()); @@ -3296,9 +3174,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { rentBillq.updateTenantInfo(rentcontract); rentBillq.setRentContractId(rentcontract.getId()); List feesIdList = new ArrayList(); - feesIdList.add(EnumBillAllType.RENT.getEnergyFeesId()); - feesIdList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); - feesIdList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId()); + //feesIdList.add(EnumBillAllType.RENT.getEnergyFeesId()); + //feesIdList.add(EnumBillAllType.RENT_BUSSINESS_MANAGE.getEnergyFeesId()); + //feesIdList.add(EnumBillAllType.RENT_OPERATION_MANAGE.getEnergyFeesId()); rentBillq.setEnergyFeesIds(feesIdList); rentBillq.setIsPreview(EnumYesOrNo.NO.getCode()); rentBillq.setStarttime(rentcontract.getYearsBegin()); @@ -3309,21 +3187,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { } //查询对应的物业账单,包括录入销售额自动生成的 - if (null != rentcontract.getPropertyContractId()) { - WxAllBill propertyBillq = new WxAllBill(); - propertyBillq.updateTenantInfo(rentcontract); - propertyBillq.setPropertyContractId(rentcontract.getPropertyContractId()); - propertyBillq.setBillType(EnumBillAllType.PROPERTY.getCode()); - propertyBillq.setEnergyFeesId(EnumBillAllType.PROPERTY.getEnergyFeesId()); - propertyBillq.setIsPreview(EnumYesOrNo.NO.getCode()); - propertyBillq.setStarttime(rentcontract.getYearsBegin()); - propertyBillq.setEndtime(rentcontract.getYearsEnd()); - //prpoertyBillq.setExtraCreateFrom(EnumBillExtraCreateFrom.RNET_REVENUE_SALES.getCode()); - WxBillSum propertyBillSum = wxAllBillMapper.getBillMonthSum(propertyBillq); - if (null != propertyBillSum) { - receivepay = receivepay.add(propertyBillSum.getNeedPayNumber()); - } - } WxRentContractYearsSumVo vo = new WxRentContractYearsSumVo(); vo.setTotalSales(sum.toPlainString()); @@ -3339,31 +3202,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { } private WxRentContractRevenueSetSalesVo handelHuiSuanBills(MallUserInfo user,WxRentContract rentcontract,String owe) { - //计算每一年的基数 - List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); - String[] rentPriceArrs = priceArrs.get(0); - //String[] revenuePriceArrs = priceArrs.get(1); - //计算商业管理费 - String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); - //计算运营管理费 - String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); - - //物业费单价 - String[] propertyContractArrs = null; - List yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); - int yearIndex = 0; - for( int i = 0 ; i < yearList.size() ; i ++) { - Date yearEndDate = yearList.get(i); - if (rentcontract.getYearsBegin().before(yearEndDate) || rentcontract.getYearsEnd().equals(yearEndDate)) { - yearIndex = i-1; - break; - } - } - if (yearIndex <= 0 ) { - yearIndex = 0; - } - StringBuffer sb = new StringBuffer(""); - return handleBills(user,sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); +// //计算每一年的基数 +// List priceArrs = WxRentContractHelper.calcuteRentAndRevenuePrice(rentcontract); +// String[] rentPriceArrs = priceArrs.get(0); +// //String[] revenuePriceArrs = priceArrs.get(1); +// //计算商业管理费 +// String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(rentcontract); +// //计算运营管理费 +// String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(rentcontract); +// +// //物业费单价 +// String[] propertyContractArrs = null; +// List yearList = this.getYearList(rentPriceArrs.length, 12, rentcontract.getRentalStartDate(),null); +// int yearIndex = 0; +// for( int i = 0 ; i < yearList.size() ; i ++) { +// Date yearEndDate = yearList.get(i); +// if (rentcontract.getYearsBegin().before(yearEndDate) || rentcontract.getYearsEnd().equals(yearEndDate)) { +// yearIndex = i-1; +// break; +// } +// } +// if (yearIndex <= 0 ) { +// yearIndex = 0; +// } +// StringBuffer sb = new StringBuffer(""); +// return handleBills(user,sb,rentcontract,null,owe,null,rentcontract.getYearsBegin(),rentcontract.getYearsEnd(),EnumBillExtraCreateFrom.RNET_TIAODIAN_HUISUAN,null,rentPriceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs,propertyContractArrs,yearIndex); + return null; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java deleted file mode 100644 index 228aaa05a..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.iformall.service.impl; - -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.enums.EnumYesOrNo; -import com.iformall.mapper.WxContractCustomersMapper; -import com.iformall.mapper.WxPropertyContractMapper; -import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.WxAgileContractService; -import com.iformall.service.WxFlowRecordService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPropertyContractService; -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; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author gongbiao - */ -@Service -public class WxRentPropertyContractServiceImpl implements WxRentPropertyContractService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxRentContractMapper wxRentContractMapper; - - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - - @Autowired - WxContractCustomersMapper wxContractCustomersMapper; - - @Autowired - WxPropertyContractService wxPropertyContractService; - - @Autowired - WxRentContractService wxRentContractService; - - @Autowired - WxFlowRecordService wxFlowRecordService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Lazy - @Autowired - WxAgileContractService wxAgileContractService; - - @Override - public PageInfo listContractVo(WxRentPropertyContractVo record, Integer pageIndex, Integer pageSize) { - if (StringUtils.isNotBlank(record.getFloorForRule()) || StringUtils.isNotBlank(record.getQueryShopIdStr())) { - List shopIdList = null; - if (StringUtils.isNotBlank(record.getQueryShopIdStr())) { - String[] qsids = record.getQueryShopIdStr().split(","); - if (null != qsids && qsids.length > 0 ) { - shopIdList = new ArrayList(); - 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 contractIds = wxAgileContractService.findBuildingFloorContractIds(record, record.getFloorForRule(), null, null, shopIdList, 0); - //List 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 customersIdList = wxContractCustomersMapper.findIdList(ccq); - if (null != customersIdList && customersIdList.size() > 0 ) { - record.setCustomersIdList(customersIdList); - }else { - record.setId(-1L); - } - } - - PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record)); - if (null != pageInfo && null != pageInfo.getList() && pageInfo.getList().size() > 0 ) { - List customersIdList = new ArrayList(); - for (int i = 0 ; i < pageInfo.getList().size(); i ++ ){ - WxRentPropertyContractVo contract = pageInfo.getList().get(i); - if (null != contract.getCustomersId()) { - customersIdList.add(contract.getCustomersId()); - } - } - - Map 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 getContractCustomersMap(TenantEntity tenantEntity,List customerIds) { - WxContractCustomers ccq = new WxContractCustomers(); - ccq.updateTenantInfo(tenantEntity); - ccq.setIds(customerIds); - List cclist = wxContractCustomersMapper.findList(ccq); - if (null != cclist && cclist.size() > 0 ){ - Map map = new HashMap(); - 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 ResultData getContractInfo(Long rentId,Long propertyId) { - Map data = new HashMap<>(2); - if (null != rentId) { - Map rent = wxRentContractService.getById(rentId,EnumYesOrNo.YES.getCode()); - data.put("rent", rent); - } - //WxPropertyContract wxPropertyContractQuery = new WxPropertyContract(); - //wxPropertyContractQuery.setRentContractId(rentId); - //WxPropertyContract propertyContract = wxPropertyContractMapper.selectOne(new QueryWrapper(wxPropertyContractQuery)); - if (null != propertyId) { - WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(propertyId); - if (propertyContract != null) { - List wxBillPropertyPreview = wxPropertyContractService.getWxBillPropertyPreview(propertyContract,propertyContract.getId()); - propertyContract.setPreviewBillRentList(wxBillPropertyPreview); - data.put("property", propertyContract); - } - } - return new ResultData(data); - } - - - @Override - public ResultData getContractApplyInfo(Long rentId,Long propertyId) { - List> result = new ArrayList>(); - String bussinessId = null; - if (null != rentId && null == propertyId) { - bussinessId = String.valueOf(rentId); - }else if (null == rentId && null != propertyId) { - bussinessId = String.valueOf(propertyId); - }else { - bussinessId = String.valueOf(rentId)+"_RP_"+String.valueOf(propertyId); - } - - WxFlowRecord wxFlowRecord = new WxFlowRecord(); - wxFlowRecord.setBusinessId(bussinessId); - List flowRecordList = wxFlowRecordService.findList(wxFlowRecord); - for (WxFlowRecord wfr : flowRecordList) { - Map data = new HashMap(); - data.put("status", wfr.getStatus()); - data.put("userName", wfr.getUserName()); - data.put("remark", wfr.getRemark()); - data.put("updateDate",wfr.getUpdateDate()); - result.add(data); - } - return new ResultData(result); - } - - - @Override - public ResultData insertRentForCreate(WxRentContract wxRentContract) { - return null; - } -} - - - - - - diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java index a5e85110c..b787708e5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java @@ -19,7 +19,6 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxAllBillMapper; import com.iformall.mapper.WxMerchantMapper; import com.iformall.mapper.WxMerchantShopMapper; -import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractMapper; import com.iformall.mapper.WxShopMapper; import com.iformall.mapper.WxShopUsersInfoMapper; @@ -84,9 +83,6 @@ public class WxShopServiceImpl implements WxShopService { @Autowired WxRentContractMapper wxRentContractMapper; - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - @Autowired WxAllBillMapper wxAllBillMapper; @@ -472,14 +468,6 @@ public class WxShopServiceImpl implements WxShopService { return new ResultData(Result.ERROR, "店铺存在有效或者审批中的租金合同,请先终止该合同或者审批退回作废合同"); } - WxPropertyContract pcq = new WxPropertyContract(); - pcq.updateTenantInfo(wxShop); - pcq.setQueryShopId(wxShop.getId()); - pcq.setStatuss(status); - List plist = wxPropertyContractMapper.findList(pcq); - if (null != plist && plist.size() > 0 ) { - return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,请先终止该合同或者审批退回作废合同"); - } // WxAllBill abq = new WxAllBill(); // abq.updateTenantInfo(wxShop); // abq.setQueryShopNumber(wxShop.getShopNumber()); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index e7dccb56e..1d564c16c 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -808,14 +808,14 @@ public class InvestBizServiceImpl implements InvestBizService { } private void checkCustomer(InvestCustomerEntity customerEntity) { - if (Objects.equals(customerEntity.getType(), EnumCustomerType.COOPERATIVE)) { - InvestHelper.notNull(customerEntity.getContractNo(), "合同编号"); - WxRentContract contract = new WxRentContract(); - contract.updateTenantInfo(InvestUserContext.getUser()); - contract.setContractNumber(customerEntity.getContractNo()); - ResultData resultData = rentContractService.hasContractNumber(contract); - InvestHelper.isTrue(Objects.equals(resultData.data, true),ErrorCode.INVEST_RESULT_NOT_FOUND,"合同编号"); - } +// if (Objects.equals(customerEntity.getType(), EnumCustomerType.COOPERATIVE)) { +// InvestHelper.notNull(customerEntity.getContractNo(), "合同编号"); +// WxRentContract contract = new WxRentContract(); +// contract.updateTenantInfo(InvestUserContext.getUser()); +// contract.setContractNumber(customerEntity.getContractNo()); +// ResultData resultData = rentContractService.hasContractNumber(contract); +// InvestHelper.isTrue(Objects.equals(resultData.data, true),ErrorCode.INVEST_RESULT_NOT_FOUND,"合同编号"); +// } } @Transactional(rollbackFor = Exception.class) diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/PayBillBaseService.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/PayBillBaseService.java index b3d7a635c..2a5b150fc 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/PayBillBaseService.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/PayBillBaseService.java @@ -6,7 +6,6 @@ import org.springframework.stereotype.Service; import com.iformall.domain.dto.WxBillPayDTO; import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.enums.EnumBillAllType; import com.iformall.service.WxMerchantBUserService; import com.iformall.service.helper.WxBillAllHelper; @@ -18,11 +17,11 @@ public class PayBillBaseService { @Autowired WxMerchantBUserService wxMerchantBUserService; - public void updateBillPaid(String tenantId,Long merchantBUserId,EnumBillAllType billType,Long billId,String paid,WxBillPayWay payWay,String remark) { + public void updateBillPaid(String tenantId,Long merchantBUserId,Long billId,String paid,WxBillPayWay payWay,String remark) { WxBillPayDTO dto = new WxBillPayDTO(); dto.setTenantId(tenantId); dto.setId(billId); - dto.setBillTypeValue(billType.getCode()); + //dto.setBillTypeValue(billType.getCode()); dto.setAddpay(paid); dto.setPayWay(payWay.getId()); dto.setPayWayName(payWay.getName()); diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java index 2dd32df15..affa885ee 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangMaServiceImpl.java @@ -19,7 +19,6 @@ import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxBuser; import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.enums.EnumBillAllType; import com.iformall.service.payBill.PayBillAdapterService; import com.iformall.service.payBill.impl.PayBillBaseService; import com.iformall.utils.DateUtils; @@ -57,7 +56,7 @@ public class JianHangMaServiceImpl extends PayBillBaseService implements PayBill Long billId = Long.parseLong(remark1_args[1]); Long merchantBUserId = Long.parseLong((String)paramMap.get("REMARK2")); String orderId = (String) paramMap.get("ORDERID"); - this.updateBillPaid(tenantId, merchantBUserId, EnumBillAllType.getEnum(billType), billId, + this.updateBillPaid(tenantId, merchantBUserId, billId, money, payWay, "商户单号"+orderId); } } diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangWxMiniProgramServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangWxMiniProgramServiceImpl.java index 77d786e8a..c03d97843 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangWxMiniProgramServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/JianHangWxMiniProgramServiceImpl.java @@ -20,7 +20,6 @@ import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxBuser; import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.enums.EnumBillAllType; import com.iformall.mapper.WxBuserMapper; import com.iformall.service.payBill.PayBillAdapterService; import com.iformall.service.payBill.impl.PayBillBaseService; @@ -62,7 +61,7 @@ public class JianHangWxMiniProgramServiceImpl extends PayBillBaseService impleme Long billId = Long.parseLong(remark1_args[1]); Long merchantBUserId = Long.parseLong((String)paramMap.get("REMARK2")); String orderId = (String) paramMap.get("ORDERID"); - this.updateBillPaid(tenantId, merchantBUserId, EnumBillAllType.getEnum(billType), billId, + this.updateBillPaid(tenantId, merchantBUserId, billId, money, payWay, "商户单号"+orderId); } } diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/MiniProgramDemo.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/MiniProgramDemo.java index 5862601ae..60d20f66c 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/MiniProgramDemo.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/MiniProgramDemo.java @@ -24,11 +24,13 @@ public class MiniProgramDemo { String POSID = wxPayAccountBill.getPayConfigString("POSID"); String BRANCHID = wxPayAccountBill.getPayConfigString("BRANCHID"); final IdWorker idWorker = IdWorker.get(); - String ORDERID = billdetail.getBillType()+"_"+idWorker.nextId(); + //String ORDERID = billdetail.getBillType()+"_"+idWorker.nextId(); + String ORDERID = "_"+idWorker.nextId(); String PAYMENT= money.toString(); String CURCODE="01"; String TXCODE = "530590"; - String REMARK1 = billdetail.getBillType()+"_"+billdetail.getId(); + //String REMARK1 = billdetail.getBillType()+"_"+billdetail.getId(); + String REMARK1 = "_"+billdetail.getId(); String REMARK2 = String.valueOf(buser.getId()); String TYPE = "1"; String GATEWAY="0"; diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java index adf0bef46..1fb37d106 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/jianhang/QrDemo.java @@ -25,11 +25,13 @@ public class QrDemo { String POSID = wxPayAccountBill.getPayConfigString("POSID"); String BRANCHID = wxPayAccountBill.getPayConfigString("BRANCHID"); final IdWorker idWorker = IdWorker.get(); - String ORDERID = billdetail.getBillType()+"_"+idWorker.nextId(); + //String ORDERID = billdetail.getBillType()+"_"+idWorker.nextId(); + String ORDERID = "_"+idWorker.nextId(); String PAYMENT= money.toString(); String CURCODE="01"; String TXCODE = "530550"; - String REMARK1 = billdetail.getBillType()+"_"+billdetail.getId(); + //String REMARK1 = billdetail.getBillType()+"_"+billdetail.getId(); + String REMARK1 = "_"+billdetail.getId(); String REMARK2 = String.valueOf(buser.getId()); String RETURNTYPE="3"; String TIMEOUT = DateUtils.date2String(DateUtils.getSecondsTimeAfter(10*60, new Date()), DateUtils.DATE_PATTERN_ALL_NOSPACE); diff --git a/mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java index 24fe30d5f..9eeaffad9 100644 --- a/mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/payBill/impl/wx/WxMiniProgramServiceImpl.java @@ -21,7 +21,6 @@ import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.WxPayAccountBill; import com.iformall.enums.EnumAppPlat; -import com.iformall.enums.EnumBillAllType; import com.iformall.exception.MallinkException; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxPayAccountService; @@ -58,7 +57,8 @@ public class WxMiniProgramServiceImpl extends PayBillBaseService implements PayB throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND.getCode(),"未查询到payAccount."); } StringBuffer attachSb = new StringBuffer() - .append(billdetail.getBillType()).append(",") + //.append(billdetail.getBillType()).append(",") + .append("").append(",") .append(billdetail.getId()).append(",") .append(buser.getId()).append(",") ; @@ -67,8 +67,9 @@ public class WxMiniProgramServiceImpl extends PayBillBaseService implements PayB Integer fee = m1.intValue(); try { final IdWorker idWorker = IdWorker.get(); - String uniquePayOrderNo = billdetail.getBillType()+"_"+idWorker.nextId(); - PayAdapterResult wxResult = wxMiniAppPayAdapterService.payIsv(payAccount, bAppInfo, payAccount.getSubMchId(), openId, billdetail.getBillTypeName(), attach, uniquePayOrderNo, + //String uniquePayOrderNo = billdetail.getBillType()+"_"+idWorker.nextId(); + String uniquePayOrderNo = "_"+idWorker.nextId(); + PayAdapterResult wxResult = wxMiniAppPayAdapterService.payIsv(payAccount, bAppInfo, payAccount.getSubMchId(), openId, "", attach, uniquePayOrderNo, fee, "127.0.0.1", wxPayAccountBill.getPaidCallBack()+"/"+wxPayAccountBill.getTenantId(), new Date(), false); if (wxResult.isSuccess()) { return wxResult; @@ -106,7 +107,7 @@ public class WxMiniProgramServiceImpl extends PayBillBaseService implements PayB Long billId = Long.parseLong(attrs[1]); Long merchantBUserId = Long.parseLong(attrs[2]); String paid = new BigDecimal(cashFee).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP).toPlainString(); - this.updateBillPaid(tenantId, merchantBUserId, EnumBillAllType.getEnum(billType), billId, + this.updateBillPaid(tenantId, merchantBUserId, billId, paid, payWay, "微信支付单号"+transcationId); }else { throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND.getCode(),"attach参数错误"); diff --git a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml index f6559b929..d22e8168e 100644 --- a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml @@ -17,7 +17,6 @@ - @@ -49,14 +48,15 @@ + `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`,`history_receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`, + `price_detail`,`need_pay`,`receive_pay`,`history_receive_pay`,`pay`,`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`,`virtual_compose_id`,`parent_virtual_compose_id`, - `energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,`can_edit`,`cus_name` + `energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,`can_edit`,`cus_name`,`fees_type` @@ -66,9 +66,9 @@ and `shop_id` = #{shopId} and `create_by` = #{createBy} and `create_by_name` like concat('%',#{createByName},'%') - and `bill_type` = #{billType} and `pay_way` = #{payWay} and `status` = #{status} + and `fees_type` = #{feesType} and `energy_fees_id` = #{energyFeesId} and `rent_contract_id` = #{rentContractId} and `rent_contract_agile_fees_type` = #{rentContractAgileFeesType} @@ -84,53 +84,33 @@ and `endtime` = #{endtimeEqual} and `extra_create_from` = #{extraCreateFrom} and `extra_create_from` is null - and bill_type = 6 and IFNULL(`pay`,'0') -IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 - and IFNULL(`pay`,'0') - IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 and bill_type in (13,21,5) + and fees_type = 2 and IFNULL(`pay`,'0') -IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 + and `can_edit` = #{canEdit} and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} - and ( - (`receive_date` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) - or - (`receive_date` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) - ) + and (`receive_date` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and fees_type = 1) - and ( - (`receive_date` > #{oweBillLastTime} and `receive_date` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) - or - (`receive_date` > #{oweBillLastTime} and `receive_date` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) - ) + and (`receive_date` > #{oweBillLastTime} and `receive_date` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and fees_type = 1) - and ( - (`receive_date` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) - or - (`receive_date` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) - ) + and (`receive_date` <= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and fees_type = 1) - and ( - ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,6,7)) - or - ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,6,7)) - ) + and ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and fees_type = 1) and ( - ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5,6,7)) + ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') < 0 and fees_type = 1) or - ( `pay` - IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 and bill_type in (13,21,5,7)) + ( `pay` - IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 and fees_type = 2) ) - and ( - (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,7)) - or - (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,7)) - ) + and (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') > 0 ) and `parent_bill_id` is not null and `parent_bill_id` is null @@ -321,16 +301,13 @@ select energy_fees_id, count(1) total_count , - case when bill_type in (13,21,5,7) then sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2))) - else sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) + CAST(IFNULL(`return_pay`,'0') AS DECIMAL(20,2))) - end as total_money, + sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2))) as total_money, MIN(starttime) min_begin_time from wx_all_bill group by energy_fees_id - @@ -339,7 +316,7 @@ @@ -347,10 +324,6 @@ delete from wx_all_bill where rent_contract_id = #{id} - - delete from wx_all_bill where property_contract_id = #{id} - - delete from wx_all_bill where is_preview = 1 @@ -434,9 +407,9 @@ delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId} and ( - (bill_type != 7 and pay <= 0 and IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 and IFNULL(`use_money`,'0') <= 0) + ( pay <= 0 and IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 and IFNULL(`use_money`,'0') <= 0) or - (bill_type = 7 and IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 and IFNULL(`use_money`,'0') <= 0) + ( IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 and IFNULL(`use_money`,'0') <= 0) ) @@ -468,15 +441,15 @@ ( IFNULL(`pay`,'0') <= 0 or - ( starttime >= #{starttime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and bill_type not in (13,21,5,6,7)) + ( starttime >= #{starttime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 ) or - ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and bill_type in (13,21,5,6,7)) + ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 ) ) or ( - ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5,6,7)) + ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 ) or - ( `pay` - IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 and bill_type in (13,21,5,7)) + ( `pay` - IFNULL(`return_pay`,'0') - IFNULL(`use_money`,'0') > 0 ) ) ) diff --git a/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml index c6986ac86..01490afe2 100644 --- a/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillActionMapper.xml @@ -5,7 +5,6 @@ - @@ -23,7 +22,7 @@ - `id`,`tenant_id`,`parent_tenant_id`,`bill_type`,`bill_id`,`old_money`,`new_money`,`user_Type`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime`,`pay_date`,`pay_way`,`remark` + `id`,`tenant_id`,`parent_tenant_id`,`bill_id`,`old_money`,`new_money`,`user_Type`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime`,`pay_date`,`pay_way`,`remark` @@ -41,10 +40,6 @@ and `parent_tenant_id` = #{parentTenantId} - - and `bill_type` = #{billType} - - and `action` = #{action} @@ -85,6 +80,7 @@ + diff --git a/mallinkService/src/main/resources/mapper/WxEnergyFeesShopMapper.xml b/mallinkService/src/main/resources/mapper/WxFeesCalcuteShopMapper.xml similarity index 85% rename from mallinkService/src/main/resources/mapper/WxEnergyFeesShopMapper.xml rename to mallinkService/src/main/resources/mapper/WxFeesCalcuteShopMapper.xml index af71bf6fd..158902c2a 100644 --- a/mallinkService/src/main/resources/mapper/WxEnergyFeesShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFeesCalcuteShopMapper.xml @@ -1,7 +1,7 @@ - - + + @@ -58,28 +58,28 @@ order by ${sortColumns} - select - from wx_energy_fees_shop + from wx_fees_calcute_shop - select distinct fees_id - from wx_energy_fees_shop + from wx_fees_calcute_shop - update wx_energy_fees_shop set begin_time = #{item.beginTime}, end_time = #{item.endTime} where id = #{item.id} + update wx_fees_calcute_shop set begin_time = #{item.beginTime}, end_time = #{item.endTime} where id = #{item.id} diff --git a/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml b/mallinkService/src/main/resources/mapper/WxFinanceFeesMapper.xml similarity index 50% rename from mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml rename to mallinkService/src/main/resources/mapper/WxFinanceFeesMapper.xml index bdd473be8..d82124c55 100644 --- a/mallinkService/src/main/resources/mapper/WxEnergyFeesMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFinanceFeesMapper.xml @@ -1,7 +1,7 @@ - - + + @@ -9,22 +9,14 @@ - - - - - - - - - + - `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`price`,`cashier_type`,`type`,`bill_type`,`is_system`, - `fixed_price`,`calcute_unit`,`time_unit`,`tax_rate`,`is_despoit`,`is_public` + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`, + `tax_rate`,`is_despoit`,`fees_type` @@ -37,23 +29,9 @@ and `parent_tenant_id` = #{parentTenantId} and `is_del` = #{isDel} - and `cashier_type` = #{cashierType} - and `type` = #{type} - and `bill_type` = #{billType} - and `bill_type` != 6 - and `is_system` = #{isSystem} - and `fixed_price` = #{fixedPrice} - and `calcute_unit` = #{calcuteUnit} - and `time_unit` = #{timeUnit} and name like concat('%', #{name},'%') and `is_despoit` = #{isDespoit} - and `is_public` = #{isPublic} - - and bill_type in - - #{billTypeItem} - - + and `fees_type` = #{feesType} and id in @@ -63,27 +41,27 @@ order by ${sortColumns} - select - from wx_energy_fees + from wx_finance_fees - select id - from wx_energy_fees + from wx_finance_fees - update wx_energy_fees set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} + update wx_finance_fees set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} diff --git a/mallinkService/src/main/resources/mapper/WxEnergyFeesSetoffMapper.xml b/mallinkService/src/main/resources/mapper/WxFinanceFeesSetoffMapper.xml similarity index 76% rename from mallinkService/src/main/resources/mapper/WxEnergyFeesSetoffMapper.xml rename to mallinkService/src/main/resources/mapper/WxFinanceFeesSetoffMapper.xml index 4ebe74108..23e18a657 100644 --- a/mallinkService/src/main/resources/mapper/WxEnergyFeesSetoffMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFinanceFeesSetoffMapper.xml @@ -1,7 +1,7 @@ - - + + @@ -35,33 +35,33 @@ order by ${sortColumns} - select - from wx_energy_fees_setoff + from wx_finance_fees_setoff - select distinct fees_id - from wx_energy_fees_setoff + from wx_finance_fees_setoff - select distinct advance_fees_id - from wx_energy_fees_setoff + from wx_finance_fees_setoff - - delete from wx_energy_fees_setoff where `tenant_id` = #{tenantId} and advance_fees_id = #{advanceFeesId} + + delete from wx_finance_fees_setoff where `tenant_id` = #{tenantId} and advance_fees_id = #{advanceFeesId} diff --git a/mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml b/mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml index 3966163aa..3aa8468b2 100644 --- a/mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFinanceReceiveBillMapper.xml @@ -8,7 +8,6 @@ - @@ -24,7 +23,7 @@ - `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_type`,`bill_cus_name`,`shop_id`,`fees_id`, + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_cus_name`,`shop_id`,`fees_id`, `pay_way`,`receive_id`,`receive`,`pay`,`starttime`,`endtime`,`is_del`,`type`,`receive_date` @@ -38,7 +37,6 @@ and `parent_tenant_id` = #{parentTenantId} and `bill_id` = #{billId} - and `bill_type` = #{billType} and `bill_cus_name` like concat('%',#{billCusName},'%') diff --git a/mallinkService/src/main/resources/mapper/WxFinanceReceiveSetoffMapper.xml b/mallinkService/src/main/resources/mapper/WxFinanceReceiveSetoffMapper.xml index 5ff52b8f7..6107f500d 100644 --- a/mallinkService/src/main/resources/mapper/WxFinanceReceiveSetoffMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFinanceReceiveSetoffMapper.xml @@ -9,7 +9,6 @@ - @@ -20,7 +19,7 @@ - `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_type`,`fees_id`, + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`fees_id`, `receive_id`,`advance_id`,`setoff`,`shop_id`,`starttime`,`endtime`,`is_del` @@ -35,7 +34,6 @@ and `bill_id` = #{billId} and `receive_id` = #{receiveId} - and `bill_type` = #{billType} and `fees_id` = #{feesId} and `advance_id` = #{advanceId} and `shop_id` = #{shopId} diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml deleted file mode 100644 index cf59729d6..000000000 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `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`,`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`, - `file_names`,price_unit,rent_price,subject_name,rent_start_type,`operation_type`,late_pay_ratio,late_pay_day,end_contract_time,out_date_notify_days,out_date_notify_phone - - - - where 1 = 1 - and `id` = #{id} - and `customers_id` = #{customersId} - and `price` = #{price} - and `rental_start_date` = #{rentalStartDate} - and `rental_end_date` = #{rentalEndDate} - - and ( - (`rental_start_date` <= #{useStartTime} and rental_end_date > #{useStartTime}) - or - (`rental_start_date` >= #{useStartTime} and rental_start_date < #{useEndTime}) - ) - - and out_date_notify_phone is not null and out_date_notify_phone != '' and and out_date_notify_days is not null and out_date_notify_days > 0 - and `sign_date` = #{signDate} - and `receive_period` = #{receivePeriod} - and `receive_period_unit` = #{receivePeriodUnit} - and `pay_period_rate` = #{payPeriodRate} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `filepath` = #{filepath} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `contract_number` = #{contractNumber} - and `deposit` = #{deposit} - and `is_del` = #{isDel} - and `updatetime` = #{updatetime} - and `createtime` = #{createtime} - and `rent_area` = #{rentArea} - and `link_person` = #{linkPerson} - and `link_phone` = #{linkPhone} - and `pay_account` = #{payAccount} - and `filename` = #{filename} - and `lease` = #{lease} - and `rent_contract_id` = #{rentContractId} - and `start_date` = #{startDate} - and `end_date` = #{endDate} - and `operation_type` = #{operationType} - and `create_type` = #{createType} - and `day_price_calcute` = #{dayPriceCalcute} - and `month_average_days` = #{monthAverageDays} - - and concat(',',shop_id_str,',') like concat('%,',#{queryShopId},',%') - - - and business_id in (${businessForRule}) - - - - and customers_id in - - #{cusItem} - - - - - and id in - - #{idItem} - - - - - and status in - - #{statusItem} - - - order by ${sortColumns} - - - - - - - - - - - - - - - - update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and DATEDIFF(rental_end_date,now()) <= 30 and rental_end_date > now() - - - - update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and rental_start_date <= now() and rental_end_date >= now() - - - - update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and rental_end_date <now() - - - - update wx_property_contract set apply_status=#{applyStatus} - ,business_type=#{businessType} - ,status=#{status} - where id=#{id} - - - - update wx_property_contract set apply_status=#{applyStatus} - ,business_type=#{businessType} - ,status=#{status} - where rent_contract_id=#{rentContractId} and id = #{id} - - - - update wx_property_contract set status=#{status} - - ,end_contract_time = #{endContractTime} - - where id=#{id} - - - - - update wx_property_contract set status=#{status} where rent_contract_id=#{rentContractId} - - - - - - - - - - update wx_property_contract set status=#{status},updatetime = #{updatetime},update_by = #{updateBy} where rent_contract_id =#{rentContractId} - - and status in - - #{statusItem} - - - - - - update wx_property_contract set end_contract_time = #{endContractTime} where id = #{id} - - - - - diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index b3d9e46af..d4011bb8d 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -5,10 +5,8 @@ - - @@ -24,85 +22,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`agile_type`,`customers_id`,`tenant_id`,`parent_tenant_id`, - `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`receive_period_unit`, - `filepath`,`status`,`contract_number`,`price_detail`,`create_by`,`update_by`, - `day_price_calcute`,`first_bill_date_start`,`first_bill_date_end`,`month_average_days`,`free_period_remark`, - `deposit`,cashtype_content_lsit,cashtype_lsit,`is_del`,`revenue_jumps_remark`, + `id`,`customers_id`,`tenant_id`,`parent_tenant_id`, + `decimal_size`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`receive_period_unit`, + `filepath`,`status`,`contract_number`,`create_by`,`update_by`, + `day_price_calcute`,`month_average_days`,`free_period_remark`, + cashtype_content_lsit,`is_del`,`revenue_jumps_remark`, `updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, - `pay_account`,`filename`,`lease`,`type`,`revenue`,`limit_revenue`,`revenue_ratio`,`revenue_ratio_way`,`revenue_ratio_set`,`adjust_ratio`,`adjust_period`,`pay_ratio`, - `start_date`,`end_date`,`from_id`,`end_contract_time`,`revenue_fixed_rent_price`,`revenue_rent_price`, + `pay_account`,`lease`,`type`, + `start_date`,`end_date`,`from_id`,`end_contract_time`, `apply_status`,`bank_name`,`fix_start_date`,`fix_end_date`,`pay_period_rate`,`create_by_name`,`update_by_name`, - `business_type`,`rent_info`, `file_names`,price_unit,rent_price,other_rent_price_info,`subject_name`,rent_start_type, - `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,first_bill_receive_date, - bussiness_management_fee,bussiness_management_fee_ratio_way,bussiness_management_fee_ratio,shop_id_str, - operating_management_fee,operating_management_fee_ratio_way,operating_management_fee_ratio,out_date_notify_days, - out_date_notify_phone,design_file,remark,revenue_minimum_method + `rent_info`, `file_names`, + shop_id_str, + design_file,remark @@ -110,9 +69,7 @@ where 1 = 1 and `id` = #{id} and `from_id` = #{fromId} - and `agile_type` = #{agileType} and `customers_id` = #{customersId} - and `price` = #{price} and `rental_start_date` = #{rentalStartDate} and `rental_end_date` = #{rentalEndDate} @@ -122,7 +79,6 @@ (`rental_start_date` >= #{useStartTime} and rental_start_date < #{useEndTime}) ) - and out_date_notify_phone is not null and out_date_notify_phone != '' and out_date_notify_days is not null and out_date_notify_days > 0 and `sign_date` = #{signDate} and `receive_period` = #{receivePeriod} and `receive_period_unit` = #{receivePeriodUnit} @@ -137,23 +93,19 @@ and `status` = #{status} and `apply_status` = #{applyStatus} and `contract_number` = #{contractNumber} - and `deposit` = #{deposit} and `is_del` = #{isDel} and `updatetime` = #{updatetime} and `createtime` = #{createtime} and `link_person` = #{linkPerson} and `link_phone` = #{linkPhone} and `pay_account` = #{payAccount} - and `filename` = #{filename} and `lease` = #{lease} and `type` = #{type} and `start_date` = #{startDate} and `end_date` = #{endDate} - and `operation_type` = #{operationType} and json_contains(json_extract(rent_info,'$[*].id'),concat('"',#{queryShopId},'"')) and `day_price_calcute` = #{dayPriceCalcute} and `month_average_days` = #{monthAverageDays} - and `revenue_fixed_rent_price` = #{revenueFixedRentPrice} and concat(',',shop_id_str,',') like concat('%,',#{queryShopId},',%') @@ -214,7 +166,6 @@ update wx_rent_contract set apply_status=#{applyStatus} - ,business_type=#{businessType} ,status=#{status} where id=#{id} @@ -270,90 +221,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -