Quellcode durchsuchen

修改一个小bug。

xiaochan vor 4 Jahren
Ursprung
Commit
5f61c85bdb

+ 3 - 1
src/main/java/thyyxxk/webserver/controller/querydata/CovidVaccinateAppointmentController.java

@@ -5,6 +5,7 @@ import oracle.ucp.proxy.annotation.Post;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.querydata.CovidVaccinateAppointment;
 import thyyxxk.webserver.entity.querydata.CovidVaccinateFactory;
@@ -68,11 +69,12 @@ public class CovidVaccinateAppointmentController {
     }
 
     @PostMapping("/xinZengChangJia")
-    public ResultVo<Boolean> xinZengChangJia(@RequestBody List<CovidVaccinateFactory> param){
+    public ResultVo<Boolean> xinZengChangJia(@RequestBody List<CovidVaccinateFactory> param) throws ParseException {
         return server.xinZengChangJia(param);
     }
 
     @GetMapping("/chaKanYiMiao")
+    @PassToken
     public ResultVo<List<ZdCovidVaccinate>> chaKanYiMiao(){
         return server.chaKanYiMiao();
     }

+ 4 - 4
src/main/java/thyyxxk/webserver/dao/his/datamodify/YzActOrderModifyVerifyDao.java

@@ -27,10 +27,10 @@ public interface YzActOrderModifyVerifyDao extends BaseMapper<TYzActOrderModify>
     @Update("<script>" +
             "update yz_act_order set " +
             "<if test=\"newStartTime!=null \">" +
-            "start_time=#{newStartTime}" +
+            "start_time=#{newStartTime}," +
             "</if>" +
             "<if test=\"newEndTime!=null\">" +
-            ",end_time=#{newEndTime}" +
+            "end_time=#{newEndTime}" +
             "</if>" +
             " where act_order_no=#{actOrderNo}" +
             "</script>")
@@ -47,10 +47,10 @@ public interface YzActOrderModifyVerifyDao extends BaseMapper<TYzActOrderModify>
     @Update("<script>" +
             "update yz_act_order set " +
             "<if test=\"startTime!=null \">" +
-            "start_time=#{startTime}" +
+            "start_time=#{startTime}," +
             "</if>" +
             "<if test=\"endTime!=null\">" +
-            ",end_time=#{endTime}" +
+            "end_time=#{endTime}" +
             "</if>" +
             " where act_order_no=#{actOrderNo}" +
             "</script>")

+ 37 - 22
src/main/java/thyyxxk/webserver/service/querydata/CovidVaccinateAppointmentService.java

@@ -5,9 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
 import thyyxxk.webserver.dao.his.querydata.CovidVaccinateAppointmentMapper;
@@ -40,6 +39,7 @@ public class CovidVaccinateAppointmentService {
     private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd");
     private static final int GET_DATE_SECTION = 7;
 
+    @Autowired
     public CovidVaccinateAppointmentService(CovidVaccinateAppointmentMapper dao) {
         this.dao = dao;
     }
@@ -67,33 +67,43 @@ public class CovidVaccinateAppointmentService {
      * 查看 可以预约的厂家信息
      * @return 指定数据
      * */
-
     public ResultVo<List<CovidVaccinateFactory>> queryCount() {
+        log.info("查看可以预约疫苗厂家的信息");
         return ResultVoUtil.success(dao.kaiQiYuYueChangJia());
     }
 
     /**
-     * 插入每日阈值人数的限制 要判断一些 第一次创建数据库中没有对应的值那么就全部插入 如果有了
-     * 就只插入没有的日期 这个是新冠疫苗的厂家每日阈值的人数
-     * @param code 只要产品的 code 去判断有没有这个产品的 日期 和 阈值 如果没有就插入 日期 和 默认的阈值  默认值为150
-     * @return 插入完后就需要返回给 前端 查看近七日的 阈值
+     * 根据新冠疫苗产品的code来 近七天的阈值
+     * 如果没有这个日期的话 就插入一条
+     * @param code 产品的code
+     * @return 返回七天的数据
      * */
     public ResultVo<List<CovidVaccinateThreshold>> queryChangJiaDuiYingDeYuZhi(Integer code) throws ParseException {
-         Date maxDate = dao.changJiaYuZhiDoesItExist(code);
-         for(int i = 1; i<= GET_DATE_SECTION; i++){
-            Date date =SDF.parse(DateUtil.getOffsetDate(i));
-            //厂家在创建的时候是 没有日期的 那么就需要 插入全部的数据
-            if (maxDate == null){
-                dao.chaRuMeiYouDeDate(code,date);
-                log.info("第一次插入新冠疫苗厂家阈值插入=》code:{},插入的日期为:{}",code,date);
-            }else if (maxDate.getTime()<date.getTime()){
-                dao.chaRuMeiYouDeDate(code,date);
-                log.info("新冠疫苗厂家阈值插入=》code:{},插入的日期为:{}",code,date);
-            }
-        }
+        chaRuRiQI(code);
+        log.info("查看疫苗产品编码为:{}的",code);
         return ResultVoUtil.success(dao.chaKanQiTianYuZhi(code,DateUtil.getOffsetDate(1),DateUtil.getOffsetDate(7)));
     }
 
+    /**
+     * 设置每日阈值人数的限制 要判断一些 第一次创建数据库中没有对应的值那么就插入七天的阈值
+     * 如果已经有了 就只插入没有的日期 这个是新冠疫苗的厂家每日阈值的人数
+     * @param code 厂家的产品的 code
+     * */
+    private void chaRuRiQI(Integer code) throws ParseException {
+        Date maxDate = dao.changJiaYuZhiDoesItExist(code);
+        for(int i = 1; i<= GET_DATE_SECTION; i++){
+           Date date =SDF.parse(DateUtil.getOffsetDate(i));
+           //厂家在创建的时候是 没有日期的 那么就需要 插入全部的数据
+           if (maxDate == null){
+               dao.chaRuMeiYouDeDate(code,date);
+               log.info("第一次插入新冠疫苗厂家阈值插入=》code:{},插入的日期为:{}", code,date);
+           }else if (maxDate.getTime()<date.getTime()){
+               dao.chaRuMeiYouDeDate(code,date);
+               log.info("新冠疫苗厂家阈值插入=》code:{},插入的日期为:{}", code,date);
+           }
+       }
+    }
+
     /**
      * 修改指定日期的人数
      * @param id 根据id来修改 对应的阈值
@@ -171,8 +181,9 @@ public class CovidVaccinateAppointmentService {
      * 插入对应的 疫苗的厂家
      * @param param 需要插入的字段有 code主键不允许重复 vaccinateId:对应的疫苗
      *              specification:规格 price:金额,name;名字,enableFlag:是否允许预约
+     *              在插入厂家成功的时候要默认给他一个产品的阈值
      * */
-    public ResultVo<Boolean> xinZengChangJia(List<CovidVaccinateFactory> param){
+    public ResultVo<Boolean> xinZengChangJia(List<CovidVaccinateFactory> param) throws ParseException {
         //先判断一边是否有存在这编码的
         for (CovidVaccinateFactory pojo : param) {
             Integer vaccinesId =  dao.changJiaCodePanDuan(pojo.getCode());
@@ -183,8 +194,10 @@ public class CovidVaccinateAppointmentService {
             }
         }
         for (CovidVaccinateFactory pojo : param) {
-            log.info("插入厂家=》操作人:{},信息:{}",TokenUtil.getTokenUserId(),JSON.toJSONString(param));
+            log.info("插入厂家=》操作人:{},信息:{}",TokenUtil.getTokenUserId(),JSON.toJSONString(pojo));
             dao.xinZengChangJia(pojo);
+            //在新插入厂家的时候我就要默认设置好 阈值
+            chaRuRiQI(pojo.getCode());
         }
         return ResultVoUtil.success();
     }
@@ -234,7 +247,9 @@ public class CovidVaccinateAppointmentService {
         log.info("删除新冠疫苗厂家==》操作人:{},删除的数据:{}",TokenUtil.getTokenUserId(),code);
         return ResultVoUtil.success(dao.shanChuChangJia(code));
     }
-
+    /**
+     * 这里是批量修改 新冠阈值的数据
+     * */
     public ResultVo<Boolean> yiJianXiuGaiRiQi(List<CovidVaccinateThreshold> list){
         log.info("批量修改新冠疫苗厂家阈值==》操作人:{},数据:{}",TokenUtil.getTokenUserId(),JSON.toJSONString(list));
         for (CovidVaccinateThreshold pojo : list) {