mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev' into HuiFu
This commit is contained in:
@@ -3,20 +3,26 @@ package com.jsowell.api.uniapp;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||
import com.jsowell.common.util.file.FileUtils;
|
||||
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
|
||||
import com.jsowell.service.PileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/app-xcx-h5")
|
||||
@@ -25,9 +31,6 @@ public class JumpController extends BaseController {
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询充电桩详情
|
||||
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
|
||||
@@ -73,13 +76,25 @@ public class JumpController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新接口
|
||||
* http://localhost:8080/app-xcx-h5/pile/updateOrderDetail
|
||||
* 上传到阿里云oss
|
||||
* http://localhost:8080/app-xcx-h5/uploadOSS
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("updateOrderDetail")
|
||||
public RestApiResponse<?> updateOrderDetail() {
|
||||
orderBasicInfoService.updateElecAmount();
|
||||
return new RestApiResponse<>();
|
||||
@CrossOrigin
|
||||
@PostMapping("/uploadOSS")
|
||||
public AjaxResult uploadFileOSS(MultipartFile file) {
|
||||
try {
|
||||
String url = AliyunOssUploadUtils.uploadFile(file);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", FileUtils.getName(url));
|
||||
ajax.put("newFileName", FileUtils.getName(url));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class OrderController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查询未开发票订单
|
||||
* 时间限制60天内
|
||||
* 时间限制15天内
|
||||
* http://localhost:8080/uniapp/order/queryUninvoicedOrderList
|
||||
*/
|
||||
@PostMapping("/queryUninvoicedOrderList")
|
||||
|
||||
@@ -3,13 +3,14 @@ package com.jsowell.lianlian;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.thirdparty.service.LianLianService;
|
||||
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
import com.jsowell.thirdparty.vo.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -44,6 +45,9 @@ public class LianLianController extends BaseController {
|
||||
try {
|
||||
LianLianPageResponse pageResponse = lianLianService.query_stations_info(dto);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台查询充电站信息 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("联联平台查询充电站信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
@@ -67,6 +71,9 @@ public class LianLianController extends BaseController {
|
||||
}
|
||||
LianLianPageResponse pageResponse = lianLianService.query_station_status(StationIDs);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台查询充电站状态信息 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("联联平台查询充电站状态信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
@@ -87,6 +94,9 @@ public class LianLianController extends BaseController {
|
||||
try {
|
||||
StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
|
||||
response = new RestApiResponse<>(stationStatsInfo);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台查询统计信息 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台查询统计信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
@@ -107,6 +117,9 @@ public class LianLianController extends BaseController {
|
||||
try {
|
||||
EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
|
||||
response = new RestApiResponse<>(equipmentAuthVO);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台请求设备认证 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台请求设备认证 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
@@ -114,4 +127,75 @@ public class LianLianController extends BaseController {
|
||||
logger.info("联联平台请求设备认证 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_start_charge")
|
||||
public RestApiResponse<?> query_start_charge(@RequestBody QueryStartChargeDTO dto) {
|
||||
logger.info("联联平台请求启动充电 params :{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
QueryStartChargeVO queryStartChargeVO = lianLianService.query_start_charge(dto);
|
||||
response = new RestApiResponse<>(queryStartChargeVO);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台请求启动充电 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台请求启动充电 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("联联平台请求启动充电 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param startChargeSeq
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/query_equip_charge_status/{startChargeSeq}")
|
||||
public RestApiResponse<?> query_equip_charge_status(@PathVariable("startChargeSeq") String startChargeSeq) {
|
||||
logger.info("联联平台查询充电状态 params :{}", startChargeSeq);
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
QueryChargingStatusVO vo = lianLianService.query_equip_charge_status(startChargeSeq);
|
||||
response = new RestApiResponse<>(vo);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台查询充电状态 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台查询充电状态 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("联联平台查询充电状态 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_stop_charge")
|
||||
public RestApiResponse<?> query_stop_charge(@RequestBody QueryStartChargeDTO dto) {
|
||||
logger.info("联联平台请求停止充电 params :{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
QueryStopChargeVO queryStopChargeVO = lianLianService.query_stop_charge(dto);
|
||||
response = new RestApiResponse<>(queryStopChargeVO);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("联联平台请求停止充电 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台请求停止充电 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("联联平台请求停止充电 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ public class MemberService {
|
||||
// 校验短信验证码 两种情况不能通过校验,1-验证码错误;2-超时 验证码10分钟有效
|
||||
checkVerificationCode(dto);
|
||||
String merchantId = "";
|
||||
return memberRegisterAndLogin(dto.getMobileNumber(), merchantId, null);
|
||||
return memberRegisterAndLogin(dto.getMobileNumber(), dto.getMerchantId(), dto.getOpenId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共登陆注册方法
|
||||
* @param phoneNumber 手机号
|
||||
* @param merchantId 商户id
|
||||
* @return
|
||||
* @return token返给前端
|
||||
*/
|
||||
private String memberRegisterAndLogin(String phoneNumber, String merchantId, String openId) {
|
||||
if (StringUtils.isBlank(phoneNumber)) {
|
||||
@@ -121,7 +121,7 @@ public class MemberService {
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumberAndMerchantId(phoneNumber, merchantId);
|
||||
if (Objects.isNull(memberBasicInfo)) {
|
||||
// 不存在则新增数据
|
||||
String memberId = IdUtils.getMemberId();
|
||||
String memberId = generateNewMemberId();
|
||||
memberBasicInfo = new MemberBasicInfo();
|
||||
memberBasicInfo.setStatus(Constants.ONE);
|
||||
memberBasicInfo.setMemberId(memberId);
|
||||
@@ -149,6 +149,17 @@ public class MemberService {
|
||||
return memberToken;
|
||||
}
|
||||
|
||||
private String generateNewMemberId() {
|
||||
while (true) {
|
||||
String memberId = IdUtils.getMemberId();
|
||||
// 通过memberId查询是否已经存在
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||
if (memberVO == null) {
|
||||
return memberId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信一键登录
|
||||
* @param dto
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.InvoiceRecordEnum;
|
||||
import com.jsowell.common.enums.MemberWalletEnum;
|
||||
import com.jsowell.common.enums.ykc.ActionTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.BillingTimeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayRecordEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
@@ -796,6 +797,45 @@ public class OrderService {
|
||||
OrderDetailInfoVO.BillingDetails billingDetails = new OrderDetailInfoVO.BillingDetails();
|
||||
BeanUtils.copyBeanProp(billingDetails, orderDetail);
|
||||
vo.setBillingDetails(billingDetails);
|
||||
|
||||
// new 收费明细
|
||||
OrderDetailInfoVO.ChargeDetail sharp = new OrderDetailInfoVO.ChargeDetail();
|
||||
sharp.setPeriodType(BillingTimeEnum.SHARP.getLabel());
|
||||
sharp.setElectricityPrice(orderDetail.getSharpElectricityPrice());
|
||||
sharp.setServicePrice(orderDetail.getSharpServicePrice());
|
||||
BigDecimal sharpUsedElectricity = orderDetail.getSharpUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getSharpUsedElectricity();
|
||||
sharp.setUsedElectricity(sharpUsedElectricity);
|
||||
sharp.setElectricityAmount(sharp.getElectricityPrice().multiply(sharp.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
sharp.setServiceAmount(sharp.getServicePrice().multiply(sharp.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
|
||||
OrderDetailInfoVO.ChargeDetail peak = new OrderDetailInfoVO.ChargeDetail();
|
||||
peak.setPeriodType(BillingTimeEnum.PEAK.getLabel());
|
||||
peak.setElectricityPrice(orderDetail.getPeakElectricityPrice());
|
||||
peak.setServicePrice(orderDetail.getPeakServicePrice());
|
||||
BigDecimal peakUsedElectricity = orderDetail.getPeakUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getPeakUsedElectricity();
|
||||
peak.setUsedElectricity(peakUsedElectricity);
|
||||
peak.setElectricityAmount(peak.getElectricityPrice().multiply(peak.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
peak.setServiceAmount(peak.getServicePrice().multiply(peak.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
|
||||
OrderDetailInfoVO.ChargeDetail flat = new OrderDetailInfoVO.ChargeDetail();
|
||||
flat.setPeriodType(BillingTimeEnum.FLAT.getLabel());
|
||||
flat.setElectricityPrice(orderDetail.getFlatElectricityPrice());
|
||||
flat.setServicePrice(orderDetail.getFlatServicePrice());
|
||||
BigDecimal flatUsedElectricity = orderDetail.getFlatUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getFlatUsedElectricity();
|
||||
flat.setUsedElectricity(flatUsedElectricity);
|
||||
flat.setElectricityAmount(flat.getElectricityPrice().multiply(flat.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
flat.setServiceAmount(flat.getServicePrice().multiply(flat.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
|
||||
OrderDetailInfoVO.ChargeDetail valley = new OrderDetailInfoVO.ChargeDetail();
|
||||
valley.setPeriodType(BillingTimeEnum.VALLEY.getLabel());
|
||||
valley.setElectricityPrice(orderDetail.getValleyElectricityPrice());
|
||||
valley.setServicePrice(orderDetail.getValleyServicePrice());
|
||||
BigDecimal valleyUsedElectricity = orderDetail.getValleyUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getValleyUsedElectricity();
|
||||
valley.setUsedElectricity(valleyUsedElectricity);
|
||||
valley.setElectricityAmount(valley.getElectricityPrice().multiply(valley.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
valley.setServiceAmount(valley.getServicePrice().multiply(valley.getUsedElectricity()).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
|
||||
vo.setChargeDetails(Lists.newArrayList(sharp, peak, flat, valley));
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
@@ -1010,9 +1050,9 @@ public class OrderService {
|
||||
}
|
||||
|
||||
public List<OrderVO> queryUninvoicedOrderList(QueryOrderDTO dto) {
|
||||
int i = 60;
|
||||
int i = 15;
|
||||
|
||||
// 查询最近60天完成的订单
|
||||
// 查询最近15天完成的订单
|
||||
LocalDateTime dateTime = LocalDateTime.now().plusDays(-i);
|
||||
List<OrderVO> orderList = orderBasicInfoService.getListByMemberIdAndOrderStatus(dto.getMemberId(), Lists.newArrayList("6"), dateTime);
|
||||
|
||||
|
||||
@@ -163,10 +163,16 @@ public class CommonController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传到阿里云oss
|
||||
* http://localhost:8080/common/uploadOSS
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@CrossOrigin
|
||||
@PostMapping("/uploadOSS")
|
||||
public AjaxResult uploadFileOSS(MultipartFile file) throws Exception {
|
||||
System.out.println(file);
|
||||
try {
|
||||
String url = AliyunOssUploadUtils.uploadFile(file);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
@@ -174,6 +180,7 @@ public class CommonController {
|
||||
ajax.put("fileName", FileUtils.getName(url));
|
||||
ajax.put("newFileName", FileUtils.getName(url));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
log.info("图片上传成功 url:{}", url);
|
||||
return ajax;
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 会员基础信息Controller
|
||||
@@ -91,12 +90,12 @@ public class MemberBasicInfoController extends BaseController {
|
||||
/**
|
||||
* 新增会员基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('member:info:add')")
|
||||
@Log(title = "会员基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MemberBasicInfo memberBasicInfo) {
|
||||
return toAjax(memberBasicInfoService.insertMemberBasicInfo(memberBasicInfo));
|
||||
}
|
||||
// @PreAuthorize("@ss.hasPermi('member:info:add')")
|
||||
// @Log(title = "会员基础信息", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody MemberBasicInfo memberBasicInfo) {
|
||||
// return toAjax(memberBasicInfoService.insertMemberBasicInfo(memberBasicInfo));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改会员基础信息
|
||||
|
||||
@@ -106,7 +106,7 @@ minio:
|
||||
|
||||
aliyunoss:
|
||||
# 地域节点
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
endpoint: http://oss-cn-shanghai.aliyuncs.com
|
||||
# AccessKey
|
||||
accessKeyId: LTAI5tBgCN4xuxQF1HV9rf7t
|
||||
# AccessKey 秘钥
|
||||
@@ -116,7 +116,7 @@ aliyunoss:
|
||||
# bucket下文件夹的路径
|
||||
filehost: img
|
||||
# 访问域名
|
||||
url: ydc-oss-dev.oss-cn-shanghai.aliyuncs.com
|
||||
url: https://ydc-oss-dev.oss-cn-shanghai.aliyuncs.com
|
||||
|
||||
|
||||
########################微信支付参数#######################################
|
||||
|
||||
@@ -108,17 +108,17 @@ minio:
|
||||
|
||||
aliyunoss:
|
||||
# 地域节点
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
endpoint: http://oss-cn-shanghai.aliyuncs.com
|
||||
# AccessKey
|
||||
accessKeyId: LTAI5tBgCN4xuxQF1HV9rf7t
|
||||
# AccessKey 秘钥
|
||||
accessKeySecret: tsxMyujk6KY9h0e4Bx0D7ld16PBUyW
|
||||
# bucket名称
|
||||
bucketName: ydc-oss-dev
|
||||
bucketName: ydc-oss-prd
|
||||
# bucket下文件夹的路径
|
||||
filehost: img
|
||||
# 访问域名
|
||||
url: ydc-oss-dev.oss-cn-shanghai.aliyuncs.com
|
||||
url: https://ydc-oss-prd.oss-cn-shanghai.aliyuncs.com
|
||||
|
||||
########################微信支付参数#######################################
|
||||
#微信商户号
|
||||
|
||||
Reference in New Issue
Block a user