From 95833f004deb9b8131bbaea00daa1031e978cf68 Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Thu, 27 Aug 2020 02:06:03 +0800 Subject: [PATCH 1/2] fix contract --- .../WxPropertyContractController.java | 9 ++++--- .../contract/WxRentContractController.java | 6 +++-- .../V202007311200__FOR_MEMBER_ONLY_001.sql | 2 ++ .../service/WxPropertyContractService.java | 2 +- .../impl/WxPropertyContractServiceImpl.java | 26 +++++++++++-------- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index bc9ce2ead..d1258e20e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -172,7 +172,7 @@ public class WxPropertyContractController extends WxContractBaseController { if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); } - return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); + return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),false); } @PostMapping("updateRentStartTime") @@ -184,7 +184,7 @@ public class WxPropertyContractController extends WxContractBaseController { propertyContract.updateTenantInfo(user); propertyContract.setAdjustPeriodHandle(); propertyContract.setRentStartType(wxPropertyContract.getRentStartType()); - return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName()); + return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),false); } @PostMapping("update") @@ -195,7 +195,7 @@ public class WxPropertyContractController extends WxContractBaseController { wxPropertyContract.updateTenantInfo(user); wxPropertyContract.setAdjustPeriodHandle(); //第三步提交 SWITCH - return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); + return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),true); } @@ -228,7 +228,8 @@ public class WxPropertyContractController extends WxContractBaseController { if (null == contract) { return new ResultData(Result.ERROR, "合同不存在."); } - if (contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || + 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()))) { 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 b8df68570..cc99017f4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -266,7 +266,8 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"租赁合同未查询到"); } - if (cure.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || + 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()))) { @@ -411,7 +412,8 @@ public class WxRentContractController extends WxContractBaseController { if (null == contract) { return new ResultData(Result.ERROR, "合同不存在."); } - if (contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || + 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()))) { diff --git a/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql b/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql index 010095a24..791913379 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql @@ -61,8 +61,10 @@ WHERE wrc.rent_info IS NULL AND wrc.shop_id IS NOT NULL ; //删除店铺不存在的垃圾数据 (先查询!!!!) DELETE FROM wx_rent_contract WHERE shop_id IS NOT NULL AND shop_id NOT IN (SELECT id FROM wx_shop); +DELETE FROM wx_property_contract WHERE shop_id IS NOT NULL AND shop_id NOT IN (SELECT id FROM wx_shop); //删除商户不存在得垃圾数据(先查询!!!!) delete from wx_rent_contract where merchant_id IS NOT NULL AND merchant_id not in ( select id from wx_merchant ); +delete from wx_property_contract where merchant_id IS NOT NULL AND merchant_id not in ( select id from wx_merchant ); //删除租金合同不在的物业合同 delete from wx_property_contract where rent_contract_id is not null and rent_contract_id not in ( diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java index 1ef310580..38dad083c 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -48,7 +48,7 @@ public interface WxPropertyContractService { * @param userName * @return */ - ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName); + ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName,boolean writeComplate); /** * 根据Id删除实体 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 913b119d4..d46c0ac54 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -265,7 +265,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Override @Transactional(rollbackFor = {Exception.class}) - public ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName) { + public ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName,boolean writeComplate) { // 保存调整金额(预账单调整) boolean haspreview = false; if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ @@ -328,14 +328,14 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService String message; boolean hasFlow = true; if (record.getId() == null) { - if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { - WxPropertyContract propertyContractQuery = new WxPropertyContract(); - propertyContractQuery.setRentContractId(record.getRentContractId()); - int propertyContractCount = wxPropertyContractMapper.selectCount(new QueryWrapper(propertyContractQuery)); - if (propertyContractCount > 0) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"租金合同编号["+record.getRentContractId()+"]存在关联的物业合同"); - } - } +// if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { +// WxPropertyContract propertyContractQuery = new WxPropertyContract(); +// propertyContractQuery.setRentContractId(record.getRentContractId()); +// int propertyContractCount = wxPropertyContractMapper.selectCount(new QueryWrapper(propertyContractQuery)); +// if (propertyContractCount > 0) { +// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"租金合同编号["+record.getRentContractId()+"]存在关联的物业合同"); +// } +// } hasFlow = false; final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); @@ -352,7 +352,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService // } else { // record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); // } - record.setStatus(EnumRentContractStatus.DRAFT.getCode()); + record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); try { wxPropertyContractMapper.insert(record); @@ -402,7 +402,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService record.setUpdatetime(new Date()); //如果是合并合同 物业合同的状态为 意向 - record.setStatus(EnumRentContractStatus.DRAFT.getCode()); + if (writeComplate) { + record.setStatus(EnumRentContractStatus.DRAFT.getCode()); + }else { + record.setStatus(wxPropertyContract.getStatus()); + } // if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { // record.setStatus(EnumRentContractStatus.INTENTION.getCode()); // } From b755cc8c105a328fb0fb28468845b8b79ab600f3 Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Thu, 27 Aug 2020 02:50:18 +0800 Subject: [PATCH 2/2] fix contract --- .../basic/WxMerchantController.java | 3 +- .../WxPropertyContractController.java | 85 +++++----- .../contract/WxRentContractController.java | 148 +++++++++++------- .../WxRentPropertyContractController.java | 82 ++++++++++ .../domain/vo/WxRentPropertyContractVo.java | 3 + .../service/impl/WxMerchantServiceImpl.java | 32 ++-- .../resources/mapper/WxMallBuildingMapper.xml | 10 +- 7 files changed, 250 insertions(+), 113 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index a43db08da..acfc27e16 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -186,8 +186,7 @@ public class WxMerchantController extends BaseController { @SystemControllerLog(description = "商户-更新") public ResultData updateMerchant(@RequestBody WxMerchant wxMerchant) { logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchant"); - //wxMerchant.updateTenantInfo(getTenantInfo()); - wxMerchant.setTenantId("789"); + wxMerchant.updateTenantInfo(getTenantInfo()); return wxMerchantService.updateMerchant(wxMerchant); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index d1258e20e..2c288eadc 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -107,44 +107,59 @@ public class WxPropertyContractController extends WxContractBaseController { if (!StringUtils.isBlank(renInfo)) { JSONArray arrays = JSONArray.parseArray(renInfo); if ( null != arrays) { - List floorIds = new ArrayList(); - List buildIds = new ArrayList(); - List shopIds = new ArrayList(); - for (int i = 0 ; i < arrays.size(); i ++) { - JSONObject o = arrays.getJSONObject(i); - floorIds.add(Long.parseLong(o.getString("floor"))); - buildIds.add(Long.parseLong(o.getString("building"))); - shopIds.add(Long.parseLong(o.getString("id"))); - } String floorName = ""; String buildingName = ""; String shopNumber = ""; - WxMallBuilding bq = new WxMallBuilding(); - bq.setIds(buildIds); - PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); - if (null != bpage && null != bpage.getList()) { - for (WxMallBuilding wmb : bpage.getList()) { - buildingName = buildingName +"," + wmb.getBuildingName(); - } - } - - WxMallFloor fq = new WxMallFloor(); - fq.setIds(floorIds); - PageInfo fpage = floorService.listAsPage(fq, 1, 1000); - if (null != fpage && null != fpage.getList()) { - for (WxMallFloor wmf : fpage.getList()) { - floorName = floorName +"," + wmf.getFloorName(); - } - } - - WxShop ws = new WxShop(); - ws.setIds(shopIds); - PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); - if (null != spage && null != spage.getList()) { - for (WxShop shop : spage.getList()) { - shopNumber = shopNumber+","+shop.getShopNumber(); - } - } +// List floorIds = new ArrayList(); +// List buildIds = new ArrayList(); +// List shopIds = new ArrayList(); +// for (int i = 0 ; i < arrays.size(); i ++) { +// JSONObject o = arrays.getJSONObject(i); +// try { +// floorIds.add(Long.parseLong(o.getString("floor"))); +// }catch(Exception e) { +// floorName = floorName +","+o.getString("floor"); +// } +// try { +// buildIds.add(Long.parseLong(o.getString("building"))); +// }catch(Exception e) { +// buildingName = buildingName + ","+ o.getString("building"); +// } +// try { +// shopIds.add(Long.parseLong(o.getString("id"))); +// }catch(Exception e) { +// shopNumber = shopNumber +","+o.getString("id"); +// } +// +// +// } +// +// WxMallBuilding bq = new WxMallBuilding(); +// bq.setIds(buildIds); +// PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); +// if (null != bpage && null != bpage.getList()) { +// for (WxMallBuilding wmb : bpage.getList()) { +// buildingName = buildingName +"," + wmb.getBuildingName(); +// } +// } +// +// WxMallFloor fq = new WxMallFloor(); +// fq.setIds(floorIds); +// PageInfo fpage = floorService.listAsPage(fq, 1, 1000); +// if (null != fpage && null != fpage.getList()) { +// for (WxMallFloor wmf : fpage.getList()) { +// floorName = floorName +"," + wmf.getFloorName(); +// } +// } +// +// WxShop ws = new WxShop(); +// ws.setIds(shopIds); +// PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); +// if (null != spage && null != spage.getList()) { +// for (WxShop shop : spage.getList()) { +// shopNumber = shopNumber+","+shop.getShopNumber(); +// } +// } wpc.setFloorName(floorName); wpc.setBuildingName(buildingName); 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 cc99017f4..146433b57 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -1,8 +1,28 @@ package com.iformall.controller.contract; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; import com.iformall.annotation.TenantIgnore; @@ -10,8 +30,15 @@ import com.iformall.annotation.UserDataRuleAnnotation; import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.*; +import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxBillRent; +import com.iformall.domain.po.WxMallBuilding; +import com.iformall.domain.po.WxMallFloor; +import com.iformall.domain.po.WxMerchant; +import com.iformall.domain.po.WxPayAccountBill; +import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.BaseEntity.SortField; import com.iformall.enums.EnumContractOperationType; @@ -28,25 +55,19 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillPropertyMapper; import com.iformall.mapper.WxBillRentMapper; import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.*; +import com.iformall.service.WxBillRentService; +import com.iformall.service.WxMallBuildingService; +import com.iformall.service.WxMallFloorService; +import com.iformall.service.WxMerchantService; +import com.iformall.service.WxPayAccountBillService; +import com.iformall.service.WxPropertyContractService; +import com.iformall.service.WxRentContractService; +import com.iformall.service.WxRentPropertyContractService; +import com.iformall.service.WxShopService; import com.iformall.utils.DateUtils; + 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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * @author gongbiao @@ -108,46 +129,59 @@ public class WxRentContractController extends WxContractBaseController { 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(); - for (int i = 0 ; i < arrays.size(); i ++) { - JSONObject o = arrays.getJSONObject(i); - floorIds.add(Long.parseLong(o.getString("floor"))); - buildIds.add(Long.parseLong(o.getString("building"))); - shopIds.add(Long.parseLong(o.getString("id"))); - } - String floorName = ""; - String buildingName = ""; - String shopNumber = ""; - WxMallBuilding bq = new WxMallBuilding(); - bq.setIds(buildIds); - PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); - if (null != bpage && null != bpage.getList()) { - for (WxMallBuilding wmb : bpage.getList()) { - buildingName = buildingName +"," + wmb.getBuildingName(); - } - } - - WxMallFloor fq = new WxMallFloor(); - fq.setIds(floorIds); - PageInfo fpage = floorService.listAsPage(fq, 1, 1000); - if (null != fpage && null != fpage.getList()) { - for (WxMallFloor wmf : fpage.getList()) { - floorName = floorName +"," + wmf.getFloorName(); - } - } - - WxShop ws = new WxShop(); - ws.setIds(shopIds); - PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); - if (null != spage && null != spage.getList()) { - for (WxShop shop : spage.getList()) { - shopNumber = shopNumber+","+shop.getShopNumber(); - } - } +// List floorIds = new ArrayList(); +// List buildIds = new ArrayList(); +// List shopIds = new ArrayList(); +// for (int i = 0 ; i < arrays.size(); i ++) { +// JSONObject o = arrays.getJSONObject(i); +// try { +// floorIds.add(Long.parseLong(o.getString("floor"))); +// }catch(Exception e) { +// floorName = floorName +","+o.getString("floor"); +// } +// try { +// buildIds.add(Long.parseLong(o.getString("building"))); +// }catch(Exception e) { +// buildingName = buildingName + ","+ o.getString("building"); +// } +// try { +// shopIds.add(Long.parseLong(o.getString("id"))); +// }catch(Exception e) { +// shopNumber = shopNumber +","+o.getString("id"); +// } +// } +// +// WxMallBuilding bq = new WxMallBuilding(); +// bq.setIds(buildIds); +// PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); +// if (null != bpage && null != bpage.getList()) { +// for (WxMallBuilding wmb : bpage.getList()) { +// buildingName = buildingName +"," + wmb.getBuildingName(); +// } +// } +// +// WxMallFloor fq = new WxMallFloor(); +// fq.setIds(floorIds); +// PageInfo fpage = floorService.listAsPage(fq, 1, 1000); +// if (null != fpage && null != fpage.getList()) { +// for (WxMallFloor wmf : fpage.getList()) { +// floorName = floorName +"," + wmf.getFloorName(); +// } +// } +// +// WxShop ws = new WxShop(); +// ws.setIds(shopIds); +// PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); +// if (null != spage && null != spage.getList()) { +// for (WxShop shop : spage.getList()) { +// shopNumber = shopNumber+","+shop.getShopNumber(); +// } +// } wrc.setFloorName(floorName); wrc.setBuildingName(buildingName); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java index 5cccba5fb..4750509ce 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentPropertyContractController.java @@ -1,17 +1,31 @@ package com.iformall.controller.contract; +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.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxMallBuilding; +import com.iformall.domain.po.WxMallFloor; import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxShop; import com.iformall.domain.vo.WxRentPropertyContractVo; +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 java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +41,12 @@ public class WxRentPropertyContractController extends WxContractBaseController { @Autowired private WxRentPropertyContractService wxRentPropertyContractService; + @Autowired + WxMallBuildingService buildingService; + @Autowired + WxMallFloorService floorService; + @Autowired + private WxShopService wxShopService; @UserDataRuleAnnotation("rent_property_contract_list") @GetMapping("/list") @@ -51,6 +71,68 @@ public class WxRentPropertyContractController extends WxContractBaseController { } } 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(); +// for (int i = 0 ; i < arrays.size(); i ++) { +// JSONObject o = arrays.getJSONObject(i); +// try { +// floorIds.add(Long.parseLong(o.getString("floor"))); +// }catch(Exception e) { +// floorName = floorName +","+o.getString("floor"); +// } +// try { +// buildIds.add(Long.parseLong(o.getString("building"))); +// }catch(Exception e) { +// buildingName = buildingName + ","+ o.getString("building"); +// } +// try { +// shopIds.add(Long.parseLong(o.getString("id"))); +// }catch(Exception e) { +// shopNumber = shopNumber +","+o.getString("id"); +// } +// } +// +// WxMallBuilding bq = new WxMallBuilding(); +// bq.setIds(buildIds); +// PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); +// if (null != bpage && null != bpage.getList()) { +// for (WxMallBuilding wmb : bpage.getList()) { +// buildingName = buildingName +"," + wmb.getBuildingName(); +// } +// } +// +// WxMallFloor fq = new WxMallFloor(); +// fq.setIds(floorIds); +// PageInfo fpage = floorService.listAsPage(fq, 1, 1000); +// if (null != fpage && null != fpage.getList()) { +// for (WxMallFloor wmf : fpage.getList()) { +// floorName = floorName +"," + wmf.getFloorName(); +// } +// } +// +// WxShop ws = new WxShop(); +// ws.setIds(shopIds); +// PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); +// if (null != spage && null != spage.getList()) { +// for (WxShop shop : spage.getList()) { +// shopNumber = shopNumber+","+shop.getShopNumber(); +// } +// } + + wrc.setFloorName(floorName); + wrc.setBuildingName(buildingName); + wrc.setShopNumber(shopNumber); + } + + } } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java index a4ee35a22..642fed370 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxRentPropertyContractVo.java @@ -21,6 +21,9 @@ public class WxRentPropertyContractVo extends TenantEntity { private Long rentId; private Long propertyId; + private String floorName; + private String buildingName; + @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber") private String contractNumber; 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 5bbdc45f2..d1412ea39 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -482,21 +482,23 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId()); } List shopIds = wxMerchant.getShopids(); - for (Long sid: shopIds) { - WxMerchantShop mcs = new WxMerchantShop(); - mcs.setMerchantId(wxMerchant.getId()); - mcs.setShopId(sid); - mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - mcs.setId(idWorker.nextId()); - mcs.updateTenantInfo(wxMerchant); - Date shopdate = new Date(); - mcs.setUpdateDate(shopdate); - mcs.setCreateDate(shopdate); - wxMerchantShopMapper.insert(mcs); - //更新商铺状态 - WxShop sh = wxShopMapper.selectById(sid); - sh.setStatus(EnumShopStatus.RENT.getCode()); - wxShopMapper.updateById(sh); + if (null != shopIds) { + for (Long sid: shopIds) { + WxMerchantShop mcs = new WxMerchantShop(); + mcs.setMerchantId(wxMerchant.getId()); + mcs.setShopId(sid); + mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + mcs.setId(idWorker.nextId()); + mcs.updateTenantInfo(wxMerchant); + Date shopdate = new Date(); + mcs.setUpdateDate(shopdate); + mcs.setCreateDate(shopdate); + wxMerchantShopMapper.insert(mcs); + //更新商铺状态 + WxShop sh = wxShopMapper.selectById(sid); + sh.setStatus(EnumShopStatus.RENT.getCode()); + wxShopMapper.updateById(sh); + } } return new ResultData(Result.SUCCESS, "商户更新成功"); } catch (Exception e) { diff --git a/mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml b/mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml index d0d8456bc..91a62fe4a 100644 --- a/mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml @@ -55,13 +55,15 @@ and `update_date` = #{updateDate} - + + - and id in + and id in - #{idItem} + #{idItem} - + + order by ${sortColumns}