第三方订单结算

This commit is contained in:
yuyang 2021-11-05 14:55:03 +08:00
parent 1fecc7e1af
commit fafd4479a3
22 changed files with 311 additions and 53 deletions

View File

@ -44,5 +44,9 @@ public class ServiceNameConstants {
* 通用服务 * 通用服务
*/ */
public static final String XHPC_GENERAL = "xhpc-general"; public static final String XHPC_GENERAL = "xhpc-general";
/**
* 用户服务
*/
public static final String XHPC_USER = "xhpc-user";
} }

View File

@ -1,29 +1,21 @@
package ${packageName}.domain; package ${packageName}.domain;
#foreach ($import in $importList) #foreach ($import in $subImportList)
import ${import}; import ${import};
#end #end
import com.xhpc.common.core.annotation.Excel; import com.xhpc.common.core.annotation.Excel;
#if($table.crud || $table.sub)
#elseif($table.tree)
#end
/** /**
* ${functionName}对象 ${tableName} * ${subTable.functionName}对象 ${subTableName}
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
#if($table.crud || $table.sub) public class ${subClassName} extends BaseEntity
#set($Entity="BaseEntity")
#elseif($table.tree)
#set($Entity="TreeEntity")
#end
public class ${ClassName} extends ${Entity}
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
#foreach ($column in $columns) #foreach ($column in $subTable.columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */ /** $column.columnComment */
#if($column.list) #if($column.list)
@ -46,12 +38,7 @@ public class ${ClassName} extends ${Entity}
#end #end
#end #end
#if($table.sub) #foreach ($column in $subTable.columns)
/** $table.subTable.functionName信息 */
private List<${subClassName}> ${subclassName}List;
#end
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField) #set($AttrName=$column.javaField)
@ -70,31 +57,16 @@ public class ${ClassName} extends ${Entity}
#end #end
#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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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]")) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField) #set($AttrName=$column.javaField)
#else #else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end #end
.append("${column.javaField}", get${AttrName}()) .append("${column.javaField}", get${AttrName}())
#end
#if($table.sub)
.append("${subclassName}List", get${subClassName}List())
#end #end
.toString(); .toString();
} }

View File

@ -6,6 +6,8 @@ import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -27,6 +29,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
@Autowired @Autowired
private XhpcDownCodeMapper xhpcDownCodeMapper; private XhpcDownCodeMapper xhpcDownCodeMapper;
private static final Logger logger = LoggerFactory.getLogger(XhpcDownCodeServiceImpl.class);
@Override @Override
public List<Map<String, Object>> listStations(String stationName) { public List<Map<String, Object>> listStations(String stationName) {
@ -101,6 +104,8 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
List<String> list1 = DownMaterialUtil.getDownLoadUrls(left,imgUrls); List<String> list1 = DownMaterialUtil.getDownLoadUrls(left,imgUrls);
DownMaterialUtil.saveImageToDisk(list1,file2,imgUrls); DownMaterialUtil.saveImageToDisk(list1,file2,imgUrls);
File file = new File(file1.getAbsolutePath()); File file = new File(file1.getAbsolutePath());
logger.info("file地址"+file1.getAbsolutePath());
DownMaterialUtil.fileToZip(file); DownMaterialUtil.fileToZip(file);
System.out.println("success"); System.out.println("success");
} }

View File

@ -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);
}

View File

@ -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<InternetUserService> {
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());
}
};
}
}

View File

@ -437,8 +437,9 @@ public class XhpcPileOrderController extends BaseController {
// //
// } // }
// } // }
@GetMapping(value = "/chargeOrder/pileStartUpBy3rd") @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) { 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); return xhpcChargeOrderService.startUpBy3rd(internetSerialNumber, driverId, chargingAmt, plateNum, status, connectorId);
} }
} }

View File

