修改审核异常订单没有实时数据问题

This commit is contained in:
yuyang 2022-04-02 16:29:52 +08:00
parent 1fac912262
commit 40cb18c055
9 changed files with 113 additions and 23 deletions

View File

@ -110,7 +110,7 @@
<if test="tenantId !=null and '' !=tenantId"> <if test="tenantId !=null and '' !=tenantId">
and tcm.tenant_id =#{tenantId} and tcm.tenant_id =#{tenantId}
</if> </if>
order by tcm.status desc, tcm.create_time desc order by tcm.status asc, tcm.create_time desc
</select> </select>
<insert id="insertXhpcTimingChargingModel" parameterType="com.xhpc.common.domain.XhpcTimingChargingModel" useGeneratedKeys="true" keyProperty="timingChargingModelId"> <insert id="insertXhpcTimingChargingModel" parameterType="com.xhpc.common.domain.XhpcTimingChargingModel" useGeneratedKeys="true" keyProperty="timingChargingModelId">

View File

@ -4,9 +4,13 @@ import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.DateUtil; import com.xhpc.common.util.DateUtil;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.invoice.domain.*; import com.xhpc.invoice.domain.*;
import com.xhpc.invoice.service.XhpcInvoiceService; import com.xhpc.invoice.service.XhpcInvoiceService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -24,6 +28,10 @@ public class XhpcInvoiceApiController extends BaseController {
@Resource @Resource
XhpcInvoiceService xhpcInvoiceService; XhpcInvoiceService xhpcInvoiceService;
@Resource
TokenService tokenService;
@Resource
RedisService redisService;
/** /**
* 查询用户显示小红点即查询用户有几个未读的已开发票 * 查询用户显示小红点即查询用户有几个未读的已开发票
@ -35,7 +43,23 @@ public class XhpcInvoiceApiController extends BaseController {
@GetMapping("/user/no-read") @GetMapping("/user/no-read")
public AjaxResult findNotReadCount(@RequestParam Long creatorId, @RequestParam Integer creatorType) { public AjaxResult findNotReadCount(@RequestParam Long creatorId, @RequestParam Integer creatorType) {
LoginUser loginUser = tokenService.getLoginUser();
Long userid = loginUser.getUserid();
String tenantId = loginUser.getTenantId();
Integer userType = loginUser.getUserType();
String globalInvoice="global:invoice:"+ tenantId +":";
String invoice ="";
if(UserTypeUtil.USER_TYPE.equals(userType)){
invoice =globalInvoice + UserTypeUtil.USER + userid;
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
invoice =globalInvoice + UserTypeUtil.INTERNET + userid;
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
invoice =globalInvoice + UserTypeUtil.COMMUNIT + userid;
}else{
invoice =globalInvoice + UserTypeUtil.CUSTOMERS + userid;
}
Long notRead = xhpcInvoiceService.findNotReadCount(creatorId, creatorType); Long notRead = xhpcInvoiceService.findNotReadCount(creatorId, creatorType);
redisService.setCacheObject(invoice,notRead);
return AjaxResult.success(notRead); return AjaxResult.success(notRead);
} }

View File

@ -516,26 +516,34 @@ public class XhpcPileOrderController extends BaseController {
@Transactional @Transactional
@PostMapping("/chargeOrder/abnormalOrder") @PostMapping("/chargeOrder/abnormalOrder")
public R abnormalOrder(@RequestParam(value = "orderNo") String orderNo) { public R abnormalOrder(@RequestParam(value = "orderNo") String orderNo) {
//获取实时订单 //获取实时订单
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo); XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){ if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
logger.info("订单异常回调接口--无效订单号>>>>>orderNo" + orderNo); logger.info("订单异常回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号"); return R.fail(500,"无效订单号");
} }
if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){
logger.info("订单异常回调接口--已结算订单>>>>>orderNo" + orderNo);
return R.ok();
}
Integer source = xhpcChargeOrder.getSource(); Integer source = xhpcChargeOrder.getSource();
String tenantId = xhpcChargeOrder.getTenantId(); String tenantId = xhpcChargeOrder.getTenantId();
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){ // if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); // R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
if(user !=null && user.getData() !=null){ // if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); // Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage != null && userMessage.get("balance") != null) { // if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1); // xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1);
} // }
} // }
}else{ // }else{
xhpcHistoryOrderService.addXhpcChargeOrder(null,orderNo,1); // xhpcHistoryOrderService.addXhpcChargeOrder(null,orderNo,1);
} // }
Date date = new Date();
xhpcChargeOrder.setStatus(2);
xhpcChargeOrder.setEndTime(date);
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
Long userId = xhpcChargeOrder.getUserId(); Long userId = xhpcChargeOrder.getUserId();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("code", 500); map.put("code", 500);

View File

@ -58,9 +58,9 @@ public class XhpcRealTimeOrderController extends BaseController {
* 实时/异常订单详情PC * 实时/异常订单详情PC
*/ */
@GetMapping("/getMessage") @GetMapping("/getMessage")
public AjaxResult getMessage(@RequestParam Long realTimeOrderId) public AjaxResult getMessage(@RequestParam Long realTimeOrderId,@RequestParam Long chargeOrderId)
{ {
return AjaxResult.success(xhpcRealTimeOrderService.getMessage(realTimeOrderId)); return AjaxResult.success(xhpcRealTimeOrderService.getMessage(realTimeOrderId,chargeOrderId));
} }
@ -92,8 +92,8 @@ public class XhpcRealTimeOrderController extends BaseController {
*异常订单审核详情 *异常订单审核详情
*/ */
@GetMapping("/getExamineMessage") @GetMapping("/getExamineMessage")
public AjaxResult getExamineMessage(@RequestParam Long realTimeOrderId){ public AjaxResult getExamineMessage(@RequestParam Long realTimeOrderId,@RequestParam Long chargeOrderId){
return xhpcRealTimeOrderService.getExamineMessage(realTimeOrderId); return xhpcRealTimeOrderService.getExamineMessage(realTimeOrderId,chargeOrderId);
} }
/** /**

View File

@ -69,6 +69,13 @@ public interface XhpcRealTimeOrderMapper {
*/ */
Map<String,Object> getMessage(@Param("realTimeOrderId")Long realTimeOrderId); Map<String,Object> getMessage(@Param("realTimeOrderId")Long realTimeOrderId);
/**
* 异常订单详情接口(PC端)
* @param chargeOrderId
* @return
*/
Map<String,Object> getMessageChargeOrderId(@Param("chargeOrderId")Long chargeOrderId);
/** /**
* 实时订单详情数据列表PC * 实时订单详情数据列表PC

View File

@ -38,7 +38,7 @@ public interface IXhpcRealTimeOrderService {
* @param realTimeOrderId * @param realTimeOrderId
* @return * @return
*/ */
Map<String,Object> getMessage(Long realTimeOrderId); Map<String,Object> getMessage(Long realTimeOrderId,Long chargeOrderId);
/** /**
* 实时订单详情数据列表PC * 实时订单详情数据列表PC
@ -93,7 +93,7 @@ public interface IXhpcRealTimeOrderService {
* @param realTimeOrderId * @param realTimeOrderId
* @return * @return
*/ */
AjaxResult getExamineMessage(Long realTimeOrderId); AjaxResult getExamineMessage(Long realTimeOrderId,Long chargeOrderId);
/** /**
* 审核 * 审核

View File

@ -446,7 +446,6 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
xhpcChargeOrder.setAmountCharged(new BigDecimal(cacheRealtimeData.getAmountCharged()).divide(decimal, 2, BigDecimal.ROUND_HALF_UP)); xhpcChargeOrder.setAmountCharged(new BigDecimal(cacheRealtimeData.getAmountCharged()).divide(decimal, 2, BigDecimal.ROUND_HALF_UP));
xhpcChargeOrder.setChargingTimeNumber(Long.valueOf(cacheRealtimeData.getChargingTime())); xhpcChargeOrder.setChargingTimeNumber(Long.valueOf(cacheRealtimeData.getChargingTime()));
if (checking) { if (checking) {
BigDecimal money = xhpcChargeOrder.getAmountCharged(); BigDecimal money = xhpcChargeOrder.getAmountCharged();
//结算 //结算

View File

@ -119,7 +119,10 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
} }
@Override @Override
public Map<String, Object> getMessage(Long realTimeOrderId) { public Map<String, Object> getMessage(Long realTimeOrderId,Long chargeOrderId) {
if(realTimeOrderId ==null){
return xhpcRealTimeOrderMapper.getMessageChargeOrderId(chargeOrderId);
}
return xhpcRealTimeOrderMapper.getMessage(realTimeOrderId); return xhpcRealTimeOrderMapper.getMessage(realTimeOrderId);
} }
@ -159,7 +162,16 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
@Transactional @Transactional
@Override @Override
public AjaxResult getExamineMessage(Long realTimeOrderId) { public AjaxResult getExamineMessage(Long realTimeOrderId,Long chargeOrderId) {
if(realTimeOrderId==null){
Map<String, Object> message = xhpcRealTimeOrderMapper.getMessageChargeOrderId(chargeOrderId);
message.put("powerPriceTotal",0);
message.put("servicePriceTotal",0);
return AjaxResult.success(message);
}
//基本信息 //基本信息
Map<String, Object> message = xhpcRealTimeOrderMapper.getMessage(realTimeOrderId); Map<String, Object> message = xhpcRealTimeOrderMapper.getMessage(realTimeOrderId);
try{ try{

View File

@ -535,7 +535,47 @@
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where ro.real_time_order_id=#{realTimeOrderId} where ro.real_time_order_id=#{realTimeOrderId}
</select> </select>
<select id="getMessageChargeOrderId" resultType="map">
select
co.charge_order_id as chargeOrderId,
co.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.serial_number as pileSerialNumber,
cp.power as power,
cp.type as type,
concat(0) as soc,
concat(0) as voltage,
concat(0) as electricCurrent,
co.status as status,
co.create_time as createTime,
concat(0) as chargingDegree,
concat(0) as chargingTime,
co.source as source,
co.internet_serial_number as internetSerialNumber,
co.erro_remark as erroRemark,
concat(0) as amountCharged,
co.Plate_num as plateNum,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone,
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source=1) as internetName,
(SELECT account from xhpc_community_personnel where community_personnel_id = co.user_id and co.source=2) as communityAccount,
(SELECT account from xhpc_customers_personnel where customers_personnel_id = co.user_id and co.source=3) as customersAccount
from xhpc_charge_order co
Left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.terminal_id = co.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where co.xhpc_charge_order=#{chargeOrderId}
</select>
<select id="timeList" resultType="map"> <select id="timeList" resultType="map">
select select
create_time as createTime, create_time as createTime,