From fafd4479a3a52eee415fd2e4badae3c8aa12e7e8 Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Fri, 5 Nov 2021 14:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/constant/ServiceNameConstants.java | 4 ++ .../src/main/resources/vm/java/domain.java.vm | 40 +++------------- .../service/XhpcDownCodeServiceImpl.java | 5 ++ .../xhpc/common/api/InternetUserService.java | 25 ++++++++++ .../factory/InternetUserFallbackFactory.java | 32 +++++++++++++ .../order/api/XhpcPileOrderController.java | 9 ++-- .../order/mapper/XhpcRealTimeOrderMapper.java | 8 ++++ .../impl/XhpcRealTimeOrderServiceImpl.java | 29 +++++++++-- .../impl/XhpcStatisticsServiceImpl.java | 48 ++++++++++++++++--- .../mapper/XhpcRealTimeOrderMapper.xml | 10 +++- .../XhpcInternetUserController.java | 41 +++++++++++++++- ...hpcStationInternetBlacklistController.java | 8 ++++ .../xhpc/user/domain/XhpcInternetUser.java | 5 +- .../domain/XhpcStationInternetBlacklist.java | 18 +++++++ .../user/mapper/XhpcInternetUserMapper.java | 13 +++++ .../XhpcStationInternetBlacklistMapper.java | 7 +++ .../service/IXhpcInternetUserService.java | 14 ++++++ .../IXhpcStationInternetBlacklistService.java | 9 ++++ .../impl/XhpcInternetUserServiceImpl.java | 13 +++++ ...pcStationInternetBlacklistServiceImpl.java | 5 ++ .../mapper/XhpcInternetUserMapper.xml | 17 ++++++- .../XhpcStationInternetBlacklistMapper.xml | 4 ++ 22 files changed, 311 insertions(+), 53 deletions(-) create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/InternetUserService.java create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/InternetUserFallbackFactory.java diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java index 6d52b71f..43ee1793 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/ServiceNameConstants.java @@ -44,5 +44,9 @@ public class ServiceNameConstants { * 通用服务 */ public static final String XHPC_GENERAL = "xhpc-general"; + /** + * 用户服务 + */ + public static final String XHPC_USER = "xhpc-user"; } diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/domain.java.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/domain.java.vm index 0b5fd93c..412c6797 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/domain.java.vm @@ -1,29 +1,21 @@ package ${packageName}.domain; -#foreach ($import in $importList) +#foreach ($import in $subImportList) import ${import}; #end import com.xhpc.common.core.annotation.Excel; -#if($table.crud || $table.sub) -#elseif($table.tree) -#end /** - * ${functionName}对象 ${tableName} + * ${subTable.functionName}对象 ${subTableName} * * @author ${author} * @date ${datetime} */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="TreeEntity") -#end -public class ${ClassName} extends ${Entity} +public class ${subClassName} extends BaseEntity { private static final long serialVersionUID = 1L; -#foreach ($column in $columns) +#foreach ($column in $subTable.columns) #if(!$table.isSuperColumn($column.javaField)) /** $column.columnComment */ #if($column.list) @@ -46,12 +38,7 @@ public class ${ClassName} extends ${Entity} #end #end -#if($table.sub) - /** $table.subTable.functionName信息 */ - private List<${subClassName}> ${subclassName}List; - -#end -#foreach ($column in $columns) +#foreach ($column in $subTable.columns) #if(!$table.isSuperColumn($column.javaField)) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) #set($AttrName=$column.javaField) @@ -70,31 +57,16 @@ public class ${ClassName} extends ${Entity} #end #end -#if($table.sub) - public List<${subClassName}> get${subClassName}List() - { - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List) - { - this.${subclassName}List = ${subclassName}List; - } - -#end @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) +#foreach ($column in $subTable.columns) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) #set($AttrName=$column.javaField) #else #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #end .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) #end .toString(); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java index d8abb86f..c1a7b72f 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcDownCodeServiceImpl.java @@ -6,6 +6,8 @@ import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +29,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService { @Autowired private XhpcDownCodeMapper xhpcDownCodeMapper; + private static final Logger logger = LoggerFactory.getLogger(XhpcDownCodeServiceImpl.class); @Override public List> listStations(String stationName) { @@ -101,6 +104,8 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService { List list1 = DownMaterialUtil.getDownLoadUrls(left,imgUrls); DownMaterialUtil.saveImageToDisk(list1,file2,imgUrls); File file = new File(file1.getAbsolutePath()); + + logger.info("file地址:"+file1.getAbsolutePath()); DownMaterialUtil.fileToZip(file); System.out.println("success"); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/InternetUserService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/InternetUserService.java new file mode 100644 index 00000000..88d62dbb --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/InternetUserService.java @@ -0,0 +1,25 @@ +package com.xhpc.common.api; + +import com.xhpc.common.api.factory.InternetUserFallbackFactory; +import com.xhpc.common.api.factory.SmsFallbackFactory; +import com.xhpc.common.core.constant.ServiceNameConstants; +import com.xhpc.common.core.domain.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Map; + +/** + * @author yuyang + * @date 2021/11/4 11:46 + * @Version 1.0 + */ +@FeignClient(contextId = "internetUserService", value = ServiceNameConstants.XHPC_USER, fallbackFactory = InternetUserFallbackFactory.class) +public interface InternetUserService { + + @GetMapping("/internet/getOperatorIdEvcs") + R getOperatorIdEvcs(@RequestParam String operatorIdEvcs); +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/InternetUserFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/InternetUserFallbackFactory.java new file mode 100644 index 00000000..1bc8c7df --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/InternetUserFallbackFactory.java @@ -0,0 +1,32 @@ +package com.xhpc.common.api.factory; + +import com.xhpc.common.api.InternetUserService; +import com.xhpc.common.core.domain.R; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +/** + * @author yuyang + * @date 2021/11/4 11:49 + * @Version 1.0 + */ +@Component +public class InternetUserFallbackFactory implements FallbackFactory { + + private static final Logger logger = LoggerFactory.getLogger(InternetUserFallbackFactory.class); + @Override + public InternetUserService create(Throwable cause) { + logger.error("平台第三方服务调用失败:{} //fallback", cause.getMessage()); + + return new InternetUserService() { + @Override + public R getOperatorIdEvcs(String operatorIdEvcs) { + + return R.fail("平台第三方服务发送失败:" + cause.getMessage()); + } + }; + } + +} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 6a757642..fc37ff99 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -437,8 +437,9 @@ public class XhpcPileOrderController extends BaseController { // // } // } -@GetMapping(value = "/chargeOrder/pileStartUpBy3rd") -public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String internetSerialNumber, @RequestParam(value = "driverId") String driverId, @RequestParam(value = "chargingAmt") Integer chargingAmt, @RequestParam(value = "plateNum", required = false) String plateNum, @RequestParam(value = "status") Integer status, @RequestParam(value = "connectorId") String connectorId) { - return xhpcChargeOrderService.startUpBy3rd(internetSerialNumber, driverId, chargingAmt, plateNum, status, connectorId); -} + @GetMapping(value = "/chargeOrder/pileStartUpBy3rd") + public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String internetSerialNumber, @RequestParam(value = "driverId") String driverId, @RequestParam(value = "chargingAmt") Integer chargingAmt, @RequestParam(value = "plateNum", required = false) String plateNum, @RequestParam(value = "status") Integer status, @RequestParam(value = "connectorId") String connectorId) { + return xhpcChargeOrderService.startUpBy3rd(internetSerialNumber, driverId, chargingAmt, plateNum, status, connectorId); + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java index def8fae0..0afcff22 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java @@ -114,4 +114,12 @@ public interface XhpcRealTimeOrderMapper { XhpcRealTimeOrder getChargingOrderId(@Param("chargingOrderId")Long chargingOrderId); Map getChargeOrderById(@Param("chargingOrderId")Long chargingOrderId); + + + /** + * 根据第三方平台及监管平台的operatorId 查询 + * @param operatorIdEvcs + * @return + */ + Map getOperatorIdEvcs(String operatorIdEvcs); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index aa3889ec..ea528a86 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -13,6 +13,7 @@ import com.xhpc.order.mapper.XhpcRealTimeOrderMapper; import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcRealTimeOrderService; +import org.checkerframework.checker.units.qual.A; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +48,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { @Autowired private SmsService smsService; + private ExecutorService executorService = Executors.newFixedThreadPool(20); @@ -226,7 +228,30 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { //运维服务费抽成 BigDecimal operationSvcCommission =new BigDecimal(0); //判断是C端用户还是流量端用户 - if (xhpcChargeOrder.getSource() == 0) { + //先计算第三方优惠力度 + Integer source = xhpcChargeOrder.getSource(); + String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber(); + if(source==1 && internetSerialNumber!=null){ + String substring = internetSerialNumber.substring(0, 9); + + Map operatorIdEvcs = xhpcRealTimeOrderMapper.getOperatorIdEvcs(substring); + if(operatorIdEvcs !=null){ + //未完成 + if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){ + Integer commissionType = Integer.parseInt(operatorIdEvcs.get("commissionType").toString()); + BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString()); + //0总金额提成 1服务费提成 + if(commissionType==0){ + internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); + actPrice = actPrice.multiply(internetCommission); + }else{ + internetSvcCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); + actPrice = actPrice.multiply(internetSvcCommission); + } + } + } + } + if ( source== 0) { String state = ""; BigDecimal discount = new BigDecimal(0); //用户第几次充电 @@ -273,8 +298,6 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { } xhpcHistoryOrder.setInternetCommission(internetCommission); xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); - }else{ - //流量方,未实现,新增接口 } //获取运营商 Map operatorMessage = xhpcChargeOrderService.getOperatorMessage(xhpcChargeOrder.getChargingStationId()); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java index e123c969..5e5dfece 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java @@ -1,6 +1,7 @@ package com.xhpc.order.service.impl; +import cn.hutool.core.date.DateUtil; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.order.domain.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; @@ -30,6 +31,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(!"".equals(chargingStationIds) && chargingStationIds !=null){ chargingStationId= Arrays.asList(chargingStationIds.split(",")); } +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } List> list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, type,userId); List> page =new ArrayList<>(); if(list !=null && list.size()>0){ @@ -132,7 +137,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(!"".equals(chargingStationIds) && chargingStationIds !=null){ chargingStationId= Arrays.asList(chargingStationIds.split(",")); } - +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } return xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, type,userId); } @@ -149,6 +157,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(!"".equals(operatorIds) && operatorIds !=null){ operatorUserId= Arrays.asList(operatorIds.split(",")); } +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } return xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,type,userId); } @@ -161,6 +173,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(!"".equals(operatorIds) && operatorIds !=null){ operatorUserId= Arrays.asList(operatorIds.split(",")); } +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } return xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, type,userId); } @@ -173,6 +189,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(!"".equals(internetUserIds) && internetUserIds !=null){ internetIds= Arrays.asList(internetUserIds.split(",")); } +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,userId); } @@ -181,6 +201,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { if(getJudge(null,operatorId,type)){ return new ArrayList<>(); } +// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ +// startTime =date(1); +// endTime =date(2); +// } return xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, type,userId); } @@ -257,15 +281,27 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { } /** - * 平台管理员权限问题 + * 获取时间 + * type 1 开始时间 2结束时间 */ - private void jurisdiction(String userId){ - - - + private String date(Integer type){ + if(type ==1){ + //一天的开始,结果:2017-03-01 00:00:00 + Date beginOfDay = DateUtil.beginOfDay(new Date()); + return beginOfDay.toString(); + } + //一天的结束,结果:2017-03-01 23:59:59 + Date endOfDay = DateUtil.endOfDay(new Date()); + return endOfDay.toString(); } +// public static void main(String[] args) { +// Date beginOfDay = DateUtil.beginOfDay(new Date()); +// +// System.out.println(">>>>>>>>>"+beginOfDay.toString()); +// } + } diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml index 3e1da5c3..3a63910c 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml @@ -581,8 +581,14 @@ left join xhpc_terminal as ter on ter.terminal_id = co.terminal_id left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id where ro.real_time_order_id=#{realTimeOrderId} - - + \ No newline at end of file diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java index 69f3c09d..ede97f2d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcInternetUserController.java @@ -2,6 +2,7 @@ package com.xhpc.user.controller; import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.StatusConstants; +import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.controller.BaseController; @@ -11,6 +12,7 @@ import com.xhpc.common.security.annotation.PreAuthorize; import com.xhpc.system.api.domain.SysUser; import com.xhpc.user.domain.XhpcInternetUser; import com.xhpc.user.service.IXhpcInternetUserService; +import com.xhpc.user.service.IXhpcStationInternetBlacklistService; import com.xhpc.user.service.IXhpcUserService; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -36,6 +38,8 @@ public class XhpcInternetUserController extends BaseController { @Autowired private IXhpcUserService iXhpcUserService; + @Autowired + private IXhpcStationInternetBlacklistService xhpcStationInternetBlacklistService; /** * 新增流量用户 */ @@ -60,7 +64,14 @@ public class XhpcInternetUserController extends BaseController { if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); } - + if(xhpcInternetUser.getOperatorIdEvcs().length()!=9){ + return AjaxResult.error("operatorId长度9位"); + } + //第三方平台及监管平台的operatorId 不能重复 + int count = iXhpcInternetUserService.getCountOperatorIdEvcs(null, xhpcInternetUser.getOperatorIdEvcs()); + if(count>0){ + return AjaxResult.error("operatorId已存在"); + } iXhpcInternetUserService.insert(xhpcInternetUser); sysUser.setInternetUserId(xhpcInternetUser.getInternetUserId()); iXhpcUserService.insertUser(sysUser); @@ -77,6 +88,24 @@ public class XhpcInternetUserController extends BaseController { if (null == xhpcInternetUser.getInternetUserId()) { return AjaxResult.error(HttpStatus.NOT_NULL, "用户id不能为空"); } + String operatorIdEvcs = xhpcInternetUser.getOperatorIdEvcs(); + if(operatorIdEvcs.length()!=9){ + return AjaxResult.error("operatorId长度9位"); + } + + //第三方平台及监管平台的operatorId 不能重复 + int count = iXhpcInternetUserService.getCountOperatorIdEvcs(xhpcInternetUser.getInternetUserId(), operatorIdEvcs); + if(count>0){ + return AjaxResult.error("operatorId已存在"); + } + //operatorId变化,修改黑名单 + Long internetUserId = xhpcInternetUser.getInternetUserId(); + Map info = iXhpcInternetUserService.info(internetUserId); + if(info !=null && info.get("operatorIdEvcs") !=null){ + if(!xhpcInternetUser.getOperatorIdEvcs().equals(info.get("operatorIdEvcs").toString())){ + xhpcStationInternetBlacklistService.updateByOperatorIdEvcs(internetUserId+"",operatorIdEvcs); + } + } SysUser sysUser = new SysUser(); sysUser.setUserName(xhpcInternetUser.getPhone()); sysUser.setNickName(xhpcInternetUser.getName()); @@ -146,4 +175,14 @@ public class XhpcInternetUserController extends BaseController { List> list = iXhpcInternetUserService.list(name); return getDataTable(list); } + + /** + * 获取流量用户 + */ + @ApiOperation("获取流量用户") + @GetMapping("/getOperatorIdEvcs") + public R getOperatorIdEvcs(@RequestParam(value = "operatorIdEvcs")String operatorIdEvcs) { + XhpcInternetUser operatorId = iXhpcInternetUserService.getOperatorIdEvcs(operatorIdEvcs); + return R.ok(operatorId); + } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java index ec448fbf..d4fca7f6 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcStationInternetBlacklistController.java @@ -4,6 +4,7 @@ import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.user.domain.XhpcStationInternetBlacklist; +import com.xhpc.user.service.IXhpcInternetUserService; import com.xhpc.user.service.IXhpcStationInternetBlacklistService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +26,9 @@ public class XhpcStationInternetBlacklistController extends BaseController { @Autowired private IXhpcStationInternetBlacklistService iXhpcStationInternetBlacklistService; + @Autowired + private IXhpcInternetUserService xhpcInternetUserService; + /** * 新增电站流量方黑名单 */ @@ -36,6 +40,10 @@ public class XhpcStationInternetBlacklistController extends BaseController { String internetUserId = list.get(0).getInternetUserId(); iXhpcStationInternetBlacklistService.deleteByOperatorIdEvcs(internetUserId); for (XhpcStationInternetBlacklist xhpcStationInternetBlacklist : list) { + Map info = xhpcInternetUserService.info(Long.valueOf(xhpcStationInternetBlacklist.getInternetUserId())); + if(info !=null || info.get("operatorIdEvcs") !=null){ + xhpcStationInternetBlacklist.setOperatorIdEvcs(info.get("operatorIdEvcs").toString()); + } iXhpcStationInternetBlacklistService.insert(xhpcStationInternetBlacklist); } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcInternetUser.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcInternetUser.java index 9ade960e..c547893f 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcInternetUser.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcInternetUser.java @@ -99,13 +99,13 @@ public class XhpcInternetUser extends BaseEntity { private String detailedAddress; /** - * 提成类型(0总金额提成 1服务费提成) + * 优惠渠道,我们给流量方的优惠(0总金额提成 1服务费提成) */ @NotNull(message = "提成类型不能为空") private Integer commissionType; /** - * 提成率 + * 优惠率 */ @NotNull(message = "提成率不能为空") private Double commissionRate; @@ -135,6 +135,7 @@ public class XhpcInternetUser extends BaseEntity { /** * 对接第三方平台及监管平台的operatorId */ + @NotBlank(message = "operatorId不能为空") private String operatorIdEvcs; public String getOperatorIdEvcs() { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcStationInternetBlacklist.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcStationInternetBlacklist.java index f6d69afe..dd5c8f2c 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcStationInternetBlacklist.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcStationInternetBlacklist.java @@ -1,5 +1,6 @@ package com.xhpc.user.domain; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -26,6 +27,12 @@ public class XhpcStationInternetBlacklist implements Serializable { @NotNull(message = "流量用户OperatorID(evcs)不能为空") private String internetUserId; + /** + * 对接第三方平台及监管平台的operatorId + */ + @NotBlank(message = "operatorId不能为空") + private String operatorIdEvcs; + /** * 电站id */ @@ -139,4 +146,15 @@ public class XhpcStationInternetBlacklist implements Serializable { public void setRemark(String remark) { this.remark = remark; } + + public String getOperatorIdEvcs() { + + return operatorIdEvcs; + } + + public void setOperatorIdEvcs(String operatorIdEvcs) { + + this.operatorIdEvcs = operatorIdEvcs; + } + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcInternetUserMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcInternetUserMapper.java index abd2fe41..3bbb4174 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcInternetUserMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcInternetUserMapper.java @@ -72,4 +72,17 @@ public interface XhpcInternetUserMapper { * @return 结果 */ public List> list(@Param("name") String name); + + /** + * 根据第三方平台及监管平台的operatorId 查询 + * @param operatorIdEvcs + * @return + */ + XhpcInternetUser getOperatorIdEvcs(@Param("operatorIdEvcs")String operatorIdEvcs); + + /** + * 查询operatorId 是否重复 + */ + + int getCountOperatorIdEvcs(@Param("internetUserId")Long internetUserId,@Param("operatorIdEvcs")String operatorIdEvcs); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcStationInternetBlacklistMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcStationInternetBlacklistMapper.java index 1fa5368c..9ba08ea5 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcStationInternetBlacklistMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcStationInternetBlacklistMapper.java @@ -29,6 +29,13 @@ public interface XhpcStationInternetBlacklistMapper { */ public int deleteByOperatorIdEvcs(@Param("internetUserId") String internetUserId); + /** + * 批量修改流量方的operatorIdEvcs + * + * @param internetUserId 需要删除的数据OperatorID(evcs) + * @return 结果 + */ + public void updateByOperatorIdEvcs(@Param("internetUserId")String internetUserId,@Param("operatorIdEvcs")String operatorIdEvcs); /** * 流量用户设置流量方黑名单列表 diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcInternetUserService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcInternetUserService.java index 5b2cb216..2f306ea7 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcInternetUserService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcInternetUserService.java @@ -70,4 +70,18 @@ public interface IXhpcInternetUserService { * @return 结果 */ public List> list(String name); + + /** + * 根据第三方平台及监管平台的operatorId 查询 + * @param operatorIdEvcs + * @return + */ + XhpcInternetUser getOperatorIdEvcs(String operatorIdEvcs); + + /** + * 查询operatorId 是否重复 + */ + + int getCountOperatorIdEvcs(Long internetUserId,String operatorIdEvcs); + } \ No newline at end of file diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcStationInternetBlacklistService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcStationInternetBlacklistService.java index 1637205c..d7b6dd44 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcStationInternetBlacklistService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcStationInternetBlacklistService.java @@ -30,6 +30,15 @@ public interface IXhpcStationInternetBlacklistService { public void deleteByOperatorIdEvcs(String internetUserId); + /** + * 批量修改流量方的operatorIdEvcs + * + * @param internetUserId 需要删除的数据OperatorID(evcs) + * @return 结果 + */ + public void updateByOperatorIdEvcs(String internetUserId,String operatorIdEvcs); + + /** * 运营商设置流量方黑名单信息列表 * diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java index 87dfe0be..d29298f2 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java @@ -130,4 +130,17 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService { public List> list(String name) { return xhpcInternetUserMapper.list(name); } + + @Override + public XhpcInternetUser getOperatorIdEvcs(String operatorIdEvcs) { + + return xhpcInternetUserMapper.getOperatorIdEvcs(operatorIdEvcs); + } + + @Override + public int getCountOperatorIdEvcs(Long internetUserId,String operatorIdEvcs) { + + return xhpcInternetUserMapper.getCountOperatorIdEvcs(internetUserId, operatorIdEvcs); + } + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java index d74e54d1..91dc61cd 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java @@ -53,6 +53,11 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte xhpcStationInternetBlacklistMapper.deleteByOperatorIdEvcs(internetUserId); } + @Override + public void updateByOperatorIdEvcs(String internetUserId, String operatorIdEvcs) { + xhpcStationInternetBlacklistMapper.updateByOperatorIdEvcs(internetUserId, operatorIdEvcs); + } + /** * 流量用户设置流量方黑名单信息列表 diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInternetUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInternetUserMapper.xml index 834c8c20..1345de12 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInternetUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInternetUserMapper.xml @@ -29,7 +29,7 @@ - + @@ -322,4 +322,19 @@ ORDER BY xiu.update_time DESC + + + + diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcStationInternetBlacklistMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcStationInternetBlacklistMapper.xml index 5961c245..0d2dda43 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcStationInternetBlacklistMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcStationInternetBlacklistMapper.xml @@ -8,6 +8,7 @@ + @@ -80,6 +81,9 @@ where internet_user_id = #{internetUserId} + + update xhpc_station_internet_blacklist set operator_id_evcs=#{operatorIdEvcs} where internet_user_id = #{internetUserId} +