插入充电历史

This commit is contained in:
liuhanqing
2025-12-01 13:31:11 +08:00
parent d765c0a8cb
commit b832cf2214
5 changed files with 60 additions and 30 deletions

View File

@@ -5,15 +5,15 @@ import com.ruoyi.job.charg.domain.SrgvChargingJob;
/**
* 充电任务Mapper接口
*
*
* @author ruoyi
* @date 2025-11-21
*/
public interface SrgvChargingJobMapper
public interface SrgvChargingJobMapper
{
/**
* 查询充电任务
*
*
* @param guid 充电任务主键
* @return 充电任务
*/
@@ -21,7 +21,7 @@ public interface SrgvChargingJobMapper
/**
* 查询充电任务列表
*
*
* @param srgvChargingJob 充电任务
* @return 充电任务集合
*/
@@ -29,7 +29,7 @@ public interface SrgvChargingJobMapper
/**
* 新增充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -37,7 +37,7 @@ public interface SrgvChargingJobMapper
/**
* 修改充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface SrgvChargingJobMapper
/**
* 删除充电任务
*
*
* @param guid 充电任务主键
* @return 结果
*/
@@ -53,9 +53,14 @@ public interface SrgvChargingJobMapper
/**
* 批量删除充电任务
*
*
* @param guids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSrgvChargingJobByGuids(String[] guids);
/**
* 插入充电任务历史
* @param guid
*/
void insertHistory(String guid);
}

View File

@@ -5,15 +5,15 @@ import com.ruoyi.job.charg.domain.SrgvChargingJob;
/**
* 充电任务Service接口
*
*
* @author ruoyi
* @date 2025-11-21
*/
public interface ISrgvChargingJobService
public interface ISrgvChargingJobService
{
/**
* 查询充电任务
*
*
* @param guid 充电任务主键
* @return 充电任务
*/
@@ -21,7 +21,7 @@ public interface ISrgvChargingJobService
/**
* 查询充电任务列表
*
*
* @param srgvChargingJob 充电任务
* @return 充电任务集合
*/
@@ -29,7 +29,7 @@ public interface ISrgvChargingJobService
/**
* 新增充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -37,7 +37,7 @@ public interface ISrgvChargingJobService
/**
* 修改充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface ISrgvChargingJobService
/**
* 批量删除充电任务
*
*
* @param guids 需要删除的充电任务主键集合
* @return 结果
*/
@@ -53,9 +53,14 @@ public interface ISrgvChargingJobService
/**
* 删除充电任务信息
*
*
* @param guid 充电任务主键
* @return 结果
*/
public int deleteSrgvChargingJobByGuid(String guid);
/**
* 插入充电任务历史
* @param guid
*/
void insertHistory(String guid);
}

View File

@@ -9,19 +9,19 @@ import com.ruoyi.job.charg.service.ISrgvChargingJobService;
/**
* 充电任务Service业务层处理
*
*
* @author ruoyi
* @date 2025-11-21
*/
@Service
public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
{
@Autowired
private SrgvChargingJobMapper srgvChargingJobMapper;
/**
* 查询充电任务
*
*
* @param guid 充电任务主键
* @return 充电任务
*/
@@ -33,7 +33,7 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
/**
* 查询充电任务列表
*
*
* @param srgvChargingJob 充电任务
* @return 充电任务
*/
@@ -45,7 +45,7 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
/**
* 新增充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -57,7 +57,7 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
/**
* 修改充电任务
*
*
* @param srgvChargingJob 充电任务
* @return 结果
*/
@@ -69,7 +69,7 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
/**
* 批量删除充电任务
*
*
* @param guids 需要删除的充电任务主键
* @return 结果
*/
@@ -81,7 +81,7 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
/**
* 删除充电任务信息
*
*
* @param guid 充电任务主键
* @return 结果
*/
@@ -90,4 +90,13 @@ public class SrgvChargingJobServiceImpl implements ISrgvChargingJobService
{
return srgvChargingJobMapper.deleteSrgvChargingJobByGuid(guid);
}
/**
* 插入充电任务历史
* @param guid
*/
@Override
public void insertHistory(String guid) {
srgvChargingJobMapper.insertHistory(guid);
}
}

View File

@@ -153,6 +153,10 @@ public class CdzThread implements Runnable {
srgvChargingJob.setChargingStatus("1");
srgvChargingJob.setChargingDate(DateUtil.formatDateTime(DateUtil.date()));
chargingJobService.updateSrgvChargingJob(srgvChargingJob);
//插入历史
chargingJobService.insertHistory(srgvChargingJob.getGuid());
chargingJobService.deleteSrgvChargingJobByGuid(srgvChargingJob.getGuid());
}
}
@@ -227,7 +231,10 @@ public class CdzThread implements Runnable {
List<SrgvChargingJob> srgvChargingJobs = chargingJobService.selectSrgvChargingJobList(srgvChargingJobParam);
if (CollUtil.isNotEmpty(srgvChargingJobs)) {
SrgvChargingJob scj = srgvChargingJobs.get(0);
//scj.setGuid(IdUtil.fastSimpleUUID());
//插入历史
chargingJobService.insertHistory(scj.getGuid());
scj.setChargingSite(cdz.getSiteId());
scj.setJobStatus("1");
scj.setChargingStatus("0");

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.job.charg.mapper.SrgvChargingJobMapper">
<resultMap type="SrgvChargingJob" id="SrgvChargingJobResult">
<result property="guid" column="guid" />
<result property="chargingSite" column="charging_site" />
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSrgvChargingJobList" parameterType="SrgvChargingJob" resultMap="SrgvChargingJobResult">
<include refid="selectSrgvChargingJobVo"/>
<where>
<where>
<if test="chargingSite != null and chargingSite != ''"> and charging_site = #{chargingSite}</if>
<if test="jobStatus != null and jobStatus != ''"> and job_status = #{jobStatus}</if>
<if test="chargingStatus != null and chargingStatus != ''"> and charging_status = #{chargingStatus}</if>
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="chargingId != null and chargingId != ''"> and charging_id = #{chargingId}</if>
</where>
</select>
<select id="selectSrgvChargingJobByGuid" parameterType="String" resultMap="SrgvChargingJobResult">
<include refid="selectSrgvChargingJobVo"/>
where guid = #{guid}
@@ -64,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="chargingId != null">#{chargingId},</if>
</trim>
</insert>
<insert id="insertHistory">
insert into srgv_charging_job_finish
select * from srgv_charging_job where guid = #{guid}
</insert>
<update id="updateSrgvChargingJob" parameterType="SrgvChargingJob">
update srgv_charging_job
@@ -85,9 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteSrgvChargingJobByGuids" parameterType="String">
delete from srgv_charging_job where guid in
delete from srgv_charging_job where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
</mapper>
</mapper>