Преглед на файлове

驾驶舱——车闸通行记录

liu преди 2 години
родител
ревизия
8f6a611e65

+ 1 - 1
src/main/java/com/template/api/SmartAccessControllerAPI.java

@@ -21,7 +21,7 @@ public interface SmartAccessControllerAPI {
 
 
     @GetMapping("/getAccessPage")
-    @ApiOperation(value = "门禁通行汇总", notes = "门禁通行汇总", httpMethod = "GET")
+    @ApiOperation(value = "驾驶舱——门禁通行汇总", notes = "门禁通行汇总", httpMethod = "GET")
     CommonResult getAccessPage(@RequestParam Integer currentPage, @RequestParam Integer pageCount,String keyWord,Integer gradeId,Integer classId,String resultStatus,String inOut,String startTime,String endTime);
 
 

+ 11 - 1
src/main/java/com/template/api/SmartCarAccessControllerAPI.java

@@ -1,7 +1,17 @@
 package com.template.api;
 
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
-@RequestMapping("/auto/smart-car-access")
+@RequestMapping("/api/smartCarAccess")
 public interface SmartCarAccessControllerAPI {
+
+    @GetMapping("/getPage")
+    @ApiOperation(value = "驾驶舱——车闸通行记录", notes = "门禁通行记录", httpMethod = "GET")
+    CommonResult getPage(@RequestParam Integer currentPage, @RequestParam Integer pageCount, String keyWord , String type, String startTime, String endTime);
+
+
 }

+ 19 - 1
src/main/java/com/template/controller/SmartCarAccessController.java

@@ -3,7 +3,14 @@ package com.template.controller;
 
 import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartCarAccessControllerAPI;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.template.model.pojo.SmartCarAccess;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartAccessVo;
+import com.template.model.vo.SmartCarAccessVo;
+import com.template.services.SmartCarAccessService;
+import org.springframework.beans.factory.annotation.Autowired;
+
 
 import org.springframework.web.bind.annotation.RestController;
 
@@ -20,5 +27,16 @@ import org.springframework.web.bind.annotation.RestController;
 @DESRespondSecret
 public class SmartCarAccessController implements SmartCarAccessControllerAPI {
 
+    @Autowired
+    SmartCarAccessService smartCarAccessService;
+
+    @Override
+    @DESRespondSecret(validated = false)
+    public CommonResult getPage(Integer currentPage, Integer pageCount, String keyWord, String type, String startTime, String endTime) {
+        PageUtils<SmartCarAccessVo> pageUtils=smartCarAccessService.getPage(currentPage,pageCount,keyWord,type,startTime,endTime);
+        return CommonResult.ok(pageUtils);
+
+    }
+
 }
 

+ 27 - 0
src/main/java/com/template/controller/SmartEvaluateStudentController.java

@@ -313,8 +313,35 @@ public class SmartEvaluateStudentController implements SmartEvaluateStudentContr
     }
 
     @Override
+    @DESRespondSecret(validated = true)
     public CommonResult historicalEvaluation(String cardNo) {
         List<HistoricalEvaluationVo> vos = smartEvaluateStudentService.getHistoricalEvaluation(cardNo);
+
+//        获取评级
+        for (int i = 0; i < vos.size(); i++) {
+            HistoricalEvaluationVo vo = vos.get(i);
+            String term = vo.getTerm();
+            String scoreNum = vo.getScoreNum();
+            QueryWrapper<SmartSubjectRule> queryWrapper1 = new QueryWrapper<>();
+            queryWrapper1.eq("subject_name", "平均成绩");
+            queryWrapper1.eq("term", term);
+            List<SmartSubjectRule> rule = smartSubjectRuleService.list(queryWrapper1);
+
+            for (int j = 0; j < rule.size(); j++) {
+                String[] range = rule.get(j).getScoreRange().split("-");
+                double min = Double.parseDouble(range[0]);
+                double max = Double.parseDouble(range[1]);
+                Double num = Double.valueOf(scoreNum);
+                if (num >= min && num <= max) {
+                   String scoreLevel = rule.get(j).getLevel();
+                   vo.setScoreLevel(scoreLevel);
+                   break;
+                }
+            }
+
+        }
+
+
         return CommonResult.ok(vos);
     }
 

