ソースを参照

1.更新学生采集接口,将地址改成非必填,2.更新班级下拉数据,将按照年份获取对应的班级数据

liu 1 ヶ月 前
コミット
1218c1eb1f

+ 3 - 1
src/main/java/com/template/api/WelcomeOrgControllerAPI.java

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.text.ParseException;
+
 @RequestMapping("/api/welcomeOrg")
 @Api(tags = {"WelcomeOrgController"}, value = "下拉数据管理")
 public interface WelcomeOrgControllerAPI {
@@ -23,6 +25,6 @@ public interface WelcomeOrgControllerAPI {
 
     @GetMapping(value = "/getClasss")
     @ApiOperation(value = "获取班级下拉数据", notes = "获取班级下拉数据", httpMethod = "GET")
-    CommonResult getClasss(@RequestParam int majorId);
+    CommonResult getClasss(@RequestParam int majorId,Integer yearId) throws Exception;
 
 }

+ 24 - 2
src/main/java/com/template/controller/WelcomeOrgController.java

@@ -2,6 +2,7 @@ package com.template.controller;
 
 
 import com.template.api.WelcomeOrgControllerAPI;
+import com.template.common.utils.TimeExchange;
 import com.template.model.pojo.WelcomeOrg;
 import com.template.model.result.CommonResult;
 import com.template.model.vo.ListVo;
@@ -9,6 +10,7 @@ import com.template.services.WelcomeOrgService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -55,8 +57,28 @@ public class WelcomeOrgController implements WelcomeOrgControllerAPI {
     }
 
     @Override
-    public CommonResult getClasss(int majorId) {
-        List<WelcomeOrg> classs = welcomeOrgService.queryClasss(majorId);
+    public CommonResult getClasss(int majorId,Integer yearId) throws Exception {
+        String nstartTime = null;
+        String nendTime = null;
+        boolean isNowYear = false;
+        boolean lastYear = TimeExchange.CompareDate(TimeExchange.getDate(), TimeExchange.getYear() + "-07-01", "yyyy-MM-dd");
+        if (yearId == null) {
+            Integer yearInt = Integer.valueOf(TimeExchange.getYear());
+            //当前时间小于本年度的7月1日 说明要查去年的数据
+            if (lastYear) {
+                nstartTime = (yearInt - 1) + "-06-01";
+                nendTime = yearInt + "-06-01";
+            } else {//今年
+                isNowYear = true;
+                nstartTime = yearInt + "-06-01";
+                nendTime = (yearInt + 1) + "-06-01";
+            }
+        } else {
+            nstartTime = yearId + "-06-01";
+            nendTime = (yearId + 1) + "-06-01";
+        }
+
+        List<WelcomeOrg> classs = welcomeOrgService.queryClasss(majorId, nstartTime, nendTime);
 
         List<ListVo> result = new ArrayList<>();
         for (WelcomeOrg maj:classs) {

+ 30 - 6
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -782,17 +782,41 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         ws.setNationality(icr.getNationality());
         ws.setPhone(icr.getPhone());
         ws.setOprovinceId(icr.getOprovinceId());
-        ws.setOprovince(icr.getOprovince());
+        if (ObjectUtils.isEmpty(icr.getOprovince())) {
+            ws.setOprovince("");
+        }else {
+            ws.setOprovince(icr.getOprovince());
+        }
         ws.setOcityId(icr.getOcityId());
-        ws.setOcity(icr.getOcity());
+        if (ObjectUtils.isEmpty(icr.getOcity())) {
+            ws.setOcity("");
+        }else {
+            ws.setOcity(icr.getOcity());
+        }
         ws.setOdistrictId(icr.getOdistrictId());
-        ws.setOdistrict(icr.getOdistrict());
+        if (ObjectUtils.isEmpty(icr.getOdistrict())) {
+            ws.setOdistrict("");
+        }else {
+            ws.setOdistrict(icr.getOdistrict());
+        }
         ws.setProvinceId(icr.getProvinceId());
-        ws.setProvince(icr.getProvince());
+        if (ObjectUtils.isEmpty(icr.getProvince())) {
+            ws.setProvince("");
+        }else {
+            ws.setProvince(icr.getProvince());
+        }
         ws.setCityId(icr.getCityId());
-        ws.setCity(icr.getCity());
+        if (ObjectUtils.isEmpty(icr.getCity())) {
+            ws.setCity("");
+        }else {
+            ws.setCity(icr.getCity());
+        }
         ws.setDistrictId(icr.getDistrictId());
-        ws.setDistrict(icr.getDistrict());
+        if (ObjectUtils.isEmpty(icr.getDistrict())) {
+            ws.setDistrict("");
+        }else {
+            ws.setDistrict(icr.getDistrict());
+        }
         ws.setAddress(icr.getAddress());
         ws.setRegisterOntime(icr.getRegisterOntime());
         ws.setZipCode(icr.getZipCode());

+ 10 - 10
src/main/java/com/template/model/request/InfoCollectionRequest.java

@@ -104,43 +104,43 @@ public class InfoCollectionRequest {
     private String phone;
 
     @ApiModelProperty(value = "籍贯省ID")
-    @NotNull(message = "籍贯省ID不能为空")
+//    @NotNull(message = "籍贯省ID不能为空")
     private Integer oprovinceId;
 
     @ApiModelProperty(value = "籍贯省")
-    @NotBlank(message = "籍贯省不能为空")
+//    @NotBlank(message = "籍贯省不能为空")
     private String oprovince;
 
     @ApiModelProperty(value = "籍贯市ID")
-    @NotNull(message = "籍贯市ID不能为空")
+//    @NotNull(message = "籍贯市ID不能为空")
     private Integer ocityId;
 
     @ApiModelProperty(value = "籍贯市")
-    @NotBlank(message = "籍贯市不能为空")
+//    @NotBlank(message = "籍贯市不能为空")
     private String ocity;
 
     @ApiModelProperty(value = "籍贯区ID")
-    @NotNull(message = "籍贯区ID不能为空")
+//    @NotNull(message = "籍贯区ID不能为空")
     private Integer odistrictId;
 
     @ApiModelProperty(value = "籍贯区")
-    @NotBlank(message = "籍贯区不能为空")
+//    @NotBlank(message = "籍贯区不能为空")
     private String odistrict;
 
     @ApiModelProperty(value = "省ID")
-    @NotNull(message = "省ID不能为空")
+//    @NotNull(message = "省ID不能为空")
     private Integer provinceId;
 
     @ApiModelProperty(value = "省")
-    @NotBlank(message = "省不能为空")
+//    @NotBlank(message = "省不能为空")
     private String province;
 
     @ApiModelProperty(value = "市ID")
-    @NotNull(message = "市ID不能为空")
+//    @NotNull(message = "市ID不能为空")
     private Integer cityId;
 
     @ApiModelProperty(value = "市")
-    @NotBlank(message = "市不能为空")
+//    @NotBlank(message = "市不能为空")
     private String city;
 
     @ApiModelProperty(value = "区ID")

+ 1 - 1
src/main/java/com/template/services/WelcomeOrgService.java

@@ -24,7 +24,7 @@ public interface WelcomeOrgService extends IService<WelcomeOrg> {
     List<WelcomeOrg> queryMajors(Integer collegeId);
 
     //获取班级下拉数据
-    List<WelcomeOrg> queryClasss(Integer majorId);
+    List<WelcomeOrg> queryClasss(Integer majorId, String startTime, String endTime);
 
     List<WelcomeOrg> queryDatas(String college, String major, String classstr);
 }

+ 2 - 1
src/main/java/com/template/services/impl/WelcomeOrgServiceImpl.java

@@ -53,10 +53,11 @@ public class WelcomeOrgServiceImpl extends ServiceImpl<WelcomeOrgMapper, Welcome
     }
 
     @Override
-    public List<WelcomeOrg> queryClasss(Integer majorId) {
+    public List<WelcomeOrg> queryClasss(Integer majorId, String startTime, String endTime) {
         QueryWrapper<WelcomeOrg> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("type_id",3);
         queryWrapper.eq("parent_id",majorId);
+        queryWrapper.between("create_time",startTime,endTime);
         List<WelcomeOrg> result = welcomeOrgMapper.selectList(queryWrapper);
         return result;
     }

+ 1 - 1
src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
 
 spring:
   profiles:
-      active: dev
+      active: prod
   main:
     allow-circular-references: true
   servlet: