Эх сурвалжийг харах

线上考试违纪考生导入

haogh 6 сар өмнө
parent
commit
f66e41334d

BIN
WebRoot/template/模版-线上考试违纪考生.xls


+ 24 - 1
sql/update.sql

@@ -154,4 +154,27 @@ INSERT INTO `frame_res`(`RES_ID`, `RES_NAME`, `RES_ALIAS`, `RES_URL`, `RES_PID`,
 
 -- 2024-12-04
 ALTER TABLE `sc_score_ym` ADD COLUMN `REVIEW_LOG_FILE` varchar(255) NULL COMMENT '成绩复核日志文件' AFTER `EMS_NO`;
-ALTER TABLE `sc_score_ym` ADD COLUMN `RECOVERY_TIME` varchar(20) NULL COMMENT '复核回复时间' AFTER `REVIEW_LOG_FILE`;
+ALTER TABLE `sc_score_ym` ADD COLUMN `RECOVERY_TIME` varchar(20) NULL COMMENT '复核回复时间' AFTER `REVIEW_LOG_FILE`;
+
+
+-- 2024-12-06
+INSERT INTO `frame_res`(`RES_ID`, `RES_NAME`, `RES_ALIAS`, `RES_URL`, `RES_PID`, `RES_LEVEL`, `RES_TYPE`, `RES_CSS`, `RES_STATUS`, `RES_ORDER`, `RES_DESC`) VALUES (609001, '违规考生', '违规考生', '/art/score/violation', 600000, 2, 'Page', 'icon-directions	', 'Active', 609001, NULL);
+
+CREATE TABLE `sc_score_ym_violation`
+(
+    `id`               int(0)                                                  NOT NULL AUTO_INCREMENT COMMENT '主键',
+    `std_name`         varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '考生姓名',
+    `cert_id`          varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '身份证号',
+    `aspect_name`      varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '专业名称',
+    `ticket_no`        varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '准考证号',
+    `violation_no`     varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '考生违规编号',
+    `exam_date`        varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci  NULL DEFAULT NULL COMMENT '考试日期 yyyy-MM-dd',
+    `exam_subject`     varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '考试科目',
+    `violation_remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '违规行为',
+    `country_rule`     varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '国家处理办法',
+    `school_rule`      varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学校处理办法',
+    PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB
+  CHARACTER SET = utf8
+  COLLATE = utf8_general_ci COMMENT = '违纪考生'
+  ROW_FORMAT = Dynamic;

+ 4 - 1
src/cn/hmsoft/art/constants/ArtOptrLogType.java

@@ -119,7 +119,10 @@ public enum ArtOptrLogType {
 	WISHPLAN_IMPORT("导入录取计划"),
 	CLEAN_DATA("清空测试数据"),
 
-	IMPORT_SCORE("成绩导入");
+	IMPORT_SCORE("成绩导入"),
+
+	VIOLATION_IMPORT("违规考生导入");
+
 	
 	private String value;
 

+ 38 - 0
src/cn/hmsoft/art/control/score/ScScoreYmViolationControl.java

@@ -0,0 +1,38 @@
+package cn.hmsoft.art.control.score;
+
+import cn.hmsoft.application.web.Ajax;
+import cn.hmsoft.art.control.ArtControl;
+import cn.hmsoft.art.service.score.ScScoreYmViolationService;
+import cn.hmsoft.helper.StringHelper;
+import cn.hmsoft.helper.excel.ExcelReaderHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+import java.util.Objects;
+
+@RestController
+public class ScScoreYmViolationControl extends ArtControl {
+
+    @Autowired
+    private ScScoreYmViolationService scScoreYmViolationService;
+
+    @RequestMapping("score/ym/violation/page")
+    public Ajax page(String query, Integer start, Integer limit, String order, String type) {
+        if(StringHelper.isEmpty(order)){
+            order = "violation_no";
+        }
+        return new Ajax(scScoreYmViolationService.page(query, start, limit, getQueryOrder(order, type)));
+    }
+
+    @CrossOrigin
+    @RequestMapping("score/ym/violation/upload")
+    public Ajax upload(MultipartFile file) throws Exception {
+        List<List<String>> values = ExcelReaderHelper.readSheet(Objects.requireNonNull(file.getOriginalFilename()), file.getInputStream(), 1, 10);
+        scScoreYmViolationService.upload(values, getFrameOptr());
+        return new Ajax();
+    }
+}

+ 2 - 0
src/cn/hmsoft/art/control/score/ScoreYmControl.java

@@ -78,9 +78,11 @@ public class ScoreYmControl extends ArtControl {
 		String sql = "select * from sc_score_ym ym where batch='first'";
 		QueryOrder qr = this.getQueryOrder(order, type);
 		if (StringHelper.isEmpty(query)) {
+			sql += " order by wei_gui desc";
 			return new Ajax(this.daoStd.pageMapBySql(qr, start, limit, sql));
 		}
 		sql = sql + " and ( ym.cert_id =? or ym.ticket_no=? or  ym.aspect_name=? or ym.std_name like ? )";
+		sql += " order by wei_gui desc";
 		return new Ajax(this.daoStd.pageMapBySql(qr, start, limit, sql, query, query, query, "%" + query + "%"));
 	}
 	

+ 28 - 0
src/cn/hmsoft/art/data/dao/sc/ScScoreYmViolationDao.java

@@ -0,0 +1,28 @@
+package cn.hmsoft.art.data.dao.sc;
+
+import cn.hmsoft.art.data.model.sc.ScScoreYmViolation;
+import cn.hmsoft.helper.StringHelper;
+import cn.hmsoft.jdbc.core.PlatformDaoSupport;
+import cn.hmsoft.jdbc.entity.Pager;
+import cn.hmsoft.jdbc.entity.QueryOrder;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class ScScoreYmViolationDao extends PlatformDaoSupport<ScScoreYmViolation> {
+
+    public Pager pageViolation(String query, Integer start, Integer limit, QueryOrder queryOrder) {
+        String sql = "select v.*,r.std_sex,p.province_name,r.exam_id from sc_score_ym_violation v, std_reg r,cf_enrol_province p ";
+        sql += " where v.cert_id=r.cert_id and r.std_province=p.province_id ";
+        if (StringHelper.isEmpty(query)) {
+            return this.pageMapBySql(queryOrder, start, limit, sql);
+        }
+        String value = this.generateLikeParamter(query);
+        sql += " and (v.cert_id like ? or v.std_name like ?  or v.ticket_no like ?)";
+        return this.pageMapBySql(queryOrder, start, limit, sql, value, value, value);
+    }
+
+    public ScScoreYmViolation findByCertAndAspect(String certId, String aspectName) {
+        String sql = "select * from sc_score_ym_violation where cert_id=? and aspect_name=?";
+        return this.findBySql(sql, certId, aspectName);
+    }
+}

+ 134 - 0
src/cn/hmsoft/art/data/model/sc/ScScoreYmViolation.java

@@ -0,0 +1,134 @@
+package cn.hmsoft.art.data.model.sc;
+
+import cn.hmsoft.jdbc.entity.Table;
+
+import java.io.Serializable;
+
+/**
+ * @Description 违纪考生信息
+ */
+@Table(tableName = "sc_score_ym_violation", keyColumn = "id", sequenceName = "")
+public class ScScoreYmViolation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    //考生姓名
+    private String std_name;
+
+    //证件号码
+    private String cert_id;
+
+    //专业名称
+    private String aspect_name;
+
+    //准考证号
+    private String ticket_no;
+
+    //考生违规编号
+    private String violation_no;
+
+    //考试日期 yyyy-MM-dd
+    private String exam_date;
+
+    //考试科目
+    private String exam_subject;
+
+    //违规行为
+    private String violation_remark;
+
+    //国家处理办法
+    private String country_rule;
+
+    //学校处理办法
+    private String school_rule;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getStd_name() {
+        return std_name;
+    }
+
+    public void setStd_name(String std_name) {
+        this.std_name = std_name;
+    }
+
+    public String getCert_id() {
+        return cert_id;
+    }
+
+    public void setCert_id(String cert_id) {
+        this.cert_id = cert_id;
+    }
+
+    public String getAspect_name() {
+        return aspect_name;
+    }
+
+    public void setAspect_name(String aspect_name) {
+        this.aspect_name = aspect_name;
+    }
+
+    public String getTicket_no() {
+        return ticket_no;
+    }
+
+    public void setTicket_no(String ticket_no) {
+        this.ticket_no = ticket_no;
+    }
+
+    public String getViolation_no() {
+        return violation_no;
+    }
+
+    public void setViolation_no(String violation_no) {
+        this.violation_no = violation_no;
+    }
+
+    public String getExam_date() {
+        return exam_date;
+    }
+
+    public void setExam_date(String exam_date) {
+        this.exam_date = exam_date;
+    }
+
+    public String getExam_subject() {
+        return exam_subject;
+    }
+
+    public void setExam_subject(String exam_subject) {
+        this.exam_subject = exam_subject;
+    }
+
+    public String getViolation_remark() {
+        return violation_remark;
+    }
+
+    public void setViolation_remark(String violation_remark) {
+        this.violation_remark = violation_remark;
+    }
+
+    public String getCountry_rule() {
+        return country_rule;
+    }
+
+    public void setCountry_rule(String country_rule) {
+        this.country_rule = country_rule;
+    }
+
+    public String getSchool_rule() {
+        return school_rule;
+    }
+
+    public void setSchool_rule(String school_rule) {
+        this.school_rule = school_rule;
+    }
+}

+ 3 - 2
src/cn/hmsoft/art/service/ly/ticket/Ticket10047FZ.java

@@ -18,8 +18,9 @@ import cn.hmsoft.helper.StringHelper;
  */
 public class Ticket10047FZ extends TicketHelper {
 	
-	public final String stdSql = "select std.std_id,aspect_code,e.agent_id from std_enrol e,std_reg std,cf_aspect t "
-			+ " where std.std_id=e.std_id and e.batch_pay_status='Active' and e.std_batch=1 and t.aspect_id=e.aspect_id group by std.std_id,aspect_code,agent_id  order by aspect_code";
+	public final String stdSql = "select std.std_id,aspect_code,e.agent_id,t.aspect_id from std_enrol e,std_reg std,cf_aspect t "
+			+ " where std.std_id=e.std_id and e.batch_pay_status='Active' and e.std_batch=1 and t.aspect_id=e.aspect_id "
+			+ " group by std.std_id,aspect_code,t.aspect_id,agent_id  order by aspect_code,t.aspect_id ";
 
 	@Override
 	protected void makeTicket(LyStdTicketDao daoTicket, LyAgent agent) {

+ 177 - 0
src/cn/hmsoft/art/service/score/ScScoreYmViolationService.java

@@ -0,0 +1,177 @@
+package cn.hmsoft.art.service.score;
+
+import cn.hmsoft.art.constants.ArtOptrLogType;
+import cn.hmsoft.art.data.dao.ly.LyStdTicketDao;
+import cn.hmsoft.art.data.dao.sc.ScScoreYmViolationDao;
+import cn.hmsoft.art.data.dao.std.StdEnrolDao;
+import cn.hmsoft.art.data.dao.std.StdRegDao;
+import cn.hmsoft.art.data.model.ly.LyStdTicket;
+import cn.hmsoft.art.data.model.sc.ScScoreYmViolation;
+import cn.hmsoft.art.data.model.std.StdEnrol;
+import cn.hmsoft.art.data.model.std.StdReg;
+import cn.hmsoft.art.service.ArtService;
+import cn.hmsoft.frame.data.model.FrameOptr;
+import cn.hmsoft.frame.exception.BusinessException;
+import cn.hmsoft.helper.CollectionHelper;
+import cn.hmsoft.helper.LocalDateHelper;
+import cn.hmsoft.helper.StringHelper;
+import cn.hmsoft.jdbc.entity.Pager;
+import cn.hmsoft.jdbc.entity.QueryOrder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class ScScoreYmViolationService extends ArtService {
+
+    @Autowired
+    private ScScoreYmViolationDao scScoreYmViolationDao;
+
+    @Autowired
+    private StdRegDao stdRegDao;
+
+    @Autowired
+    private StdEnrolDao stdEnrolDao;
+
+    @Autowired
+    private LyStdTicketDao stdTicketDao;
+
+    public Pager page(String query, Integer start, Integer limit, QueryOrder queryOrder) {
+        return scScoreYmViolationDao.pageViolation(query, start, limit, queryOrder);
+    }
+
+    public void upload(List<List<String>> values, FrameOptr optr) {
+        int row = 2;
+        for (List<String> list : values) {
+            String std_name = list.get(0) == null ? null : list.get(0).trim();
+            String cert_id = list.get(1) == null ? null : list.get(1).trim();
+            String aspect_name = list.get(2) == null ? null : list.get(2).trim();
+            String ticket_no = list.get(3) == null ? null : list.get(3).trim();
+            String violation_no = list.get(4) == null ? null : list.get(4).trim();
+            String exam_date = list.get(5) == null ? null : list.get(5).trim();
+            String exam_subject = list.get(6) == null ? null : list.get(6).trim();
+            String violation_remark = list.get(7) == null ? null : list.get(7).trim();
+            String country_rule = list.get(8) == null ? null : list.get(8).trim();
+            String school_rule = list.get(9) == null ? null : list.get(9).trim();
+
+            if (StringHelper.isEmpty(std_name)) {
+                throw new BusinessException("第【" + row + "】行,考生姓名不能为空");
+            }
+
+            if (StringHelper.isEmpty(cert_id)) {
+                throw new BusinessException("第【" + row + "】行,考生证件号码不能为空");
+            }
+
+            //考生是否存在
+            StdReg stdReg = stdRegDao.findStdRegByCertAndName(cert_id, std_name);
+            if (stdReg == null) {
+                throw new BusinessException("第【" + row + "】行,找不到该考生");
+            }
+
+            if (StringHelper.isEmpty(aspect_name)) {
+                throw new BusinessException("第【" + row + "】行,考生报考专业不能为空");
+            }
+
+            List<StdEnrol> stdEnrolList = stdEnrolDao.list("std_id", stdReg.getStd_id());
+            if (CollectionHelper.isEmpty(stdEnrolList)) {
+                throw new BusinessException("第【" + row + "】行,考生未参加考试");
+            }
+
+            List<StdEnrol> filterEnrolList = stdEnrolList.stream()
+                    .filter(item -> item.getAspect_name().equals(aspect_name))
+                    .collect(Collectors.toList());
+            if (CollectionHelper.isEmpty(filterEnrolList)) {
+                throw new BusinessException("第【" + row + "】行,考生未报考该专业");
+            }
+
+            if (StringHelper.isEmpty(ticket_no)) {
+                throw new BusinessException("第【" + row + "】行,考生准考证号不能为空");
+            }
+
+            List<LyStdTicket> stdTicketList = stdTicketDao.list("std_id", stdReg.getStd_id());
+            if (CollectionHelper.isEmpty(stdTicketList)) {
+                throw new BusinessException("第【" + row + "】行,考生准考证号不存在");
+            }
+            List<LyStdTicket> filterTicketList = stdTicketList.stream()
+                    .filter(item -> item.getTicket_no().equals(ticket_no))
+                    .collect(Collectors.toList());
+            if (CollectionHelper.isEmpty(filterTicketList)) {
+                throw new BusinessException("第【" + row + "】行,考生准考证号错误");
+            }
+
+            if (StringHelper.isEmpty(violation_no)) {
+                throw new BusinessException("第【" + row + "】行,考生违规编号不能为空");
+            }
+
+            if (StringHelper.isEmpty(exam_date)) {
+                throw new BusinessException("第【" + row + "】行,考试日期不能为空");
+            }
+            String[] dates = exam_date.split("-");
+            if (dates.length != 3) {
+                throw new BusinessException("第【" + row + "】行,日期格式错误");
+            }
+            if (dates[1].length() == 1) {
+                dates[1] = "0" + dates[1];
+                exam_date = String.join("-", dates);
+            }
+            if (dates[2].length() == 1) {
+                dates[2] = "0" + dates[2];
+                exam_date = String.join("-", dates);
+            }
+            LocalDate localDate = LocalDateHelper.parseDate(exam_date);
+            if (localDate == null) {
+                throw new BusinessException("第【" + row + "】行,日期格式错误");
+            }
+
+            if (StringHelper.isEmpty(exam_subject)) {
+                throw new BusinessException("第【" + row + "】行,考生考试科目不能为空");
+            }
+
+            if (StringHelper.isEmpty(violation_remark)) {
+                throw new BusinessException("第【" + row + "】行,考生违规行为不能为空");
+            }
+
+            if (StringHelper.isEmpty(country_rule)) {
+                throw new BusinessException("第【" + row + "】行,国家处理办法不能为空");
+            }
+
+            if (StringHelper.isEmpty(school_rule)) {
+                throw new BusinessException("第【" + row + "】行,学校处理办法不能为空");
+            }
+
+            //判断是否已经存在
+            ScScoreYmViolation existViolation = scScoreYmViolationDao.findByCertAndAspect(cert_id, aspect_name);
+            if (existViolation != null) {
+                existViolation.setTicket_no(ticket_no);
+                existViolation.setViolation_no(violation_no);
+                existViolation.setExam_date(exam_date);
+                existViolation.setExam_subject(exam_subject);
+                existViolation.setViolation_remark(violation_remark);
+                existViolation.setCountry_rule(country_rule);
+                existViolation.setSchool_rule(school_rule);
+                scScoreYmViolationDao.update(existViolation);
+            } else {
+                ScScoreYmViolation violation = new ScScoreYmViolation();
+                violation.setStd_name(std_name);
+                violation.setCert_id(cert_id);
+                violation.setAspect_name(aspect_name);
+                violation.setTicket_no(ticket_no);
+                violation.setViolation_no(violation_no);
+                violation.setExam_date(exam_date);
+                violation.setExam_subject(exam_subject);
+                violation.setViolation_remark(violation_remark);
+                violation.setCountry_rule(country_rule);
+                violation.setSchool_rule(school_rule);
+                scScoreYmViolationDao.insert(violation);
+            }
+            row++;
+        }
+
+        this.log(optr, ArtOptrLogType.VIOLATION_IMPORT.toString());
+    }
+
+
+}