修改桩回调实体类,增加桩订单字段

This commit is contained in:
yuyang 2021-08-17 11:41:46 +08:00
parent 374036ed76
commit e7ae59dad2
4 changed files with 121 additions and 14 deletions

View File

@ -12,7 +12,7 @@ public class PileEndOrder {
private Integer chargingTime; //累计充电时间 private Integer chargingTime; //累计充电时间
private Integer chargingDegree; //充电度数 private Integer chargingDegree; //充电度数
private Integer amountCharged; //已充金额 private Integer amountCharged; //已充金额
private Integer erroRemark; //备注 private String erroRemark; //备注
public String getOrderNo() { public String getOrderNo() {
@ -75,12 +75,12 @@ public class PileEndOrder {
this.chargingDegree = chargingDegree; this.chargingDegree = chargingDegree;
} }
public Integer getErroRemark() { public String getErroRemark() {
return erroRemark; return erroRemark;
} }
public void setErroRemark(Integer erroRemark) { public void setErroRemark(String erroRemark) {
this.erroRemark = erroRemark; this.erroRemark = erroRemark;
} }

View File

@ -7,13 +7,16 @@ import com.xhpc.common.api.PileOrderService;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController; 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.dto.PileEndOrder;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.util.ConnectionRabbitMQUtil; import com.xhpc.common.util.ConnectionRabbitMQUtil;
import com.xhpc.order.domain.HxpcChargeOrder; import com.xhpc.order.domain.HxpcChargeOrder;
import com.xhpc.order.service.IHxpcChargeOrderService; import com.xhpc.order.service.IHxpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -28,7 +31,7 @@ public class HxpcPileOrderController extends BaseController {
private RedisService redisService; private RedisService redisService;
@Autowired @Autowired
private IHxpcChargeOrderService iHxpcChargeOrderService; private IHxpcChargeOrderService hxpcChargeOrderService;
@Autowired @Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService; private IXhpcHistoryOrderService xhpcHistoryOrderService;
@ -128,17 +131,32 @@ public class HxpcPileOrderController extends BaseController {
/** /**
* 桩订单结束回调 * 桩订单结束回调
* *
* @param orderNo 订单号
* @param status 状态 1正常 2异常
* @param remark 备注
* @return
*/ */
@GetMapping("/pileEndOrder") @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]; 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(); // 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);
//
// //实时数据存入MYsqlsoc电流电压
}
/** /**
* @param status 状态 * @param status 状态
* @param delFlag 是否删除 * @param delFlag 是否删除
@ -200,7 +265,7 @@ public class HxpcPileOrderController extends BaseController {
*/ */
private Long update(Integer status, Integer delFlag, String remark, String serialNumber, Integer type) { 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.setStatus(status);
hxpcChargeOrder.setDelFlag(delFlag); hxpcChargeOrder.setDelFlag(delFlag);
hxpcChargeOrder.setErroRemark(remark); hxpcChargeOrder.setErroRemark(remark);
@ -211,7 +276,7 @@ public class HxpcPileOrderController extends BaseController {
//充电订单 --结束soc充电时长充电度数 //充电订单 --结束soc充电时长充电度数
hxpcChargeOrder.setEndTime(date); hxpcChargeOrder.setEndTime(date);
} }
iHxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder); hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
return userId; return userId;
} }

View File

@ -91,6 +91,9 @@ public class HxpcChargeOrder extends BaseEntity {
/** 异常备注 */ /** 异常备注 */
private String erroRemark; private String erroRemark;
/** 总金额 */
private String amountCharged;
public Long getChargeOrderId() { public Long getChargeOrderId() {
@ -282,4 +285,14 @@ public class HxpcChargeOrder extends BaseEntity {
this.erroRemark = erroRemark; this.erroRemark = erroRemark;
} }
public String getAmountCharged() {
return amountCharged;
}
public void setAmountCharged(String amountCharged) {
this.amountCharged = amountCharged;
}
} }

View File

@ -28,6 +28,8 @@
<result column="charging_time" property="chargingTime"/> <result column="charging_time" property="chargingTime"/>
<result column="charging_degree" property="chargingDegree"/> <result column="charging_degree" property="chargingDegree"/>
<result column="type" property="type"/> <result column="type" property="type"/>
<result column="erro_remark" property="erroRemark"/>
<result column="amount_charged" property="amountCharged"/>
</resultMap> </resultMap>
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal"> <resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
@ -120,6 +122,9 @@
<if test="null != startSoc "> <if test="null != startSoc ">
start_soc, start_soc,
</if> </if>
<if test="null != endSoc ">
end_soc,
</if>
<if test="null != source "> <if test="null != source ">
source, source,
</if> </if>
@ -145,7 +150,16 @@
charging_time, charging_time,
</if> </if>
<if test="null != chargingDegree "> <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> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -167,6 +181,9 @@
<if test="null != startSoc "> <if test="null != startSoc ">
#{startSoc}, #{startSoc},
</if> </if>
<if test="null != endSoc ">
#{endSoc},
</if>
<if test="null != source "> <if test="null != source ">
#{source}, #{source},
</if> </if>
@ -192,7 +209,16 @@
#{chargingTime}, #{chargingTime},
</if> </if>
<if test="null != chargingDegree "> <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> </if>
</trim> </trim>
</insert> </insert>
@ -200,6 +226,7 @@
<update id="updateXhpcChargeOrder" parameterType="com.xhpc.order.domain.HxpcChargeOrder"> <update id="updateXhpcChargeOrder" parameterType="com.xhpc.order.domain.HxpcChargeOrder">
update xhpc_charge_order update xhpc_charge_order
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="startSoc != null">start_soc = #{startSoc},</if>
<if test="endSoc != null">end_soc = #{endSoc},</if> <if test="endSoc != null">end_soc = #{endSoc},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
@ -207,6 +234,8 @@
<if test="chargingTime != null">charging_time = #{chargingTime},</if> <if test="chargingTime != null">charging_time = #{chargingTime},</if>
<if test="chargingDegree != null">charging_degree = #{chargingDegree},</if> <if test="chargingDegree != null">charging_degree = #{chargingDegree},</if>
<if test="type != null">type = #{type},</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> </trim>
where charge_order_id = #{chargingStationId} where charge_order_id = #{chargingStationId}
</update> </update>