mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
Merge branch 'dev' into feature-integrated_with_JCPP
This commit is contained in:
@@ -12,9 +12,12 @@ import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO;
|
|||||||
import com.jsowell.pile.dto.business.StationStatisticsInfoDTO;
|
import com.jsowell.pile.dto.business.StationStatisticsInfoDTO;
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import com.jsowell.pile.service.PileStationInfoService;
|
import com.jsowell.pile.service.PileStationInfoService;
|
||||||
|
import com.jsowell.pile.util.UserUtils;
|
||||||
|
import com.jsowell.pile.vo.base.LoginUserDetailVO;
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
||||||
import com.jsowell.pile.vo.web.StationSelectVO;
|
import com.jsowell.pile.vo.web.StationSelectVO;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -83,6 +86,12 @@ public class BusinessStationInfoController extends BaseController {
|
|||||||
public RestApiResponse<?> getStationBusinessAnalyzeInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto){
|
public RestApiResponse<?> getStationBusinessAnalyzeInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto){
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
|
// 获取登录账号信息
|
||||||
|
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
|
||||||
|
List<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
|
||||||
|
if (CollectionUtils.isEmpty(dto.getStationIds())) {
|
||||||
|
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
|
||||||
|
}
|
||||||
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationBusinessAnalyzeInfo(dto);
|
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationBusinessAnalyzeInfo(dto);
|
||||||
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -145,6 +154,12 @@ public class BusinessStationInfoController extends BaseController {
|
|||||||
public RestApiResponse<?> getStationOrderQuantityInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) {
|
public RestApiResponse<?> getStationOrderQuantityInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) {
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
|
// 获取登录账号信息
|
||||||
|
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
|
||||||
|
List<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
|
||||||
|
if (CollectionUtils.isEmpty(dto.getStationIds())) {
|
||||||
|
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
|
||||||
|
}
|
||||||
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationOrderQuantityInfo(dto);
|
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationOrderQuantityInfo(dto);
|
||||||
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -163,6 +178,12 @@ public class BusinessStationInfoController extends BaseController {
|
|||||||
public RestApiResponse<?> getStationConnectorUsedInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) {
|
public RestApiResponse<?> getStationConnectorUsedInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto) {
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
|
// 获取登录账号信息
|
||||||
|
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
|
||||||
|
List<String> merchantIdList = loginUserDetail.getFirstMerchantIdList();
|
||||||
|
if (CollectionUtils.isEmpty(dto.getStationIds())) {
|
||||||
|
dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList));
|
||||||
|
}
|
||||||
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationConnectorUsedInfo(dto);
|
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationConnectorUsedInfo(dto);
|
||||||
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -92,29 +92,11 @@ spring:
|
|||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
|
||||||
# rabbitmq配置 pre
|
# rabbitmq配置 pre
|
||||||
# rabbitmq:
|
|
||||||
# host: 172.23.0.190
|
|
||||||
# port: 5672
|
|
||||||
# username: guest
|
|
||||||
# password: guest
|
|
||||||
# #这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调
|
|
||||||
# publisher-confirm-type: correlated
|
|
||||||
# #保证交换机能把消息推送到队列中
|
|
||||||
# publisher-returns: true
|
|
||||||
# virtual-host: /
|
|
||||||
# #这个配置是保证消费者会消费消息,手动确认
|
|
||||||
# listener:
|
|
||||||
# simple:
|
|
||||||
# acknowledge-mode: manual
|
|
||||||
# template:
|
|
||||||
# mandatory: true
|
|
||||||
|
|
||||||
# rabbitmq配置 prd
|
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 172.23.0.187
|
host: 172.23.0.190
|
||||||
port: 5672
|
port: 5672
|
||||||
username: admin
|
username: guest
|
||||||
password: js160829@
|
password: guest
|
||||||
#这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调
|
#这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调
|
||||||
publisher-confirm-type: correlated
|
publisher-confirm-type: correlated
|
||||||
#保证交换机能把消息推送到队列中
|
#保证交换机能把消息推送到队列中
|
||||||
@@ -127,6 +109,24 @@ spring:
|
|||||||
template:
|
template:
|
||||||
mandatory: true
|
mandatory: true
|
||||||
|
|
||||||
|
# rabbitmq配置 prd
|
||||||
|
# rabbitmq:
|
||||||
|
# host: 172.23.0.187
|
||||||
|
# port: 5672
|
||||||
|
# username: admin
|
||||||
|
# password: js160829@
|
||||||
|
# #这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调
|
||||||
|
# publisher-confirm-type: correlated
|
||||||
|
# #保证交换机能把消息推送到队列中
|
||||||
|
# publisher-returns: true
|
||||||
|
# virtual-host: /
|
||||||
|
# #这个配置是保证消费者会消费消息,手动确认
|
||||||
|
# listener:
|
||||||
|
# simple:
|
||||||
|
# acknowledge-mode: manual
|
||||||
|
# template:
|
||||||
|
# mandatory: true
|
||||||
|
|
||||||
# Swagger配置
|
# Swagger配置
|
||||||
swagger:
|
swagger:
|
||||||
# 是否开启swagger
|
# 是否开启swagger
|
||||||
|
|||||||
@@ -54,4 +54,9 @@ public interface MemberPointsRecordMapper {
|
|||||||
* 根据主键删除
|
* 根据主键删除
|
||||||
*/
|
*/
|
||||||
int deleteByPrimaryKey(Long id);
|
int deleteByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号和类型统计记录数(用于幂等性校验)
|
||||||
|
*/
|
||||||
|
int countByOrderCodeAndType(@Param("orderCode") String orderCode, @Param("type") Integer type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ public class MemberPointsInfoServiceImpl implements MemberPointsInfoService {
|
|||||||
throw new BusinessException(ReturnCodeEnum.valueOf("参数错误"));
|
throw new BusinessException(ReturnCodeEnum.valueOf("参数错误"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 幂等性校验:检查该订单是否已发放过充电奖励积分
|
||||||
|
if (StringUtils.isNotBlank(orderCode)) {
|
||||||
|
int count = memberPointsRecordMapper.countByOrderCodeAndType(orderCode, POINTS_TYPE_CHARGE_REWARD);
|
||||||
|
if (count > 0) {
|
||||||
|
logger.warn("积分已发放,跳过重复发放,memberId: {}, orderCode: {}", memberId, orderCode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 检查积分账户是否存在,不存在则初始化
|
// 检查积分账户是否存在,不存在则初始化
|
||||||
MemberPointsInfo pointsInfo = memberPointsInfoMapper.selectByMemberId(memberId);
|
MemberPointsInfo pointsInfo = memberPointsInfoMapper.selectByMemberId(memberId);
|
||||||
if (pointsInfo == null) {
|
if (pointsInfo == null) {
|
||||||
|
|||||||
@@ -150,4 +150,11 @@
|
|||||||
from member_points_record
|
from member_points_record
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="countByOrderCodeAndType" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from member_points_record
|
||||||
|
where order_code = #{orderCode,jdbcType=VARCHAR}
|
||||||
|
and type = #{type,jdbcType=TINYINT}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user