Merge branch 'dev-zza' into dev

This commit is contained in:
Lemon
2025-04-12 16:09:37 +08:00
7 changed files with 612 additions and 4 deletions

View File

@@ -0,0 +1,173 @@
package com.jsowell.pile.domain;
import java.math.BigDecimal;
import com.jsowell.common.annotation.Excel;
import com.jsowell.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 电池充电算法记录对象 charge_algorithm_record
*
* @author jsowell
* @date 2025-04-12
*/
@Data
public class ChargeAlgorithmRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 订单编号
*/
@Excel(name = "订单编号")
private String orderCode;
/**
* 总体得分
*/
@Excel(name = "总体得分")
private String score;
/**
* 健康指标-soh
*/
@Excel(name = "健康指标-soh")
private BigDecimal capacityMetrics;
/**
* 健康指标-soe
*/
@Excel(name = "健康指标-soe")
private BigDecimal energyIndicator;
/**
* 健康指标-一致性
*/
@Excel(name = "健康指标-一致性")
private String consistency;
/**
* 温度一致性
*/
@Excel(name = "温度一致性")
private String tempConsistency;
/**
* 电压一致性
*/
@Excel(name = "电压一致性")
private String voltConsistency;
/**
* 容量一致性
*/
@Excel(name = "容量一致性")
private String capacityConsistency;
/**
* 健康指标-sot
*/
@Excel(name = "健康指标-sot")
private BigDecimal sot;
/**
* 安全指标-热失控
*/
@Excel(name = "安全指标-热失控")
private String thermalRunaway;
/**
* 安全指标-冷却系统
*/
@Excel(name = "安全指标-冷却系统")
private String cooling;
/**
* 安全指标-气密性
*/
@Excel(name = "安全指标-气密性")
private String seal;
/**
* 充电后 soc 值
*/
@Excel(name = "充电后 soc 值")
private String currentSoc;
/**
* 故障指标-Soc 跳变异常value:结果值result:结果为0正常其他异常 threshold:异常阈值)
*/
@Excel(name = "故障指标-Soc 跳变异常", readConverterExp = "v=alue:结果值result:结果为0正常其他异常,t=hreshold:异常阈值")
private String socAlarm;
/**
* 故障指标-温差异常
*/
@Excel(name = "故障指标-温差异常")
private String tempDiffAlarm;
/**
* 故障指标-温升异常value:结果值result:结果为0正常其他异常 threshold:异常阈值)
*/
@Excel(name = "故障指标-温升异常", readConverterExp = "v=alue:结果值result:结果为0正常其他异常,t=hreshold:异常阈值")
private String tempRiseAlarm;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String maxAllowableVoltageAlarm;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String maxAllowableElectricityAlarm;
/**
* 安全体系指标
*/
@Excel(name = "安全体系指标")
private String securitySystemLevel;
/**
* 故障体系指标
*/
@Excel(name = "故障体系指标")
private String failureMetrics;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId())
.append("orderCode", getOrderCode())
.append("score", getScore())
.append("capacityMetrics", getCapacityMetrics())
.append("energyIndicator", getEnergyIndicator())
.append("consistency", getConsistency())
.append("tempConsistency", getTempConsistency())
.append("voltConsistency", getVoltConsistency())
.append("capacityConsistency", getCapacityConsistency())
.append("sot", getSot())
.append("thermalRunaway", getThermalRunaway())
.append("cooling", getCooling())
.append("seal", getSeal())
.append("currentSoc", getCurrentSoc())
.append("socAlarm", getSocAlarm())
.append("tempDiffAlarm", getTempDiffAlarm())
.append("tempRiseAlarm", getTempRiseAlarm())
.append("maxAllowableVoltageAlarm", getMaxAllowableVoltageAlarm())
.append("maxAllowableElectricityAlarm", getMaxAllowableElectricityAlarm())
.append("securitySystemLevel", getSecuritySystemLevel())
.append("failureMetrics", getFailureMetrics())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@@ -0,0 +1,71 @@
package com.jsowell.pile.mapper;
import java.util.List;
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
/**
* 电池充电算法记录Mapper接口
*
* @author jsowell
* @date 2025-04-12
*/
@Repository
public interface ChargeAlgorithmRecordMapper {
/**
* 查询电池充电算法记录
*
* @param id 电池充电算法记录主键
* @return 电池充电算法记录
*/
public ChargeAlgorithmRecord selectChargeAlgorithmRecordById(Long id);
/**
* 查询电池充电算法记录列表
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 电池充电算法记录集合
*/
public List<ChargeAlgorithmRecord> selectChargeAlgorithmRecordList(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 新增电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
public int insertChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 修改电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
public int updateChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 删除电池充电算法记录
*
* @param id 电池充电算法记录主键
* @return 结果
*/
public int deleteChargeAlgorithmRecordById(Long id);
/**
* 批量删除电池充电算法记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteChargeAlgorithmRecordByIds(Long[] ids);
/**
* 通过订单号查询充电电池算法报告
* @param orderCode
* @return
*/
ChargeAlgorithmRecord queryRecordByOrderCode(String orderCode);
}

View File

@@ -0,0 +1,68 @@
package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
/**
* 电池充电算法记录Service接口
*
* @author jsowell
* @date 2025-04-12
*/
public interface ChargeAlgorithmRecordService {
/**
* 查询电池充电算法记录
*
* @param id 电池充电算法记录主键
* @return 电池充电算法记录
*/
public ChargeAlgorithmRecord selectChargeAlgorithmRecordById(Long id);
/**
* 查询电池充电算法记录列表
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 电池充电算法记录集合
*/
public List<ChargeAlgorithmRecord> selectChargeAlgorithmRecordList(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 新增电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
public int insertChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 修改电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
public int updateChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
/**
* 批量删除电池充电算法记录
*
* @param ids 需要删除的电池充电算法记录主键集合
* @return 结果
*/
public int deleteChargeAlgorithmRecordByIds(Long[] ids);
/**
* 删除电池充电算法记录信息
*
* @param id 电池充电算法记录主键
* @return 结果
*/
public int deleteChargeAlgorithmRecordById(Long id);
/**
* 通过订单号查询充电电池算法报告
* @param orderCode
* @return
*/
ChargeAlgorithmRecord queryRecordByOrderCode(String orderCode);
}

View File

@@ -0,0 +1,99 @@
package com.jsowell.pile.service.impl;
import java.util.List;
import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jsowell.pile.mapper.ChargeAlgorithmRecordMapper;
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
/**
* 电池充电算法记录Service业务层处理
*
* @author jsowell
* @date 2025-04-12
*/
@Service
public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordService {
@Autowired
private ChargeAlgorithmRecordMapper chargeAlgorithmRecordMapper;
/**
* 查询电池充电算法记录
*
* @param id 电池充电算法记录主键
* @return 电池充电算法记录
*/
@Override
public ChargeAlgorithmRecord selectChargeAlgorithmRecordById(Long id) {
return chargeAlgorithmRecordMapper.selectChargeAlgorithmRecordById(id);
}
/**
* 查询电池充电算法记录列表
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 电池充电算法记录
*/
@Override
public List<ChargeAlgorithmRecord> selectChargeAlgorithmRecordList(ChargeAlgorithmRecord chargeAlgorithmRecord) {
return chargeAlgorithmRecordMapper.selectChargeAlgorithmRecordList(chargeAlgorithmRecord);
}
/**
* 新增电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
@Override
public int insertChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord) {
chargeAlgorithmRecord.setCreateTime(DateUtils.getNowDate());
return chargeAlgorithmRecordMapper.insertChargeAlgorithmRecord(chargeAlgorithmRecord);
}
/**
* 修改电池充电算法记录
*
* @param chargeAlgorithmRecord 电池充电算法记录
* @return 结果
*/
@Override
public int updateChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord) {
return chargeAlgorithmRecordMapper.updateChargeAlgorithmRecord(chargeAlgorithmRecord);
}
/**
* 批量删除电池充电算法记录
*
* @param ids 需要删除的电池充电算法记录主键
* @return 结果
*/
@Override
public int deleteChargeAlgorithmRecordByIds(Long[] ids) {
return chargeAlgorithmRecordMapper.deleteChargeAlgorithmRecordByIds(ids);
}
/**
* 删除电池充电算法记录信息
*
* @param id 电池充电算法记录主键
* @return 结果
*/
@Override
public int deleteChargeAlgorithmRecordById(Long id) {
return chargeAlgorithmRecordMapper.deleteChargeAlgorithmRecordById(id);
}
/**
* 通过订单号查询充电电池算法报告
* @param orderCode
* @return
*/
@Override
public ChargeAlgorithmRecord queryRecordByOrderCode(String orderCode) {
return chargeAlgorithmRecordMapper.queryRecordByOrderCode(orderCode);
}
}

View File

@@ -8,18 +8,22 @@ import com.jsowell.adapay.dto.PaymentConfirmParam;
import com.jsowell.adapay.dto.SplitData;
import com.jsowell.adapay.response.PaymentConfirmResponse;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.model.LoginUser;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.AdapayMemberAccount;
import com.jsowell.pile.domain.OrderSplitRecord;
import com.jsowell.pile.domain.PileMerchantInfo;
import com.jsowell.pile.dto.QueryOrderSplitDTO;
import com.jsowell.pile.dto.SplitOrderDTO;
import com.jsowell.pile.mapper.OrderSplitRecordMapper;
import com.jsowell.pile.service.AdapayMemberAccountService;
import com.jsowell.pile.service.OrderSplitRecordService;
import com.jsowell.pile.service.PileMerchantInfoService;
import com.jsowell.pile.vo.OrderInfoDetailVO;
import com.jsowell.pile.vo.web.*;
import org.apache.commons.collections4.CollectionUtils;
@@ -28,10 +32,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -40,6 +41,9 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
@Resource
private OrderSplitRecordMapper orderSplitRecordMapper;
@Autowired
private PileMerchantInfoService pileMerchantInfoService;
@Autowired
private AdapayMemberAccountService adapayMemberAccountService;
@@ -264,6 +268,10 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
@Override
public PageResponse queryOrderSplitData(QueryOrderSplitDTO dto) {
List<SplitRecordInfoVO> resultList = new ArrayList<>();
// 获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
// 通过 depId 查询运营商记录表,如果查出来,则为运营商
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(String.valueOf(loginUser.getDeptId()));
// 设置分页参数
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
@@ -274,6 +282,7 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
List<String> orderCodes = orderSplitRecordMapper.queryOrderCodesByParams(dto);
PageInfo<String> pageInfo = new PageInfo<>(orderCodes);
// 查询符合条件的分账记录
List<OrderSplitRecordVO> orderSplitRecordVOS = orderSplitRecordMapper.queryOrderSplitData(pageInfo.getList());
// 根据 orderCode 分组
@@ -307,10 +316,21 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
.build();
orderSplitList.add(orderSplit);
}
// 对 orderSplitList 进行排序,将当前登录用户的分账记录放在第一条
if (pileMerchantInfo != null) {
for (int i = 0; i < orderSplitList.size(); i++) {
SplitRecordInfoVO.OrderSplit orderSplit = orderSplitList.get(i);
if (StringUtils.equals(String.valueOf(pileMerchantInfo.getId()), orderSplit.getMerchantId())) {
// 实则是调用swap()方法,将符合条件的记录与第一条记录进行位置互换
Collections.swap(orderSplitList, i, 0);
}
}
}
vo.setOrderSplitList(orderSplitList);
resultList.add(vo);
}
// 组装分页返回参数
PageResponse pageResponse = PageResponse.builder()
.pageSize(pageSize)

