From 72ba09f4055bcaadca22530929408a3fcd74ceee Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期三, 08 十二月 2021 14:35:13 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java | 55 +++++++++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java | 5 xboot-modules/xboot-your/src/main/resources/mapper/EventLogMapper.xml | 5 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java | 13 + xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java | 26 ++++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java | 15 ++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java | 14 ++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/EventLogController.java | 77 ++++++++++++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java | 2 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/EventLog.java | 49 ++++++++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java | 5 xboot-core/src/main/java/cn/exrick/xboot/core/entity/Department.java | 6 + xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java | 19 ++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java | 14 ++ 14 files changed, 299 insertions(+), 6 deletions(-) diff --git a/xboot-core/src/main/java/cn/exrick/xboot/core/entity/Department.java b/xboot-core/src/main/java/cn/exrick/xboot/core/entity/Department.java index 529696f..18c5f59 100644 --- a/xboot-core/src/main/java/cn/exrick/xboot/core/entity/Department.java +++ b/xboot-core/src/main/java/cn/exrick/xboot/core/entity/Department.java @@ -49,6 +49,12 @@ @ApiModelProperty(value = "鏄惁鍚敤 0鍚敤 -1绂佺敤") private Integer status = CommonConstant.STATUS_NORMAL; + @ApiModelProperty(value = "缁忓害") + private String lng; + + @ApiModelProperty(value = "缁村害") + private String lat; + @Transient @TableField(exist = false) @ApiModelProperty(value = "鐖惰妭鐐瑰悕绉�") diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/EventLogController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/EventLogController.java new file mode 100644 index 0000000..0094edb --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/EventLogController.java @@ -0,0 +1,77 @@ +package cn.exrick.xboot.your.controller; + +import cn.exrick.xboot.core.common.utils.PageUtil; +import cn.exrick.xboot.core.common.utils.ResultUtil; +import cn.exrick.xboot.core.common.vo.PageVo; +import cn.exrick.xboot.core.common.vo.Result; +import cn.exrick.xboot.your.entity.EventLog; +import cn.exrick.xboot.your.service.IEventLogService; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author whj + */ +@Slf4j +@RestController +@Api(tags = "浜嬩欢鏃ュ織琛ㄧ鐞嗘帴鍙�") +@RequestMapping("/xboot/eventLog") +@Transactional +public class EventLogController { + + @Autowired + private IEventLogService iEventLogService; + + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) + @ApiOperation(value = "閫氳繃id鑾峰彇") + public Result<EventLog> get(@PathVariable String id) { + + EventLog eventLog = iEventLogService.getById(id); + return new ResultUtil<EventLog>().setData(eventLog); + } + + @RequestMapping(value = "/getAll", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇鍏ㄩ儴鏁版嵁") + public Result<List<EventLog>> getAll() { + + List<EventLog> list = iEventLogService.list(); + return new ResultUtil<List<EventLog>>().setData(list); + } + + @RequestMapping(value = "/getByPage", method = RequestMethod.GET) + @ApiOperation(value = "鍒嗛〉鑾峰彇") + public Result<IPage<EventLog>> getByPage(PageVo page) { + + IPage<EventLog> data = iEventLogService.page(PageUtil.initMpPage(page)); + return new ResultUtil<IPage<EventLog>>().setData(data); + } + + @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) + @ApiOperation(value = "缂栬緫鎴栨洿鏂版暟鎹�") + public Result<EventLog> saveOrUpdate(EventLog eventLog) { + + if (iEventLogService.saveOrUpdate(eventLog)) { + return new ResultUtil<EventLog>().setData(eventLog); + } + return new ResultUtil<EventLog>().setErrorMsg("鎿嶄綔澶辫触"); + } + + @RequestMapping(value = "/delByIds", method = RequestMethod.POST) + @ApiOperation(value = "鎵归噺閫氳繃id鍒犻櫎") + public Result<Object> delAllByIds(@RequestParam String[] ids) { + + for (String id : ids) { + iEventLogService.removeById(id); + } + return ResultUtil.success("鎵归噺閫氳繃id鍒犻櫎鏁版嵁鎴愬姛"); + } +} diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java index 5b18749..09a0843 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java @@ -5,7 +5,9 @@ import cn.exrick.xboot.core.common.utils.SecurityUtil; import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; +import cn.exrick.xboot.core.entity.Department; import cn.exrick.xboot.core.entity.User; +import cn.exrick.xboot.core.service.DepartmentService; import cn.exrick.xboot.core.service.UserService; import cn.exrick.xboot.your.entity.*; import cn.exrick.xboot.your.service.*; @@ -59,6 +61,9 @@ @Autowired private ICarService iCarService; + @Autowired + private DepartmentService departmentService; + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "閫氳繃id鑾峰彇") public Result<OrderTask> get(@PathVariable String id) { @@ -105,11 +110,21 @@ map.put("sum",sum); map.put("name",""); if(list.size()>0){ - String areaSectionId = list.get(0).getAreaSectionId(); + OrderTask orderTask = list.get(0); + String areaSectionId = orderTask.getAreaSectionId(); AreaSection a = iAreaSectionService.getById(areaSectionId); - map.put("name",a.getName()); + Area area2 = iAreaService.getById(orderTask.getAreaId()); + map.put("name",area2.getName()+a.getName()); list.clear(); } + map.put("lng",""); + map.put("lat",""); + List<String> deparmentIds = securityUtil.getDeparmentIds(); + if(deparmentIds.size()>0){ + Department department = departmentService.get(deparmentIds.get(0)); + map.put("lng",department.getLng()); + map.put("lat",department.getLat()); + } return new ResultUtil<Object>().setData(map); } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java index 78679e7..578fa22 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java @@ -1,8 +1,20 @@ package cn.exrick.xboot.your.controller.pc; import cn.exrick.xboot.core.common.redis.RedisTemplateHelper; +import cn.exrick.xboot.core.common.utils.PageUtil; import cn.exrick.xboot.core.common.utils.ResultUtil; +import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; +import cn.exrick.xboot.your.entity.Car; +import cn.exrick.xboot.your.entity.EventLog; +import cn.exrick.xboot.your.entity.OrderTask; +import cn.exrick.xboot.your.service.ICarService; +import cn.exrick.xboot.your.service.IEventLogService; +import cn.exrick.xboot.your.service.IOrderTaskService; +import cn.exrick.xboot.your.util.HaiKangPost; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -25,6 +37,15 @@ @Autowired private RedisTemplateHelper redisTemplateHelper; + @Autowired + private IOrderTaskService iOrderTaskService; + + @Autowired + private IEventLogService iEventLogService; + + @Autowired + private ICarService iCarService; + @RequestMapping(value = "/getIndex1", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇棣栭〉鏁版嵁") public Result<Object> getIndex1() { @@ -35,4 +56,38 @@ } return new ResultUtil<Object>().setData(map); } + + @RequestMapping(value = "/getTodayTask", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇浠婃棩閰嶉�佷换鍔�") + public Result<Object> getTodayTask() { + QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); + String format = DateUtil.format(new Date(), "yyyy-MM-dd"); + wrapper2.eq("a.send_date",format); +// wrapper2.orderByAsc("a.seq"); + List<OrderTask> list = iOrderTaskService.list3(format); + return new ResultUtil<Object>().setData(list); + } + + @RequestMapping(value = "/getEventLog", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇浜嬩欢鏃ュ織") + public Result<Object> getEventLog() { + QueryWrapper<EventLog> wrapper2 = new QueryWrapper<EventLog>(); + PageVo page = new PageVo(); + page.setPageNumber(1); + page.setPageSize(20); + page.setOrder("desc"); + page.setSort("createTime"); + IPage<EventLog> data = iEventLogService.page(PageUtil.initMpPage(page),wrapper2); + return new ResultUtil<Object>().setData(data.getRecords()); + } + +// @RequestMapping(value = "/getCars", method = RequestMethod.GET) +// @ApiOperation(value = "鑾峰彇杞﹁締淇℃伅") +// public Result<Object> getCars() { +// List<Car> list = iCarService.list(); +// String codes[] = new String[list.size()]; +// +// HaiKangPost.findLatestGps() +// return new ResultUtil<Object>().setData(data.getRecords()); +// } } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java index beecf8d..c6c7f32 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java @@ -28,6 +28,11 @@ @ApiModelProperty(value = "杞﹁締id") private String carId; + //1:鐤插姵椹鹃┒ + //2:鎺ユ墦鐢佃瘽 + //3:涓嶇郴瀹夊叏甯� + //4:鎶界儫 + //5:杞﹀帰寮傚父寮�鍚� @ApiModelProperty(value = "鍏蜂綋绫诲瀷濡備笅") private int type; diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/EventLog.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/EventLog.java new file mode 100644 index 0000000..0474675 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/EventLog.java @@ -0,0 +1,49 @@ +package cn.exrick.xboot.your.entity; + +import cn.exrick.xboot.core.base.XbootBaseEntity; +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.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.util.Date; +import java.util.List; + +/** + * @author Exrick + */ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@Table(name = "t_event_log") +@TableName("t_event_log") +@ApiModel(value = "浜嬩欢鏃ュ織琛�") +public class EventLog extends XbootBaseEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "杞︾墝鍙�") + private String carNo; + + //1:鐤插姵椹鹃┒ + //2:鎺ユ墦鐢佃瘽 + //3:涓嶇郴瀹夊叏甯� + //4:鎶界儫 + //5:杞﹀帰寮傚父寮�鍚� + //6:閰嶉�佸畬鎴� + @ApiModelProperty(value = "浜嬩欢绫诲瀷") + private int type; + + @ApiModelProperty(value = "浜嬩欢鍏宠仈id") + private String refId; + +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java index 7d348a0..a71fa37 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java @@ -109,6 +109,21 @@ @Transient @TableField(exist = false) + @ApiModelProperty(value = "杞︾墝鍙�") + private String carNo; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "鍖哄煙鍚嶇О") + private String areaName; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "鍒嗘鍚嶇О") + private String areaSectionName; + + @Transient + @TableField(exist = false) @ApiModelProperty(value = "璁㈠崟璇︽儏") private List<OrderDetail> orderDetails; } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java new file mode 100644 index 0000000..b4dd248 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java @@ -0,0 +1,14 @@ +package cn.exrick.xboot.your.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.exrick.xboot.your.entity.EventLog; + +import java.util.List; + +/** + * 浜嬩欢鏃ュ織琛ㄦ暟鎹鐞嗗眰 + * @author whj + */ +public interface EventLogMapper extends BaseMapper<EventLog> { + +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java index 3580ac8..003b828 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java @@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Result; -import org.apache.ibatis.annotations.Results; -import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.*; import org.apache.ibatis.type.JdbcType; import java.util.List; @@ -36,4 +33,12 @@ @Select("SELECT count(id) FROM t_order_task where likes=1") int countLike(); + + @Select("select b.car_no as carNo1,c.name as name1,d.name as name2,count(a.area_section_id) as num1,sum(case when a.status=0 then 1 else 0 end) as num2 from t_order_task a LEFT JOIN t_car b on a.car_id=b.id LEFT JOIN t_area c on a.area_id=c.id LEFT JOIN t_area_ection d on a.area_section_id=d.id where DATE_FORMAT(a.send_date,'%Y-%m-%d')=#{date} GROUP BY a.area_section_id,b.car_no,c.name,d.name") + @Results({@Result(column="carNo1", property="carNo", jdbcType = JdbcType.VARCHAR), + @Result(column="name1", property="areaName", jdbcType = JdbcType.VARCHAR), + @Result(column="name2", property="areaSectionName", jdbcType = JdbcType.VARCHAR), + @Result(column="num1", property="num", jdbcType = JdbcType.INTEGER), + @Result(column="num2", property="level", jdbcType = JdbcType.INTEGER)}) + List<OrderTask> list3(String date); } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java new file mode 100644 index 0000000..0914a3f --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java @@ -0,0 +1,14 @@ +package cn.exrick.xboot.your.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import cn.exrick.xboot.your.entity.EventLog; + +import java.util.List; + +/** + * 浜嬩欢鏃ュ織琛ㄦ帴鍙� + * @author whj + */ +public interface IEventLogService extends IService<EventLog> { + +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java index 99198d6..1cf9c9b 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java @@ -21,4 +21,6 @@ int sumStatus(int i); int countLike(); + + List<OrderTask> list3(String date); } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java new file mode 100644 index 0000000..4ec4a95 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java @@ -0,0 +1,26 @@ +package cn.exrick.xboot.your.serviceimpl; + +import cn.exrick.xboot.your.mapper.EventLogMapper; +import cn.exrick.xboot.your.entity.EventLog; +import cn.exrick.xboot.your.service.IEventLogService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 浜嬩欢鏃ュ織琛ㄦ帴鍙e疄鐜� + * @author whj + */ +@Slf4j +@Service +@Transactional +public class IEventLogServiceImpl extends ServiceImpl<EventLogMapper, EventLog> implements IEventLogService { + + @Autowired + private EventLogMapper eventLogMapper; +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java index 45d8b76..75ede4f 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java @@ -53,4 +53,9 @@ public int countLike() { return orderTaskMapper.countLike(); } + + @Override + public List<OrderTask> list3(String date) { + return orderTaskMapper.list3(date); + } } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/resources/mapper/EventLogMapper.xml b/xboot-modules/xboot-your/src/main/resources/mapper/EventLogMapper.xml new file mode 100644 index 0000000..14b1bbf --- /dev/null +++ b/xboot-modules/xboot-your/src/main/resources/mapper/EventLogMapper.xml @@ -0,0 +1,5 @@ +<?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="cn.exrick.xboot.your.mapper.EventLogMapper"> + +</mapper> \ No newline at end of file -- Gitblit v1.9.1