@ -114,4 +114,12 @@ public interface XhpcRealTimeOrderMapper {
XhpcRealTimeOrder getChargingOrderId(@Param("chargingOrderId")Long chargingOrderId); XhpcRealTimeOrder getChargingOrderId(@Param("chargingOrderId")Long chargingOrderId);
Map<String,Object> getChargeOrderById(@Param("chargingOrderId")Long chargingOrderId); Map<String,Object> getChargeOrderById(@Param("chargingOrderId")Long chargingOrderId);
/**
* 根据第三方平台及监管平台的operatorId 查询
* @param operatorIdEvcs
* @return
*/
Map<String, Object> getOperatorIdEvcs(String operatorIdEvcs);
} }

View File

@ -13,6 +13,7 @@ import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcRealTimeOrderService; import com.xhpc.order.service.IXhpcRealTimeOrderService;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -47,6 +48,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
@Autowired @Autowired
private SmsService smsService; private SmsService smsService;
private ExecutorService executorService = Executors.newFixedThreadPool(20); private ExecutorService executorService = Executors.newFixedThreadPool(20);
@ -226,7 +228,30 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
//运维服务费抽成 //运维服务费抽成
BigDecimal operationSvcCommission =new BigDecimal(0); BigDecimal operationSvcCommission =new BigDecimal(0);
//判断是C端用户还是流量端用户 //判断是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<String, Object> 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 = ""; String state = "";
BigDecimal discount = new BigDecimal(0); BigDecimal discount = new BigDecimal(0);
//用户第几次充电 //用户第几次充电
@ -273,8 +298,6 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
} }
xhpcHistoryOrder.setInternetCommission(internetCommission); xhpcHistoryOrder.setInternetCommission(internetCommission);
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission);
}else{
//流量方未实现新增接口
} }
//获取运营商 //获取运营商
Map<String, Object> operatorMessage = xhpcChargeOrderService.getOperatorMessage(xhpcChargeOrder.getChargingStationId()); Map<String, Object> operatorMessage = xhpcChargeOrderService.getOperatorMessage(xhpcChargeOrder.getChargingStationId());

View File

@ -1,6 +1,7 @@
package com.xhpc.order.service.impl; package com.xhpc.order.service.impl;
import cn.hutool.core.date.DateUtil;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsStation;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
@ -30,6 +31,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationId= Arrays.asList(chargingStationIds.split(",")); chargingStationId= Arrays.asList(chargingStationIds.split(","));
} }
// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){
// startTime =date(1);
// endTime =date(2);
// }
List<Map<String, Object>> list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, type,userId); List<Map<String, Object>> list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, type,userId);
List<Map<String, Object>> page =new ArrayList<>(); List<Map<String, Object>> page =new ArrayList<>();
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
@ -132,7 +137,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationId= Arrays.asList(chargingStationIds.split(",")); 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); return xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, type,userId);
} }
@ -149,6 +157,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(operatorIds) && operatorIds !=null){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); 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); 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){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); 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); return xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, type,userId);
} }
@ -173,6 +189,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(internetUserIds) && internetUserIds !=null){ if(!"".equals(internetUserIds) && internetUserIds !=null){
internetIds= Arrays.asList(internetUserIds.split(",")); 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); return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,userId);
} }
@ -181,6 +201,10 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(getJudge(null,operatorId,type)){ if(getJudge(null,operatorId,type)){
return new ArrayList<>(); 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); 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());
// }
} }

View File

@ -581,8 +581,14 @@
left join xhpc_terminal as ter on ter.terminal_id = co.terminal_id 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 left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where ro.real_time_order_id=#{realTimeOrderId} where ro.real_time_order_id=#{realTimeOrderId}
</select> </select>
<select id="getOperatorIdEvcs" resultType="map">
select
operator_id_evcs as operatorIdEvcs,
commission_type as commissionType,
commission_rate as commissionRate
from xhpc_internet_user
where del_flag =0 and operator_id_evcs=#{operatorIdEvcs} limit 1
</select>
</mapper> </mapper>

View File