View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsowell.pile.mapper.ChargeAlgorithmRecordMapper">
<resultMap type="com.jsowell.pile.domain.ChargeAlgorithmRecord" id="ChargeAlgorithmRecordResult">
<result property="id" column="id" />
<result property="orderCode" column="order_code" />
<result property="score" column="score" />
<result property="capacityMetrics" column="capacity_metrics" />
<result property="energyIndicator" column="energy_indicator" />
<result property="consistency" column="consistency" />
<result property="tempConsistency" column="temp_consistency" />
<result property="voltConsistency" column="volt_consistency" />
<result property="capacityConsistency" column="capacity_consistency" />
<result property="sot" column="sot" />
<result property="thermalRunaway" column="thermal_runaway" />
<result property="cooling" column="cooling" />
<result property="seal" column="seal" />
<result property="currentSoc" column="current_soc" />
<result property="socAlarm" column="soc_alarm" />
<result property="tempDiffAlarm" column="temp_diff_alarm" />
<result property="tempRiseAlarm" column="temp_rise_alarm" />
<result property="maxAllowableVoltageAlarm" column="max_allowable_voltage_alarm" />
<result property="maxAllowableElectricityAlarm" column="max_allowable_electricity_alarm" />
<result property="securitySystemLevel" column="security_system_level" />
<result property="failureMetrics" column="failure_metrics" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectChargeAlgorithmRecordVo">
select id, order_code, score, capacity_metrics, energy_indicator, consistency, temp_consistency, volt_consistency, capacity_consistency, sot, thermal_runaway, cooling, seal, current_soc, soc_alarm, temp_diff_alarm, temp_rise_alarm, max_allowable_voltage_alarm, max_allowable_electricity_alarm, security_system_level, failure_metrics, create_time from charge_algorithm_record
</sql>
<select id="selectChargeAlgorithmRecordList" parameterType="com.jsowell.pile.domain.ChargeAlgorithmRecord" resultMap="ChargeAlgorithmRecordResult">
<include refid="selectChargeAlgorithmRecordVo"/>
<where>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="score != null and score != ''"> and score = #{score}</if>
<if test="capacityMetrics != null "> and capacity_metrics = #{capacityMetrics}</if>
<if test="energyIndicator != null "> and energy_indicator = #{energyIndicator}</if>
<if test="consistency != null and consistency != ''"> and consistency = #{consistency}</if>
<if test="tempConsistency != null and tempConsistency != ''"> and temp_consistency = #{tempConsistency}</if>
<if test="voltConsistency != null and voltConsistency != ''"> and volt_consistency = #{voltConsistency}</if>
<if test="capacityConsistency != null and capacityConsistency != ''"> and capacity_consistency = #{capacityConsistency}</if>
<if test="sot != null "> and sot = #{sot}</if>
<if test="thermalRunaway != null and thermalRunaway != ''"> and thermal_runaway = #{thermalRunaway}</if>
<if test="cooling != null and cooling != ''"> and cooling = #{cooling}</if>
<if test="seal != null and seal != ''"> and seal = #{seal}</if>
<if test="currentSoc != null and currentSoc != ''"> and current_soc = #{currentSoc}</if>
<if test="socAlarm != null and socAlarm != ''"> and soc_alarm = #{socAlarm}</if>
<if test="tempDiffAlarm != null and tempDiffAlarm != ''"> and temp_diff_alarm = #{tempDiffAlarm}</if>
<if test="tempRiseAlarm != null and tempRiseAlarm != ''"> and temp_rise_alarm = #{tempRiseAlarm}</if>
<if test="maxAllowableVoltageAlarm != null and maxAllowableVoltageAlarm != ''"> and max_allowable_voltage_alarm = #{maxAllowableVoltageAlarm}</if>
<if test="maxAllowableElectricityAlarm != null and maxAllowableElectricityAlarm != ''"> and max_allowable_electricity_alarm = #{maxAllowableElectricityAlarm}</if>
<if test="securitySystemLevel != null and securitySystemLevel != ''"> and security_system_level = #{securitySystemLevel}</if>
<if test="failureMetrics != null and failureMetrics != ''"> and failure_metrics = #{failureMetrics}</if>
</where>
</select>
<select id="selectChargeAlgorithmRecordById" parameterType="Long" resultMap="ChargeAlgorithmRecordResult">
<include refid="selectChargeAlgorithmRecordVo"/>
where id = #{id}
</select>
<insert id="insertChargeAlgorithmRecord" parameterType="com.jsowell.pile.domain.ChargeAlgorithmRecord" useGeneratedKeys="true" keyProperty="id">
insert into charge_algorithm_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null">order_code,</if>
<if test="score != null">score,</if>
<if test="capacityMetrics != null">capacity_metrics,</if>
<if test="energyIndicator != null">energy_indicator,</if>
<if test="consistency != null">consistency,</if>
<if test="tempConsistency != null">temp_consistency,</if>
<if test="voltConsistency != null">volt_consistency,</if>
<if test="capacityConsistency != null">capacity_consistency,</if>
<if test="sot != null">sot,</if>
<if test="thermalRunaway != null">thermal_runaway,</if>
<if test="cooling != null">cooling,</if>
<if test="seal != null">seal,</if>
<if test="currentSoc != null">current_soc,</if>
<if test="socAlarm != null">soc_alarm,</if>
<if test="tempDiffAlarm != null">temp_diff_alarm,</if>
<if test="tempRiseAlarm != null">temp_rise_alarm,</if>
<if test="maxAllowableVoltageAlarm != null">max_allowable_voltage_alarm,</if>
<if test="maxAllowableElectricityAlarm != null">max_allowable_electricity_alarm,</if>
<if test="securitySystemLevel != null">security_system_level,</if>
<if test="failureMetrics != null">failure_metrics,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderCode != null">#{orderCode},</if>
<if test="score != null">#{score},</if>
<if test="capacityMetrics != null">#{capacityMetrics},</if>
<if test="energyIndicator != null">#{energyIndicator},</if>
<if test="consistency != null">#{consistency},</if>
<if test="tempConsistency != null">#{tempConsistency},</if>
<if test="voltConsistency != null">#{voltConsistency},</if>
<if test="capacityConsistency != null">#{capacityConsistency},</if>
<if test="sot != null">#{sot},</if>
<if test="thermalRunaway != null">#{thermalRunaway},</if>
<if test="cooling != null">#{cooling},</if>
<if test="seal != null">#{seal},</if>
<if test="currentSoc != null">#{currentSoc},</if>
<if test="socAlarm != null">#{socAlarm},</if>
<if test="tempDiffAlarm != null">#{tempDiffAlarm},</if>
<if test="tempRiseAlarm != null">#{tempRiseAlarm},</if>
<if test="maxAllowableVoltageAlarm != null">#{maxAllowableVoltageAlarm},</if>
<if test="maxAllowableElectricityAlarm != null">#{maxAllowableElectricityAlarm},</if>
<if test="securitySystemLevel != null">#{securitySystemLevel},</if>
<if test="failureMetrics != null">#{failureMetrics},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateChargeAlgorithmRecord" parameterType="com.jsowell.pile.domain.ChargeAlgorithmRecord">
update charge_algorithm_record
<trim prefix="SET" suffixOverrides=",">
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="score != null">score = #{score},</if>
<if test="capacityMetrics != null">capacity_metrics = #{capacityMetrics},</if>
<if test="energyIndicator != null">energy_indicator = #{energyIndicator},</if>
<if test="consistency != null">consistency = #{consistency},</if>
<if test="tempConsistency != null">temp_consistency = #{tempConsistency},</if>
<if test="voltConsistency != null">volt_consistency = #{voltConsistency},</if>
<if test="capacityConsistency != null">capacity_consistency = #{capacityConsistency},</if>
<if test="sot != null">sot = #{sot},</if>
<if test="thermalRunaway != null">thermal_runaway = #{thermalRunaway},</if>
<if test="cooling != null">cooling = #{cooling},</if>
<if test="seal != null">seal = #{seal},</if>
<if test="currentSoc != null">current_soc = #{currentSoc},</if>
<if test="socAlarm != null">soc_alarm = #{socAlarm},</if>
<if test="tempDiffAlarm != null">temp_diff_alarm = #{tempDiffAlarm},</if>
<if test="tempRiseAlarm != null">temp_rise_alarm = #{tempRiseAlarm},</if>
<if test="maxAllowableVoltageAlarm != null">max_allowable_voltage_alarm = #{maxAllowableVoltageAlarm},</if>
<if test="maxAllowableElectricityAlarm != null">max_allowable_electricity_alarm = #{maxAllowableElectricityAlarm},</if>
<if test="securitySystemLevel != null">security_system_level = #{securitySystemLevel},</if>
<if test="failureMetrics != null">failure_metrics = #{failureMetrics},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteChargeAlgorithmRecordById" parameterType="Long">
delete from charge_algorithm_record where id = #{id}
</delete>
<delete id="deleteChargeAlgorithmRecordByIds" parameterType="String">
delete from charge_algorithm_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="queryRecordByOrderCode" resultMap="ChargeAlgorithmRecordResult">
<include refid="selectChargeAlgorithmRecordVo"/>
where order_code = #{orderCode,jdbcType=VARCHAR}
</select>
</mapper>

