优化异常订单审核、刷卡

This commit is contained in:
yuyang 2022-06-09 15:46:35 +08:00
parent 7dce8aa986
commit be15ff8b84
14 changed files with 123 additions and 35 deletions

View File

@ -222,7 +222,6 @@ public class WorkOrderServiceImpl implements WorkOrderService {
@Override @Override
public R workOrderMessage(Integer type, String time) { public R workOrderMessage(Integer type, String time) {
int i = orderMapper.workOrderMessage(type, time); int i = orderMapper.workOrderMessage(type, time);
System.out.println("------------iiiiii--------"+i);
if(i>0){ if(i>0){
return R.fail(); return R.fail();
} }

View File

@ -47,6 +47,12 @@ public class SearchCardResponse {
@JsonProperty("userType") @JsonProperty("userType")
private Integer userType; private Integer userType;
@JsonProperty("phone")
private String phone;
@JsonProperty("name")
private String name;
} }
} }

View File

@ -25,6 +25,10 @@ public class SearchCardUserQueryCondition {
@JsonProperty("userType") @JsonProperty("userType")
@NotNull(message = "userType的参数名不正确或者userType的值为空请检查传入参数") @NotNull(message = "userType的参数名不正确或者userType的值为空请检查传入参数")
private Integer userType; private Integer userType;
private String name;
private String phone;
/** /**
* cardClassification * cardClassification
*/ */

View File

@ -308,6 +308,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO(); SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
dataDTO.setUserAccount(xhpcCommunityPersonnel.getAccount()); dataDTO.setUserAccount(xhpcCommunityPersonnel.getAccount());
dataDTO.setUserType(2); dataDTO.setUserType(2);
dataDTO.setPhone(xhpcCommunityPersonnel.getPhone());
dataDTO.setName(xhpcCommunityPersonnel.getName());
searchCardResponse.getData().add(dataDTO); searchCardResponse.getData().add(dataDTO);
} }
return R.ok(searchCardResponse); return R.ok(searchCardResponse);
@ -320,6 +322,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO(); SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
dataDTO.setUserAccount(xhpcCustomersPersonnel.getAccount()); dataDTO.setUserAccount(xhpcCustomersPersonnel.getAccount());
dataDTO.setUserType(3); dataDTO.setUserType(3);
dataDTO.setPhone(xhpcCustomersPersonnel.getPhone());
dataDTO.setName(xhpcCustomersPersonnel.getName());
searchCardResponse.getData().add(dataDTO); searchCardResponse.getData().add(dataDTO);
} }
return R.ok(searchCardResponse); return R.ok(searchCardResponse);

View File

@ -328,14 +328,13 @@
(phone) (phone)
FROM FROM
xhpc_app_user xhpc_app_user
<where> where del_flag =0
<if test="tenantIdsStr!=null and tenantIdsStr!='' "> <if test="tenantIdsStr!=null and tenantIdsStr!='' ">
and find_in_set(tenant_id, #{tenantIdsStr}) and find_in_set(tenant_id, #{tenantIdsStr})
</if> </if>
<if test="currentTime!=null and currentTime!='' "> <if test="currentTime!=null and currentTime!='' ">
and create_time <![CDATA[>=]]> DATE_ADD(#{currentTime},INTERVAL -3 MONTH) and create_time <![CDATA[>=]]> DATE_ADD(#{currentTime},INTERVAL -3 MONTH)
</if> </if>
</where>
) AS a ) AS a
</select> </select>
</mapper> </mapper>

View File