@ -2,6 +2,7 @@ package com.xhpc.user.controller;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; 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.SecurityUtils;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.controller.BaseController; 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.system.api.domain.SysUser;
import com.xhpc.user.domain.XhpcInternetUser; import com.xhpc.user.domain.XhpcInternetUser;
import com.xhpc.user.service.IXhpcInternetUserService; import com.xhpc.user.service.IXhpcInternetUserService;
import com.xhpc.user.service.IXhpcStationInternetBlacklistService;
import com.xhpc.user.service.IXhpcUserService; import com.xhpc.user.service.IXhpcUserService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@ -36,6 +38,8 @@ public class XhpcInternetUserController extends BaseController {
@Autowired @Autowired
private IXhpcUserService iXhpcUserService; private IXhpcUserService iXhpcUserService;
@Autowired
private IXhpcStationInternetBlacklistService xhpcStationInternetBlacklistService;
/** /**
* 新增流量用户 * 新增流量用户
*/ */
@ -60,7 +64,14 @@ public class XhpcInternetUserController extends BaseController {
if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) { if (iXhpcUserService.checkUserNameUnique(sysUser.getUserName(),null) > 0) {
return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); 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); iXhpcInternetUserService.insert(xhpcInternetUser);
sysUser.setInternetUserId(xhpcInternetUser.getInternetUserId()); sysUser.setInternetUserId(xhpcInternetUser.getInternetUserId());
iXhpcUserService.insertUser(sysUser); iXhpcUserService.insertUser(sysUser);
@ -77,6 +88,24 @@ public class XhpcInternetUserController extends BaseController {
if (null == xhpcInternetUser.getInternetUserId()) { if (null == xhpcInternetUser.getInternetUserId()) {
return AjaxResult.error(HttpStatus.NOT_NULL, "用户id不能为空"); 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<String, Object> 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 sysUser = new SysUser();
sysUser.setUserName(xhpcInternetUser.getPhone()); sysUser.setUserName(xhpcInternetUser.getPhone());
sysUser.setNickName(xhpcInternetUser.getName()); sysUser.setNickName(xhpcInternetUser.getName());
@ -146,4 +175,14 @@ public class XhpcInternetUserController extends BaseController {
List<Map<String, Object>> list = iXhpcInternetUserService.list(name); List<Map<String, Object>> list = iXhpcInternetUserService.list(name);
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取流量用户
*/
@ApiOperation("获取流量用户")
@GetMapping("/getOperatorIdEvcs")
public R getOperatorIdEvcs(@RequestParam(value = "operatorIdEvcs")String operatorIdEvcs) {
XhpcInternetUser operatorId = iXhpcInternetUserService.getOperatorIdEvcs(operatorIdEvcs);
return R.ok(operatorId);
}
} }

View File

@ -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.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.user.domain.XhpcStationInternetBlacklist; import com.xhpc.user.domain.XhpcStationInternetBlacklist;
import com.xhpc.user.service.IXhpcInternetUserService;
import com.xhpc.user.service.IXhpcStationInternetBlacklistService; import com.xhpc.user.service.IXhpcStationInternetBlacklistService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -25,6 +26,9 @@ public class XhpcStationInternetBlacklistController extends BaseController {
@Autowired @Autowired
private IXhpcStationInternetBlacklistService iXhpcStationInternetBlacklistService; private IXhpcStationInternetBlacklistService iXhpcStationInternetBlacklistService;
@Autowired
private IXhpcInternetUserService xhpcInternetUserService;
/** /**
* 新增电站流量方黑名单 * 新增电站流量方黑名单
*/ */
@ -36,6 +40,10 @@ public class XhpcStationInternetBlacklistController extends BaseController {
String internetUserId = list.get(0).getInternetUserId(); String internetUserId = list.get(0).getInternetUserId();
iXhpcStationInternetBlacklistService.deleteByOperatorIdEvcs(internetUserId); iXhpcStationInternetBlacklistService.deleteByOperatorIdEvcs(internetUserId);
for (XhpcStationInternetBlacklist xhpcStationInternetBlacklist : list) { for (XhpcStationInternetBlacklist xhpcStationInternetBlacklist : list) {
Map<String, Object> info = xhpcInternetUserService.info(Long.valueOf(xhpcStationInternetBlacklist.getInternetUserId()));
if(info !=null || info.get("operatorIdEvcs") !=null){
xhpcStationInternetBlacklist.setOperatorIdEvcs(info.get("operatorIdEvcs").toString());
}
iXhpcStationInternetBlacklistService.insert(xhpcStationInternetBlacklist); iXhpcStationInternetBlacklistService.insert(xhpcStationInternetBlacklist);
} }
} }

View File

@ -99,13 +99,13 @@ public class XhpcInternetUser extends BaseEntity {
private String detailedAddress; private String detailedAddress;
/** /**
* 提成类型0总金额提成 1服务费提成 * 优惠渠道我们给流量方的优惠0总金额提成 1服务费提成
*/ */
@NotNull(message = "提成类型不能为空") @NotNull(message = "提成类型不能为空")
private Integer commissionType; private Integer commissionType;
/** /**
* 提成 * 优惠
*/ */
@NotNull(message = "提成率不能为空") @NotNull(message = "提成率不能为空")
private Double commissionRate; private Double commissionRate;
@ -135,6 +135,7 @@ public class XhpcInternetUser extends BaseEntity {
/** /**
* 对接第三方平台及监管平台的operatorId * 对接第三方平台及监管平台的operatorId
*/ */
@NotBlank(message = "operatorId不能为空")
private String operatorIdEvcs; private String operatorIdEvcs;
public String getOperatorIdEvcs() { public String getOperatorIdEvcs() {

View File

@ -1,5 +1,6 @@
package com.xhpc.user.domain; package com.xhpc.user.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -26,6 +27,12 @@ public class XhpcStationInternetBlacklist implements Serializable {
@NotNull(message = "流量用户OperatorID(evcs)不能为空") @NotNull(message = "流量用户OperatorID(evcs)不能为空")
private String internetUserId; private String internetUserId;
/**
* 对接第三方平台及监管平台的operatorId
*/
@NotBlank(message = "operatorId不能为空")
private String operatorIdEvcs;
/** /**
* 电站id * 电站id
*/ */
@ -139,4 +146,15 @@ public class XhpcStationInternetBlacklist implements Serializable {
public void setRemark(String remark) { public void setRemark(String remark) {
this.remark = remark; this.remark = remark;
} }
public String getOperatorIdEvcs() {
return operatorIdEvcs;
}
public void setOperatorIdEvcs(String operatorIdEvcs) {
this.operatorIdEvcs = operatorIdEvcs;
}
} }

View File

@ -72,4 +72,17 @@ public interface XhpcInternetUserMapper {
* @return 结果 * @return 结果
*/ */
public List<Map<String, Object>> list(@Param("name") String name); public List<Map<String, Object>> 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);
} }

View File

@ -29,6 +29,13 @@ public interface XhpcStationInternetBlacklistMapper {
*/ */
public int deleteByOperatorIdEvcs(@Param("internetUserId") String internetUserId); public int deleteByOperatorIdEvcs(@Param("internetUserId") String internetUserId);
/**
* 批量修改流量方的operatorIdEvcs
*
* @param internetUserId 需要删除的数据OperatorID(evcs)
* @return 结果
*/
public void updateByOperatorIdEvcs(@Param("internetUserId")String internetUserId,@Param("operatorIdEvcs")String operatorIdEvcs);
/** /**
* 流量用户设置流量方黑名单列表 * 流量用户设置流量方黑名单列表

View File

@ -70,4 +70,18 @@ public interface IXhpcInternetUserService {
* @return 结果 * @return 结果
*/ */
public List<Map<String, Object>> list(String name); public List<Map<String, Object>> list(String name);
/**
* 根据第三方平台及监管平台的operatorId 查询
* @param operatorIdEvcs
* @return
*/
XhpcInternetUser getOperatorIdEvcs(String operatorIdEvcs);
/**
* 查询operatorId 是否重复
*/
int getCountOperatorIdEvcs(Long internetUserId,String operatorIdEvcs);
} }

View File

@ -30,6 +30,15 @@ public interface IXhpcStationInternetBlacklistService {
public void deleteByOperatorIdEvcs(String internetUserId); public void deleteByOperatorIdEvcs(String internetUserId);
/**
* 批量修改流量方的operatorIdEvcs
*
* @param internetUserId 需要删除的数据OperatorID(evcs)
* @return 结果
*/
public void updateByOperatorIdEvcs(String internetUserId,String operatorIdEvcs);
/** /**
* 运营商设置流量方黑名单信息列表 * 运营商设置流量方黑名单信息列表
* *

View File

@ -130,4 +130,17 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService {
public List<Map<String, Object>> list(String name) { public List<Map<String, Object>> list(String name) {
return xhpcInternetUserMapper.list(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);
}
} }

View File

@ -53,6 +53,11 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte
xhpcStationInternetBlacklistMapper.deleteByOperatorIdEvcs(internetUserId); xhpcStationInternetBlacklistMapper.deleteByOperatorIdEvcs(internetUserId);
} }
@Override
public void updateByOperatorIdEvcs(String internetUserId, String operatorIdEvcs) {
xhpcStationInternetBlacklistMapper.updateByOperatorIdEvcs(internetUserId, operatorIdEvcs);
}
/** /**
* 流量用户设置流量方黑名单信息列表 * 流量用户设置流量方黑名单信息列表

View File

@ -29,7 +29,7 @@
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/> <result column="remark" property="remark"/>
<!-- <result column="operator_id_evcs" property="operatorIdEvcs"/>--> <result column="operator_id_evcs" property="operatorIdEvcs"/>
</resultMap> </resultMap>
@ -322,4 +322,19 @@
</if> </if>
ORDER BY xiu.update_time DESC ORDER BY xiu.update_time DESC
</select> </select>
<select id="getOperatorIdEvcs" resultMap="XhpcInternetUserResult">
select * from xhpc_internet_user where del_flag =0 and operator_id_evcs=#{operatorIdEvcs} limit 1
</select>
<select id="getCountOperatorIdEvcs" resultType="int">
select
count(internet_user_id)
from xhpc_internet_user
where del_flag =0
and operator_id_evcs=#{operatorIdEvcs}
<if test="internetUserId !=null">
and internet_user_id !=#{internetUserId}
</if>
</select>
</mapper> </mapper>

View File

@ -8,6 +8,7 @@
<result column="xhpc_station_internet_blacklist_id" property="xhpcStationInternetBlackId"/> <result column="xhpc_station_internet_blacklist_id" property="xhpcStationInternetBlackId"/>
<result column="internet_user_id" property="internetUserId"/> <result column="internet_user_id" property="internetUserId"/>
<result column="charging_station_id" property="chargingStationId" /> <result column="charging_station_id" property="chargingStationId" />
<result column="operator_id_evcs" property="operatorIdEvcs" />
<result column="status" property="status" /> <result column="status" property="status" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="create_by" property="createBy" /> <result column="create_by" property="createBy" />
@ -80,6 +81,9 @@
where internet_user_id = #{internetUserId} where internet_user_id = #{internetUserId}
</delete> </delete>
<update id="updateByOperatorIdEvcs">
update xhpc_station_internet_blacklist set operator_id_evcs=#{operatorIdEvcs} where internet_user_id = #{internetUserId}
</update>
<select id="list" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="list" parameterType="java.lang.Long" resultType="java.util.Map">
select select
internet_user_id internetUserId, charging_station_id chargingStationId internet_user_id internetUserId, charging_station_id chargingStationId