调整首页数据动态显示
This commit is contained in:
parent
df6ea01c3e
commit
534ac97440
@ -1,6 +1,6 @@
|
||||
package com.evotech.hd.authorization.service;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
@ -16,11 +16,14 @@ public interface CloudService {
|
||||
|
||||
|
||||
@GetMapping(value = "/batterystation/login/list", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||
public BaseResponse<List<BatteryStation>> loadBatteryStation(@RequestParam("proxyCode") String proxyCode);
|
||||
public Result<List<BatteryStation>> loadBatteryStation(@RequestParam("proxyCode") String proxyCode);
|
||||
|
||||
@GetMapping(value = "/company/login/one", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||
public BaseResponse<Company> loadCompany(@RequestParam("code") String code);
|
||||
public Result<Company> loadCompany(@RequestParam("code") String code);
|
||||
|
||||
@GetMapping(value = "/vehicle/login/list", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||
public BaseResponse<List<VehicleInfo>> loadVehicleInfo(@RequestParam("companyCode") String companyCode);
|
||||
public Result<List<VehicleInfo>> loadVehicleInfo(@RequestParam("companyCode") String companyCode);
|
||||
|
||||
@GetMapping(value = "/home/login/data", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||
public void loadIndexData();
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.evotech.hd.authorization.service;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.LoginCacheInfo;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.LogLogin;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUserStation;
|
||||
@ -22,21 +21,21 @@ public interface ResourceService {
|
||||
|
||||
@GetMapping(value = "/user/userbyname",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<AuthUser> loadUserByName(@RequestParam("uname") String userName);
|
||||
public com.evotech.hd.common.core.entity.Result<AuthUser> loadUserByName(@RequestParam("uname") String userName);
|
||||
|
||||
@PostMapping(value = "/user/userpermbyid",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<String> userPermById(@NotNull @RequestParam("uid") String userId, @RequestParam("type")Integer type);
|
||||
public com.evotech.hd.common.core.entity.Result<String> userPermById(@NotNull @RequestParam("uid") String userId, @RequestParam("type")Integer type);
|
||||
|
||||
@PostMapping(value = "/loginlog/add",
|
||||
consumes = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public Result<Integer> addLoginLog(@RequestBody LogLogin log);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addLoginLog(@RequestBody LogLogin log);
|
||||
|
||||
@GetMapping(value = "/logininfo/get",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<LoginCacheInfo> loginInfo(@RequestParam("uid") String uid);
|
||||
public com.evotech.hd.common.core.entity.Result<LoginCacheInfo> loginInfo(@RequestParam("uid") String uid);
|
||||
|
||||
@GetMapping(value = "/user/station",consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||
public BaseResponse<List<AuthUserStation>> loadBatteryStation(@RequestParam("uid") String uid);
|
||||
public Result<List<AuthUserStation>> loadBatteryStation(@RequestParam("uid") String uid);
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ import com.evotech.hd.authorization.service.ResourceService;
|
||||
import com.evotech.hd.authorization.utils.LoginRequesHeadertUtil;
|
||||
import com.evotech.hd.authorization.utils.Oauth2AccessTokenUtil;
|
||||
import com.evotech.hd.authorization.utils.TokenUtil;
|
||||
import com.evotech.hd.common.core.Dto.ResponseUtil;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.entity.LoginCacheInfo;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
@ -32,6 +32,7 @@ import com.evotech.hd.common.redis.utils.RedisUtil;
|
||||
import com.evotech.hd.common.web.util.IpUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.auth.AuthenticationException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.core.env.Environment;
|
||||
@ -42,8 +43,10 @@ import org.springframework.util.StringUtils;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@ -159,7 +162,10 @@ public class LoginServiceImpl implements LoginService {
|
||||
AuthUser user = JSONUtil.toBean(jo.getJSONObject("user"), AuthUser.class);
|
||||
BeanUtils.copyProperties(user, uv);
|
||||
redisUtil.set(HDConstant.LOGIN_CACHE_KEY_PREFIX + jti + ":user", user, tokenExp);
|
||||
|
||||
|
||||
//异步缓存首页统计
|
||||
asyncIndexTask();
|
||||
|
||||
List<AuthRole> roleList = JSONUtil.toList(jo.getJSONArray("roleList"), AuthRole.class);
|
||||
uv.setRoleList(roleList);
|
||||
String rcodes = roleList.stream().map(i -> i.getRcode()).collect(Collectors.joining(","));
|
||||
@ -180,7 +186,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
String pkIds = "-1", codes="-1";
|
||||
if(Integer.valueOf(2).equals(user.getType())) {
|
||||
if (rcodeList.contains(HDConstant.OPERATOR_ROLE_CODE)) {
|
||||
List<BatteryStation> list = ResponseUtil.getValue(cloudService.loadBatteryStation(user.getBusinessCode()));
|
||||
List<BatteryStation> list = ResultUtil.getValue(cloudService.loadBatteryStation(user.getBusinessCode()));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
pkIds = list.stream().map(BatteryStation::getPkId).map(String::valueOf).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
codes = list.stream().map(BatteryStation::getCode).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
@ -188,7 +194,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
} else {
|
||||
//不是运营商管理角色
|
||||
// 检查当前角色的站点信息
|
||||
List<AuthUserStation> list = ResponseUtil.getValue(resourceService.loadBatteryStation(user.getUid()));
|
||||
List<AuthUserStation> list = ResultUtil.getValue(resourceService.loadBatteryStation(user.getUid()));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
pkIds = list.stream().map(AuthUserStation::getStationId).map(String::valueOf).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
codes = list.stream().map(AuthUserStation::getStationCode).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
@ -203,11 +209,11 @@ public class LoginServiceImpl implements LoginService {
|
||||
String companyId = "-1", companyCode = "-1", carIds = "-1", carPlateNums = "-1";
|
||||
if (Integer.valueOf(3).equals(user.getType())) {
|
||||
if (rcodeList.contains(HDConstant.COMPANY_ROLE_CODE)) {
|
||||
Company company = ResponseUtil.getValue(cloudService.loadCompany(user.getBusinessCode()));
|
||||
Company company = ResultUtil.getValue(cloudService.loadCompany(user.getBusinessCode()));
|
||||
if (!ObjectUtils.isEmpty(company)) {
|
||||
companyId = String.valueOf(company.getPkId());
|
||||
companyCode = company.getCcode();
|
||||
List<VehicleInfo> list = ResponseUtil.getValue(cloudService.loadVehicleInfo(company.getCcode()));
|
||||
List<VehicleInfo> list = ResultUtil.getValue(cloudService.loadVehicleInfo(company.getCcode()));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
carIds = list.stream().map(VehicleInfo::getPkId).map(String::valueOf).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
carPlateNums = list.stream().map(VehicleInfo::getPlateNum).filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).collect(Collectors.joining(","));
|
||||
@ -223,7 +229,16 @@ public class LoginServiceImpl implements LoginService {
|
||||
|
||||
return uv;
|
||||
}
|
||||
|
||||
|
||||
private void asyncIndexTask(){
|
||||
CompletableFuture<Void> asyncTask = CompletableFuture.runAsync(()->{
|
||||
try {
|
||||
cloudService.loadIndexData();
|
||||
} catch (Exception e) {
|
||||
log.error("异步处理首页数据异常:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -231,7 +246,16 @@ public class LoginServiceImpl implements LoginService {
|
||||
String authorization = request.getHeader(HDConstant.AUTHORIZATION_KEY);
|
||||
if (authorization != null && authorization.contains(HDConstant.JWT_PREFIX)) {
|
||||
String token = authorization.substring(HDConstant.JWT_PREFIX.length());
|
||||
String jti = TokenUtil.getJti(token);
|
||||
|
||||
String jti = TokenUtil.getJti(token);
|
||||
|
||||
AuthUser user = (AuthUser)redisUtil.get(HDConstant.LOGIN_CACHE_KEY_PREFIX + jti + ":user");
|
||||
Integer id = user.getPkId();
|
||||
redisUtil.del(HDConstant.LOGIN_CACHE_KEY_PREFIX + HDConstant.IndexConstant.HOME_DATA_5+":"+id);
|
||||
redisUtil.del(HDConstant.LOGIN_CACHE_KEY_PREFIX + HDConstant.IndexConstant.HOME_DATA_6+":"+id);
|
||||
|
||||
|
||||
|
||||
redisUtil.del(HDConstant.LOGIN_CACHE_KEY_PREFIX + jti + ":token");
|
||||
redisUtil.del(HDConstant.LOGIN_CACHE_KEY_PREFIX + jti + ":user");
|
||||
redisUtil.del(HDConstant.LOGIN_CACHE_KEY_PREFIX + jti + ":rcodes");
|
||||
|
||||
@ -15,7 +15,7 @@ import java.io.Serializable;
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class BaseResponse<T> implements Serializable {
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
@Schema(description = "请求处理状态", example = "1")
|
||||
private Integer status;
|
||||
@ -26,10 +26,10 @@ public class BaseResponse<T> implements Serializable {
|
||||
@Schema(description = "返回数据")
|
||||
private T data;
|
||||
|
||||
public BaseResponse() {
|
||||
public Result() {
|
||||
}
|
||||
|
||||
public BaseResponse<T> success(T o) {
|
||||
public Result<T> success(T o) {
|
||||
this.status = 1;
|
||||
this.code = CodeMsg.SUCCESS.getCode();
|
||||
this.msg = CodeMsg.SUCCESS.getMsg();
|
||||
@ -37,11 +37,17 @@ public class BaseResponse<T> implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseResponse<T> error(CodeMsg codeMsg) {
|
||||
public Result<T> error(CodeMsg codeMsg) {
|
||||
this.status = 1;
|
||||
this.code = codeMsg.getCode();
|
||||
this.msg = codeMsg.getMsg();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result<T> error(CodeMsg codeMsg, String errorMsg) {
|
||||
this.status = 1;
|
||||
this.code = codeMsg.getCode();
|
||||
this.msg = errorMsg;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,7 @@ import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* 请求相应工具类
|
||||
* @ClassName:ResponseUtil
|
||||
* @date: 2025年04月22日 16:38
|
||||
* @author: andy.shi
|
||||
@ -13,10 +12,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Slf4j
|
||||
public class ResponseUtil {
|
||||
public class ResultUtil {
|
||||
|
||||
|
||||
public static <T> T getValue(BaseResponse<T> result){
|
||||
public static <T> T getValue(Result<T> result){
|
||||
if(CodeMsg.SUCCESS.getCode().equals(result.getCode())){
|
||||
return result.getData();
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.evotech.hd.common.core.Dto.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* 类
|
||||
* @ClassName:HomeRequestDto
|
||||
* @date: 2025年04月24日 10:00
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HomeRequestDto {
|
||||
|
||||
|
||||
Date begin;
|
||||
|
||||
Date end;
|
||||
|
||||
public HomeRequestDto() {
|
||||
}
|
||||
|
||||
public HomeRequestDto(Date begin, Date end) {
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.evotech.hd.common.core.Dto.result.home;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 首页订单金额统计类
|
||||
*
|
||||
* @ClassName:HomeOrderSwapBatteryAmountDto
|
||||
* @date: 2025年04月24日 11:14
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HomeOrderSwapBatteryAmountDto {
|
||||
|
||||
Double amount;
|
||||
|
||||
Integer status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.evotech.hd.common.core.Dto.result.home;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 近半年订单交易金额统计
|
||||
*
|
||||
* @ClassName:HomeOrderSwapBatteryAmountDto
|
||||
* @date: 2025年04月24日 11:14
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HomeOrderSwapBatteryHalfYearAmountDto {
|
||||
|
||||
@Schema(description = "年月")
|
||||
private String month;
|
||||
|
||||
@Schema(description = "交易数")
|
||||
private Long quantity;
|
||||
|
||||
@Schema(description = "交易金额")
|
||||
private Double totalMoney;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "支付类型")
|
||||
private Integer payType;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.evotech.hd.common.core.Dto.result.home;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 近半年订单统计
|
||||
*
|
||||
* @ClassName:HomeOrderSwapBatteryAmountDto
|
||||
* @date: 2025年04月24日 11:14
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HomeOrderSwapBatteryHalfYearDto {
|
||||
|
||||
private String month;
|
||||
|
||||
private Long quantity;
|
||||
|
||||
private Double totalMoney;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.evotech.hd.common.core.Dto.result.home;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 换电站订单占比类
|
||||
*
|
||||
* @ClassName:HomeOrderSwapBatteryDto
|
||||
* @date: 2025年04月24日 10:06
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "首页换电站订单数,换电站占比相关数据")
|
||||
public class HomeOrderSwapBatteryProportionDto {
|
||||
|
||||
@Schema(description = "换电站名称")
|
||||
String stationName;
|
||||
@Schema(description = "换电站code")
|
||||
String stationCode;
|
||||
@Schema(description = "换电站订单数量")
|
||||
Long quantity;
|
||||
@Schema(description = "订单类型")
|
||||
Integer orderType;
|
||||
|
||||
}
|
||||
@ -2,6 +2,16 @@ package com.evotech.hd.common.core.constant;
|
||||
|
||||
public interface HDConstant {
|
||||
|
||||
/***
|
||||
* 大华设备相关CONSTANT
|
||||
*/
|
||||
final class IndexConstant{
|
||||
//redis accessToken的key
|
||||
public static final String HOME_DATA_5 = "homeData5";
|
||||
public static final String HOME_DATA_6 = "homeData6";
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* 大华设备相关CONSTANT
|
||||
*/
|
||||
@ -21,9 +31,6 @@ public interface HDConstant {
|
||||
|
||||
public static final String LIVE_NOT_EXISTS_CODE = "LV1002";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,20 @@
|
||||
package com.evotech.hd.common.core.dao.cloud;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evotech.hd.common.core.Dto.request.HomeRequestDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryAmountDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryHalfYearAmountDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryHalfYearDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryProportionDto;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBattery;
|
||||
import com.evotech.hd.common.core.permission.DataScope;
|
||||
import com.evotech.hd.common.core.permission.DataScopeOpenMethod;
|
||||
import com.evotech.hd.common.core.permission.DataScopes;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zrb
|
||||
@ -14,6 +24,20 @@ import com.evotech.hd.common.core.permission.DataScopes;
|
||||
@DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE),
|
||||
@DataScope(permissionObject = HDConstant.COMPANY_ROLE_CODE, permissionScopeName = "plate_num", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_CAR_CODE),
|
||||
})
|
||||
@DataScopeOpenMethod(openMethod = true, methodName = {"homeFindHalfYearAmountData"})
|
||||
public interface OrderSwapBatteryDao extends BaseMapper<OrderSwapBattery> {
|
||||
|
||||
|
||||
List<HomeOrderSwapBatteryProportionDto> homeFindProportionData(@Param("params") HomeRequestDto params);
|
||||
|
||||
List<HomeOrderSwapBatteryAmountDto> homeFindAmountData(@Param("params") HomeRequestDto params);
|
||||
|
||||
List<HomeOrderSwapBatteryHalfYearDto> homeFindHalfYearOrderData(@Param("params") HomeRequestDto params);
|
||||
|
||||
@DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, tableAlias = "osb", permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE)
|
||||
List<HomeOrderSwapBatteryHalfYearAmountDto> homeFindHalfYearAmountData(@Param("params") HomeRequestDto params);
|
||||
|
||||
Long homeFindOrderCountData(@Param("date") Date date);
|
||||
|
||||
Double homeFindOrderAmountData(@Param("date") Date date);
|
||||
}
|
||||
|
||||
@ -1,24 +1,19 @@
|
||||
package com.evotech.hd.common.core.entity.cloud;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zrb
|
||||
@ -73,7 +68,7 @@ public class OrderSwapBattery extends BaseEntity implements Serializable {
|
||||
@Schema(description = "订单金额")
|
||||
private Integer amount;
|
||||
|
||||
@Schema(description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消")
|
||||
@Schema(description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消, -1-退款")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "计算费用方式:1-ODO,2-SOC,3-按电量")
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.evotech.hd.common.core.permission;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DataScopeOpenMethod {
|
||||
|
||||
/***
|
||||
* 是否开启方法查询
|
||||
*/
|
||||
boolean openMethod() default false;
|
||||
|
||||
String[] methodName();
|
||||
|
||||
}
|
||||
@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHan
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||
import com.evotech.hd.common.core.permission.DataScope;
|
||||
import com.evotech.hd.common.core.permission.DataScopeOpenMethod;
|
||||
import com.evotech.hd.common.core.permission.DataScopes;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.permission.util.RedisPermissionUtils;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.Parenthesis;
|
||||
@ -18,7 +20,9 @@ import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.schema.Table;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -49,35 +53,95 @@ public class DataScopeHandler implements MultiDataPermissionHandler {
|
||||
if(table != null && CollectionUtils.isNotEmpty(table.getNameParts()) && !"1".equals(RedisPermissionUtils.getRoleType()) && BeanUtil.isNotEmpty(RedisPermissionUtils.getUser())){
|
||||
String roleCode = getUserRoleType();
|
||||
Class<?> mapperClazz = Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(".")));
|
||||
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(".")+1);
|
||||
//检查是否允许检查方法的数据权限
|
||||
DataScopeOpenMethod dataScopeOpenMethod = mapperClazz.getAnnotation(DataScopeOpenMethod.class);
|
||||
|
||||
if(dataScopeOpenMethod != null && dataScopeOpenMethod.openMethod()){
|
||||
List<String> methodNameList = Collections.asList(dataScopeOpenMethod.methodName());
|
||||
if(methodNameList.contains(methodName)){
|
||||
Method[] methods = mapperClazz.getMethods();
|
||||
// //优先检查方法上的权限配置
|
||||
for (Method method : methods) {
|
||||
if(methodName.equals(method.getName())){
|
||||
//优先检查是不是单角色权限
|
||||
DataScope dataScope = method.getAnnotation(DataScope.class);
|
||||
//如果不是, 检查多角色权限
|
||||
DataScopes dataScopesList = method.getAnnotation(DataScopes.class);
|
||||
if(dataScope != null || dataScopesList != null){
|
||||
return buildPermission(dataScope, dataScopesList, roleCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//优先检查是不是单角色权限
|
||||
DataScope dataScope = mapperClazz.getAnnotation(DataScope.class);
|
||||
if (ObjectUtils.isNotEmpty(dataScope) && dataScope.enabled()) {
|
||||
if(dataScope.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScope);
|
||||
//如果不是, 检查多角色权限
|
||||
DataScopes dataScopesList = mapperClazz.getAnnotation(DataScopes.class);
|
||||
if(dataScope != null || dataScopesList != null){
|
||||
return buildPermission(dataScope, dataScopesList, roleCode);
|
||||
}
|
||||
// //优先检查是不是单角色权限
|
||||
// DataScope dataScope = mapperClazz.getAnnotation(DataScope.class);
|
||||
// if (ObjectUtils.isNotEmpty(dataScope) && dataScope.enabled()) {
|
||||
// if(dataScope.permissionObject().equals(roleCode)){
|
||||
// return buildDataScopeByAnnotation(dataScope);
|
||||
// }else
|
||||
// //如果说等于没有权限
|
||||
// if(HDConstant.PERMISSION_NOT_CODE.equals(roleCode)){
|
||||
// return buildNotDataScopeByAnnotation(dataScope);
|
||||
// }
|
||||
// }
|
||||
// //如果不是, 检查多角色权限
|
||||
// DataScopes dataScopesList = mapperClazz.getAnnotation(DataScopes.class);
|
||||
// if (ObjectUtils.isNotEmpty(dataScopesList)) {
|
||||
// for (DataScope dataScopes :dataScopesList.value()){
|
||||
// if(dataScopes.enabled()){
|
||||
// if(dataScopes.permissionObject().equals(roleCode)){
|
||||
// return buildDataScopeByAnnotation(dataScopes);
|
||||
// }else
|
||||
// //如果说等于没有权限
|
||||
// if(HDConstant.PERMISSION_NOT_CODE.equals(roleCode)){
|
||||
// return buildNotDataScopeByAnnotation(dataScope);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private Expression buildPermission(DataScope dataScope, DataScopes dataScopesList, String roleCode){
|
||||
//优先检查是不是单角色权限
|
||||
if (ObjectUtils.isNotEmpty(dataScope) && dataScope.enabled()) {
|
||||
if(dataScope.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScope);
|
||||
}else
|
||||
//如果说等于没有权限
|
||||
if(HDConstant.PERMISSION_NOT_CODE.equals(roleCode)){
|
||||
return buildNotDataScopeByAnnotation(dataScope);
|
||||
}
|
||||
}
|
||||
//如果不是, 检查多角色权限
|
||||
if (ObjectUtils.isNotEmpty(dataScopesList)) {
|
||||
for (DataScope dataScopes :dataScopesList.value()){
|
||||
if(dataScopes.enabled()){
|
||||
if(dataScopes.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScopes);
|
||||
}else
|
||||
//如果说等于没有权限
|
||||
if(HDConstant.PERMISSION_NOT_CODE.equals(roleCode)){
|
||||
return buildNotDataScopeByAnnotation(dataScope);
|
||||
}
|
||||
}
|
||||
//如果不是, 检查多角色权限
|
||||
DataScopes dataScopesList = mapperClazz.getAnnotation(DataScopes.class);
|
||||
if (ObjectUtils.isNotEmpty(dataScopesList)) {
|
||||
for (DataScope dataScopes :dataScopesList.value()){
|
||||
if(dataScopes.enabled()){
|
||||
if(dataScopes.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScopes);
|
||||
}else
|
||||
//如果说等于没有权限
|
||||
if(HDConstant.PERMISSION_NOT_CODE.equals(roleCode)){
|
||||
return buildNotDataScopeByAnnotation(dataScope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class RedisPermissionUtils {
|
||||
return getStringValue(HDConstant.LOGIN_CACHE_KEY_PREFIX + HDConstant.PermissionConstant.PERMISSION_CAR_ID+":"+getUserPkId());
|
||||
}
|
||||
|
||||
private static Integer getUserPkId(){
|
||||
public static Integer getUserPkId(){
|
||||
AuthUser user = getUser();
|
||||
if(ObjectUtils.isEmpty(user) || user.getPkId() == null){
|
||||
return null;
|
||||
@ -151,7 +151,7 @@ public class RedisPermissionUtils {
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private static String getStringValue(String key){
|
||||
public static String getStringValue(String key){
|
||||
Object obj = getValue(key);
|
||||
return ObjectUtils.isEmpty(obj) ? null : String.valueOf(obj);
|
||||
}
|
||||
|
||||
@ -3,8 +3,7 @@ package com.evotech.hd.cloud.controller;
|
||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
import com.evotech.hd.cloud.mqtt.message.handle.RequestMessageService;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
@ -37,35 +36,35 @@ public class BatteryStationController {
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject BatteryStation bs) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject BatteryStation bs) {
|
||||
return batteryStationService.add(bs);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
return batteryStationService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject BatteryStation bs) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject BatteryStation bs) {
|
||||
return batteryStationService.update(bs);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<BatteryStation>> list(@ParameterObject PageListBatteryStationRequest plbsr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStation>> list(@ParameterObject PageListBatteryStationRequest plbsr) {
|
||||
return batteryStationService.list(plbsr);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询2")
|
||||
@GetMapping("/liststation")
|
||||
@Hidden
|
||||
public Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String plateNum) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String plateNum) {
|
||||
return batteryStationService.listStation(plateNum);
|
||||
}
|
||||
|
||||
@ -73,7 +72,7 @@ public class BatteryStationController {
|
||||
@Operation(summary = "站点秘钥")
|
||||
@PostMapping("/rsa_secret_key")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Map<String, String>> RsaSecretKey(@NotBlank @RequestParam String stationCode) {
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> RsaSecretKey(@NotBlank @RequestParam String stationCode) {
|
||||
return batteryStationService.RsaSecretKey(stationCode);
|
||||
}
|
||||
|
||||
@ -100,13 +99,13 @@ public class BatteryStationController {
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/login/list")
|
||||
public BaseResponse<List<BatteryStation>> loginList(@RequestParam String proxyCode) {
|
||||
public Result<List<BatteryStation>> loginList(@RequestParam String proxyCode) {
|
||||
return batteryStationService.loginList(proxyCode);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/resource/list")
|
||||
public BaseResponse<List<BatteryStation>> resourceList(@RequestParam String pkIds) {
|
||||
public Result<List<BatteryStation>> resourceList(@RequestParam String pkIds) {
|
||||
return batteryStationService.resourceList(pkIds);
|
||||
}
|
||||
|
||||
|
||||
@ -1,28 +1,20 @@
|
||||
package com.evotech.hd.cloud.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.HomeDataRequest;
|
||||
import com.evotech.hd.cloud.entity.vo.*;
|
||||
import com.evotech.hd.cloud.service.HomeService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.HomeDataRequest;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData1;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData2;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData3;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData4;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData5;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData6;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData7;
|
||||
import com.evotech.hd.cloud.service.HomeService;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "首页数据")
|
||||
@ApiSupport(order = 60)
|
||||
@ -48,14 +40,14 @@ public class HomeController {
|
||||
return homeService.homeData2();
|
||||
}
|
||||
|
||||
@Operation(summary = "数据3-订单 可按换电站统计")
|
||||
@Operation(summary = "数据3-订单总数 订单占比")
|
||||
@GetMapping("/data3")
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<HomeData3> homeData3(@ParameterObject HomeDataRequest hd) {
|
||||
return homeService.homeData3(hd);
|
||||
}
|
||||
|
||||
@Operation(summary = "数据4-交易 不按换电站统计")
|
||||
@Operation(summary = "数据4-收入/支出金额")
|
||||
@GetMapping("/data4")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<HomeData4> homeData4(@ParameterObject HomeDataRequest hd) {
|
||||
@ -84,4 +76,9 @@ public class HomeController {
|
||||
return homeService.homeData7(type);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/login/data")
|
||||
public void loginData() {
|
||||
homeService.loginData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package com.evotech.hd.cloud.controller;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.IndependentAccountRequest;
|
||||
import com.evotech.hd.cloud.service.IndependentAccountService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -36,7 +36,7 @@ public class IndependentAccountController {
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public BaseResponse<Map<String, Object>> list(@ParameterObject IndependentAccountRequest params) {
|
||||
public Result<Map<String, Object>> list(@ParameterObject IndependentAccountRequest params) {
|
||||
return independentAccountService.pageList(params);
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.evotech.hd.cloud.controller.customer;
|
||||
|
||||
import com.evotech.hd.cloud.service.CompanyService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
@ -32,43 +31,43 @@ public class CompanyController {
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject Company company) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject Company company) {
|
||||
return companyService.add(company);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(@NotNull Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(@NotNull Integer id) {
|
||||
return companyService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject Company company) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject Company company) {
|
||||
return companyService.update(company);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<Company>> list(@Valid @ParameterObject BasePageRequest bpr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<Company>> list(@Valid @ParameterObject BasePageRequest bpr) {
|
||||
return companyService.list(bpr);
|
||||
}
|
||||
|
||||
@GetMapping("/companyByCode")
|
||||
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> companyByCode(String ccode) {
|
||||
return companyService.companyByCode(ccode);
|
||||
}
|
||||
|
||||
@GetMapping("/login/one")
|
||||
public BaseResponse<Company> loginOne(@RequestParam String code) {
|
||||
public Result<Company> loginOne(@RequestParam String code) {
|
||||
return companyService.loginOne(code);
|
||||
}
|
||||
|
||||
@GetMapping("/resource/list")
|
||||
public BaseResponse<List<Company>> resourceList() {
|
||||
public Result<List<Company>> resourceList() {
|
||||
return companyService.resourceList();
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,7 @@ package com.evotech.hd.cloud.controller.customer;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.PageListVehicleRequest;
|
||||
import com.evotech.hd.cloud.service.VehicleService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleWechatUserRelation;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
@ -34,49 +33,49 @@ public class VehicleController {
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject VehicleInfo vi) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject VehicleInfo vi) {
|
||||
return vehicleService.add(vi);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
return vehicleService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject VehicleInfo vi) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject VehicleInfo vi) {
|
||||
return vehicleService.update(vi);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<VehicleInfo>> list(@ParameterObject PageListVehicleRequest plvr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> list(@ParameterObject PageListVehicleRequest plvr) {
|
||||
return vehicleService.list(plvr);
|
||||
}
|
||||
|
||||
@Operation(summary = "关联公司")
|
||||
@PostMapping("/company/relation")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
return vehicleService.companyRelation(plateNum, ccode, cname);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除关联公司")
|
||||
@PostMapping("/company/relation/del")
|
||||
@ApiOperationSupport(order = 6)
|
||||
public Result<Integer> delCompanyRelation(String plateNum) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delCompanyRelation(String plateNum) {
|
||||
return vehicleService.delCompanyRelation(plateNum);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信用户关联")
|
||||
@PostMapping("/wechatuser/relation/add")
|
||||
@ApiOperationSupport(order = 7)
|
||||
public Result<Integer> addWechatUserRelation(@Valid @ParameterObject VehicleWechatUserRelation relation) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addWechatUserRelation(@Valid @ParameterObject VehicleWechatUserRelation relation) {
|
||||
return vehicleService.addWechatUserRelation(relation);
|
||||
}
|
||||
|
||||
@ -84,7 +83,7 @@ public class VehicleController {
|
||||
@Operation(summary = "删除微信用户关联")
|
||||
@PostMapping("/wechatuser/relation/del")
|
||||
@ApiOperationSupport(order = 8)
|
||||
public Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||
return vehicleService.deleteWechatUserRelation(id);
|
||||
}
|
||||
|
||||
@ -92,14 +91,14 @@ public class VehicleController {
|
||||
@Operation(summary = "查询微信用户车辆")
|
||||
@GetMapping("/wechatuser/relation/list")
|
||||
@ApiOperationSupport(order = 9)
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String wuid) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String wuid) {
|
||||
return vehicleService.listWechatUserRelation(wuid, null);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询车辆的关联用户")
|
||||
@GetMapping("/relationuser/list")
|
||||
@ApiOperationSupport(order = 10)
|
||||
public Result<List<VehicleWechatUserRelation>> listRelationUser(@NotBlank @RequestParam String PlantNo) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>> listRelationUser(@NotBlank @RequestParam String PlantNo) {
|
||||
return vehicleService.listRelationUser(PlantNo);
|
||||
}
|
||||
|
||||
@ -107,7 +106,7 @@ public class VehicleController {
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/login/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public BaseResponse<List<VehicleInfo>> loginList(@RequestParam String companyCode) {
|
||||
public Result<List<VehicleInfo>> loginList(@RequestParam String companyCode) {
|
||||
return vehicleService.loginList(companyCode);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.evotech.hd.cloud.controller.dh;
|
||||
|
||||
import com.evotech.hd.cloud.service.DHDeviceService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.DeviceDto;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -30,14 +30,14 @@ public class DHController {
|
||||
|
||||
@Operation(summary = "设备列表")
|
||||
@GetMapping("/device/list")
|
||||
public BaseResponse<List<DeviceDto>> deviceList() {
|
||||
return new BaseResponse().success(dhDeviceService.findList());
|
||||
public Result<List<DeviceDto>> deviceList() {
|
||||
return new Result().success(dhDeviceService.findList());
|
||||
}
|
||||
|
||||
@Operation(summary = "直播地址", description = "直接返回直播地址")
|
||||
@PostMapping("/device/live")
|
||||
public BaseResponse<String> live(@RequestParam String deviceId, @RequestParam String channelId) {
|
||||
return new BaseResponse().success(dhDeviceService.live(deviceId, channelId));
|
||||
public Result<String> live(@RequestParam String deviceId, @RequestParam String channelId) {
|
||||
return new Result().success(dhDeviceService.live(deviceId, channelId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
package com.evotech.hd.cloud.entity.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.evotech.hd.cloud.entity.HomeStationOrderData;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryProportionDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(name = "订单")
|
||||
public class HomeData3 {
|
||||
@ -16,17 +15,9 @@ public class HomeData3 {
|
||||
private String dayEnd;
|
||||
|
||||
@Schema(description = "总订单数")
|
||||
private Integer quantity;
|
||||
|
||||
@Schema(description = "完成订单数")
|
||||
private Integer finishedQuantity;
|
||||
|
||||
@Schema(description = "进行中的订单数")
|
||||
private Integer toDoQuantity;
|
||||
|
||||
@Schema(description = "作废订单数")
|
||||
private Integer cancleQuantity;
|
||||
|
||||
private List<HomeStationOrderData> stationOrderDataList;
|
||||
private Long quantity;
|
||||
|
||||
@Schema(description = "各站点情况")
|
||||
private List<HomeOrderSwapBatteryProportionDto> stationOrderDataList;
|
||||
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ public class HomeData5 {
|
||||
private String month;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer quantity;
|
||||
private Long quantity;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private Integer totalMoney;
|
||||
private Double totalMoney;
|
||||
}
|
||||
|
||||
@ -9,22 +9,24 @@ public class HomeData6 {
|
||||
|
||||
@Schema(description = "年月")
|
||||
private String month;
|
||||
|
||||
|
||||
@Schema(description = "在线支付交易数")
|
||||
private Long inQuantity = 0l;
|
||||
|
||||
@Schema(description = "在线支付金额")
|
||||
private Double inMoney = 0d;
|
||||
|
||||
@Schema(description = "余额支付交易数")
|
||||
private Integer walletQuantity;
|
||||
|
||||
private Long walletQuantity = 0l;
|
||||
|
||||
@Schema(description = "余额支付金额")
|
||||
private Integer walletMoney;
|
||||
|
||||
@Schema(description = "收入金额")
|
||||
private Integer inMoney;
|
||||
|
||||
@Schema(description = "收入交易数")
|
||||
private Integer inQuantity;
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
private Integer refundMoney;
|
||||
|
||||
private Double walletMoney = 0d;
|
||||
|
||||
@Schema(description = "退款交易数")
|
||||
private Integer refundQuantity;
|
||||
private Long refundQuantity = 0l;
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
private Double refundMoney = 0d;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,26 +11,26 @@ public class HomeData7 {
|
||||
private String month;
|
||||
|
||||
@Schema(description = "订单数量")
|
||||
private Integer quantity;
|
||||
private Long quantity;
|
||||
|
||||
@Schema(description = "同比订单数量")
|
||||
private Integer lastMonthQuantity;
|
||||
private Long lastMonthQuantity;
|
||||
|
||||
@Schema(description = "环比订单数量")
|
||||
private Integer lastYearQuantity;
|
||||
private Long lastYearQuantity;
|
||||
|
||||
@Schema(description = "前年订单数量")
|
||||
private Integer last2YearQuantity;
|
||||
private Long last2YearQuantity;
|
||||
|
||||
@Schema(description = "交易金额")
|
||||
private Integer tradeAmount;
|
||||
private Double tradeAmount;
|
||||
|
||||
@Schema(description = "同比交易金额")
|
||||
private Integer lastMonthTradeAmount;
|
||||
private Double lastMonthTradeAmount;
|
||||
|
||||
@Schema(description = "环比交易金额")
|
||||
private Integer lastYearTradeAmount;
|
||||
private Double lastYearTradeAmount;
|
||||
|
||||
@Schema(description = "前年交易金额")
|
||||
private Integer last2YearTradeAmount;
|
||||
private Double last2YearTradeAmount;
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@ -12,17 +11,17 @@ import java.util.Map;
|
||||
|
||||
public interface BatteryStationService {
|
||||
|
||||
public Result<Integer> add(BatteryStation bs);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(BatteryStation bs);
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(BatteryStation bs);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(BatteryStation bs);
|
||||
|
||||
public Result<List<BatteryStation>> list(PageListBatteryStationRequest plbsr);
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStation>> list(PageListBatteryStationRequest plbsr);
|
||||
|
||||
public Result<List<BatteryStationVO>> listStation(String plateNum);
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>> listStation(String plateNum);
|
||||
|
||||
public Result<Map<String, String>> RsaSecretKey(String stationCode);
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> RsaSecretKey(String stationCode);
|
||||
|
||||
public void getQRCode2(String path, String width, String env_version, HttpServletResponse response);
|
||||
|
||||
@ -30,9 +29,9 @@ public interface BatteryStationService {
|
||||
|
||||
public void downloadQRCode2(String path, String width, HttpServletResponse response);
|
||||
|
||||
public BaseResponse<List<BatteryStation>> loginList(String proxyId);
|
||||
public Result<List<BatteryStation>> loginList(String proxyId);
|
||||
|
||||
public BaseResponse<List<BatteryStation>> resourceList(String pkIds);
|
||||
public Result<List<BatteryStation>> resourceList(String pkIds);
|
||||
|
||||
List<BatteryStation> deviceList(String proxyCode);
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
|
||||
import java.util.List;
|
||||
@ -10,17 +9,17 @@ import java.util.Map;
|
||||
|
||||
public interface CompanyService {
|
||||
|
||||
public Result<Integer> add(Company company);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(Company company);
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(Company company);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(Company company);
|
||||
|
||||
public Result<List<Company>> list(BasePageRequest bpr);
|
||||
public com.evotech.hd.common.core.entity.Result<List<Company>> list(BasePageRequest bpr);
|
||||
|
||||
public Result<Map<String, String>> companyByCode(String ccode);
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> companyByCode(String ccode);
|
||||
|
||||
public BaseResponse<Company> loginOne(String code);
|
||||
public Result<Company> loginOne(String code);
|
||||
|
||||
public BaseResponse<List<Company>> resourceList();
|
||||
public Result<List<Company>> resourceList();
|
||||
}
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.HomeDataRequest;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData1;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData2;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData3;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData4;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData5;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData6;
|
||||
import com.evotech.hd.cloud.entity.vo.HomeData7;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.cloud.entity.vo.*;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HomeService {
|
||||
|
||||
@ -28,4 +22,6 @@ public interface HomeService {
|
||||
|
||||
public Result<HomeData7> homeData7(Integer type);
|
||||
|
||||
public void loginData();
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.IndependentAccountRequest;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.TaxPoint;
|
||||
|
||||
import java.util.Map;
|
||||
@ -19,5 +19,5 @@ public interface IndependentAccountService {
|
||||
|
||||
void addIndependentAccount(TaxPoint taxPoint, String stationCode);
|
||||
|
||||
public BaseResponse<Map<String, Object>> pageList(IndependentAccountRequest params);
|
||||
public Result<Map<String, Object>> pageList(IndependentAccountRequest params);
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import com.evotech.hd.cloud.entity.request.PageListVehicleRequest;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleWechatUserRelation;
|
||||
|
||||
@ -10,26 +9,26 @@ import java.util.List;
|
||||
|
||||
public interface VehicleService {
|
||||
|
||||
public Result<Integer> add(VehicleInfo vi);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(VehicleInfo vi);
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(VehicleInfo vi);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(VehicleInfo vi);
|
||||
|
||||
public Result<List<VehicleInfo>> list(PageListVehicleRequest plvr);
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> list(PageListVehicleRequest plvr);
|
||||
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> companyRelation(String plateNum, String ccode, String cname);
|
||||
|
||||
public Result<Integer> delCompanyRelation(String plateNum);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delCompanyRelation(String plateNum);
|
||||
|
||||
public Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation);
|
||||
|
||||
public Result<Integer> deleteWechatUserRelation(Integer id);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteWechatUserRelation(Integer id);
|
||||
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(String openid, String plateNum);
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> listWechatUserRelation(String openid, String plateNum);
|
||||
|
||||
public Result<List<VehicleWechatUserRelation>> listRelationUser(String PlantNo);
|
||||
public BaseResponse<List<VehicleInfo>> loginList(String companyCode);
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>> listRelationUser(String PlantNo);
|
||||
public Result<List<VehicleInfo>> loginList(String companyCode);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -18,8 +18,7 @@ import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
import com.evotech.hd.cloud.exception.DHException;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
import com.evotech.hd.cloud.service.rpc.WechatService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
@ -56,20 +55,20 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
private WechatService wechatService;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(BatteryStation bs) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(BatteryStation bs) {
|
||||
bs.setCtime(new Date());
|
||||
boolean b = batteryStationDao.exists(new QueryWrapper<BatteryStation>()
|
||||
.eq("del_flag", 0)
|
||||
.eq("code", bs.getCode()));
|
||||
if (b) {
|
||||
return new Result<Integer>().error("换电站已存在!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("换电站已存在!");
|
||||
}
|
||||
int n = batteryStationDao.insert(bs);
|
||||
if (n == 1) {
|
||||
addStore(bs);
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加换电站出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加换电站出错!");
|
||||
}
|
||||
|
||||
|
||||
@ -104,32 +103,32 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
BatteryStation bs = new BatteryStation();
|
||||
bs.setPkId(id);
|
||||
bs.setDelFlag(1);
|
||||
int n = batteryStationDao.updateById(bs);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
throw new RuntimeException("删除换电站出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(BatteryStation bs) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(BatteryStation bs) {
|
||||
int n = batteryStationDao.updateById(bs);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新换电站失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("更新换电站失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<BatteryStation>> list(PageListBatteryStationRequest plbsr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStation>> list(PageListBatteryStationRequest plbsr) {
|
||||
Page<BatteryStation> page = new Page<BatteryStation>(plbsr.getPageNo(), plbsr.getPageSize());
|
||||
List<BatteryStation> list = batteryStationDao.listStation(page, plbsr);
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<BatteryStation>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<BatteryStation>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
// page = batteryStationDao.selectPage(page, new QueryWrapper<BatteryStation>()
|
||||
@ -142,7 +141,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
// if (page.getRecords().isEmpty()) {
|
||||
// return new Result<List<BatteryStation>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
// }
|
||||
return new Result<List<BatteryStation>>().success(page.setRecords(list));
|
||||
return new com.evotech.hd.common.core.entity.Result<List<BatteryStation>>().success(page.setRecords(list));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,7 +151,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
* @return 返回包含密钥对信息的Result对象
|
||||
*/
|
||||
@Override
|
||||
public Result<Map<String, String>> RsaSecretKey(String stationCode) {
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> RsaSecretKey(String stationCode) {
|
||||
// 查询数据库中是否存在对应电站编码的密钥对
|
||||
BatteryStationSecretKey existingKey = batteryStationSecretKeyDao.selectOne(
|
||||
new QueryWrapper<BatteryStationSecretKey>()
|
||||
@ -164,7 +163,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("publickey", existingKey.getPublicKey());
|
||||
map.put("privatekey", existingKey.getPrivateKey());
|
||||
return new Result<Map<String, String>>().success(map);
|
||||
return new com.evotech.hd.common.core.entity.Result<Map<String, String>>().success(map);
|
||||
} else {
|
||||
// 如果不存在密钥对,则生成新的密钥对
|
||||
KeyPair keyPair = KeyUtil.generateKeyPair(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue());
|
||||
@ -186,17 +185,17 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
map.put("publickey", publickeyBase64String);
|
||||
map.put("privatekey", privatekeyBase64String);
|
||||
// 返回包含密钥对信息的成功结果
|
||||
return new Result<Map<String, String>>().success(map);
|
||||
return new com.evotech.hd.common.core.entity.Result<Map<String, String>>().success(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<List<BatteryStationVO>> listStation(String plateNum) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>> listStation(String plateNum) {
|
||||
//过滤未营业的换电站
|
||||
List<BatteryStation> list = batteryStationDao.selectList(new QueryWrapper<BatteryStation>().eq("del_flag", 0).eq("status", 1));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<BatteryStationVO>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
List<BatteryStationVO> res = list.stream().map(i -> {
|
||||
BatteryStationVO vo = new BatteryStationVO();
|
||||
@ -209,7 +208,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
.eq("del_flag", 0)
|
||||
.eq("plate_num", plateNum));
|
||||
if (vi == null) {
|
||||
return new Result<List<BatteryStationVO>>().error("无车辆信息!");
|
||||
return new com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>>().error("无车辆信息!");
|
||||
}
|
||||
// 过滤未营业的换电站并根据车辆类型过滤
|
||||
res = res.stream()
|
||||
@ -222,7 +221,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
return new Result<List<BatteryStationVO>>().success(res);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>>().success(res);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -305,14 +304,14 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResponse<List<BatteryStation>> loginList(String proxyCode) {
|
||||
return new BaseResponse<List<BatteryStation>>().success(batteryStationDao.selectList(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getProxyId, proxyCode).select(BatteryStation::getPkId, BatteryStation::getCode)));
|
||||
public Result<List<BatteryStation>> loginList(String proxyCode) {
|
||||
return new Result<List<BatteryStation>>().success(batteryStationDao.selectList(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getProxyId, proxyCode).select(BatteryStation::getPkId, BatteryStation::getCode)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<BatteryStation>> resourceList(String pkIds) {
|
||||
public Result<List<BatteryStation>> resourceList(String pkIds) {
|
||||
String[] pkIdArray = pkIds.split(",");
|
||||
return new BaseResponse<List<BatteryStation>>().success(batteryStationDao.selectList(new LambdaQueryWrapper<BatteryStation>().eq((pkIdArray != null && pkIdArray.length > 0), BatteryStation::getPkId, Arrays.asList(pkIdArray)).eq(BatteryStation::getStatus, 1).eq(BatteryStation::getDelFlag, 0).select(BatteryStation::getPkId, BatteryStation::getCode)));
|
||||
return new Result<List<BatteryStation>>().success(batteryStationDao.selectList(new LambdaQueryWrapper<BatteryStation>().eq((pkIdArray != null && pkIdArray.length > 0), BatteryStation::getPkId, Arrays.asList(pkIdArray)).eq(BatteryStation::getStatus, 1).eq(BatteryStation::getDelFlag, 0).select(BatteryStation::getPkId, BatteryStation::getCode)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -5,9 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.dao.CompanyDao;
|
||||
import com.evotech.hd.cloud.service.CompanyService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -27,68 +26,68 @@ public class CompanyServiceImpl implements CompanyService {
|
||||
private CompanyDao companyDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(Company company) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(Company company) {
|
||||
company.setCtime(new Date());
|
||||
int n = companyDao.insert(company);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加公司出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加公司出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
Company company = new Company();
|
||||
company.setPkId(id);
|
||||
company.setDelFlag(1);
|
||||
int n = companyDao.updateById(company);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除公司出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("删除公司出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(Company company) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(Company company) {
|
||||
int n = companyDao.updateById(company);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新公司失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("更新公司失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Company>> list(BasePageRequest bpr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<Company>> list(BasePageRequest bpr) {
|
||||
Page<Company> page = new Page<Company>(bpr.getPageNo(), bpr.getPageSize());
|
||||
page = companyDao.selectPage(page, new QueryWrapper<Company>().eq("del_flag", 0));
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<Company>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<Company>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<Company>>().success(page);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<Company>>().success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> companyByCode(String ccode) {
|
||||
Company one = companyDao.selectOne(new QueryWrapper<Company>().eq("ccode", ccode));
|
||||
if (one == null) {
|
||||
return new Result<Map<String, String>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<Map<String, String>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
m.put("ccode", one.getCcode());
|
||||
m.put("cname", one.getCname());
|
||||
m.put("address", one.getAddress());
|
||||
m.put("phone", one.getPhone());
|
||||
return new Result<Map<String, String>>().success(m);
|
||||
return new com.evotech.hd.common.core.entity.Result<Map<String, String>>().success(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<Company> loginOne(String code) {
|
||||
return new BaseResponse<Company>().success(companyDao.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getCcode, code)));
|
||||
public Result<Company> loginOne(String code) {
|
||||
return new Result<Company>().success(companyDao.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getCcode, code)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<Company>> resourceList() {
|
||||
return new BaseResponse<List<Company>>().success(companyDao.selectList(new LambdaQueryWrapper<Company>().select(Company::getCcode, Company::getCname)));
|
||||
public Result<List<Company>> resourceList() {
|
||||
return new Result<List<Company>>().success(companyDao.selectList(new LambdaQueryWrapper<Company>().select(Company::getCcode, Company::getCname)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
import com.evotech.hd.cloud.service.DHDeviceService;
|
||||
import com.evotech.hd.cloud.service.rpc.ResourceService;
|
||||
import com.evotech.hd.common.core.Dto.DeviceDto;
|
||||
import com.evotech.hd.common.core.Dto.ResponseUtil;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
@ -47,7 +47,7 @@ public class DHDeviceServiceImpl implements DHDeviceService {
|
||||
@Override
|
||||
public Result<List<DeviceDto>> findList() {
|
||||
List<DeviceDto> result = new ArrayList<>();
|
||||
List<ProxyOperater> proxyResult = ResponseUtil.getValue(resourceService.deviceList());
|
||||
List<ProxyOperater> proxyResult = ResultUtil.getValue(resourceService.deviceList());
|
||||
if(Collections.isNotEmpty(proxyResult)){
|
||||
proxyResult.forEach(proxy ->{
|
||||
result.add(new DeviceDto(proxy.getPocode(),"0", proxy.getPoname(),"","", buildStation(proxy.getPocode())));
|
||||
|
||||
@ -2,28 +2,39 @@ package com.evotech.hd.cloud.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evotech.hd.cloud.dao.*;
|
||||
import com.evotech.hd.cloud.entity.HomeStationOrderData;
|
||||
import com.evotech.hd.cloud.entity.request.HomeDataRequest;
|
||||
import com.evotech.hd.cloud.entity.vo.*;
|
||||
import com.evotech.hd.cloud.service.HomeService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.request.HomeRequestDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryAmountDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryHalfYearAmountDto;
|
||||
import com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryProportionDto;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.dao.cloud.HomeDataOrderSwapCollateDao;
|
||||
import com.evotech.hd.common.core.dao.cloud.HomeDataTradeCollateDao;
|
||||
import com.evotech.hd.common.core.dao.cloud.OrderSwapBatteryDao;
|
||||
import com.evotech.hd.common.core.dao.resource.ProxyOperaterDao;
|
||||
import com.evotech.hd.common.core.dao.wechat.WechatUserDao;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.*;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import com.evotech.hd.common.core.enums.PayTypeEnums;
|
||||
import com.evotech.hd.common.core.enums.TradeTypeEnums;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.permission.util.RedisPermissionUtils;
|
||||
import com.evotech.hd.common.redis.utils.RedisUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -46,43 +57,44 @@ public class HomeServiceImpl implements HomeService {
|
||||
private WechatUserDao wechatUserDao;
|
||||
@Resource
|
||||
private VehicleInfoDao vehicleInfoDao;
|
||||
// @Resource
|
||||
// private OrderSwapBatteryDao orderSwapBatteryDao;
|
||||
@Resource
|
||||
private OrderSwapBatteryDao orderSwapBatteryDao;
|
||||
// @Resource
|
||||
// private TradeDetailDao tradeDetailDao;
|
||||
@Resource
|
||||
private HomeDataOrderSwapCollateDao homeDataOrderSwapCollateDao;
|
||||
@Resource
|
||||
private HomeDataTradeCollateDao homeDataTradeCollateDao;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public Result<HomeData1> homeData1(HomeDataRequest hd) {
|
||||
// 1. 运营商
|
||||
List<ProxyOperater> list1 = proxyOperaterDao.selectList(new QueryWrapper<ProxyOperater>()
|
||||
.eq(StringUtils.hasText(hd.getPoCode()), "pocode", hd.getPoCode()));
|
||||
List<ProxyOperater> list1 = proxyOperaterDao.selectList(new LambdaQueryWrapper<ProxyOperater>()
|
||||
.eq(StringUtils.hasText(hd.getPoCode()), ProxyOperater::getPocode, hd.getPoCode()));
|
||||
HomeData1 data = new HomeData1();
|
||||
data.setProxyer(list1.size());
|
||||
// 2. 换电站
|
||||
List<BatteryStation> list2 = batteryStationDao.selectList(new QueryWrapper<BatteryStation>()
|
||||
.eq("del_flag", 0)
|
||||
.eq(StringUtils.hasText(hd.getPoCode()), "proxy_id", hd.getPoCode())
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), "code", hd.getStationCode()));
|
||||
List<BatteryStation> list2 = batteryStationDao.selectList(new LambdaQueryWrapper<BatteryStation>()
|
||||
.eq(BatteryStation::getDelFlag, 0)
|
||||
.eq(StringUtils.hasText(hd.getPoCode()), BatteryStation::getProxyId, hd.getPoCode())
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), BatteryStation::getCode, hd.getStationCode()).select(BatteryStation::getStatus));
|
||||
data.setTotalStation(list2.size());
|
||||
int size1 = list2.stream().filter(i -> i.getStatus() == 1).toList().size();
|
||||
data.setWorkStation(size1);
|
||||
// 电池
|
||||
List<BatteryStationDc> list3 = batteryStationDcDao.selectList(new QueryWrapper<BatteryStationDc>()
|
||||
.eq("del_flag", 0)
|
||||
.eq(StringUtils.hasText(hd.getPoCode()), "proxy_id", hd.getPoCode())
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), "station_code", hd.getStationCode()));
|
||||
List<BatteryStationDc> list3 = batteryStationDcDao.selectList(new LambdaQueryWrapper<BatteryStationDc>()
|
||||
.eq(BatteryStationDc::getDelFlag, 0)
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), BatteryStationDc::getSourceCode, hd.getStationCode()).select(BatteryStationDc::getStatus));
|
||||
data.setTotalDC(list3.size());
|
||||
int dcSize1 = list3.stream().filter(i -> i.getStatus() == 2).toList().size();
|
||||
data.setChargeDC(dcSize1);
|
||||
int dcSize2 = list3.stream().filter(i -> i.getStatus() == 3).toList().size();
|
||||
data.setAvailableDC(dcSize2);
|
||||
// 机器人
|
||||
List<BatteryStationRobot> list4 = batteryStationRobotDao.selectList(new QueryWrapper<BatteryStationRobot>()
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), "station_code", hd.getStationCode()));
|
||||
List<BatteryStationRobot> list4 = batteryStationRobotDao.selectList(new LambdaQueryWrapper<BatteryStationRobot>()
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), BatteryStationRobot::getStationCode, hd.getStationCode()).select(BatteryStationRobot::getStatus));
|
||||
data.setTotalRobot(list4.size());
|
||||
int robotSize1 = list4.stream().filter(i -> i.getStatus() == 1).toList().size();
|
||||
data.setAvailableRobot(robotSize1);
|
||||
@ -94,13 +106,13 @@ public class HomeServiceImpl implements HomeService {
|
||||
public Result<HomeData2> homeData2() {
|
||||
HomeData2 data = new HomeData2();
|
||||
// 1. 公司
|
||||
Long count1 = companyDao.selectCount(new QueryWrapper<Company>());
|
||||
Long count1 = companyDao.selectCount(new LambdaQueryWrapper<Company>().select(Company::getPkId));
|
||||
data.setConpany(count1.intValue());
|
||||
// 2. 用户
|
||||
Long count2 = wechatUserDao.selectCount(new QueryWrapper<WechatUser>());
|
||||
Long count2 = wechatUserDao.selectCount(new LambdaQueryWrapper<WechatUser>().select(WechatUser::getPkId));
|
||||
data.setTotalUser(count2.intValue());
|
||||
// 3. 车辆
|
||||
Long count3 = vehicleInfoDao.selectCount(new QueryWrapper<VehicleInfo>());
|
||||
Long count3 = vehicleInfoDao.selectCount(new LambdaQueryWrapper<VehicleInfo>().select(VehicleInfo::getPkId));
|
||||
data.setTotalCar(count3.intValue());
|
||||
|
||||
return new Result<HomeData2>().success(data);
|
||||
@ -109,160 +121,102 @@ public class HomeServiceImpl implements HomeService {
|
||||
@Override
|
||||
public Result<HomeData3> homeData3(HomeDataRequest hd) {
|
||||
if (hd.getTimeBegin() == null || hd.getTimeEnd() == null) {
|
||||
return new Result<HomeData3>().error("时间范围未填写!");
|
||||
return new Result<HomeData3>().error(CodeMsg.PARAM_ERROR,"时间范围未填写!");
|
||||
}
|
||||
HomeData3 data = new HomeData3();
|
||||
data.setDayBegin(DateUtil.format(hd.getTimeBegin(), DatePattern.PURE_DATE_PATTERN));
|
||||
data.setDayEnd(DateUtil.format(hd.getTimeEnd(), DatePattern.PURE_DATE_PATTERN));
|
||||
List<HomeDataOrderSwapCollate> collateList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
.ge("day", data.getDayBegin())
|
||||
.le("day", data.getDayEnd()));
|
||||
Integer total = collateList.stream().collect(Collectors.summingInt(i -> i.getQuantity()));
|
||||
data.setQuantity(total);
|
||||
Integer todo = collateList.stream().filter(i -> i.getStatus() == 1).collect(Collectors.summingInt(i -> i.getQuantity()));
|
||||
data.setToDoQuantity(todo);
|
||||
Integer finish = collateList.stream().filter(i -> i.getStatus() == 2).collect(Collectors.summingInt(i -> i.getQuantity()));
|
||||
data.setFinishedQuantity(finish);
|
||||
Integer cancle = collateList.stream().filter(i -> i.getStatus() == 3).collect(Collectors.summingInt(i -> i.getQuantity()));
|
||||
data.setCancleQuantity(cancle);
|
||||
|
||||
Map<String, Integer> map = collateList.stream()
|
||||
.collect(Collectors.groupingBy(HomeDataOrderSwapCollate::getStationCode,
|
||||
Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
List<BatteryStation> stationList = batteryStationDao.selectList(new QueryWrapper<BatteryStation>());
|
||||
List<HomeStationOrderData> stationOrderDataList = new ArrayList<HomeStationOrderData>();
|
||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
HomeStationOrderData stationOrderData = new HomeStationOrderData();
|
||||
String stationCode = entry.getKey();
|
||||
String name = stationList.stream().filter(i -> stationCode.equals(i.getCode())).findFirst().get().getName();
|
||||
stationOrderData.setStationCode(stationCode);
|
||||
stationOrderData.setStationName(name);
|
||||
stationOrderData.setQuantity(entry.getValue());
|
||||
stationOrderDataList.add(stationOrderData);
|
||||
data.setDayEnd(DateUtil.format(hd.getTimeEnd(), DatePattern.PURE_DATE_PATTERN));
|
||||
|
||||
List<HomeOrderSwapBatteryProportionDto> list = orderSwapBatteryDao.homeFindProportionData(new HomeRequestDto(hd.getTimeBegin(), hd.getTimeEnd()));
|
||||
if(Collections.isNotEmpty(list)){
|
||||
Long total = list.stream().collect(Collectors.summingLong(i -> i.getQuantity()));
|
||||
data.setQuantity(total);
|
||||
}
|
||||
|
||||
data.setStationOrderDataList(stationOrderDataList);;
|
||||
data.setStationOrderDataList(list);;
|
||||
return new Result<HomeData3>().success(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<HomeData4> homeData4(HomeDataRequest hd) {
|
||||
if (hd.getTimeBegin() == null || hd.getTimeEnd() == null) {
|
||||
return new Result<HomeData4>().error("时间范围未填写!");
|
||||
return new Result<HomeData4>().error(CodeMsg.PARAM_ERROR,"时间范围未填写!");
|
||||
}
|
||||
HomeData4 data = new HomeData4();
|
||||
data.setDayBegin(DateUtil.format(hd.getTimeBegin(), DatePattern.PURE_DATE_PATTERN));
|
||||
data.setDayEnd(DateUtil.format(hd.getTimeEnd(), DatePattern.PURE_DATE_PATTERN));
|
||||
// 交易
|
||||
/***
|
||||
* @TODO: 待定
|
||||
*/
|
||||
List<HomeDataTradeCollate> collateList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", data.getDayBegin())
|
||||
.le("day", data.getDayEnd()));
|
||||
Integer quantity = collateList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getQuantity));
|
||||
data.setQuantity(quantity);
|
||||
Integer chargeTradeQuantity = collateList.stream().filter(i -> i.getTradeType() == 1).collect(Collectors.summingInt(HomeDataTradeCollate::getQuantity));
|
||||
data.setChargeTradeQuantity(chargeTradeQuantity);
|
||||
Integer orderTradeQuantity = collateList.stream().filter(i -> i.getTradeType() == 2).collect(Collectors.summingInt(HomeDataTradeCollate::getQuantity));
|
||||
data.setOrderTradeQuantity(orderTradeQuantity);
|
||||
Integer refundTradeQuantity = collateList.stream().filter(i -> i.getTradeType() == 3).collect(Collectors.summingInt(HomeDataTradeCollate::getQuantity));
|
||||
data.setRefundTradeQuantity(refundTradeQuantity);
|
||||
|
||||
Double chargeAmount = collateList.stream().filter(i -> i.getTradeType() == 1).collect(Collectors.summingDouble(HomeDataTradeCollate::getTradeAmount));
|
||||
Double orderAmount = collateList.stream().filter(i -> i.getTradeType() == 2 && i.getPayType() != 1).collect(Collectors.summingDouble(HomeDataTradeCollate::getTradeAmount));
|
||||
data.setTotalMoney(chargeAmount + orderAmount);
|
||||
|
||||
Double refundSum = collateList.stream().filter(i -> i.getTradeType() == 9).collect(Collectors.summingDouble(HomeDataTradeCollate::getTradeAmount));
|
||||
data.setTotalRefund(refundSum);
|
||||
|
||||
List<HomeOrderSwapBatteryAmountDto> list = orderSwapBatteryDao.homeFindAmountData(new HomeRequestDto(hd.getTimeBegin(), hd.getTimeEnd()));
|
||||
if(Collections.isNotEmpty(list)){
|
||||
data.setTotalMoney(list.stream().filter(i -> Integer.valueOf(7).equals(i.getStatus())).collect(Collectors.summingDouble(i -> i.getAmount())));
|
||||
data.setTotalRefund(list.stream().filter(i -> Integer.valueOf(-1).equals(i.getStatus())).collect(Collectors.summingDouble(i -> i.getAmount())));
|
||||
}
|
||||
return new Result<HomeData4>().success(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<HomeData5>> homeData5(HomeDataRequest hd) {
|
||||
List<HomeData5> list = new ArrayList<HomeData5>();
|
||||
// 1. 找出6个月
|
||||
String[] monthArr = new String[7];
|
||||
Integer id = RedisPermissionUtils.getUserPkId();
|
||||
String key = HDConstant.LOGIN_CACHE_KEY_PREFIX + HDConstant.IndexConstant.HOME_DATA_5+":"+id;
|
||||
List<HomeData5> list = Collections.emptyList();
|
||||
if(!redisUtil.hasKey(key)){
|
||||
Date d = new Date();
|
||||
list = orderSwapBatteryDao.homeFindHalfYearOrderData(new HomeRequestDto(DateUtil.offsetMonth(d, -6), d)).stream().map(data->{
|
||||
HomeData5 homeData5 = new HomeData5();
|
||||
BeanUtils.copyProperties(data, homeData5);
|
||||
homeData5.setTotalMoney(new BigDecimal(data.getTotalMoney()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
return homeData5;
|
||||
}).sorted((o1,o2) ->{
|
||||
return o1.getMonth().compareTo(o2.getMonth());
|
||||
}).collect(Collectors.toList());
|
||||
redisUtil.set(key, JSONUtil.toJsonStr(list));
|
||||
}else{
|
||||
list = JSONUtil.toList(redisUtil.getStringValue(key), HomeData5.class);
|
||||
}
|
||||
// 1. 找出6个月\
|
||||
Date d = new Date();
|
||||
monthArr[0] = DateUtil.format(d, DatePattern.SIMPLE_MONTH_FORMATTER);
|
||||
for (int i = 1; i < monthArr.length; i++) {
|
||||
monthArr[i] = DateUtil.format(DateUtil.offsetMonth(d, -i), DatePattern.SIMPLE_MONTH_FORMATTER);
|
||||
}
|
||||
|
||||
String beginDay = DateUtil.format(DateUtil.beginOfMonth(DateUtil.offsetMonth(d, -6)), DatePattern.PURE_DATE_FORMAT);
|
||||
List<HomeDataOrderSwapCollate> collateList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
.eq(StringUtils.hasText(hd.getStationCode()), "station_code", hd.getStationCode())
|
||||
.ge("day", beginDay));
|
||||
|
||||
Map<String, Integer> map1 = collateList.stream()
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
|
||||
System.out.println(map1);
|
||||
|
||||
// 订单对应的钱,先不要了
|
||||
// Map<String, Integer> map2 = orderList.parallelStream().filter(i -> i.getDelFlag() == 0 && i.getStatus() <= 7).filter(i -> i.getAmount() != null)
|
||||
// .collect(Collectors.groupingBy(i -> DateUtil.format(i.getOrderTime(), DatePattern.SIMPLE_MONTH_FORMATTER),
|
||||
// Collectors.reducing(0, OrderSwapBattery::getAmount, Integer::sum)
|
||||
// ));
|
||||
|
||||
for (int i = 0; i < monthArr.length; i++) {
|
||||
HomeData5 data = new HomeData5();
|
||||
data.setMonth(monthArr[i]);
|
||||
data.setQuantity(map1.get(monthArr[i]) == null ? 0 : map1.get(monthArr[i]));
|
||||
list.add(data);
|
||||
}
|
||||
list = list.stream().sorted((i1, i2) -> i1.getMonth().compareTo(i2.getMonth())).toList();
|
||||
|
||||
return new Result<List<HomeData5>>().success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<HomeData6>> homeData6(HomeDataRequest hd) {
|
||||
List<HomeData6> list = new ArrayList<HomeData6>();
|
||||
// 1. 找出6个月
|
||||
String[] monthArr = new String[7];
|
||||
Date d = new Date();
|
||||
monthArr[0] = DateUtil.format(d, DatePattern.SIMPLE_MONTH_FORMATTER);
|
||||
for (int i = 1; i < monthArr.length; i++) {
|
||||
monthArr[i] = DateUtil.format(DateUtil.offsetMonth(d, -i), DatePattern.SIMPLE_MONTH_FORMATTER);
|
||||
}
|
||||
|
||||
String beginDay = DateUtil.format(DateUtil.beginOfMonth(DateUtil.offsetMonth(d, -6)), DatePattern.PURE_DATE_FORMAT);
|
||||
List<HomeDataTradeCollate> collateList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", beginDay));
|
||||
// 余额支付
|
||||
Map<String, Integer> map0 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.PAYORDER.getCode() && i.getPayType() == PayTypeEnums.WALLET.getCode())
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
Map<String, Integer> map01 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.PAYORDER.getCode() && i.getPayType() == PayTypeEnums.WALLET.getCode())
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getQuantity)));
|
||||
Integer id = RedisPermissionUtils.getUserPkId();
|
||||
String key = HDConstant.LOGIN_CACHE_KEY_PREFIX + HDConstant.IndexConstant.HOME_DATA_6+":"+id;
|
||||
List<HomeData6> list = Collections.emptyList();
|
||||
if(!redisUtil.hasKey(key)){
|
||||
Date d = new Date();
|
||||
Map<String, List<HomeOrderSwapBatteryHalfYearAmountDto>> mapList= orderSwapBatteryDao.homeFindHalfYearAmountData(new HomeRequestDto(DateUtil.offsetMonth(d, -6), d)).stream().collect(Collectors.groupingBy(HomeOrderSwapBatteryHalfYearAmountDto::getMonth));
|
||||
Iterator<String> it = mapList.keySet().iterator();
|
||||
while (it.hasNext()){
|
||||
String month = it.next();
|
||||
HomeData6 homeData6 = new HomeData6();
|
||||
homeData6.setMonth(month);
|
||||
List<HomeOrderSwapBatteryHalfYearAmountDto> values = mapList.get(month);
|
||||
HomeOrderSwapBatteryHalfYearAmountDto wechat = values.stream().filter(f -> Integer.valueOf(7).equals(f.getStatus()) && Integer.valueOf(2).equals(f.getPayType())).findFirst().orElse(null);
|
||||
if(ObjectUtils.isNotEmpty(wechat)){
|
||||
homeData6.setInQuantity(wechat.getQuantity());
|
||||
homeData6.setInMoney(wechat.getTotalMoney());
|
||||
}
|
||||
|
||||
// 收入
|
||||
Map<String, Integer> map1 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.RECHARGE.getCode() ||
|
||||
(i.getTradeType() == TradeTypeEnums.PAYORDER.getCode() && i.getPayType() != PayTypeEnums.WALLET.getCode()))
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
Map<String, Integer> map11 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.RECHARGE.getCode() ||
|
||||
(i.getTradeType() == TradeTypeEnums.PAYORDER.getCode() && i.getPayType() != PayTypeEnums.WALLET.getCode()))
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getQuantity)));
|
||||
// 退款
|
||||
Map<String, Integer> map2 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.REFUND.getCode())
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
Map<String, Integer> map21 = collateList.stream().filter(i -> i.getTradeType() == TradeTypeEnums.REFUND.getCode())
|
||||
.collect(Collectors.groupingBy(i -> i.getDay().substring(0, 6), Collectors.summingInt(HomeDataTradeCollate::getQuantity)));
|
||||
for (int i = 0; i < monthArr.length; i++) {
|
||||
HomeData6 data = new HomeData6();
|
||||
data.setMonth(monthArr[i]);
|
||||
data.setWalletMoney(map0.get(monthArr[i]) == null ? 0 : map0.get(monthArr[i]));
|
||||
data.setWalletQuantity(map01.get(monthArr[i]) == null ? 0 : map01.get(monthArr[i]));
|
||||
data.setInMoney(map1.get(monthArr[i]) == null ? 0 : map1.get(monthArr[i]));
|
||||
data.setInQuantity(map11.get(monthArr[i]) == null ? 0 : map11.get(monthArr[i]));
|
||||
data.setRefundMoney(map2.get(monthArr[i]) == null ? 0 : map2.get(monthArr[i]));
|
||||
data.setRefundQuantity(map21.get(monthArr[i]) == null ? 0 : map21.get(monthArr[i]));
|
||||
|
||||
list.add(data);
|
||||
HomeOrderSwapBatteryHalfYearAmountDto account = values.stream().filter(f -> Integer.valueOf(7).equals(f.getStatus()) && Integer.valueOf(1).equals(f.getPayType())).findFirst().orElse(null);
|
||||
if(ObjectUtils.isNotEmpty(account)){
|
||||
homeData6.setWalletQuantity(account.getQuantity());
|
||||
homeData6.setWalletMoney(account.getTotalMoney());
|
||||
}
|
||||
|
||||
List<HomeOrderSwapBatteryHalfYearAmountDto> refund = values.stream().filter(f -> Integer.valueOf(-1).equals(f.getStatus())).collect(Collectors.toList());
|
||||
if(Collections.isNotEmpty(refund)){
|
||||
homeData6.setRefundQuantity(refund.stream().collect(Collectors.summingLong(i -> i.getQuantity())));
|
||||
homeData6.setRefundMoney(refund.stream().collect(Collectors.summingDouble(i -> i.getTotalMoney())));
|
||||
}
|
||||
list.add(homeData6);
|
||||
}
|
||||
list = list.stream().sorted((o1,o2) ->{
|
||||
return o1.getMonth().compareTo(o2.getMonth());
|
||||
}).collect(Collectors.toList());
|
||||
redisUtil.set(key, JSONUtil.toJsonStr(list));
|
||||
}else{
|
||||
list = JSONUtil.toList(redisUtil.getStringValue(key), HomeData6.class);
|
||||
}
|
||||
|
||||
list = list.stream().sorted((i1, i2) -> i1.getMonth().compareTo(i2.getMonth())).toList();
|
||||
return new Result<List<HomeData6>>().success(list);
|
||||
}
|
||||
|
||||
@ -271,85 +225,27 @@ public class HomeServiceImpl implements HomeService {
|
||||
HomeData7 data = new HomeData7();
|
||||
Date d = new Date();
|
||||
// 按月
|
||||
if (type == 1) {
|
||||
Date beginOfMonth = DateUtil.beginOfMonth(d);
|
||||
Date lastBeginOfMonth = DateUtil.offsetMonth(beginOfMonth, -1);
|
||||
Date last2BeginOfMonth = DateUtil.offsetMonth(lastBeginOfMonth, -1);
|
||||
String beginDayOfMonth = DateUtil.format(beginOfMonth, DatePattern.PURE_DATE_FORMATTER);
|
||||
String lastBeginDayOfMonth = DateUtil.format(lastBeginOfMonth, DatePattern.PURE_DATE_FORMATTER);
|
||||
String last2BeginDayOfMonth = DateUtil.format(last2BeginOfMonth, DatePattern.PURE_DATE_FORMATTER);
|
||||
data.setMonth(lastBeginDayOfMonth.substring(0, 6));
|
||||
// 订单
|
||||
List<HomeDataOrderSwapCollate> monthList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", lastBeginDayOfMonth)
|
||||
.lt("day", beginDayOfMonth));
|
||||
data.setQuantity(monthList.isEmpty()?0:monthList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
List<HomeDataOrderSwapCollate> lastMonthList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", last2BeginDayOfMonth)
|
||||
.lt("day", lastBeginDayOfMonth));
|
||||
data.setLastMonthQuantity(lastMonthList.isEmpty()?0:lastMonthList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
List<HomeDataOrderSwapCollate> lastYearList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", DateUtil.format(DateUtil.offsetYear(lastBeginOfMonth, -1), DatePattern.PURE_DATE_FORMATTER))
|
||||
.lt("day", DateUtil.format(DateUtil.offsetYear(beginOfMonth, -1), DatePattern.PURE_DATE_FORMATTER)));
|
||||
data.setLastYearQuantity(lastYearList.isEmpty()?0:lastYearList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
// 交易
|
||||
List<HomeDataTradeCollate> tradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", lastBeginDayOfMonth)
|
||||
.lt("day", beginDayOfMonth));
|
||||
data.setTradeAmount(tradeList.isEmpty()?0:tradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
List<HomeDataTradeCollate> lastMonthTradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", last2BeginDayOfMonth)
|
||||
.lt("day", lastBeginDayOfMonth));
|
||||
data.setLastMonthTradeAmount(lastMonthTradeList.isEmpty()?0:lastMonthTradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
List<HomeDataTradeCollate> lastYearTradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", DateUtil.format(DateUtil.offsetYear(lastBeginOfMonth, -1), DatePattern.PURE_DATE_FORMATTER))
|
||||
.lt("day", DateUtil.format(DateUtil.offsetYear(beginOfMonth, -1), DatePattern.PURE_DATE_FORMATTER)));
|
||||
data.setLastYearTradeAmount(lastYearTradeList.isEmpty()?0:lastYearTradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
|
||||
return new Result<HomeData7>().success(data);
|
||||
}
|
||||
// 按年
|
||||
Date beginOfYear = DateUtil.beginOfYear(d);
|
||||
Date lastBeginOfYear = DateUtil.offsetYear(beginOfYear, -1);
|
||||
Date last2BeginOfYear = DateUtil.offsetYear(lastBeginOfYear, -1);
|
||||
String beginDayOfYear = DateUtil.format(beginOfYear, DatePattern.PURE_DATE_FORMATTER);
|
||||
String lastBeginDayOfYear = DateUtil.format(lastBeginOfYear, DatePattern.PURE_DATE_FORMATTER);
|
||||
String last2BeginDayOfYear = DateUtil.format(last2BeginOfYear, DatePattern.PURE_DATE_FORMATTER);
|
||||
// 订单
|
||||
List<HomeDataOrderSwapCollate> yearList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", beginDayOfYear)
|
||||
.lt("day", DateUtil.format(d, DatePattern.PURE_DATE_FORMATTER)));
|
||||
data.setQuantity(yearList.isEmpty()?0:yearList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
List<HomeDataOrderSwapCollate> lastYearList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", lastBeginDayOfYear)
|
||||
.lt("day", beginDayOfYear));
|
||||
data.setLastYearQuantity(lastYearList.isEmpty()?0:lastYearList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
List<HomeDataOrderSwapCollate> last2YearList = homeDataOrderSwapCollateDao.selectList(new QueryWrapper<HomeDataOrderSwapCollate>()
|
||||
// .ne("status", OrderStatusEnums.CANCLE.getCode())
|
||||
.ge("day", last2BeginDayOfYear)
|
||||
.lt("day", lastBeginDayOfYear));
|
||||
data.setLast2YearQuantity(last2YearList.isEmpty()?0:last2YearList.stream().collect(Collectors.summingInt(HomeDataOrderSwapCollate::getQuantity)));
|
||||
|
||||
// 交易
|
||||
List<HomeDataTradeCollate> tradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", beginDayOfYear)
|
||||
.lt("day", DateUtil.format(d, DatePattern.PURE_DATE_FORMATTER)));
|
||||
data.setTradeAmount(tradeList.isEmpty()?0:tradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
List<HomeDataTradeCollate> lastYearTradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", lastBeginDayOfYear)
|
||||
.lt("day", beginDayOfYear));
|
||||
data.setLastYearTradeAmount(lastYearTradeList.isEmpty()?0:lastYearTradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
List<HomeDataTradeCollate> last2YearTradeList = homeDataTradeCollateDao.selectList(new QueryWrapper<HomeDataTradeCollate>()
|
||||
.ge("day", last2BeginDayOfYear)
|
||||
.lt("day", lastBeginDayOfYear));
|
||||
data.setLast2YearTradeAmount(last2YearTradeList.isEmpty()?0:last2YearTradeList.stream().collect(Collectors.summingInt(HomeDataTradeCollate::getTradeAmount)));
|
||||
|
||||
Date month = DateUtil.beginOfMonth(d);
|
||||
Date beforeMonth = DateUtil.offsetMonth(month, -1);
|
||||
Date beforeYearMonth = DateUtil.offsetYear(d, -1);
|
||||
data.setMonth(DateUtil.format(month, "yyyy-MM"));
|
||||
//订单数量
|
||||
data.setQuantity(orderSwapBatteryDao.homeFindOrderCountData(month));
|
||||
data.setTradeAmount(orderSwapBatteryDao.homeFindOrderAmountData(month));
|
||||
//环比
|
||||
data.setLastMonthQuantity(orderSwapBatteryDao.homeFindOrderCountData(beforeMonth));
|
||||
data.setLastMonthTradeAmount(orderSwapBatteryDao.homeFindOrderAmountData(beforeMonth));
|
||||
//同比
|
||||
data.setLastYearQuantity(orderSwapBatteryDao.homeFindOrderCountData(beforeYearMonth));
|
||||
data.setLastYearTradeAmount(orderSwapBatteryDao.homeFindOrderAmountData(beforeYearMonth));
|
||||
return new Result<HomeData7>().success(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginData() {
|
||||
HomeDataRequest hd = new HomeDataRequest();
|
||||
homeData5(hd);
|
||||
homeData6(hd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ import com.evotech.hd.cloud.entity.request.IndependentAccountRequest;
|
||||
import com.evotech.hd.cloud.service.IndependentAccountDetailService;
|
||||
import com.evotech.hd.cloud.service.IndependentAccountService;
|
||||
import com.evotech.hd.cloud.service.rpc.ResourceService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.ResponseUtil;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.IndependentAccount;
|
||||
import com.evotech.hd.common.core.entity.cloud.TaxPoint;
|
||||
@ -57,7 +57,7 @@ public class IndependentAccountServiceImpl implements IndependentAccountService
|
||||
log.error("未找到对应的站点信息. 站点code{}", stationCode);
|
||||
return;
|
||||
}
|
||||
ProxyOperater proxyOperater = ResponseUtil.getValue(resourceService.basicInfo(batteryStation.getProxyId()));
|
||||
ProxyOperater proxyOperater = ResultUtil.getValue(resourceService.basicInfo(batteryStation.getProxyId()));
|
||||
if(ObjectUtils.isEmpty(proxyOperater)){
|
||||
log.error("未找到对应的运营商信息. 站点code{}", stationCode);
|
||||
return;
|
||||
@ -96,16 +96,16 @@ public class IndependentAccountServiceImpl implements IndependentAccountService
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<Map<String, Object>> pageList(IndependentAccountRequest params) {
|
||||
public Result<Map<String, Object>> pageList(IndependentAccountRequest params) {
|
||||
Page<IndependentAccount> page = new Page<IndependentAccount>(params.getPageNo(), params.getPageSize());
|
||||
List<IndependentAccount> list = independentAccountDao.pageList(page, params);
|
||||
if (list.isEmpty()) {
|
||||
return new BaseResponse<Map<String, Object>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new Result<Map<String, Object>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
IndependentAccount totalAmount = independentAccountDao.countAmount(params);
|
||||
|
||||
return new BaseResponse<Map<String, Object>>().success(Collections.asMap("pageList", page.setRecords(list), "totalAmount", totalAmount));
|
||||
return new Result<Map<String, Object>>().success(Collections.asMap("pageList", page.setRecords(list), "totalAmount", totalAmount));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,8 +7,7 @@ import com.evotech.hd.cloud.dao.VehicleInfoDao;
|
||||
import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
||||
import com.evotech.hd.cloud.entity.request.PageListVehicleRequest;
|
||||
import com.evotech.hd.cloud.service.VehicleService;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleWechatUserRelation;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
@ -29,38 +28,38 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
private VehicleWechatUserRelationDao vehicleWechatUserRelationDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(VehicleInfo vi) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(VehicleInfo vi) {
|
||||
vi.setCtime(new Date());
|
||||
int n = vehicleInfoDao.insert(vi);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加车辆出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加车辆出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
VehicleInfo vi = new VehicleInfo();
|
||||
vi.setPkId(id);
|
||||
vi.setDelFlag(1);
|
||||
int n = vehicleInfoDao.updateById(vi);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
throw new RuntimeException("删除车辆出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(VehicleInfo vi) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(VehicleInfo vi) {
|
||||
int n = vehicleInfoDao.updateById(vi);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新车辆失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("更新车辆失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<VehicleInfo>> list(PageListVehicleRequest plvr) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> list(PageListVehicleRequest plvr) {
|
||||
Page<VehicleInfo> page = new Page<VehicleInfo>(plvr.getPageNo(), plvr.getPageSize());
|
||||
|
||||
page = vehicleInfoDao.selectPage(page, new QueryWrapper<VehicleInfo>()
|
||||
@ -76,83 +75,83 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
.ne("del_flag", 1)
|
||||
.orderByAsc("plate_num"));
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<VehicleInfo>>().success(page);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleInfo>>().success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
VehicleInfo vi = new VehicleInfo();
|
||||
vi.setCcode(ccode);
|
||||
vi.setCname(cname);
|
||||
vi.setOwnerType(2);
|
||||
int n = vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", plateNum));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("关联公司失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("关联公司失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> delCompanyRelation(String plateNum) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delCompanyRelation(String plateNum) {
|
||||
VehicleInfo vi = new VehicleInfo();
|
||||
vi.setCcode("");
|
||||
vi.setCname("");
|
||||
vi.setOwnerType(1);
|
||||
int n = vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", plateNum));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除关联公司失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("删除关联公司失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation) {
|
||||
relation.setCtime(new Date());
|
||||
int n = vehicleWechatUserRelationDao.insert(relation);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加车辆用户关系出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加车辆用户关系出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||
int n = vehicleWechatUserRelationDao.deleteById(id);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
throw new RuntimeException("删除车辆用户关系出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(String wuid, String plateNum) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> listWechatUserRelation(String wuid, String plateNum) {
|
||||
List<VehicleWechatUserRelation> relationList = vehicleWechatUserRelationDao.selectList(new QueryWrapper<VehicleWechatUserRelation>().eq(StringUtils.hasText(wuid), "ucode", wuid));
|
||||
if (relationList.isEmpty()) {
|
||||
return new Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
List<String> plateNumList = relationList.stream().map(i -> i.getPlateNum()).toList();
|
||||
List<VehicleInfo> list = vehicleInfoDao.selectList(new QueryWrapper<VehicleInfo>().ne("del_flag", 1).in("plate_num", plateNumList));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<VehicleInfo>>().success(list);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleInfo>>().success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<VehicleWechatUserRelation>> listRelationUser(String PlantNo) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>> listRelationUser(String PlantNo) {
|
||||
List<VehicleWechatUserRelation> list = vehicleWechatUserRelationDao.selectList(new QueryWrapper<VehicleWechatUserRelation>().eq("plate_num", PlantNo));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<VehicleWechatUserRelation>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
list.stream().forEach(i -> i.setOpenid(null));
|
||||
return new Result<List<VehicleWechatUserRelation>>().success(list);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>>().success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<VehicleInfo>> loginList(String companyCode) {
|
||||
return new BaseResponse<List<VehicleInfo>>().success(vehicleInfoDao.selectList(new LambdaQueryWrapper<VehicleInfo>().eq(VehicleInfo::getCcode, companyCode).select(VehicleInfo::getPkId, VehicleInfo::getPlateNum)));
|
||||
public Result<List<VehicleInfo>> loginList(String companyCode) {
|
||||
return new Result<List<VehicleInfo>>().success(vehicleInfoDao.selectList(new LambdaQueryWrapper<VehicleInfo>().eq(VehicleInfo::getCcode, companyCode).select(VehicleInfo::getPkId, VehicleInfo::getPlateNum)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.cloud.service.rpc;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.common.core.entity.resource.dict.Dict;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@ -17,13 +16,13 @@ public interface ResourceService {
|
||||
|
||||
@GetMapping(value = "/dict/listdict",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<Dict>> listDict(@RequestParam String typeCode);
|
||||
public com.evotech.hd.common.core.entity.Result<List<Dict>> listDict(@RequestParam String typeCode);
|
||||
|
||||
@GetMapping(value = "/proxyoperater/device/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public BaseResponse<List<ProxyOperater>> deviceList();
|
||||
public Result<List<ProxyOperater>> deviceList();
|
||||
|
||||
@GetMapping(value = "/proxyoperater/basic/info",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public BaseResponse<ProxyOperater> basicInfo(@RequestParam String proxyCode);
|
||||
public Result<ProxyOperater> basicInfo(@RequestParam String proxyCode);
|
||||
}
|
||||
|
||||
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.evotech.hd.common.core.dao.cloud.OrderSwapBatteryDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="homeProportionResultMap" type="com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryProportionDto">
|
||||
<result column="name" property="stationName" />
|
||||
<result column="code" property="stationCode" />
|
||||
<result column="quantity" property="quantity" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="homeAmountResultMap" type="com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryAmountDto">
|
||||
<result column="amount" property="amount" />
|
||||
<result column="status" property="status" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="homeHalfYearResultMap" type="com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryHalfYearDto">
|
||||
<result column="y_m" property="month" />
|
||||
<result column="quantity" property="quantity" />
|
||||
<result column="totalMoney" property="totalMoney" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="homeHalfYearAmountResultMap" type="com.evotech.hd.common.core.Dto.result.home.HomeOrderSwapBatteryHalfYearAmountDto">
|
||||
<result column="y_m" property="month" />
|
||||
<result column="quantity" property="quantity" />
|
||||
<result column="totalMoney" property="totalMoney" />
|
||||
<result column="status" property="status" />
|
||||
<result column="payType" property="payType" />
|
||||
</resultMap>
|
||||
|
||||
<select id="homeFindProportionData" resultMap="homeProportionResultMap">
|
||||
select ifnull(count(osb.pk_id),0) as quantity,
|
||||
bs.code,
|
||||
bs.name
|
||||
from hd_cloud_manage.yt_t_battery_station bs
|
||||
left join hd_cloud_manage.yt_t_order_swap_battery osb on bs.code = osb.station_code
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m-%d") >= DATE_FORMAT(#{params.begin},"%Y-%m-%d")
|
||||
and DATE_FORMAT(#{params.end},"%Y-%m-%d") >= DATE_FORMAT(osb.order_time,"%Y-%m-%d")
|
||||
GROUP by bs.code,bs.name
|
||||
</select>
|
||||
|
||||
<select id="homeFindAmountData" resultMap="homeAmountResultMap">
|
||||
select osb.amount,
|
||||
osb.status
|
||||
from hd_cloud_manage.yt_t_order_swap_battery osb
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m-%d") >= DATE_FORMAT(#{params.begin},"%Y-%m-%d")
|
||||
and DATE_FORMAT(#{params.end},"%Y-%m-%d") >= DATE_FORMAT(osb.order_time,"%Y-%m-%d")
|
||||
and osb.amount is not null
|
||||
</select>
|
||||
|
||||
<select id="homeFindHalfYearOrderData" resultMap="homeHalfYearResultMap">
|
||||
select
|
||||
DATE_FORMAT(osb.order_time,"%Y-%m") as y_m,
|
||||
count(osb.pk_id) as quantity,
|
||||
sum(osb.amount) as totalMoney
|
||||
from hd_cloud_manage.yt_t_order_swap_battery osb
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m-%d") >= DATE_FORMAT(#{params.begin},"%Y-%m-%d")
|
||||
and DATE_FORMAT(#{params.end},"%Y-%m-%d") >= DATE_FORMAT(osb.order_time,"%Y-%m-%d")
|
||||
and osb.amount is not null
|
||||
and osb.status=7
|
||||
GROUP by y_m
|
||||
</select>
|
||||
|
||||
<select id="homeFindHalfYearAmountData" resultMap="homeHalfYearAmountResultMap">
|
||||
select
|
||||
DATE_FORMAT(osb.order_time,"%Y-%m") as y_m,
|
||||
ifnull(count(osb.pk_id), 0) as quantity,
|
||||
sum(ifnull(osb.amount,0)) as totalMoney,
|
||||
osb.status as status,
|
||||
td.pay_type as payType
|
||||
from
|
||||
hd_cloud_manage.yt_t_order_swap_battery osb
|
||||
left join
|
||||
hd_cloud_manage.yt_t_trade_detail td on td.order_no=osb.order_no
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m-%d") >= DATE_FORMAT(#{params.begin},"%Y-%m-%d")
|
||||
and DATE_FORMAT(#{params.end},"%Y-%m-%d") >= DATE_FORMAT(osb.order_time,"%Y-%m-%d")
|
||||
and osb.amount is not null
|
||||
and td.pay_type IS not null
|
||||
and osb.status in (-1,7)
|
||||
GROUP by y_m,osb.status,td.pay_type
|
||||
</select>
|
||||
|
||||
|
||||
<select id="homeFindOrderCountData" resultType="java.lang.Long" >
|
||||
select count(osb.pk_id)
|
||||
from hd_cloud_manage.yt_t_order_swap_battery osb
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m") = DATE_FORMAT(#{date},"%Y-%m")
|
||||
and osb.amount is not null
|
||||
and osb.status=7
|
||||
</select>
|
||||
|
||||
<select id="homeFindOrderAmountData" resultType="java.lang.Double" >
|
||||
select sum(osb.amount)
|
||||
from hd_cloud_manage.yt_t_order_swap_battery osb
|
||||
where DATE_FORMAT(osb.order_time,"%Y-%m") = DATE_FORMAT(#{date},"%Y-%m")
|
||||
and osb.amount is not null
|
||||
and osb.status=7
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -188,7 +188,7 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
|
||||
if (!permList.contains(path) && !notPermissionUrlList.contains(path)) {
|
||||
Boolean notPermission = true;
|
||||
for (String notPermissionUrl : notPermissionUrlList)
|
||||
if(Pattern.compile(notPermissionUrl).matcher("/cloud/test/123/asd").find()){
|
||||
if(Pattern.compile(notPermissionUrl).matcher(path).find()){
|
||||
notPermission = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.resource.controller;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUserRole;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUserStation;
|
||||
@ -32,35 +31,35 @@ public class AuthUserController {
|
||||
|
||||
@GetMapping("/userbyname")
|
||||
@Operation(summary = "登陆用查询接口", hidden = true)
|
||||
public Result<AuthUser> userByName(@RequestParam("uname") String uname) {
|
||||
public com.evotech.hd.common.core.entity.Result<AuthUser> userByName(@RequestParam("uname") String uname) {
|
||||
return authUserService.userByName(uname);
|
||||
}
|
||||
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject AuthUser user) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject AuthUser user) {
|
||||
return authUserService.add(user);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(@NotNull String uid) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(@NotNull String uid) {
|
||||
return authUserService.delete(uid);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject AuthUser u) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject AuthUser u) {
|
||||
return authUserService.update(u);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<AuthUser>> list(@ParameterObject ListUserRequest lur) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<AuthUser>> list(@ParameterObject ListUserRequest lur) {
|
||||
return authUserService.list(lur);
|
||||
}
|
||||
|
||||
@ -68,28 +67,28 @@ public class AuthUserController {
|
||||
@Operation(summary = "用户分配角色")
|
||||
@PostMapping("/adduserrole")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Integer> addUserRole(@Valid @ParameterObject AuthUserRole aur) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserRole(@Valid @ParameterObject AuthUserRole aur) {
|
||||
return authUserService.addUserRole(aur);
|
||||
}
|
||||
|
||||
@Operation(summary = "用户删除角色")
|
||||
@PostMapping("/deluserrole")
|
||||
@ApiOperationSupport(order = 6)
|
||||
public Result<Integer> deleteUserRole(@RequestParam @NotBlank String uid, @RequestParam String rid) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteUserRole(@RequestParam @NotBlank String uid, @RequestParam String rid) {
|
||||
return authUserService.deleteUserRole(uid, rid);
|
||||
}
|
||||
|
||||
@Operation(summary = "用户分配站")
|
||||
@PostMapping("/adduserstation")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Integer> addUserRole(@RequestParam @NotBlank String uid, @RequestParam String stationIds) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserRole(@RequestParam @NotBlank String uid, @RequestParam String stationIds) {
|
||||
return authUserService.addUserStation(stationIds, uid);
|
||||
}
|
||||
|
||||
@Operation(summary = "登录查询站信息")
|
||||
@GetMapping("/station")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public BaseResponse<List<AuthUserStation>> loadUserStation(@RequestParam @NotBlank String uid) {
|
||||
public Result<List<AuthUserStation>> loadUserStation(@RequestParam @NotBlank String uid) {
|
||||
return authUserService.loadUserStation(uid);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.resource.controller;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.resource.entity.request.PageListProxyOperaterRequest;
|
||||
import com.evotech.hd.resource.service.ProxyOperaterService;
|
||||
@ -29,38 +28,38 @@ public class ProxyOperaterController {
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject ProxyOperater po) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject ProxyOperater po) {
|
||||
return proxyOperaterService.add(po);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
return proxyOperaterService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject ProxyOperater po) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject ProxyOperater po) {
|
||||
return proxyOperaterService.update(po);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<ProxyOperater>> list(@ParameterObject PageListProxyOperaterRequest plpor) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<ProxyOperater>> list(@ParameterObject PageListProxyOperaterRequest plpor) {
|
||||
return proxyOperaterService.list(plpor);
|
||||
}
|
||||
|
||||
@GetMapping("/device/list")
|
||||
public BaseResponse<List<ProxyOperater>> deviceList() {
|
||||
public Result<List<ProxyOperater>> deviceList() {
|
||||
return proxyOperaterService.deviceList();
|
||||
}
|
||||
|
||||
@GetMapping("/basic/info")
|
||||
public BaseResponse<ProxyOperater> basicInfo(@RequestParam String proxyCode) {
|
||||
public Result<ProxyOperater> basicInfo(@RequestParam String proxyCode) {
|
||||
return proxyOperaterService.basicInfo(proxyCode);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.resource.service;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUserRole;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUserStation;
|
||||
@ -11,21 +10,21 @@ import java.util.List;
|
||||
|
||||
public interface AuthUserService {
|
||||
|
||||
public Result<AuthUser> userByName(String uname);
|
||||
public com.evotech.hd.common.core.entity.Result<AuthUser> userByName(String uname);
|
||||
|
||||
public Result<Integer> add(AuthUser u);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(AuthUser u);
|
||||
|
||||
public Result<Integer> delete(String uid);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(String uid);
|
||||
|
||||
public Result<Integer> update(AuthUser u);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(AuthUser u);
|
||||
|
||||
public Result<List<AuthUser>> list(ListUserRequest lur);
|
||||
public com.evotech.hd.common.core.entity.Result<List<AuthUser>> list(ListUserRequest lur);
|
||||
|
||||
public Result<Integer> addUserRole(AuthUserRole aur);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserRole(AuthUserRole aur);
|
||||
|
||||
public Result<Integer> deleteUserRole(String uid, String rid);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteUserRole(String uid, String rid);
|
||||
|
||||
public Result<Integer> addUserStation(String stationIds, String uid);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserStation(String stationIds, String uid);
|
||||
|
||||
public BaseResponse<List<AuthUserStation>> loadUserStation(String uid);
|
||||
public Result<List<AuthUserStation>> loadUserStation(String uid);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.resource.service;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.resource.entity.request.PageListProxyOperaterRequest;
|
||||
|
||||
@ -9,15 +8,15 @@ import java.util.List;
|
||||
|
||||
public interface ProxyOperaterService {
|
||||
|
||||
public Result<Integer> add(ProxyOperater po);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(ProxyOperater po);
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(ProxyOperater po);
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(ProxyOperater po);
|
||||
|
||||
public Result<List<ProxyOperater>> list(PageListProxyOperaterRequest plpor);
|
||||
public com.evotech.hd.common.core.entity.Result<List<ProxyOperater>> list(PageListProxyOperaterRequest plpor);
|
||||
|
||||
public BaseResponse<List<ProxyOperater>> deviceList();
|
||||
public Result<List<ProxyOperater>> deviceList();
|
||||
|
||||
BaseResponse<ProxyOperater> basicInfo(String proxyCode);
|
||||
Result<ProxyOperater> basicInfo(String proxyCode);
|
||||
}
|
||||
|
||||
@ -5,13 +5,12 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.ResponseUtil;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.dao.resource.ProxyOperaterDao;
|
||||
import com.evotech.hd.common.core.dao.resource.auth.AuthUserDao;
|
||||
import com.evotech.hd.common.core.dao.resource.auth.AuthUserRoleDao;
|
||||
import com.evotech.hd.common.core.dao.resource.auth.AuthUserStationDao;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
@ -54,22 +53,22 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
|
||||
|
||||
@Override
|
||||
public Result<AuthUser> userByName(String userName) {
|
||||
public com.evotech.hd.common.core.entity.Result<AuthUser> userByName(String userName) {
|
||||
AuthUser user = userDao.selectOne(new QueryWrapper<AuthUser>().eq("uname", userName));
|
||||
if (user == null) {
|
||||
return new Result<AuthUser>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<AuthUser>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
List<AuthUserRole> roleList = authUserRoleDao.selectList(new QueryWrapper<AuthUserRole>().eq("uid", user.getUid()));
|
||||
String rcodes = roleList.stream().map(i -> i.getRcode()).collect(Collectors.joining(","));
|
||||
user.setRcodes(rcodes);
|
||||
return new Result<AuthUser>().success(user);
|
||||
return new com.evotech.hd.common.core.entity.Result<AuthUser>().success(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(AuthUser u) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(AuthUser u) {
|
||||
boolean exists = userDao.exists(new QueryWrapper<AuthUser>().eq("uname", u.getUname()));
|
||||
if (exists) {
|
||||
return new Result<Integer>().error("账号已存在!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("账号已存在!");
|
||||
}
|
||||
u.setUid(SnowflakeUtil.getIdStr());
|
||||
// 密码加密
|
||||
@ -90,36 +89,36 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
|
||||
int n = userDao.insert(u);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加账号出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加账号出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<Integer> delete(String uid) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(String uid) {
|
||||
AuthUser u = new AuthUser();
|
||||
u.setUid(uid);
|
||||
int n = userDao.deleteById(u);
|
||||
if (n == 1) {
|
||||
// 删除账号关联角色信息
|
||||
deleteUserRole(uid, "");
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除账号出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("删除账号出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(AuthUser u) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(AuthUser u) {
|
||||
int n = userDao.updateById(u);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新账号失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("更新账号失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<AuthUser>> list(ListUserRequest lur) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<AuthUser>> list(ListUserRequest lur) {
|
||||
Page<AuthUser> page = new Page<>(lur.getPageNo(), lur.getPageSize());
|
||||
page = userDao.selectPage(page, new QueryWrapper<AuthUser>()
|
||||
.eq(StringUtils.hasText(lur.getUid()), "uid", lur.getUid())
|
||||
@ -129,11 +128,11 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
.eq(StringUtils.hasText(lur.getPhone()), "phone", lur.getPhone())
|
||||
);
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<AuthUser>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<AuthUser>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
Map<String, String> businessNames = proxyOperaterDao.selectList(new LambdaQueryWrapper<ProxyOperater>().select(ProxyOperater::getPocode, ProxyOperater::getPoname)).stream().collect(Collectors.toMap(ProxyOperater::getPocode, ProxyOperater::getPoname, (k1, k2)->k1));
|
||||
List<Company> companyList = ResponseUtil.getValue(cloudService.resourceCompanyList());
|
||||
List<Company> companyList = ResultUtil.getValue(cloudService.resourceCompanyList());
|
||||
if(Collections.isNotEmpty(companyList)){
|
||||
businessNames.putAll(companyList.stream().collect(Collectors.toMap(Company::getCcode, Company::getCname, (k1,k2)->k1)));
|
||||
}
|
||||
@ -146,39 +145,39 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
});
|
||||
|
||||
|
||||
return new Result<List<AuthUser>>().success(page);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<AuthUser>>().success(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<Integer> addUserRole(AuthUserRole aur) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserRole(AuthUserRole aur) {
|
||||
authUserRoleDao.delete(new QueryWrapper<AuthUserRole>()
|
||||
.eq("uid", aur.getUid()));//先删除该用户的所有角色
|
||||
|
||||
boolean exists = authUserRoleDao.exists(new QueryWrapper<AuthUserRole>()
|
||||
.eq("uid", aur.getUid()).eq("rcode", aur.getRcode()));
|
||||
if (exists) {
|
||||
return new Result<Integer>().error("该用户已有此角色");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("该用户已有此角色");
|
||||
}
|
||||
aur.setCtime(new Date());
|
||||
int n = authUserRoleDao.insert(aur);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加用户角色失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加用户角色失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> deleteUserRole(String uid, String rid) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteUserRole(String uid, String rid) {
|
||||
int n = authUserRoleDao.delete(new QueryWrapper<AuthUserRole>()
|
||||
.eq("uid", uid).eq(StringUtils.hasText(rid), "rid", rid));
|
||||
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> addUserStation(String stationIds, String uid) {
|
||||
List<BatteryStation> stationlist = ResponseUtil.getValue(cloudService.resourceList(stationIds));
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> addUserStation(String stationIds, String uid) {
|
||||
List<BatteryStation> stationlist = ResultUtil.getValue(cloudService.resourceList(stationIds));
|
||||
if(Collections.isNotEmpty(stationlist)){
|
||||
if(!CollectionUtils.isEmpty(stationlist)){
|
||||
List<AuthUserStation> list = new ArrayList<AuthUserStation>();
|
||||
@ -190,15 +189,15 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
list.add(u);
|
||||
}
|
||||
authUserStationDao.insert(list);
|
||||
return new Result<Integer>().success(list.size());
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(list.size());
|
||||
}
|
||||
}
|
||||
return new Result<Integer>().error("添加用户站信息失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加用户站信息失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<AuthUserStation>> loadUserStation(String uid) {
|
||||
return new BaseResponse<List<AuthUserStation>>().success(authUserStationDao.selectList(new LambdaQueryWrapper<AuthUserStation>().eq(AuthUserStation::getUid, uid).select(AuthUserStation::getStationId, AuthUserStation::getStationCode)));
|
||||
public Result<List<AuthUserStation>> loadUserStation(String uid) {
|
||||
return new Result<List<AuthUserStation>>().success(authUserStationDao.selectList(new LambdaQueryWrapper<AuthUserStation>().eq(AuthUserStation::getUid, uid).select(AuthUserStation::getStationId, AuthUserStation::getStationCode)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,9 +3,8 @@ package com.evotech.hd.resource.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.dao.resource.ProxyOperaterDao;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.resource.entity.request.PageListProxyOperaterRequest;
|
||||
@ -25,39 +24,39 @@ public class ProxyOperaterServiceImpl implements ProxyOperaterService {
|
||||
private ProxyOperaterDao proxyOperaterDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(ProxyOperater po) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> add(ProxyOperater po) {
|
||||
po.setCtime(new Date());
|
||||
int n = proxyOperaterDao.insert(po);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加运营商出错!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("添加运营商出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<Integer> delete(Integer id) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
||||
ProxyOperater po = new ProxyOperater();
|
||||
po.setPkId(id);
|
||||
po.setDelFlag(1);
|
||||
int n = proxyOperaterDao.updateById(po);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
throw new RuntimeException("删除运营商出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(ProxyOperater po) {
|
||||
public com.evotech.hd.common.core.entity.Result<Integer> update(ProxyOperater po) {
|
||||
int n = proxyOperaterDao.updateById(po);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新运营商失败!");
|
||||
return new com.evotech.hd.common.core.entity.Result<Integer>().error("更新运营商失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<ProxyOperater>> list(PageListProxyOperaterRequest plpor) {
|
||||
public com.evotech.hd.common.core.entity.Result<List<ProxyOperater>> list(PageListProxyOperaterRequest plpor) {
|
||||
Page<ProxyOperater> page = new Page<ProxyOperater>(plpor.getPageNo(), plpor.getPageSize());
|
||||
page = proxyOperaterDao.selectPage(page, new QueryWrapper<ProxyOperater>()
|
||||
.eq(StringUtils.hasText(plpor.getDivisionNo()), "division_no", plpor.getDivisionNo())
|
||||
@ -66,19 +65,19 @@ public class ProxyOperaterServiceImpl implements ProxyOperaterService {
|
||||
.eq(plpor.getStatus() != null, "status", plpor.getStatus())
|
||||
.ne("del_flag", 1));
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<ProxyOperater>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<ProxyOperater>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<ProxyOperater>>().success(page);
|
||||
return new com.evotech.hd.common.core.entity.Result<List<ProxyOperater>>().success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<ProxyOperater>> deviceList() {
|
||||
return new BaseResponse<List<ProxyOperater>>().success(proxyOperaterDao.selectList(new LambdaQueryWrapper<ProxyOperater>().eq(ProxyOperater::getStatus, 1).eq(ProxyOperater::getDelFlag, 0).select(ProxyOperater::getPkId, ProxyOperater::getPoname,ProxyOperater::getPocode)));
|
||||
public Result<List<ProxyOperater>> deviceList() {
|
||||
return new Result<List<ProxyOperater>>().success(proxyOperaterDao.selectList(new LambdaQueryWrapper<ProxyOperater>().eq(ProxyOperater::getStatus, 1).eq(ProxyOperater::getDelFlag, 0).select(ProxyOperater::getPkId, ProxyOperater::getPoname,ProxyOperater::getPocode)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<ProxyOperater> basicInfo(String proxyCode) {
|
||||
return new BaseResponse<ProxyOperater>().success(proxyOperaterDao.selectOne(new LambdaQueryWrapper<ProxyOperater>().eq(ProxyOperater::getPocode, proxyCode).select(ProxyOperater::getPkId, ProxyOperater::getPoname,ProxyOperater::getPocode), false));
|
||||
public Result<ProxyOperater> basicInfo(String proxyCode) {
|
||||
return new Result<ProxyOperater>().success(proxyOperaterDao.selectOne(new LambdaQueryWrapper<ProxyOperater>().eq(ProxyOperater::getPocode, proxyCode).select(ProxyOperater::getPkId, ProxyOperater::getPoname,ProxyOperater::getPocode), false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.evotech.hd.common.core.Dto.ResponseUtil;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.dao.resource.ProxyOperaterDao;
|
||||
import com.evotech.hd.common.core.dao.resource.auth.AuthRoleDao;
|
||||
@ -138,7 +138,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
return new Result<List<AuthRole>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
Map<String, String> businessNames = proxyOperaterDao.selectList(new LambdaQueryWrapper<ProxyOperater>().select(ProxyOperater::getPocode, ProxyOperater::getPoname)).stream().collect(Collectors.toMap(ProxyOperater::getPocode, ProxyOperater::getPoname, (k1,k2)->k1));
|
||||
List<Company> companyList = ResponseUtil.getValue(cloudService.resourceCompanyList());
|
||||
List<Company> companyList = ResultUtil.getValue(cloudService.resourceCompanyList());
|
||||
if(CollectionUtils.isNotEmpty(companyList)){
|
||||
businessNames.putAll(companyList.stream().collect(Collectors.toMap(Company::getCcode, Company::getCname, (k1,k2)->k1)));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.evotech.hd.resource.service.rpc;
|
||||
|
||||
import com.evotech.hd.common.core.Dto.BaseResponse;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@ -15,8 +15,8 @@ public interface CloudService {
|
||||
|
||||
@GetMapping(value = "/batterystation/resource/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public BaseResponse<List<BatteryStation>> resourceList(String pkIds);
|
||||
public Result<List<BatteryStation>> resourceList(String pkIds);
|
||||
|
||||
@GetMapping(value = "/company/resource/list", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public BaseResponse<List<Company>> resourceCompanyList();
|
||||
public Result<List<Company>> resourceCompanyList();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user