优化异常订单审核、刷卡

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
public R workOrderMessage(Integer type, String time) {
int i = orderMapper.workOrderMessage(type, time);
System.out.println("------------iiiiii--------"+i);
if(i>0){
return R.fail();
}

View File

@ -47,6 +47,12 @@ public class SearchCardResponse {
@JsonProperty("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")
@NotNull(message = "userType的参数名不正确或者userType的值为空请检查传入参数")
private Integer userType;
private String name;
private String phone;
/**
* cardClassification
*/

View File

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

View File

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

View File

@ -63,6 +63,13 @@
#{userId}
</foreach>
</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>
limit #{queryCondition.currentPage},#{queryCondition.items}
</select>

View File

@ -63,6 +63,12 @@
#{userId}
</foreach>
</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>
limit #{queryCondition.currentPage},#{queryCondition.items}
</select>

View File

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

View File

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

View File

@ -353,8 +353,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
try{
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber());
if(cacheMap.get("stopReason") !=null && !"".equals(cacheMap.get("stopReason").toString())){
xhpcChargeOrder.setType(cacheMap.get("stopReason").toString());
if(cacheMap.get("stopReasonHex") !=null && !"".equals(cacheMap.get("stopReasonHex").toString())){
xhpcChargeOrder.setType(cacheMap.get("stopReasonHex").toString());
}else{
xhpcChargeOrder.setType("91");
xhpcChargeOrder.setStopReasonEvcs(45);
@ -366,7 +366,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
Map<String, Object> userMessage =new HashMap<>();
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());
if(cacheMap !=null){
@ -385,21 +385,22 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
BigDecimal bigDecimal = new BigDecimal(10000);
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP);
xhpcChargeOrder.setChargingDegree(divide);
}
}else{
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"));
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());
if(xhpcChargeOrder.getEndTime()==null ){

View File

@ -835,12 +835,12 @@
left join xhpc_rate ra on rt.rate_id =ra.rate_id
WHERE
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 !='24:00:00' ">
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>

View File

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

View File

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

View File

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