+ 8 - 0
src/main/java/com/template/mapper/SmartCarAccessMapper.java

@@ -1,7 +1,12 @@
 package com.template.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.model.pojo.SmartCarAccess;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.SmartCarAccessVo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @author ceshi
  * @since 2024-02-23
  */
+@Repository
 public interface SmartCarAccessMapper extends BaseMapper<SmartCarAccess> {
 
+    IPage<SmartCarAccessVo> getPage(Page<SmartCarAccessVo> page, @Param("keyWord") String keyWord,@Param("type") String type,@Param("startTime") String startTime,@Param("endTime") String endTime);
+
 }

+ 22 - 0
src/main/java/com/template/model/vo/SmartCarAccessVo.java

@@ -0,0 +1,22 @@
+package com.template.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SmartCarAccessVo {
+
+    private Integer id;
+
+    @ApiModelProperty(value = "状态,1:进站,2:出站")
+    private String type;
+
+    @ApiModelProperty(value = "车牌号码")
+    private String carNo;
+
+    @ApiModelProperty(value = "产生时间")
+    private String dataTime;
+
+    @ApiModelProperty(value = "图片")
+    private String image;
+}

+ 3 - 0
src/main/java/com/template/services/SmartCarAccessService.java

@@ -2,6 +2,8 @@ package com.template.services;
 
 import com.template.model.pojo.SmartCarAccess;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartCarAccessVo;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface SmartCarAccessService extends IService<SmartCarAccess> {
 
+    PageUtils<SmartCarAccessVo> getPage(Integer currentPage, Integer pageCount, String keyWord, String type, String startTime, String endTime);
 }

+ 16 - 1
src/main/java/com/template/services/impl/SmartCarAccessServiceImpl.java

@@ -4,13 +4,18 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.common.utils.CommonUtil;
 import com.template.common.utils.RequestUtils;
 import com.template.config.ParkConfig;
 import com.template.config.ScheduleConfig;
 import com.template.model.pojo.SmartCarAccess;
 import com.template.mapper.SmartCarAccessMapper;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartAccessVo;
+import com.template.model.vo.SmartCarAccessVo;
 import com.template.services.SmartCarAccessService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +44,9 @@ public class SmartCarAccessServiceImpl extends ServiceImpl<SmartCarAccessMapper,
     @Resource
     private ScheduleConfig scheduleConfig;
 
+    @Autowired
+    SmartCarAccessMapper smartCarAccessMapper;
+
     private Integer page = 0;
     private Integer size = 20;
 
@@ -279,5 +287,12 @@ public class SmartCarAccessServiceImpl extends ServiceImpl<SmartCarAccessMapper,
     }
 
 
-
+    @Override
+    public PageUtils<SmartCarAccessVo> getPage(Integer currentPage, Integer pageCount, String keyWord, String type, String startTime, String endTime) {
+        Page<SmartCarAccessVo> page = new Page<>();
+        page.setCurrent(currentPage);
+        page.setSize(pageCount);
+        IPage<SmartCarAccessVo> datas = smartCarAccessMapper.getPage(page,keyWord,type,startTime,endTime);
+        return new PageUtils(datas);
+    }
 }

+ 22 - 0
src/main/resources/mapper/template/SmartCarAccessMapper.xml

@@ -2,4 +2,26 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartCarAccessMapper">
 
+    <select id="getPage" resultType="com.template.model.vo.SmartCarAccessVo">
+        SELECT
+        sca.id as id,
+        sca.type as type,
+        sca.car_no as carNo,
+        sca.data_time as dataTime,
+        sca.image as image
+        FROM
+        `smart_car_access` sca
+        WHERE sca.deleted=0
+        <if test="keyWord != null and keyWord != ''">
+            and sca.car_no like '%' #{keyWord} '%'
+        </if>
+        <if test="type != null and type != ''">
+            and sca.type = #{type}
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and sca.data_time &gt;= #{startTime} and sca.data_time &lt;= #{endTime}
+        </if>
+        ORDER BY sca.date_time DESC
+
+    </select>
 </mapper>