@ -63,6 +63,13 @@
#{userId} #{userId}
</foreach> </foreach>
</if> </if>
<if test="queryCondition.name!=null and queryCondition.name!='' ">
and name like concat('%',#{queryCondition.name},'%')
</if>
<if test="queryCondition.phone!=null and queryCondition.phone!='' ">
and phone like concat('%',#{queryCondition.phone},'%')
</if>
</where> </where>
limit #{queryCondition.currentPage},#{queryCondition.items} limit #{queryCondition.currentPage},#{queryCondition.items}
</select> </select>

View File

@ -63,6 +63,12 @@
#{userId} #{userId}
</foreach> </foreach>
</if> </if>
<if test="queryCondition.name!=null and queryCondition.name!='' ">
and name like concat('%',#{queryCondition.name},'%')
</if>
<if test="queryCondition.phone!=null and queryCondition.phone!='' ">
and phone like concat('%',#{queryCondition.phone},'%')
</if>
</where> </where>
limit #{queryCondition.currentPage},#{queryCondition.items} limit #{queryCondition.currentPage},#{queryCondition.items}
</select> </select>

View File

@ -174,6 +174,10 @@ public class XhpcChargingPileController extends BaseController {
if(configRateReply==null || "".equals(configRateReply)){ if(configRateReply==null || "".equals(configRateReply)){
return AjaxResult.success("未下发"); return AjaxResult.success("未下发");
} }
String configTimeReply = redisService.getCacheObject("pile:" + serialNumber + ".configTimeReply");
if(configTimeReply !=null && !"".equals(configTimeReply)){
return AjaxResult.success(configRateReply+"--"+configTimeReply);
}
return AjaxResult.success(configRateReply); return AjaxResult.success(configRateReply);
} }

View File

@ -65,7 +65,7 @@ public class XhpcPileOrderController extends BaseController {
@GetMapping("/chargeOrder/pileStartup") @GetMapping("/chargeOrder/pileStartup")
public R pileStartup(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) { public R pileStartup(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) {
logger.info("桩启动回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo); logger.info("桩启动回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo);
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo);
//解析订单编号 //解析订单编号
Long userId =0L; Long userId =0L;
Integer code =200; Integer code =200;
@ -74,6 +74,12 @@ public class XhpcPileOrderController extends BaseController {
logger.info("桩启动回调接口--无效订单号>>>>>orderNo" + orderNo); logger.info("桩启动回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号"); return R.fail(500,"无效订单号");
} }
if(historyOrder !=null){
logger.info(">>>>>订单已结算不在改变订单状态>>>>>>>>>");
return R.ok();
}
if (status == 1) { if (status == 1) {
userId = update(0, remark, orderNo, 0); userId = update(0, remark, orderNo, 0);
} else { } else {
@ -115,6 +121,12 @@ public class XhpcPileOrderController extends BaseController {
public R pileStop(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) { public R pileStop(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) {
logger.info("桩停止回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo); logger.info("桩停止回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo);
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo);
//解析订单编号
if(historyOrder !=null){
logger.info(">>>>>订单已结算不在改变订单状态>>>>>>>>>");
return R.ok();
}
//解析订单编号 //解析订单编号
Integer code = 500; Integer code = 500;
Long userId=0L; Long userId=0L;
@ -279,6 +291,11 @@ public class XhpcPileOrderController extends BaseController {
public R pileEndOrder(@RequestParam(value = "orderNo") String orderNo) { public R pileEndOrder(@RequestParam(value = "orderNo") String orderNo) {
logger.info("桩订单结束回调>>>>>orderNo"+orderNo); logger.info("桩订单结束回调>>>>>orderNo"+orderNo);
try{ try{
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo);
if(historyOrder !=null){
logger.info("订单已结束不能重复结算>>>>>orderNo"+orderNo);
return R.ok();
}
//获取实时订单 //获取实时订单
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo); Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo);
if(cacheMap==null || cacheMap.get("orderData")==null ){ if(cacheMap==null || cacheMap.get("orderData")==null ){
@ -368,7 +385,6 @@ public class XhpcPileOrderController extends BaseController {
} }
return R.ok(); return R.ok();
} }
if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){ if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){
logger.info("订单已结束不能重复结算>>>>>orderNo"+orderNo+">>>chargeOrderId:"+xhpcChargeOrder.getChargeOrderId()); logger.info("订单已结束不能重复结算>>>>>orderNo"+orderNo+">>>chargeOrderId:"+xhpcChargeOrder.getChargeOrderId());
return R.ok(); return R.ok();
@ -590,6 +606,11 @@ public class XhpcPileOrderController extends BaseController {
logger.info("订单异常回调接口--无效订单号>>>>>orderNo" + orderNo); logger.info("订单异常回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号"); return R.fail(500,"无效订单号");
} }
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo);
if(historyOrder !=null){
logger.info("订单已结束不能重复结算>>>>>orderNo"+orderNo);
return R.ok();
}
if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){ if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){
logger.info("订单异常回调接口--已结算订单>>>>>orderNo" + orderNo); logger.info("订单异常回调接口--已结算订单>>>>>orderNo" + orderNo);
return R.ok(); return R.ok();

View File

@ -353,8 +353,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
try{ try{
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber()); Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber());
if(cacheMap.get("stopReason") !=null && !"".equals(cacheMap.get("stopReason").toString())){ if(cacheMap.get("stopReasonHex") !=null && !"".equals(cacheMap.get("stopReasonHex").toString())){
xhpcChargeOrder.setType(cacheMap.get("stopReason").toString()); xhpcChargeOrder.setType(cacheMap.get("stopReasonHex").toString());
}else{ }else{
xhpcChargeOrder.setType("91"); xhpcChargeOrder.setType("91");
xhpcChargeOrder.setStopReasonEvcs(45); xhpcChargeOrder.setStopReasonEvcs(45);
@ -366,7 +366,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
Map<String, Object> userMessage =new HashMap<>(); Map<String, Object> userMessage =new HashMap<>();
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder(); XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null){ if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null || xhpcChargeOrder.getChargingDegree()==null){
//获取实时数据 //获取实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber()); Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber());
if(cacheMap !=null){ if(cacheMap !=null){
@ -385,21 +385,22 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
BigDecimal bigDecimal = new BigDecimal(10000); BigDecimal bigDecimal = new BigDecimal(10000);
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP); BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP);
xhpcChargeOrder.setChargingDegree(divide); xhpcChargeOrder.setChargingDegree(divide);
}
if(cacheMap.get("realtimeDataList") !=null){
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
if(list !=null && list.size()>0){
xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
}
}else{ }else{
if(cacheMap.get("startTime") !=null) { if(cacheMap.get("realtimeDataList") !=null){
xhpcChargeOrder.setEndTime(DateUtil.parse(cacheMap.get("startTime").toString(), "yyyy-MM-dd HH:mm:ss")); List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
if(list !=null && list.size()>0){
xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
BigDecimal bigDecimal = new BigDecimal(10000);
BigDecimal divide = new BigDecimal(list.get(list.size()-1).getChargingDegree()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP);
xhpcChargeOrder.setChargingDegree(divide);
}
}else{
if(cacheMap.get("startTime") !=null) {
xhpcChargeOrder.setEndTime(DateUtil.parse(cacheMap.get("startTime").toString(), "yyyy-MM-dd HH:mm:ss"));
}
} }
} }
} }
} }
@ -430,6 +431,22 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
} }
} }
//生成一条历史订单 //生成一条历史订单
if(UserTypeUtil.INTERNET_TYPE ==xhpcChargeOrder.getSource()){
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
}else{
if("微信".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("微信");
}
if("支付宝".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("支付宝");
}
if("刷卡".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("刷卡");
}
}
xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime()); xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime());
if(xhpcChargeOrder.getEndTime()==null ){ if(xhpcChargeOrder.getEndTime()==null ){

View File

@ -835,12 +835,12 @@
left join xhpc_rate ra on rt.rate_id =ra.rate_id left join xhpc_rate ra on rt.rate_id =ra.rate_id
WHERE WHERE
rt.rate_time_id in ( rt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime} AND del_flag=0 SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime}
) )
<if test="endTime !='' and endTime !=null and endTime !='00:00:00' "> <if test="endTime !='' and endTime !=null and endTime !='00:00:00' ">
<if test="endTime !='24:00:00' "> <if test="endTime !='24:00:00' ">
or rt.rate_time_id in ( or rt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime} AND del_flag=0 SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime}
) )
</if> </if>
</if> </if>

