main
吴顺杰 2 months ago
parent e9adc154d9
commit f6e9cbd9c7

@ -36,7 +36,7 @@ public class LineController extends BaseController {
@Resource @Resource
private LineService lineService; private LineService lineService;
@ApiOperation(value = "根据车辆id查询线路,装备,人员,标的物", response = GetCarIdInfoResponse.class) @ApiOperation(value = "根据任务id查询线路,装备,人员,标的物", response = GetCarIdInfoResponse.class)
@GetMapping("/getCarIdInfo/{id}") @GetMapping("/getCarIdInfo/{id}")
public AjaxResult getCarIdInfo(@PathVariable String id) { public AjaxResult getCarIdInfo(@PathVariable String id) {
return success(lineService.getCarIdInfo(id)); return success(lineService.getCarIdInfo(id));

@ -0,0 +1,101 @@
package com.ykMap.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ykMap.base.controller.BaseController;
import com.ykMap.base.domain.AjaxResult;
import com.ykMap.entity.TaskMission;
import com.ykMap.service.TaskMissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.Serializable;
/**
* 'task_mission(TaskMission)
*
* @author wu
* @since 2024-09-19 13:15:12
*/
@RestController
@RequestMapping("/ykmap/taskMission")
@Api(tags = "'task_mission")
@Transactional(rollbackFor = Exception.class)
public class TaskMissionController extends BaseController {
/**
*
*/
@Resource
private TaskMissionService taskMissionService;
/**
*
*
* @param page
* @param taskMission
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询'task_mission", response = TaskMission.class)
public AjaxResult page(Page<TaskMission> page, TaskMission taskMission) {
return success(taskMissionService.page(page, new QueryWrapper<>(taskMission)));
}
/**
*
*
* @param taskMission
* @return
*/
@GetMapping("/findAll")
@ApiOperation(value = "条件查询'task_mission", response = TaskMission.class)
public AjaxResult page(TaskMission taskMission) {
return success(taskMissionService.list(new QueryWrapper<>(taskMission)));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条'task_mission", response = TaskMission.class)
public AjaxResult getById(@PathVariable Serializable id) {
return success(taskMissionService.getById(id));
}
/**
*
*
* @param plateNum
* @return
*/
@GetMapping("findByPlateNum")
@ApiOperation(value = "根据车牌号查询task_mission", response = TaskMission.class)
public AjaxResult findByPlateNum(String plateNum) {
return success(taskMissionService.findByPlateNum(plateNum));
}
/**
* task_mission
*
* @param plateNum
* @return
*/
@GetMapping("findByPlateNums")
@ApiOperation(value = "根据多个车牌号查询task_mission", response = TaskMission.class)
public AjaxResult findByPlateNums(String plateNum) {
return success(taskMissionService.findByPlateNums(plateNum));
}
}

@ -0,0 +1,158 @@
package com.ykMap.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 'task_mission(TaskMission)
*
* @author wu
* @since 2024-09-19 13:15:13
*/
@Data
@ApiModel("task_mission实体类")
@TableName(value = "task_mission")
public class TaskMission implements Serializable {
private static final long serialVersionUID = -20548411213691388L;
private String id;
private Integer isDelete;
private String updateUser;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String remark;
/**
*
*/
@ApiModelProperty(value = "任务名称")
private String name;
/**
*
*/
@ApiModelProperty(value = "任务日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date missionDate;
/**
*
*/
@ApiModelProperty(value = "固定任务;临时任务")
private String missionType;
/**
* id
*/
@ApiModelProperty(value = "车组模板id")
private String taskGroupTemplateId;
/**
* id
*/
@ApiModelProperty(value = "车组考勤小组id")
private String attGroupId;
/**
*
*/
@ApiModelProperty(value = "任务状态:已编排、执行中、交接完成、已结束")
private String missionState;
/**
*
*/
@ApiModelProperty(value = "任务开始时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**
*
*/
@ApiModelProperty(value = "任务结束时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
*
*/
@ApiModelProperty(value = "是否提前交接")
private Integer isEarlyHandover;
/**
*
*/
@ApiModelProperty(value = "是否延后交接")
private Integer isLateHandover;
/**
* id
*/
@ApiModelProperty(value = "编排人id")
private String operatorId;
/**
* -
*/
@ApiModelProperty(value = "编排人信息(工号-姓名)")
private String operatorInfo;
/**
*
*/
@ApiModelProperty(value = "编排时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date operateTime;
/**
* 线id
*/
@ApiModelProperty(value = "路线id")
private String taskRouteId;
/**
*
*/
@ApiModelProperty(value = "出车时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date departureTime;
/**
*
*/
@ApiModelProperty(value = "任务分类:早送、晚接、中间、维护车、清机")
private String missionCategory;
/**
* id
*/
@ApiModelProperty(value = "本车车辆id")
private String originalVehicleId;
/**
*
*/
@ApiModelProperty(value = "车牌号")
@TableField(exist = false)
private String plateNum;
}

@ -0,0 +1,33 @@
package com.ykMap.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ykMap.entity.TaskMission;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 'task_mission(TaskMission)访
*
* @author wu
* @since 2024-09-19 13:15:13
*/
public interface TaskMissionMapper extends BaseMapper<TaskMission> {
/**
*
*
* @param plateNum
* @return
*/
TaskMission findByPlateNum(@Param("plateNum") String plateNum);
/**
* task_mission
*
* @param arr
* @return
*/
List<TaskMission> findByPlateNums(@Param("array") String[] arr);
}

@ -56,7 +56,7 @@ public interface LineService {
/** /**
* id线,,, * id线,,,
*/ */
GetCarIdInfoResponse getCarIdInfo(String id); GetCarIdInfoResponse getCarIdInfo(String id);
} }

@ -0,0 +1,33 @@
package com.ykMap.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ykMap.entity.TaskMission;
import java.util.List;
/**
* 'task_mission(TaskMission)
*
* @author wu
* @since 2024-09-19 13:15:13
*/
public interface TaskMissionService extends IService<TaskMission> {
/**
*
*
* @param plateNum
* @return
*/
TaskMission findByPlateNum(String plateNum);
/**
* task_mission
*
* @param plateNum
* @return
*/
List<TaskMission> findByPlateNums(String plateNum);
}

@ -113,17 +113,16 @@ public class LineServiceImpl implements LineService {
} }
/** /**
* id线,,, * id线,,,
*/ */
@Override @Override
public GetCarIdInfoResponse getCarIdInfo(String id) { public GetCarIdInfoResponse getCarIdInfo(String id) {
//获取该车辆的任务id //获取该车辆的任务id
String bcs = lineMapper.getByCarId(id);
GetCarIdInfoResponse res = new GetCarIdInfoResponse(); GetCarIdInfoResponse res = new GetCarIdInfoResponse();
res.setZbList(lineMapper.equip(bcs)); res.setZbList(lineMapper.equip(id));
res.setUserList(lineMapper.userInfo(bcs)); res.setUserList(lineMapper.userInfo(id));
res.setBdwInfo(lineMapper.items(bcs)); res.setBdwInfo(lineMapper.items(id));
SelectLineInfoResponse se = lineMapper.selectLineInfo(bcs); SelectLineInfoResponse se = lineMapper.selectLineInfo(id);
if (BeanUtil.isNotEmpty(se)) { if (BeanUtil.isNotEmpty(se)) {
res.setLineType(se.getType()); res.setLineType(se.getType());
} }

@ -0,0 +1,48 @@
package com.ykMap.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ykMap.entity.TaskMission;
import com.ykMap.mapper.TaskMissionMapper;
import com.ykMap.service.TaskMissionService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 'task_mission(TaskMission)
*
* @author wu
* @since 2024-09-19 13:15:13
*/
@Service("taskMissionService")
public class TaskMissionServiceImpl extends ServiceImpl<TaskMissionMapper, TaskMission> implements TaskMissionService {
/**
*
*
* @param plateNum
* @return
*/
@Override
public TaskMission findByPlateNum(String plateNum) {
return baseMapper.findByPlateNum(plateNum);
}
/**
* task_mission
*
* @param plateNum
* @return
*/
@Override
public List<TaskMission> findByPlateNums(String plateNum) {
String[] split = plateNum.split(",");
if (split.length > 0) {
return baseMapper.findByPlateNums(split);
} else {
return null;
}
}
}

@ -6,17 +6,17 @@ spring:
# 主库数据源 # 主库数据源
master: master:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.101.188.84:3307/yk_map?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://127.0.0.1:3306/finance_security?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: Admin123@ password: 123456
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
driverClassName: org.postgresql.Driver driverClassName: org.postgresql.Driver
enabled: true enabled: true
url: jdbc:postgresql://39.101.188.84:5432/yk_map url: jdbc:postgresql://127.0.0.1:5432/ctsy_data
username: postgres username: postgres
password: adminadmin password: 123456
# 配置检测连接是否有效 # 配置检测连接是否有效
validationQuery: SELECT 1 validationQuery: SELECT 1
# 初始连接数 # 初始连接数

@ -0,0 +1,64 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
master:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.101.188.84:3307/yk_map?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Admin123@
# 从库数据源
slave:
# 从数据源开关/默认关闭
driverClassName: org.postgresql.Driver
enabled: true
url: jdbc:postgresql://39.101.188.84:5432/yk_map
username: postgres
password: adminadmin
# 配置检测连接是否有效
validationQuery: SELECT 1
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -4,7 +4,7 @@ server:
port: 9066 port: 9066
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /api
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8

@ -54,18 +54,18 @@
<select id="searchCity" resultType="com.ykMap.entity.response.SearchCityResponse"> <select id="searchCity" resultType="com.ykMap.entity.response.SearchCityResponse">
SELECT SELECT
provinceName AS city, province_name AS city,
dataTime data_time
FROM FROM
ysk_ywbmwjdr.operation_expansion_data ysk_ywbmwjdr.operation_expansion_data
WHERE WHERE
dataTime >= #{a1} and dataTime &lt; #{a2} data_time >= #{a1} and data_time &lt; #{a2}
</select> </select>
<select id="searchCityCount" resultType="com.ykMap.entity.response.SearchCityCountResponse"> <select id="searchCityCount" resultType="com.ykMap.entity.response.SearchCityCountResponse">
SELECT count(*) AS count SELECT count(*) AS count
FROM ysk_ywbmwjdr.operation_expansion_data FROM ysk_ywbmwjdr.operation_expansion_data
WHERE dataTime >= #{a1} WHERE data_time >= #{a1}
and dataTime &lt; #{a2} and data_time &lt; #{a2}
</select> </select>
<select id="getByCarId" resultType="java.lang.String"> <select id="getByCarId" resultType="java.lang.String">
select task_mission_id select task_mission_id

@ -0,0 +1,35 @@
<?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.ykMap.mapper.TaskMissionMapper">
<select id="findByPlateNum" resultType="com.ykMap.entity.TaskMission">
select tm.*
from vehicle_info vi
left join task_mission tm on vi.id = tm.original_vehicle_id
where vi.plate_num = #{plateNum}
and tm.id is not null
order by tm.update_time desc
limit 1
</select>
<select id="findByPlateNums" resultType="com.ykMap.entity.TaskMission">
SELECT tm.*,vi.plate_num
FROM vehicle_info vi
INNER JOIN (
SELECT original_vehicle_id, MAX(update_time) AS latest_update_time
FROM task_mission
WHERE update_time IS NOT NULL
GROUP BY original_vehicle_id
) AS latest_tasks ON vi.id = latest_tasks.original_vehicle_id
INNER JOIN task_mission tm ON latest_tasks.original_vehicle_id = tm.original_vehicle_id
AND latest_tasks.latest_update_time = tm.update_time
WHERE vi.plate_num IN
<foreach item="plateNum" collection="array" open="(" separator="," close=")">
#{plateNum}
</foreach>
ORDER BY tm.update_time DESC;
</select>
</mapper>
Loading…
Cancel
Save