From 0fcd57fc1abded73a575862fd51e6b6b0df03fca Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 23 Jul 2020 12:49:14 +0800 Subject: [PATCH 01/19] init bug --- .../controller/basic/WxProjectConfigController.java | 5 +++-- .../iformall/service/impl/WxMallBuildingServiceImpl.java | 8 ++++++++ .../src/main/resources/mapper/WxFlowConfigMapper.xml | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index 2c03784f4..f9f901464 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -129,7 +129,7 @@ public class WxProjectConfigController extends BaseController { if(wxMall.getSaleType().equals(100)){ wxMall.setGroupSupport(EnumGroupSupport.SUPPORT.getCode()); }else{ - wxMall.setGroupSupport(EnumGroupSupport.SUPPORT.getCode()); + wxMall.setGroupSupport(EnumGroupSupport.NOT_SUPPORT.getCode()); } if(StringUtils.isBlank(wxMall.getBusinessHours())){ wxMall.setBusinessHours("[]"); @@ -500,7 +500,7 @@ public class WxProjectConfigController extends BaseController { setTenantId(wxMall.getTenantId()); }}; ResultData wxMallBuildingFloorList = wxMallBuildingService.getBuildingFloorList(tenantEntity); - map.put("wxMallBuildingFloorList",wxMallBuildingFloorList); + map.put("wxMallBuildingFloorList",wxMallBuildingFloorList.data); WxPayAccount wxPayAccount = wxPayAccountService.getByTenantId(wxMall.getTenantId()); map.put("wxPayAccount",wxPayAccount); WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxMall.getTenantId()); @@ -512,6 +512,7 @@ public class WxProjectConfigController extends BaseController { map.put("wxAppinfoList",wxAppinfoList); MallUserInfo mallUserInfo = new MallUserInfo() {{ setTenantId(wxMall.getTenantId()); + setIsAdmin(1); }}; List mallUserInfoList = mallUserInfoService.findList(mallUserInfo); map.put("mallUserInfoList",mallUserInfoList); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMallBuildingServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMallBuildingServiceImpl.java index ebfef73f3..224270858 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMallBuildingServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMallBuildingServiceImpl.java @@ -88,8 +88,11 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); + record.setCreateDate(new Date()); + record.setUpdateDate(new Date()); wxMallBuildingMapper.insert(record); } else { + record.setUpdateDate(new Date()); wxMallBuildingMapper.updateById(record); } } @@ -115,6 +118,8 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { List wxMallBuildings = buildings.stream().map(b -> { WxMallBuilding tempb = new WxMallBuilding(); tempb.setId(b.getId()); + tempb.setTenantId(b.getTenantId()); + tempb.setParentTenantId(b.getParentTenantId()); tempb.setName(b.getName()); return tempb; }).collect(Collectors.toList()); @@ -125,7 +130,10 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { List wxMallFloors = wxMallFloorMapper.findList(wxMallFloor).stream().map(f -> { WxMallFloor tempf = new WxMallFloor(); tempf.setId(f.getId()); + tempf.setTenantId(f.getTenantId()); + tempf.setParentTenantId(f.getParentTenantId()); tempf.setFloorName(f.getFloorName()); + tempf.setBackgroundImg(f.getBackgroundImg()); if (f.getTotalArea() != null) { tempf.setTotalArea(f.getTotalArea()); } diff --git a/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml index 1918745b8..ca9efb0e2 100644 --- a/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml @@ -4,7 +4,7 @@ - + @@ -20,7 +20,6 @@ where 1=1 - and `parent_id` = #{parentId} and `tenant_id` = #{tenantId} From 834a8eefff7946a5c6b63bfc2bd9c4bf17ade4cb Mon Sep 17 00:00:00 2001 From: furunxin <864795252@qq.com> Date: Thu, 23 Jul 2020 13:11:01 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=BB=AD=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract/WxPropertyContractExtensionController.java | 5 ++++- .../contract/WxRentContractExtensionController.java | 6 ++++-- .../src/main/resources/mapper/WxPropertyContractMapper.xml | 2 +- .../src/main/resources/mapper/WxRentContractMapper.xml | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java index b256ac08d..b425751e5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java @@ -37,9 +37,12 @@ public class WxPropertyContractExtensionController extends BaseController { @GetMapping("getMerchantList") @SystemControllerLog(description = "获取可续签商户列表") - public ResultData getMerchantList() throws Exception{ + @ApiImplicitParams({ + @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) + public ResultData getMerchantList(Integer shopType) throws Exception{ WxPropertyContract wxPropertyContract = new WxPropertyContract(); wxPropertyContract.updateTenantInfo(getTenantInfo()); + wxPropertyContract.setRentShopType(shopType); return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getMerchantList(wxPropertyContract)); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractExtensionController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractExtensionController.java index f14e20a26..ece13f08c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractExtensionController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractExtensionController.java @@ -49,12 +49,14 @@ public class WxRentContractExtensionController extends BaseController { @GetMapping("searchMerchant") @ApiImplicitParams({ - @ApiImplicitParam(name = "merchantName", value = "商户名称", dataType = "string", paramType = "query", required = true)}) + @ApiImplicitParam(name = "merchantName", value = "商户名称", dataType = "string", paramType = "query", required = true), + @ApiImplicitParam(name = "shopType", value = "店铺类型 1:店铺 2:多经点位", dataType = "Integer", paramType = "query", required = true)}) @SystemControllerLog(description = "商户搜索") - public ResultData searchMerchant(String merchantName) throws Exception{ + public ResultData searchMerchant(String merchantName,Integer shopType) throws Exception{ WxRentContract wxRentContract = new WxRentContract(); wxRentContract.updateTenantInfo(getTenantInfo()); wxRentContract.setMerchantName(merchantName); + wxRentContract.setRentShopType(shopType); List> result = wxRentContractService.searchMerchantByname(wxRentContract); return new ResultData(result); } diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 8169dd543..96638fc7d 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -398,6 +398,6 @@ and `parent_tenant_id` = #{parentTenantId} ) pc) - and rent_shop_type = 1 + and rent_shop_type = #{shopType} diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 5e77c1df8..877a45dc8 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -652,7 +652,7 @@ diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 877a45dc8..1cd586dd8 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -652,7 +652,7 @@ - - + + + + delete from wx_mall_building where `tenant_id` = #{tenantId} + diff --git a/mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml b/mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml index 9a5022c8f..ddf4fd1d2 100644 --- a/mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml @@ -74,7 +74,11 @@ - delete from wx_mall_floor where building_id=#{buildingId} + delete from wx_mall_floor where building_id = #{buildingId} + + + + delete from wx_mall_floor where `tenant_id` = #{tenantId} From a7bea5fef48e300e08691c078fc8a76308b25c11 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 23 Jul 2020 15:44:23 +0800 Subject: [PATCH 06/19] init bug --- .../iformall/controller/basic/WxProjectConfigController.java | 3 +-- .../com/iformall/service/impl/WxProjectConfigServiceImpl.java | 1 + mallinkService/src/main/resources/mapper/WxCouponMapper.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index df9af776c..34a014e25 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -560,9 +560,8 @@ public class WxProjectConfigController extends BaseController { setTenantId(wxMall.getParentTenantId()); }}; WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); - logger.info(parentWxMall.toString()); if(parentWxMall == null || parentWxMall.getSaleType() != 100 - || !parentWxMall.equals(EnumGroupSupport.SUPPORT.getCode()) + || !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) || StringUtils.isNotBlank(parentWxMall.getParentTenantId())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java index bc75f8f09..c395ed8e8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java @@ -245,6 +245,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { /** * 初始化数据 */ + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 9e9d1a276..efcfc6a9d 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -931,7 +931,7 @@ and wo.`parent_tenant_id` = #{parentTenantId} - and wop.`tenant_id` = #{tenantId} + and wop.`parent_tenant_id` = #{parentTenantId} ) * 100 From e129a8f9720bb0d5103a1d7a9cae947cad4fa8f9 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 23 Jul 2020 16:12:52 +0800 Subject: [PATCH 07/19] init bug --- .../iformall/controller/basic/WxProjectConfigController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index 34a014e25..7ae3bf899 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -9,6 +9,7 @@ import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxWeappInfo; import com.iformall.enums.EnumGroupSupport; +import com.iformall.enums.EnumInvestUserType; import com.iformall.enums.EnumUserAdmin; import com.iformall.service.*; import com.iformall.shiro.PasswordHelper; @@ -270,6 +271,7 @@ public class WxProjectConfigController extends BaseController { PasswordHelper passwordHelper = new PasswordHelper(); passwordHelper.encryptPassword(userInfo); userInfo.setIsAdmin(EnumUserAdmin.ADMIN.getCode()); + userInfo.setInvestRule(EnumInvestUserType.MANAGER.getCode()); wxProjectConfigService.initUserInfo(userInfo); }else{ From bfd91b2baa3964c89684af4138d24efaaa084f46 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 23 Jul 2020 16:40:05 +0800 Subject: [PATCH 08/19] init bug --- .../src/main/resources/mapper/WxUserVisitMapper.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml index 893f380d0..2ac0d1b60 100644 --- a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml @@ -108,7 +108,7 @@ + + From 445f289bed181b45c873a1ab0f63017176a2ae52 Mon Sep 17 00:00:00 2001 From: furunxin <864795252@qq.com> Date: Fri, 24 Jul 2020 17:04:30 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=BB=AD=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...WxPropertyContractExtensionController.java | 37 +++- .../service/WxPropertyContractService.java | 2 + .../impl/WxPropertyContractServiceImpl.java | 197 ++++++++++++++++++ 3 files changed, 233 insertions(+), 3 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java index b425751e5..1b397bbb4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractExtensionController.java @@ -4,17 +4,19 @@ import com.iformall.annotation.SystemControllerLog; 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.WxPropertyContract; import com.iformall.domain.po.WxRentContract; +import com.iformall.enums.EnumContractType; +import com.iformall.enums.EnumRentStartType; import com.iformall.service.WxPropertyContractService; +import com.iformall.service.WxRentPropertyContractService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @@ -34,6 +36,8 @@ public class WxPropertyContractExtensionController extends BaseController { @Autowired private WxPropertyContractService wxPropertyContractService; + @Autowired + private WxRentPropertyContractService wxRentPropertyContractService; @GetMapping("getMerchantList") @SystemControllerLog(description = "获取可续签商户列表") @@ -45,4 +49,31 @@ public class WxPropertyContractExtensionController extends BaseController { wxPropertyContract.setRentShopType(shopType); return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getMerchantList(wxPropertyContract)); } + + @PostMapping("add") + @SystemControllerLog(description = "物业合同-新增") + public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { + log.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); + MallUserInfo user = getUser(); + wxPropertyContract.updateTenantInfo(user); + wxPropertyContract.setAdjustPeriodHandle(); + Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode()); + wxPropertyContract.setContractType(contractType); + if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ + wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); + } + return wxPropertyContractService.saveOrUpdate2(wxPropertyContract, user.getId(), user.getName()); + } + + @PostMapping("update") + @SystemControllerLog(description = "物业合同-修改") + public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { + log.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); + MallUserInfo user = getUser(); + wxPropertyContract.updateTenantInfo(user); + wxPropertyContract.setAdjustPeriodHandle(); + //第三步提交 SWITCH + return wxPropertyContractService.saveOrUpdate2(wxPropertyContract, user.getId(), user.getName()); + + } } diff --git a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java index ad6cf5804..f1e972e7c 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java @@ -42,6 +42,8 @@ public interface WxPropertyContractService { */ ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName); + ResultData saveOrUpdate2(WxPropertyContract record, Long userId, String userName); + /** * 根据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 7c0adc420..669ac95ef 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -455,6 +455,203 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return new ResultData(Result.SUCCESS, message, record); } + @Override + @Transactional(rollbackFor = {Exception.class}) + public ResultData saveOrUpdate2(WxPropertyContract record, Long userId, String userName) { + // 保存调整金额(预账单调整) + boolean haspreview = false; + if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ + savePreviewBill(record); + haspreview = true; + } + + if (record.getRentShopType().equals(EnumRentShopType.POINT.getCode()) && null == record.getShopId()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "shopId不能为空"); + } + + WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getRentContractId()); + if (wxRentContract != null) { + if (wxRentContract.getStatus().equals(EnumRentContractStatus.CONTRACT_END.getCode()) || + wxRentContract.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) || + wxRentContract.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) { + return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED); + } + } else { + return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); + } + if (null == record.getMerchantId() && record.getOperationType().equals(EnumContractOperationType.PART.getCode())) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空"); + } + if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) { + WxMerchant merchant = wxMerchantMapper.selectById(record.getMerchantId()); + if (merchant == null) { + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); + } + } + if (null == record.getReceivePeriod()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "付款周期不能为空"); + } + if (null == record.getLease()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "租期不能为空"); + } + if (null == record.getPrice()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "物业费不能为空"); + } + if (null == record.getDeposit()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "押金不能为空"); + } + if (record.getPrice().longValue() <= 0) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "物业费要大于0"); + } + + WxPropertyContract propertyContract = new WxPropertyContract(); + propertyContract.updateTenantInfo(wxRentContract); + propertyContract.setRentContractId(record.getRentContractId()); + long count = wxPropertyContractMapper.findList(propertyContract) + .stream().filter(p -> p.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) || + p.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) || + p.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); + if (count > 1) { + return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); + } + //保存物业合同信息 + 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); + } + } + hasFlow = false; + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + record.setRentalStartDate(wxRentContract.getRentalStartDate()); + record.setRentalEndDate(wxRentContract.getRentalEndDate()); + record.setStartDate(wxRentContract.getStartDate()); + record.setEndDate(wxRentContract.getEndDate()); + Date date = new Date(); + record.setCreatetime(date); + record.setUpdatetime(date); + record.setStatus(EnumRentContractStatus.EXTENSION.getCode()); + record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); + try { + wxPropertyContractMapper.insert(record); + } catch (Exception e) { + logger.error("保存物业合同信息失败,e:" + e.getMessage()); + throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); + } + + //生成预览账单 + wxBillPropertyMapper.deletePreviewBill(record); + //重新生成 + List billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode(),true); + record.setPreviewBillRentList(billList); + + message = "保存物业合同信息成功"; + } else {//更新物业合同信息 + //查询预账单用于展示 + WxBillProperty wxBillRent = new WxBillProperty(); + wxBillRent.setPropertyContractId(record.getId()); + wxBillRent.setSortColumns(BaseEntity.SortField.Period_ASC); + wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); + List billList = wxBillPropertyMapper.findList(wxBillRent); + record.setPreviewBillRentList(billList); + + if(!haspreview){ + if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null + && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) { + //删除预账单,重新生成 + wxBillPropertyMapper.deletePreviewBill(record); + //重新生成 + billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode(),true); + record.setPreviewBillRentList(billList); + } + } + + WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectById(record.getId()); + if (wxPropertyContract == null) { + return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); + } + + record.setRentalStartDate(wxRentContract.getRentalStartDate()); + record.setRentalEndDate(wxRentContract.getRentalEndDate()); + record.setStartDate(wxRentContract.getStartDate()); + record.setEndDate(wxRentContract.getEndDate()); + record.setPrice(record.getPrice() != null ? record.getPrice() : 0); + record.setDeposit(record.getDeposit() != null ? record.getDeposit() : 0); + record.setUpdatetime(new Date()); + + //如果是合并合同 物业合同的状态为 意向 + if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { + record.setStatus(EnumRentContractStatus.EXTENSION.getCode()); + } + + if (CollectionUtils.isEmpty(record.getFlowParams())) { + hasFlow = false; + 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()); + } + + message = "更新物业合同信息成功"; + } + + if (hasFlow) { + if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) { + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null) { + updatePropertyContractStatus(record.getId()); + } else { + record.getFlowParams().put("businessId", record.getId().toString()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); + + // 合同状态改成待签约 + WxPropertyContract updateRentContract = new WxPropertyContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setStatus(EnumRentContractStatus.EXTENSION.getCode()); + wxPropertyContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功", record.getId().toString()); + } + } else { + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null + && record.getMerchantId() != null) { + wxRentContractService.updateRentContractStatus(record.getId()); + } else { + record.getFlowParams().put("businessId", record.getRentContractId().toString()); + if (record.getMerchantId() != null) { + record.getFlowParams().put("supplement", true); //设置补录 + } + wxFlowService.start(record.getFlowParams(), userId, userName, record); + + // 合同状态改成待签约 + WxRentContract updateRentContract = new WxRentContract(); + updateRentContract.setId(record.getRentContractId()); + updateRentContract.setStatus(EnumRentContractStatus.EXTENSION.getCode()); + if(wxRentContract.getStatus().equals(EnumRentContractStatus.SUPPLE.getCode())){ + updateRentContract.setStatus(EnumRentContractStatus.EXTENSION.getCode()); + } + wxRentContractMapper.updateStatus(updateRentContract); + logger.info("id:{},启动审批流成功,是否补录:{}", record.getRentContractId().toString(), record.getMerchantId() != null); + } + } + }else{ + //审批状态重置 + WxPropertyContract updateRentContract = new WxPropertyContract(); + updateRentContract.setId(record.getId()); + updateRentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); + wxPropertyContractMapper.updateById(updateRentContract); + } + + return new ResultData(Result.SUCCESS, message, record); + } + @Override public ResultData updatePropertyContractStatus(Long id) { if (id == null) { From 6bbd52fd6d499be942746670228ac4b937bd7c2e Mon Sep 17 00:00:00 2001 From: xhxu Date: Sat, 25 Jul 2020 13:47:04 +0800 Subject: [PATCH 16/19] =?UTF-8?q?wx=5Fuser=5Fvisit=20=20=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=88=A4null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/WxUserVisitMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml index 2ac0d1b60..49986720a 100644 --- a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml @@ -108,7 +108,7 @@