View File

@ -117,6 +117,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId} and tenant_id = #{tenantId}
</if> </if>
<if test="operatorId !=null">
and operator_id =#{operatorId}
</if>
group by status group by status
order by status order by status
</select> </select>
@ -177,6 +180,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId} and tenant_id = #{tenantId}
</if> </if>
<if test="operatorId !=null">
and operator_id =#{operatorId}
</if>
group by DATE_FORMAT(create_time,'%Y-%m-%d') group by DATE_FORMAT(create_time,'%Y-%m-%d')
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
</select> </select>
@ -244,6 +250,10 @@
#{operatorId} #{operatorId}
</foreach> </foreach>
</if> </if>
<if test="operatorId !=null">
and ss.operator_id =#{operatorId}
</if>
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId} and ss.tenant_id = #{tenantId}
</if> </if>
@ -308,6 +318,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId} and ss.tenant_id = #{tenantId}
</if> </if>
<if test="operatorId !=null">
and operator_id =#{operatorId}
</if>
group by ss.operator_id group by ss.operator_id
</select> </select>
@ -356,6 +369,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId} and ss.tenant_id = #{tenantId}
</if> </if>
<if test="operatorId !=null">
and operator_id =#{operatorId}
</if>
group by ss.internet_user_id group by ss.internet_user_id
</select> </select>
@ -410,6 +426,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId} and ss.tenant_id = #{tenantId}
</if> </if>
<if test="operatorId !=null">
and operator_id =#{operatorId}
</if>
group by ss.terminal_id group by ss.terminal_id
</select> </select>

View File

@ -210,13 +210,14 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId()); XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId());
String redisKey = generateRedisKey(xhpcInvoice); String redisKey = generateRedisKey(xhpcInvoice);
if (redisService.getCacheObject(redisKey) == null) { redisService.setCacheObject(redisKey, 1L);
redisService.setCacheObject(redisKey, 1); // if (redisService.getCacheObject(redisKey) == null) {
} else { // redisService.setCacheObject(redisKey, 1L);
Long noReadCount = redisService.getCacheObject(redisKey); // } else {
noReadCount = noReadCount + 1; // Long noReadCount = redisService.getCacheObject(redisKey);
redisService.setCacheObject(redisKey, noReadCount); // noReadCount = noReadCount + 1;
} // redisService.setCacheObject(redisKey, noReadCount);
// }
} }
@Override @Override

View File

@ -62,6 +62,7 @@
`updator`, `updator`,
`update_time`, `update_time`,
`is_read`, `is_read`,
tenant_id,
`del_flag` `del_flag`
</sql> </sql>