View File

@@ -9,7 +9,9 @@ import com.jsowell.common.core.domain.ykc.*;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
import com.jsowell.pile.domain.OrderSplitRecord;
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.service.PileBasicInfoService;
import com.jsowell.pile.service.PileStationInfoService;
@@ -52,6 +54,9 @@ public class ChargeAlgorithmService {
@Autowired
private PileStationInfoService pileStationInfoService;
@Autowired
private ChargeAlgorithmRecordService chargeAlgorithmRecordService;
@Autowired
private RedisCache redisCache;
@@ -169,6 +174,18 @@ public class ChargeAlgorithmService {
String response = HttpRequest.post(url).header("clientId", clientId).body(JSON.toJSONString(jsonObject)).execute().body();
log.info("发送请求收到回复 response:{}", response);
// 将返回结果转化为json
Map<String, Object> map = (Map<String, Object>) JSON.parse(response);
String resultCode = String.valueOf(map.get("code"));
if (StringUtils.equals("200", resultCode)) {
// 请求成功,将数据报告保存到数据库
ChargeAlgorithmRecord record = chargeAlgorithmRecordService.queryRecordByOrderCode(orderCode);
if (record == null) {
String jsonString = JSON.toJSONString(map.get("data"));
record = JSON.parseObject(jsonString, ChargeAlgorithmRecord.class);
chargeAlgorithmRecordService.insertChargeAlgorithmRecord(record);
}
}
return response;
}