From c33f2b8f0c6ee01556dbc70c0b5cad84d1c09bce Mon Sep 17 00:00:00 2001 From: yuyang Date: Mon, 28 Mar 2022 14:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E7=AB=99=E3=80=81=E6=A1=A9=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=A7=9F=E6=88=B7=E8=AE=BE=E7=BD=AE=E7=9A=84=E5=9C=BA?= =?UTF-8?q?=E7=AB=99=E3=80=81=E6=A1=A9=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/XhpcChargingPileMapper.java | 4 +++ .../mapper/XhpcChargingStationMapper.java | 2 ++ .../service/XhpcChargingPileServiceImpl.java | 24 ++++++++++++++++- .../XhpcChargingStationServiceImpl.java | 27 ++++++++++++++++--- .../mapper/XhpcChargingPileMapper.xml | 4 +++ .../mapper/XhpcChargingStationMapper.xml | 5 ++++ .../controller/XhpcTenantController.java | 6 ++--- .../com/xhpc/tenant/task/XhpcTenantTask.java | 1 - .../resources/mapper/XhpcTenantMapper.xml | 3 +++ 9 files changed, 66 insertions(+), 10 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java index 609a0d23..f830bc02 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java @@ -23,6 +23,10 @@ public interface XhpcChargingPileMapper { */ List> selectXhpcChargingPileList(@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("operatorId")Long operatorId,@Param("number")Integer number,@Param("tenantId") String tenantId); + + int getCountXhpcChargingPile(@Param("chargingStationId") Long chargingStationId,@Param("tenantId") String tenantId); + + /** * 终端 * diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java index c4246a29..15131238 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java @@ -172,6 +172,8 @@ public interface XhpcChargingStationMapper { List> getWXXhpcTerminalMassage(@Param("chargingStationId") Long chargingStationId); + int getCountXhpcChargingStation(@Param("tenantId") String tenantId); + /** * 添加费率模型 */ diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java index 021acf7e..71191026 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -10,6 +10,7 @@ import com.xhpc.charging.station.mapper.XhpcTerminalMapper; import com.xhpc.charging.station.pojo.XhpcImg; import com.xhpc.charging.station.utils.img.QrImgUtils; import com.xhpc.common.api.PowerPileService; +import com.xhpc.common.api.TenantService; import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.exception.CustomException; @@ -67,6 +68,9 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha private LogUserUtils logUserUtils; @Autowired private TokenService tokenService; + @Autowired + private TenantService tenantService; + //字母集合 private static Map letterMap; @@ -121,6 +125,24 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha @Override @Transactional public AjaxResult addXhpcChargingPile(XhpcChargingPile xhpcChargingPile) { + Long chargingStationId = xhpcChargingPile.getChargingStationId(); + LoginUser loginUser = tokenService.getLoginUser(); + R r1 = tenantService.gettenantIdTime(loginUser.getTenantId()); + if(r1.getCode()!=200){ + return AjaxResult.error(1001, "请重新登录"); + }else{ + Map map = (Map)r1.getData(); + if(map !=null){ + if(!map.get("stationPileQuote").equals("-1")){ + int count = xhpcChargingPileMapper.getCountXhpcChargingPile(chargingStationId,loginUser.getTenantId()); + if(Integer.parseInt(map.get("stationPileQuote").toString())26){ return AjaxResult.error("终端数量不能大于26"); @@ -128,7 +150,7 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha if(xhpcChargingPile.getSerialNumber() ==null || xhpcChargingPile.getSerialNumber().length()!=14){ return AjaxResult.error("桩编号14位"); } - Long chargingStationId = xhpcChargingPile.getChargingStationId(); + //获取计费模型id Map stringObjectMap = xhpcChargingPileMapper.selectXhpcChargingStationById(chargingStationId); Long rateModelId = Long.parseLong(StringUtils.valueOf(stringObjectMap.get("rateModelId"))); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 28b19bba..304f507c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; import com.xhpc.charging.station.mapper.XhpcChargingStationPushStatusMapper; import com.xhpc.common.api.PowerPileService; +import com.xhpc.common.api.TenantService; import com.xhpc.common.api.dto.XhpcChargingStationDto; import com.xhpc.common.api.dto.XhpcRateDto; import com.xhpc.common.api.dto.XhpcRateTimeDto; @@ -14,10 +15,7 @@ import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.data.redis.CacheRateModel; -import com.xhpc.common.domain.XhpcChargingStation; -import com.xhpc.common.domain.XhpcRate; -import com.xhpc.common.domain.XhpcRateModel; -import com.xhpc.common.domain.XhpcRateTime; +import com.xhpc.common.domain.*; import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.util.LogUserUtils; import com.xhpc.system.api.model.LoginUser; @@ -56,6 +54,9 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc private RedisService redisService; @Autowired private LogUserUtils logUserUtils; + @Autowired + private TenantService tenantService; + @Autowired private XhpcChargingStationPushStatusMapper xhpcChargingStationPushStatusMapper; @@ -318,6 +319,24 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc LoginUser loginUser = logUserUtils.getLogUser(request); String userName = loginUser.getUsername(); + R r1 = tenantService.gettenantIdTime(loginUser.getTenantId()); + if(r1.getCode()!=200){ + return AjaxResult.error(1001, "请重新登录"); + }else{ + Map map = (Map)r1.getData(); + if(map !=null){ + if(!map.get("getStationQuote").equals("-1")){ + int count = xhpcChargingStationMapper.getCountXhpcChargingStation(loginUser.getTenantId()); + if(Integer.parseInt(map.get("getStationQuote").toString()) + + + + + insert into xhpc_rate_model diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java index b0a9cb6e..a850e5bf 100644 --- a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java @@ -2,7 +2,6 @@ package com.xhpc.tenant.controller; import com.xhpc.common.core.domain.R; -import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; @@ -20,7 +19,6 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; @RestController @@ -116,7 +114,7 @@ public class XhpcTenantController extends BaseController { @Log(title = "租户管理-删除租户", businessType = BusinessType.DELETE) - @DeleteMapping("/detail") + @DeleteMapping("/deleteTenantByPk") public R deleteTenantByPk(@RequestParam("tenantId")String tenantId){ return R.ok(tenantService.deleteByPk(tenantId)); } @@ -126,7 +124,7 @@ public class XhpcTenantController extends BaseController { public R getTenantIdTime(@RequestParam("tenantId")String tenantId){ XhpcTenantDomain infoByPk = tenantService.getInfoByPk(tenantId); if(infoByPk !=null && infoByPk.getIsDeleted()==0 && infoByPk.getStatus()==1){ - return R.ok(); + return R.ok(infoByPk); } return R.fail(); } diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java index 57f7cded..5cd05048 100644 --- a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java @@ -2,7 +2,6 @@ package com.xhpc.tenant.task; import cn.hutool.core.date.DateUtil; import com.xhpc.common.api.SmsService; -import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.StringUtils; import com.xhpc.tenant.domain.XhpcTenantDomain; import com.xhpc.tenant.mapper.XhpcTenantMapper; diff --git a/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml b/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml index cdc0f3d7..d18e3343 100644 --- a/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml +++ b/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml @@ -265,7 +265,10 @@ `domain` = #{domain,jdbcType=VARCHAR}, background_url = #{backgroundUrl,jdbcType=VARCHAR}, linkman = #{linkman,jdbcType=VARCHAR}, + expire_time = #{expireTime,jdbcType=TIMESTAMP}, contact_number = #{contactNumber,jdbcType=VARCHAR}, + station_quote = #{stationQuote,jdbcType=INTEGER}, + station_pile_quote = #{stationPileQuote,jdbcType=INTEGER}, address = #{address,jdbcType=VARCHAR}, update_user = #{updateUser,jdbcType=BIGINT}, update_time = sysdate()