车牌页面已完成

This commit is contained in:
yuyang 2023-11-07 09:36:04 +08:00
parent f2d2b41223
commit 92886f6ff8
8 changed files with 281 additions and 7 deletions

View File

@ -3,11 +3,18 @@ package com.xhpc.charging.station.controller;
import com.xhpc.charging.station.service.IXhpcBarrierGateService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.domain.XhpcBarrierGate;
import com.xhpc.common.domain.XhpcEquipmentAccident;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/barrierGate")
@ -21,5 +28,40 @@ public class XhpcBarrierGateController extends BaseController {
return xhpcBarrierGateService.getBarrierGateList();
}
@GetMapping("/list")
public TableDataInfo list(HttpServletRequest request, String barrierGateCompany) {
List<Map<String, Object>> list = xhpcBarrierGateService.getLsit(barrierGateCompany);
return getDataTable(list);
}
@PostMapping(value = "/addBarrierGate")
public R addXhpcEquipmentAccident(@RequestBody XhpcBarrierGate xhpcBarrierGate) {
return xhpcBarrierGateService.insertBarrierGate(xhpcBarrierGate);
}
@PostMapping(value = "/updateBarrierGate")
public R updateBarrierGate(@RequestBody XhpcBarrierGate xhpcBarrierGate) {
return xhpcBarrierGateService.updateBarrierGate(xhpcBarrierGate);
}
@Log(title = "删除道闸", businessType = BusinessType.DELETE)
@GetMapping("/deleteBarrierGateById")
public R deleteBarrierGateById(Long barrierGateId) {
return xhpcBarrierGateService.deleteBarrierGateById(barrierGateId);
}
@GetMapping("/getXhpcBarrierGateById")
public R getXhpcBarrierGateById(Long barrierGateId) {
Map<String, Object> map = xhpcBarrierGateService.getXhpcBarrierGateById(barrierGateId);
return R.ok(map);
}
/**
* 定时任务时间
*/
@Scheduled(cron = "0 0 12 * * ? ")
@GetMapping("/getEndTimeExpire")
public void getEndTimeExpire(){
xhpcBarrierGateService.getEndTimeExpire();
}
}

View File

