| @@ -58,6 +58,23 @@ public class WxMerchantController extends BaseController { | |||
| } | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listVo2") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData listVo2(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage2(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -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; | |||
| @@ -129,7 +130,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("[]"); | |||
| @@ -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{ | |||
| @@ -500,7 +502,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 +514,7 @@ public class WxProjectConfigController extends BaseController { | |||
| map.put("wxAppinfoList",wxAppinfoList); | |||
| MallUserInfo mallUserInfo = new MallUserInfo() {{ | |||
| setTenantId(wxMall.getTenantId()); | |||
| setIsAdmin(1); | |||
| }}; | |||
| List<MallUserInfo> mallUserInfoList = mallUserInfoService.findList(mallUserInfo); | |||
| map.put("mallUserInfoList",mallUserInfoList); | |||
| @@ -560,7 +563,7 @@ public class WxProjectConfigController extends BaseController { | |||
| }}; | |||
| WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); | |||
| 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); | |||
| } | |||
| @@ -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,12 +36,44 @@ public class WxPropertyContractExtensionController extends BaseController { | |||
| @Autowired | |||
| private WxPropertyContractService wxPropertyContractService; | |||
| @Autowired | |||
| private WxRentPropertyContractService wxRentPropertyContractService; | |||
| @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)); | |||
| } | |||
| @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()); | |||
| } | |||
| } | |||
| @@ -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<Map<String,Object>> result = wxRentContractService.searchMerchantByname(wxRentContract); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -36,7 +36,7 @@ public class ContractSchedule { | |||
| /** | |||
| * 2小时执行一次 | |||
| */ | |||
| @Scheduled(cron = "0 0 0/2 * * ?") | |||
| @Scheduled(cron = "0 */1 * * * ?") | |||
| public void sendMsg() { | |||
| logger.info("合同状态更新开始"); | |||
| @@ -7,10 +7,7 @@ import com.iformall.domain.po.WxMallBuilding; | |||
| public interface WxMallBuildingMapper extends CommonMapper<WxMallBuilding, String> { | |||
| List<WxMallBuilding> findList(WxMallBuilding wxMallBuilding); | |||
| void deleteByTenantId(String tenantId); | |||
| } | |||
| @@ -9,4 +9,6 @@ public interface WxMallFloorMapper extends CommonMapper<WxMallFloor, String> { | |||
| List<WxMallFloor> findList(WxMallFloor wxMallFloor); | |||
| int deleteByBuildingId(Long buildingId); | |||
| void deleteByTenantId(String tenantId); | |||
| } | |||
| @@ -34,4 +34,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| List<WxMerchantTradeDetailVo> userTradeDetailList(WxMerchant wxMerchant); | |||
| WxMerchant findByTrade(HashMap<String, String> params); | |||
| List<WxMerchant> findListVo2(WxMerchant record); | |||
| } | |||
| @@ -68,4 +68,5 @@ public interface WxMallBuildingService { | |||
| */ | |||
| void saveFloorArea(WxMallFloor record); | |||
| void deleteByTenantId(String tenantId); | |||
| } | |||
| @@ -43,4 +43,6 @@ public interface WxMallFloorService { | |||
| ResultData getFloorList(TenantEntity tenantEntity, Long buildingId); | |||
| void deleteByBuildingId(Long buildingId); | |||
| void deleteByTenantId(String tenantId); | |||
| } | |||
| @@ -143,4 +143,6 @@ public interface WxMerchantService { | |||
| List<WxMerchantVo> findMerchantVoList(Map paramMap); | |||
| PageInfo<WxMerchant> listVoAsPage2(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); | |||
| } | |||
| @@ -42,6 +42,8 @@ public interface WxPropertyContractService { | |||
| */ | |||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName); | |||
| ResultData saveOrUpdate2(WxPropertyContract record, Long userId, String userName); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| @@ -84,12 +84,16 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| @Override | |||
| public void saveOrUpdate(WxMallBuilding record) { | |||
| Date nowDate = new Date(); | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(nowDate); | |||
| record.setUpdateDate(nowDate); | |||
| wxMallBuildingMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(nowDate); | |||
| wxMallBuildingMapper.updateById(record); | |||
| } | |||
| } | |||
| @@ -115,6 +119,8 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| List<WxMallBuilding> 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 +131,10 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| List<WxMallFloor> 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()); | |||
| } | |||
| @@ -184,5 +193,10 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| wxMallFloorMapper.updateById(mallFloor); | |||
| } | |||
| @Override | |||
| public void deleteByTenantId(String tenantId) { | |||
| wxMallBuildingMapper.deleteByTenantId(tenantId); | |||
| } | |||
| } | |||
| @@ -34,12 +34,16 @@ public class WxMallFloorServiceImpl implements WxMallFloorService { | |||
| @Override | |||
| public void saveOrUpdate(WxMallFloor record) { | |||
| Date nowDate = new Date(); | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(nowDate); | |||
| record.setUpdateDate(nowDate); | |||
| wxMallFloorMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(nowDate); | |||
| wxMallFloorMapper.updateById(record); | |||
| } | |||
| } | |||
| @@ -64,5 +68,10 @@ public class WxMallFloorServiceImpl implements WxMallFloorService { | |||
| wxMallFloorMapper.deleteByBuildingId(buildingId); | |||
| } | |||
| @Override | |||
| public void deleteByTenantId(String tenantId) { | |||
| wxMallFloorMapper.deleteByTenantId(tenantId); | |||
| } | |||
| } | |||
| @@ -795,4 +795,12 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| public List<WxMerchantVo> findMerchantVoList(Map paramMap) { | |||
| return wxCouponMerchantMapper.findMerchantVoList(paramMap); | |||
| } | |||
| @Override | |||
| public PageInfo<WxMerchant> listVoAsPage2(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findListVo2(record); | |||
| PageInfo<WxMerchant> pageInfo = new PageInfo<>(merchants); | |||
| return pageInfo; | |||
| } | |||
| } | |||
| @@ -157,11 +157,15 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| @Transactional | |||
| public void initBuilding(List<WxMallBuilding> wxMallBuildings) { | |||
| for (WxMallBuilding wxMallBuilding:wxMallBuildings) { | |||
| wxMallBuildingService.deleteByTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallBuilding.setId(null); | |||
| wxMallBuilding.setMallId(Long.parseLong(wxMallBuilding.getTenantId())); | |||
| if(wxMallBuilding.getFloors() != null && wxMallBuilding.getFloors().size() > 0){ | |||
| wxMallBuilding.setFloorNumber(wxMallBuilding.getFloors().size()); | |||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||
| for (WxMallFloor wxMallFloor:wxMallBuilding.getFloors()) { | |||
| wxMallFloorService.deleteByTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallFloor.setId(null); | |||
| wxMallFloor.setTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallFloor.setParentTenantId(wxMallBuilding.getParentTenantId()); | |||
| wxMallFloor.setMallId(Long.parseLong(wxMallBuilding.getTenantId())); | |||
| @@ -241,6 +245,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| /** | |||
| * 初始化数据 | |||
| */ | |||
| } | |||
| @@ -455,6 +455,200 @@ 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<WxBillProperty> 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<WxBillProperty> 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()); | |||
| 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) { | |||
| @@ -2630,16 +2630,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| shopList.add(shopId); | |||
| } | |||
| } else { | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.updateTenantInfo(record); | |||
| wxRentContract.setShopId(record.getShopId()); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| filter(rc -> rc.get("status").equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.RENT_PAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| } | |||
| shopList.add(record.getShopId()); | |||
| } | |||
| @@ -46,7 +46,7 @@ public class CYFUtil { | |||
| //会员车辆信息注册接口地址 | |||
| public static final String REGISTER_CAR_URL = "http://oepn.cheyifu2016.com:8892/openapi/personCar"; | |||
| public static final String REGISTER_CAR_URL = "http://open.cheyifu2016.com:8892/openapi/personCar"; | |||
| public static final String GET_CAR_STOPFEE = "http://open.cheyifu2016.com:8892/openapi/getFee"; | |||
| @@ -100,8 +100,10 @@ public class CYFUtil { | |||
| * @Date 2020/7/8 下午10:12 | |||
| **/ | |||
| public String registerCar(String token,int carport,int feeGroupId,String parkingId,String plates,long personId,String personName){ | |||
| String[] plate = new String[1]; | |||
| plate[0] = plates; | |||
| Map<String, Object> paramMap = new HashMap<>(); | |||
| paramMap.put("token ",token); | |||
| paramMap.put("token",token); | |||
| paramMap.put("parkingId",Integer.valueOf(parkingId)); | |||
| paramMap.put("beginTime",getLocalDate()); | |||
| paramMap.put("endTime",getLocalDate()); | |||
| @@ -109,7 +111,7 @@ public class CYFUtil { | |||
| paramMap.put("lotNumber",carport); | |||
| paramMap.put("personId",personId); | |||
| paramMap.put("personName",personName); | |||
| paramMap.put("plates",plates); | |||
| paramMap.put("plates",plate); | |||
| String result = Proc(REGISTER_CAR_URL, paramMap); | |||
| return result; | |||
| } | |||
| @@ -931,7 +931,7 @@ | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wo.`parent_tenant_id` = #{parentTenantId} | |||
| and wop.`tenant_id` = #{tenantId} | |||
| and wop.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) | |||
| * 100 | |||
| @@ -4,7 +4,7 @@ | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFlowConfig"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenantId" property="tenantId" /> | |||
| <result column="tenant_id" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="parent_id" property="parentId" /> | |||
| <result column="name" property="name" /> | |||
| @@ -20,7 +20,6 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != parentId ">and `parent_id` = #{parentId}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -70,8 +70,11 @@ | |||
| from wx_mall_building | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <delete id="deleteByTenantId"> | |||
| delete from wx_mall_building where `tenant_id` = #{tenantId} | |||
| </delete> | |||
| @@ -74,7 +74,11 @@ | |||
| <delete id="deleteByBuildingId"> | |||
| delete from wx_mall_floor where building_id=#{buildingId} | |||
| delete from wx_mall_floor where building_id = #{buildingId} | |||
| </delete> | |||
| <delete id="deleteByTenantId"> | |||
| delete from wx_mall_floor where `tenant_id` = #{tenantId} | |||
| </delete> | |||
| @@ -193,6 +193,29 @@ | |||
| <include refid="dynamicWhereConditionsVo"/> | |||
| </select> | |||
| <select id="findListVo2" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap"> | |||
| select * from wx_merchant | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != name and ''!=name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != linkPhone and ''!=linkPhone "> | |||
| and `link_phone` like concat('%', #{linkPhone},'%') | |||
| </if> | |||
| <if test=" null != businessId "> | |||
| and `business_id` = #{businessId} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| </select> | |||
| <sql id="dataRule"> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| @@ -398,6 +398,6 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) pc) | |||
| and rent_shop_type = 1 | |||
| and rent_shop_type = #{rentShopType} | |||
| </select> | |||
| </mapper> | |||
| @@ -652,7 +652,7 @@ | |||
| </select> | |||
| <select id="searchMerchantByname" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| select merchant_id,merchant_name from wx_rent_contract where tenant_id = #{tenantId} and merchant_name like concat('%',#{merchantName},'%') and rent_shop_type = 1 ORDER BY merchant_name | |||
| select merchant_id,merchant_name from wx_rent_contract where tenant_id = #{tenantId} and merchant_name like concat('%',#{merchantName},'%') and rent_shop_type = #{rentShopType} and status in (3,5) and merchant_id not in (select merchant_id from wx_rent_contract where status=9) ORDER BY merchant_name | |||
| </select> | |||
| <select id="getByMerchantId" resultType="com.iformall.domain.po.WxRentContract" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| @@ -108,7 +108,7 @@ | |||
| <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" | |||
| parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto"> | |||
| SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,visit_pv as pv,visit_uv as uv | |||
| SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv | |||
| from wx_user_visit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -124,12 +124,13 @@ | |||
| and day_date <= #{endTime} | |||
| </if> | |||
| group by xTime | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by day_date desc </if> | |||
| <if test=" null == sortColumns"> order by xTime desc </if> | |||
| </select> | |||
| <select id="touchUsersReportData" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap"> | |||
| SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,visit_pv as pv,visit_uv as uv | |||
| SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv | |||
| from wx_user_visit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -144,11 +145,12 @@ | |||
| <if test="endTime != null"> | |||
| and day_date <= #{endTime} | |||
| </if> | |||
| order by day_date desc | |||
| group by xTime | |||
| order by xTime desc | |||
| </select> | |||
| <select id="queryVisitUv" resultType="Long" parameterType="hashmap"> | |||
| select count(visit_uv) from wx_user_visit where 1=1 | |||
| select IFNULL(sum(visit_uv),0) from wx_user_visit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||