修改桩回调实体类,增加桩订单字段
This commit is contained in:
parent
374036ed76
commit
e7ae59dad2
@ -12,7 +12,7 @@ public class PileEndOrder {
|
||||
private Integer chargingTime; //累计充电时间
|
||||
private Integer chargingDegree; //充电度数
|
||||
private Integer amountCharged; //已充金额
|
||||
private Integer erroRemark; //备注
|
||||
private String erroRemark; //备注
|
||||
|
||||
|
||||
public String getOrderNo() {
|
||||
@ -75,12 +75,12 @@ public class PileEndOrder {
|
||||
this.chargingDegree = chargingDegree;
|
||||
}
|
||||
|
||||
public Integer getErroRemark() {
|
||||
public String getErroRemark() {
|
||||
|
||||
return erroRemark;
|
||||
}
|
||||
|
||||
public void setErroRemark(Integer erroRemark) {
|
||||
public void setErroRemark(String erroRemark) {
|
||||
|
||||
this.erroRemark = erroRemark;
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.dto.PileEndOrder;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.util.ConnectionRabbitMQUtil;
|
||||
import com.xhpc.order.domain.HxpcChargeOrder;
|
||||
import com.xhpc.order.service.IHxpcChargeOrderService;
|
||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -28,7 +31,7 @@ public class HxpcPileOrderController extends BaseController {
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private IHxpcChargeOrderService iHxpcChargeOrderService;
|
||||
private IHxpcChargeOrderService hxpcChargeOrderService;
|
||||
|
||||
@Autowired
|
||||
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
||||
@ -128,17 +131,32 @@ public class HxpcPileOrderController extends BaseController {
|
||||
/**
|
||||
* 桩订单结束回调
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
* @param status 状态 1正常 2异常
|
||||
* @param remark 备注
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/pileEndOrder")
|
||||
public R pileEndOrder(String orderNo, Integer status, String remark) {
|
||||
public R pileEndOrder(@RequestBody PileEndOrder pileEndOrder) {
|
||||
|
||||
//解析订单编号
|
||||
String s = orderNo.split("\\.")[0];
|
||||
String s = pileEndOrder.getOrderNo().split("\\.")[0];
|
||||
String s1 = s.split(":")[1];
|
||||
Date date = new Date();
|
||||
|
||||
//获取充电订单
|
||||
HxpcChargeOrder hxpcChargeOrder = hxpcChargeOrderService.getSerialNumberMessage(s1);
|
||||
hxpcChargeOrder.setStartSoc(pileEndOrder.getStartSoc());
|
||||
hxpcChargeOrder.setEndSoc(pileEndOrder.getEndSoc());
|
||||
hxpcChargeOrder.setStatus(pileEndOrder.getStatus());
|
||||
hxpcChargeOrder.setEndTime(date);
|
||||
hxpcChargeOrder.setChargingTime(pileEndOrder.getChargingTime().toString());
|
||||
hxpcChargeOrder.setChargingDegree(pileEndOrder.getChargingDegree().toString());
|
||||
hxpcChargeOrder.setAmountCharged(pileEndOrder.getAmountCharged().toString());
|
||||
hxpcChargeOrder.setErroRemark(pileEndOrder.getErroRemark());
|
||||
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
|
||||
|
||||
//历史订单
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Date date = new Date();
|
||||
@ -190,6 +208,53 @@ public class HxpcPileOrderController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
private void gun(){
|
||||
// Date date = new Date();
|
||||
// //获取实时订单
|
||||
// Map<String, Object> cacheMap = redisService.getCacheMap("order:"+serialNumber);
|
||||
// JSONArray st = (JSONArray)cacheMap.get("realtimeDataList");
|
||||
// System.out.println(st.toString());
|
||||
// CacheRealtimeData cacheRealtimeData = JSON.toJavaObject(st.getJSONObject(0), CacheRealtimeData.class);
|
||||
//
|
||||
// //用户第几次充电
|
||||
// int count = iHxpcChargeOrderService.getCount(userId);
|
||||
// String state ="";
|
||||
// String discount ="";
|
||||
// if(count==0){
|
||||
// //活动折扣
|
||||
// Map<String, Object> promotion = iHxpcChargeOrderService.getPromotion();
|
||||
// if(promotion !=null){
|
||||
// //state 1.总金额 2.金额 3.服务费 discount 折扣率
|
||||
// state = promotion.get("state").toString();
|
||||
// discount = promotion.get("discount").toString();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //生成一条历史订单
|
||||
// XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder();
|
||||
// xhpcHistoryOrder.setChargeOrderId(hxpcChargeOrder.getChargeOrderId());
|
||||
// xhpcHistoryOrder.setChargingStationId(hxpcChargeOrder.getChargingStationId());
|
||||
// xhpcHistoryOrder.setUserId(userId);
|
||||
// xhpcHistoryOrder.setTerminalId(hxpcChargeOrder.getTerminalId());
|
||||
// xhpcHistoryOrder.setSerialNumber(hxpcChargeOrder.getSerialNumber());
|
||||
// xhpcHistoryOrder.setStartSoc(hxpcChargeOrder.getStartSoc());
|
||||
// xhpcHistoryOrder.setReconciliationStatus(0);
|
||||
// xhpcHistoryOrder.setSortingStatus(0);
|
||||
// xhpcHistoryOrder.setType(1);
|
||||
// xhpcHistoryOrder.setStatus(0);
|
||||
// xhpcHistoryOrder.setDelFlag(0);
|
||||
// xhpcHistoryOrder.setCreateTime(date);
|
||||
// //订单总价---运维服务费抽成
|
||||
// //结束时soc
|
||||
// xhpcHistoryOrderService.insert(xhpcHistoryOrder);
|
||||
//
|
||||
// //充电订单 --结束soc、充电时长、充电度数
|
||||
// hxpcChargeOrder.setEndTime(date);
|
||||
//
|
||||
// //实时数据存入MYsql、soc、电流、电压
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param status 状态
|
||||
* @param delFlag 是否删除
|
||||
@ -200,7 +265,7 @@ public class HxpcPileOrderController extends BaseController {
|
||||
*/
|
||||
private Long update(Integer status, Integer delFlag, String remark, String serialNumber, Integer type) {
|
||||
|
||||
HxpcChargeOrder hxpcChargeOrder = iHxpcChargeOrderService.getSerialNumberMessage(serialNumber);
|
||||
HxpcChargeOrder hxpcChargeOrder = hxpcChargeOrderService.getSerialNumberMessage(serialNumber);
|
||||
hxpcChargeOrder.setStatus(status);
|
||||
hxpcChargeOrder.setDelFlag(delFlag);
|
||||
hxpcChargeOrder.setErroRemark(remark);
|
||||
@ -211,7 +276,7 @@ public class HxpcPileOrderController extends BaseController {
|
||||
//充电订单 --结束soc、充电时长、充电度数
|
||||
hxpcChargeOrder.setEndTime(date);
|
||||
}
|
||||
iHxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
|
||||
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
|
||||
|
||||
return userId;
|
||||
}
|
||||
|
||||
@ -91,6 +91,9 @@ public class HxpcChargeOrder extends BaseEntity {
|
||||
/** 异常备注 */
|
||||
private String erroRemark;
|
||||
|
||||
/** 总金额 */
|
||||
private String amountCharged;
|
||||
|
||||
|
||||
public Long getChargeOrderId() {
|
||||
|
||||
@ -282,4 +285,14 @@ public class HxpcChargeOrder extends BaseEntity {
|
||||
this.erroRemark = erroRemark;
|
||||
}
|
||||
|
||||
public String getAmountCharged() {
|
||||
|
||||
return amountCharged;
|
||||
}
|
||||
|
||||
public void setAmountCharged(String amountCharged) {
|
||||
|
||||
this.amountCharged = amountCharged;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
<result column="charging_time" property="chargingTime"/>
|
||||
<result column="charging_degree" property="chargingDegree"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="erro_remark" property="erroRemark"/>
|
||||
<result column="amount_charged" property="amountCharged"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
||||
@ -120,6 +122,9 @@
|
||||
<if test="null != startSoc ">
|
||||
start_soc,
|
||||
</if>
|
||||
<if test="null != endSoc ">
|
||||
end_soc,
|
||||
</if>
|
||||
<if test="null != source ">
|
||||
source,
|
||||
</if>
|
||||
@ -145,7 +150,16 @@
|
||||
charging_time,
|
||||
</if>
|
||||
<if test="null != chargingDegree ">
|
||||
charging_degree
|
||||
charging_degree,
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
type,
|
||||
</if>
|
||||
<if test="null != erroRemark ">
|
||||
erro_remark,
|
||||
</if>
|
||||
<if test="null != amountCharged ">
|
||||
amount_charged
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -167,6 +181,9 @@
|
||||
<if test="null != startSoc ">
|
||||
#{startSoc},
|
||||
</if>
|
||||
<if test="null != endSoc ">
|
||||
#{endSoc},
|
||||
</if>
|
||||
<if test="null != source ">
|
||||
#{source},
|
||||
</if>
|
||||
@ -192,7 +209,16 @@
|
||||
#{chargingTime},
|
||||
</if>
|
||||
<if test="null != chargingDegree ">
|
||||
#{chargingDegree}
|
||||
#{chargingDegree},
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != erroRemark ">
|
||||
#{erroRemark},
|
||||
</if>
|
||||
<if test="null != amountCharged ">
|
||||
#{amountCharged}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@ -200,6 +226,7 @@
|
||||
<update id="updateXhpcChargeOrder" parameterType="com.xhpc.order.domain.HxpcChargeOrder">
|
||||
update xhpc_charge_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="startSoc != null">start_soc = #{startSoc},</if>
|
||||
<if test="endSoc != null">end_soc = #{endSoc},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
@ -207,6 +234,8 @@
|
||||
<if test="chargingTime != null">charging_time = #{chargingTime},</if>
|
||||
<if test="chargingDegree != null">charging_degree = #{chargingDegree},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="erroRemark != null">erro_remark = #{erroRemark},</if>
|
||||
<if test="amountCharged != null">amount_charged = #{amountCharged},</if>
|
||||
</trim>
|
||||
where charge_order_id = #{chargingStationId}
|
||||
</update>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user