定时计费模型已完成,实时订单增加用户类型,增加定时计费模型短信
This commit is contained in:
parent
fad5e342ad
commit
0952849a93
@ -603,3 +603,5 @@ ALTER TABLE `xhpc_operator`
|
|||||||
|
|
||||||
ALTER TABLE `t_iccard_client_users`
|
ALTER TABLE `t_iccard_client_users`
|
||||||
ADD COLUMN `tenant_id` VARCHAR(50) NULL COMMENT '租户id' AFTER `usersTime`;
|
ADD COLUMN `tenant_id` VARCHAR(50) NULL COMMENT '租户id' AFTER `usersTime`;
|
||||||
|
|
||||||
|
ALTER TABLE `xhpc_real_time_order` ADD COLUMN `source` int(10) NULL DEFAULT NULL COMMENT '订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)' AFTER `tenant_id`;
|
||||||
@ -92,7 +92,7 @@ public class XhpcTimingChargingModelController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 每5分钟执行一次
|
* 每5分钟执行一次
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
@Scheduled(cron = "0 0/1 * * * ?")
|
||||||
public void getXhpcTimingChargingModelCron(){
|
public void getXhpcTimingChargingModelCron(){
|
||||||
xhpcTimingChargingModelService.getXhpcTimingChargingModelCron();
|
xhpcTimingChargingModelService.getXhpcTimingChargingModelCron();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -42,6 +44,8 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SmsService smsService;
|
private SmsService smsService;
|
||||||
|
|
||||||
|
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
public List<Map<String, Object>> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
||||||
|
|
||||||
@ -431,6 +435,7 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
Long chargingStationId = timingCharging.getChargingStationId();
|
Long chargingStationId = timingCharging.getChargingStationId();
|
||||||
Long rateModelId = xhpcRateModel.getRateModelId();
|
Long rateModelId = xhpcRateModel.getRateModelId();
|
||||||
Long timingChargingModelId = timingCharging.getTimingChargingModelId();
|
Long timingChargingModelId = timingCharging.getTimingChargingModelId();
|
||||||
|
String tenantId = timingCharging.getTenantId();
|
||||||
//修改场站费率
|
//修改场站费率
|
||||||
XhpcChargingStation xhpcChargingStation = xhpcChargingStationService.selectXhpcChargingStationById(chargingStationId);
|
XhpcChargingStation xhpcChargingStation = xhpcChargingStationService.selectXhpcChargingStationById(chargingStationId);
|
||||||
xhpcChargingStation.setRateModelId(rateModelId);
|
xhpcChargingStation.setRateModelId(rateModelId);
|
||||||
@ -478,15 +483,36 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
R r =powerPileService.setStationRateModel(chargingStationId,rateModelId,cacheRateModel);
|
R r =powerPileService.setStationRateModel(chargingStationId,rateModelId,cacheRateModel);
|
||||||
if (r.getCode() != 200) {
|
if (r.getCode() != 200) {
|
||||||
//数据回滚-手动回滚
|
//数据回滚-手动回滚
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
//TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
//短信通知
|
//短信通知
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("phone", timingCharging.getPhone());
|
paramMap.put("phone", timingCharging.getPhone());
|
||||||
paramMap.put("content", "【小华计费模型】尊敬的用户,计费模型"+timingChargingModelId+"更新失败,请快速处理");
|
paramMap.put("content", "【小华充电】计费--尊敬的用户,计费模型"+timingChargingModelId+"更新失败,请快速处理");
|
||||||
smsService.sendNotice(paramMap);
|
smsService.sendNotice(paramMap);
|
||||||
return R.fail("添加费率入缓存失败,请稍后在试");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
executorService.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int k=0;
|
||||||
|
do{
|
||||||
|
R r =powerPileService.setStationRateModel(chargingStationId,rateModelId,cacheRateModel);
|
||||||
|
if(r.getCode()==200){
|
||||||
|
k++;
|
||||||
|
XhpcTimingChargingModel xhpcTimingChargingModel = xhpcTimingChargingModelMapper.getXhpcTimingChargingModelById(timingChargingModelId, tenantId);
|
||||||
|
xhpcTimingChargingModel.setStatus(1);
|
||||||
|
xhpcTimingChargingModel.setNumber(k);
|
||||||
|
xhpcTimingChargingModelMapper.updateXhpcTimingChargingModel(xhpcTimingChargingModel);
|
||||||
|
}
|
||||||
|
}while (k>0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//改变定时计费模型状态
|
||||||
|
XhpcTimingChargingModel xhpcTimingChargingModel = xhpcTimingChargingModelMapper.getXhpcTimingChargingModelById(timingChargingModelId, tenantId);
|
||||||
|
xhpcTimingChargingModel.setStatus(2);
|
||||||
|
xhpcTimingChargingModel.setErrorReason(r.getMsg());
|
||||||
|
xhpcTimingChargingModelMapper.updateXhpcTimingChargingModel(xhpcTimingChargingModel);
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,4 +550,6 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
xhpcTimingChargingTime.setCreateTime(new Date());
|
xhpcTimingChargingTime.setCreateTime(new Date());
|
||||||
xhpcTimingChargingModelMapper.insertXhpcTimingChargingTime(xhpcTimingChargingTime);
|
xhpcTimingChargingModelMapper.insertXhpcTimingChargingTime(xhpcTimingChargingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -562,7 +562,7 @@
|
|||||||
tcm.charging_station_id chargingStationId,
|
tcm.charging_station_id chargingStationId,
|
||||||
tcm.phone phone
|
tcm.phone phone
|
||||||
from xhpc_timing_charging_cache_rate_model crm
|
from xhpc_timing_charging_cache_rate_model crm
|
||||||
left join xhpc_timing_charging_model tcm on crm.timing_charging_model_id = tcm.timing_charging_model_id and tcm.number<4 and tcm.status =0 and tcm.del_flag =0
|
join xhpc_timing_charging_model tcm on crm.timing_charging_model_id = tcm.timing_charging_model_id and tcm.status =0 and tcm.del_flag =0 and now() > tcm.timing_time
|
||||||
where crm.del_flag=0
|
where crm.del_flag=0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -38,5 +38,8 @@ public class AliyunTemplate {
|
|||||||
*/
|
*/
|
||||||
public static final String REFUND_FAIL = "SMS_231445428";
|
public static final String REFUND_FAIL = "SMS_231445428";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新计费模型失败
|
||||||
|
*/
|
||||||
|
public static final String CHARGING_MODEL = "SMS_234414364";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,4 +35,9 @@ public class AliyunTemplateKeyWord {
|
|||||||
*/
|
*/
|
||||||
public static final String REFUND_FAIL = "退款-尊敬的用户";
|
public static final String REFUND_FAIL = "退款-尊敬的用户";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款失败
|
||||||
|
*/
|
||||||
|
public static final String CHARGING_MODEL = "计费--尊敬的用户";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,9 @@ public class XhpcSmsController extends BaseController {
|
|||||||
} else if (content.contains(AliyunTemplateKeyWord.REFUND_FAIL)) {
|
} else if (content.contains(AliyunTemplateKeyWord.REFUND_FAIL)) {
|
||||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||||
templateId = AliyunTemplate.REFUND_FAIL;
|
templateId = AliyunTemplate.REFUND_FAIL;
|
||||||
|
}else if (content.contains(AliyunTemplateKeyWord.CHARGING_MODEL)) {
|
||||||
|
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||||
|
templateId = AliyunTemplate.CHARGING_MODEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
|
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
|
||||||
|
|||||||
@ -109,6 +109,10 @@ public class XhpcRealTimeOrder extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long chargingStationId;
|
private Long chargingStationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||||
|
*/
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
public Long getChargingOrderId() {
|
public Long getChargingOrderId() {
|
||||||
|
|
||||||
@ -352,4 +356,11 @@ public class XhpcRealTimeOrder extends BaseEntity {
|
|||||||
this.chargingTimeNumber = chargingTimeNumber;
|
this.chargingTimeNumber = chargingTimeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(Integer source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -790,7 +790,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
|
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
|
||||||
XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder();
|
XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder();
|
||||||
|
xhpcRealTimeOrder.setSource(xhpcChargeOrder.getSource());
|
||||||
xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId());
|
xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId());
|
||||||
xhpcRealTimeOrder.setTransactionNumber(orderNo);
|
xhpcRealTimeOrder.setTransactionNumber(orderNo);
|
||||||
xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo());
|
xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo());
|
||||||
|
|||||||
@ -118,7 +118,10 @@
|
|||||||
charging_station_id,
|
charging_station_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != chargingTimeNumber ">
|
<if test="null != chargingTimeNumber ">
|
||||||
charging_time_number
|
charging_time_number,
|
||||||
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
source
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -201,7 +204,10 @@
|
|||||||
#{chargingStationId},
|
#{chargingStationId},
|
||||||
</if>
|
</if>
|
||||||
<if test="null != chargingTimeNumber ">
|
<if test="null != chargingTimeNumber ">
|
||||||
#{chargingTimeNumber}
|
#{chargingTimeNumber},
|
||||||
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
#{source}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user