@ -47,7 +47,7 @@ public class XhpcEquipmentAccidentController extends BaseController {
return R.ok(map);
}
@Log(title = "删除电站", businessType = BusinessType.DELETE)
@Log(title = "删除事故", businessType = BusinessType.DELETE)
@GetMapping("/deleteXhpcEquipmentAccidentById")
public R deleteXhpcEquipmentAccidentById(Long equipmentAccidentId) {
return xhpcEquipmentAccidentService.deleteXhpcEquipmentAccidentById(equipmentAccidentId);

View File

@ -1,5 +1,9 @@
package com.xhpc.charging.station.mapper;
import com.xhpc.common.domain.XhpcBarrierGate;
import com.xhpc.common.domain.XhpcEquipmentAccident;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map;
@ -7,5 +11,19 @@ public interface XhpcBarrierGateMapper {
List<Map<String, Object>> getBarrierGateList();
List<Map<String,Object>> getLsit(@Param("barrierGateCompany")String barrierGateCompany);
void insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
void updateBarrierGate(XhpcBarrierGate xhpcBarrierGate);
void deleteBarrierGateById(@Param("barrierGateId")Long barrierGateId);
Map<String,Object> getXhpcBarrierGateById(@Param("barrierGateId")Long barrierGateId);
List<Long> getBarrierGateEndTime(@Param("date")String date);
void updateBarrierGateStatus(@Param("barrierGateId")Long barrierGateId);
}

View File

@ -1,9 +1,27 @@
package com.xhpc.charging.station.service;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.domain.XhpcBarrierGate;
import com.xhpc.common.domain.XhpcEquipmentAccident;
import java.util.List;
import java.util.Map;
public interface IXhpcBarrierGateService {
R getBarrierGateList();
List<Map<String, Object>> getLsit(String barrierGateCompany);
R insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
R updateBarrierGate(XhpcBarrierGate xhpcBarrierGate);
R deleteBarrierGateById(Long barrierGateId);
Map<String, Object> getXhpcBarrierGateById(Long barrierGateId );
void getEndTimeExpire();
}

View File

@ -1,11 +1,16 @@
package com.xhpc.charging.station.service;
import cn.hutool.core.date.DateUtil;
import com.xhpc.charging.station.mapper.XhpcBarrierGateMapper;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcBarrierGate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class XhpcBarrierGateServiceImpl extends BaseService implements IXhpcBarrierGateService{
@ -16,4 +21,45 @@ public class XhpcBarrierGateServiceImpl extends BaseService implements IXhpcBarr
public R getBarrierGateList() {
return R.ok(xhpcBarrierGateMapper.getBarrierGateList());
}
@Override
public List<Map<String, Object>> getLsit(String barrierGateCompany) {
return xhpcBarrierGateMapper.getLsit(barrierGateCompany);
}
@Override
public R insertBarrierGate(XhpcBarrierGate xhpcBarrierGate) {
if(xhpcBarrierGate.getBarrierGateId() !=null){
xhpcBarrierGateMapper.updateBarrierGate(xhpcBarrierGate);
}else {
xhpcBarrierGateMapper.insertBarrierGate(xhpcBarrierGate);
}
return R.ok();
}
@Override
public R updateBarrierGate(XhpcBarrierGate xhpcBarrierGate) {
return null;
}
@Override
public R deleteBarrierGateById(Long barrierGateId) {
xhpcBarrierGateMapper.deleteBarrierGateById(barrierGateId);
return R.ok();
}
@Override
public Map<String, Object> getXhpcBarrierGateById(Long barrierGateId) {
return xhpcBarrierGateMapper.getXhpcBarrierGateById(barrierGateId);
}
@Override
public void getEndTimeExpire() {
List<Long> barrierGateEndTime = xhpcBarrierGateMapper.getBarrierGateEndTime(DateUtil.now());
for (int i = 0; i <barrierGateEndTime.size() ; i++) {
xhpcBarrierGateMapper.updateBarrierGateStatus(barrierGateEndTime.get(i));
}
}
}

View File

@ -27,6 +27,154 @@
from xhpc_barrier_gate where status =0 and del_flag =0
</select>
<select id="getLsit" resultType="map">
select
barrier_gate_id as barrierGateId,
barrier_gate_company as barrierGateCompany,
start_time as startTime,
end_time as endTime
from xhpc_barrier_gate where del_flag =0
<if test="barrierGateCompany !=null and barrierGateCompany !=''">
and barrier_gate_company like CONCAT('%',#{barrierGateCompany},'%')
</if>
order by create_time desc
</select>
<insert id="insertBarrierGate">
insert into xhpc_barrier_gate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
barrier_gate_company,
</if>
<if test="null != startTime">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
#{barrierGateCompany},
</if>
<if test="null != startTime">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != tenantId ">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateBarrierGate">
update xhpc_barrier_gate
<trim prefix="SET" suffixOverrides=",">
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
barrier_gate_company=#{barrierGateCompany},
</if>
<if test="null != startTime">
start_time=#{startTime},
</if>
<if test="null != endTime ">
end_time=#{endTime},
</if>
<if test="null != status">
status=#{status},
</if>
<if test="null != delFlag ">
del_flag = #{delFlag},
</if>
<if test="null != createTime ">
create_time = #{createTime},
</if>
<if test="null != createBy and '' != createBy">
create_by = #{createBy},
</if>
<if test="null != updateTime ">
update_time = #{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
update_by =#{updateBy},
</if>
<if test="null != remark and '' != remark">
remark =#{remark},
</if>
<if test="null != tenantId ">
tenant_id =#{tenantId},
</if>
</trim>
where barrier_gate_id = #{barrierGateId}
</update>
<update id="deleteBarrierGateById">
update xhpc_barrier_gate set del_flag =1 where barrier_gate_id = #{barrierGateId}
</update>
<select id="getXhpcBarrierGateById" resultType="map">
select
barrier_gate_id as barrierGateId,
barrier_gate_company as barrierGateCompany,
start_time as startTime,
end_time as endTime
from xhpc_barrier_gate
where barrier_gate_id = #{barrierGateId}
</select>
<select id="getBarrierGateEndTime" resultType="Long">
select barrier_gate_id as barrierGateId from xhpc_barrier_gate where end_time &lt; #{date}
</select>
<update id="updateBarrierGateStatus">
update xhpc_barrier_gate set status =1 where barrier_gate_id = #{barrierGateId}
</update>
</mapper>

View File

@ -366,9 +366,7 @@
<if test="null != videoMonitor ">
video_monitor=#{videoMonitor},
</if>
<if test="null != barrierGateId ">
barrier_gate_id=#{barrierGateId},
</if>
</trim>
where charging_station_id = #{chargingStationId}
</update>

View File

@ -1,9 +1,11 @@
package com.xhpc.common.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
@Data
public class XhpcBarrierGate extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -11,7 +13,7 @@ public class XhpcBarrierGate extends BaseEntity {
/** 道闸id */
private Long barrierGateId;
/** 道闸公司名称 */
private Long barrierGateCompany;
private String barrierGateCompany;
/** 有效开始时间 */
private Date startTime;
@ -21,4 +23,6 @@ public class XhpcBarrierGate extends BaseEntity {
/** 帐号状态0 正常 1已过期 */
private Integer status;
private Integer delFlag;
}