From 5b3577125df6cd424b1c5d0ffab36a686b7c6331 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Wed, 5 May 2021 18:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A5=97=E7=89=88=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionCardUserVO.java | 30 ++++++++----- .../impl/DistributionCardServiceImpl.java | 43 +++++++++++++------ .../distribution-card-mapper.xml | 4 +- .../examination/distributioncard/list.html | 4 +- 4 files changed, 56 insertions(+), 25 deletions(-) diff --git a/src/main/java/cn/com/tenlion/pojo/vos/distributioncard/DistributionCardUserVO.java b/src/main/java/cn/com/tenlion/pojo/vos/distributioncard/DistributionCardUserVO.java index 1286fc0..e021bbc 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/distributioncard/DistributionCardUserVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/distributioncard/DistributionCardUserVO.java @@ -11,27 +11,37 @@ import io.swagger.annotations.ApiModelProperty; * @Date: 2021-05-03 16:46:42 * @Version: 3.0 **/ -@ApiModel +// @ApiModel public class DistributionCardUserVO { - @ApiModelProperty(name = "name", value = "姓名") + //@ApiModelProperty(name = "name", value = "姓名") private String name; - @ApiModelProperty(name = "sex", value = "性别") + //@ApiModelProperty(name = "sex", value = "性别") private String sex; - @ApiModelProperty(name = "identity", value = "身份证号码") + //@ApiModelProperty(name = "identity", value = "身份证号码") private String identity; - @ApiModelProperty(name = "icon", value = "头像") + //@ApiModelProperty(name = "icon", value = "头像") private String icon; - @ApiModelProperty(name = "time", value = "考试时间") + //@ApiModelProperty(name = "time", value = "考试时间") private String time; - @ApiModelProperty(name = "station", value = "考点") + //@ApiModelProperty(name = "station", value = "考点") private String station; - @ApiModelProperty(name = "field", value = "考场") + //@ApiModelProperty(name = "field", value = "考场") private String field; - @ApiModelProperty(name = "number", value = "考号") + //@ApiModelProperty(name = "number", value = "考号") private String number; - @ApiModelProperty(name = "unitName", value = "单位名称") + //@ApiModelProperty(name = "unitName", value = "单位名称") private String unitName; + //@ApiModelProperty(name = "classPlanName", value = "班级名称") + private String classPlanName; + + public String getClassPlanName() { + return classPlanName == null ? "" : classPlanName; + } + + public void setClassPlanName(String classPlanName) { + this.classPlanName = classPlanName; + } public String getUnitName() { return unitName == null ? "" : unitName; diff --git a/src/main/java/cn/com/tenlion/service/examination/distributioncard/impl/DistributionCardServiceImpl.java b/src/main/java/cn/com/tenlion/service/examination/distributioncard/impl/DistributionCardServiceImpl.java index 147919f..f34063f 100644 --- a/src/main/java/cn/com/tenlion/service/examination/distributioncard/impl/DistributionCardServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/examination/distributioncard/impl/DistributionCardServiceImpl.java @@ -88,6 +88,7 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I } // 考试总人数 int number = distributionDTO.getDistributionNumber(); + // 查找报名信息 List userList = iApplyService.listByClassId(classPlanId); if(userList.size() != distributionDTO.getDistributionNumber()) { @@ -100,10 +101,18 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I c:for(int i = 0 ; i < distributionFieldDTOList.size() ; i++) { DistributionFieldDTO fieldDTO = distributionFieldDTOList.get(i); int fieldumber = fieldDTO.getFieldNumber(); - for( ; j <= fieldumber ; j++) { + for( ; j <= fieldumber ; ) { if(j > userList.size()) { break c; } + /** + * 判断是否已经存在 + */ + DistributionCardDTO dto = get(userList.get(j-1).getApplyId()); + if(dto != null) { + j++; + continue; + } /** * 生成准考证 */ @@ -111,14 +120,16 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I userVO.setField(fieldDTO.getFieldName()); userVO.setStation(institutionDTO.getInstitutionName()); userVO.setNumber(j+""); - DataDTO dataDTO = dataDictionaryServiceImpl.get(userList.get(i).getApplySex()); + DataDTO dataDTO = dataDictionaryServiceImpl.get(userList.get(j-1).getApplySex()); userVO.setSex(dataDTO.getDataName()); - userVO.setName(userList.get(i).getApplyName()); - userVO.setIcon(userList.get(i).getApplyUserCardPhoto()); - userVO.setIdentity(userList.get(i).getApplyCardNumber()); + userVO.setName(userList.get(j-1).getApplyName()); + userVO.setIcon(userList.get(j-1).getApplyUserCardPhoto()); + userVO.setIdentity(userList.get(j-1).getApplyCardNumber()); userVO.setTime(distributionDTO.getDistributionAllotTime()); - userVO.setUnitName(userList.get(i).getApplyUnitName()); - String base64 = iPicturesTemplateBuildingService.buildingPictures("TS0001", new Object()); + InstitutionDTO institutionDTO1 = iInstitutionService.get(userList.get(j-1).getApplyInstitutionId()); + userVO.setUnitName(institutionDTO1.getInstitutionName()); + userVO.setClassPlanName(userList.get(j-1).getApplyClassName()); + String base64 = iPicturesTemplateBuildingService.buildingPictures("TS0001", userVO); if(base64 == null) { throw new SaveException("生成准考证出错"); } @@ -126,18 +137,19 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I * 保存准考证生成信息 */ DistributionCardVO distributionCardVO = new DistributionCardVO(); - distributionCardVO.setDistributionCardUserId(userList.get(i).getCreate()); - distributionCardVO.setDistributionCardUserName(userList.get(i).getApplyName()); + distributionCardVO.setDistributionCardUserId(userList.get(j-1).getCreate()); + distributionCardVO.setDistributionCardUserName(userList.get(j-1).getApplyName()); distributionCardVO.setDistributionCardNumber(j + ""); distributionCardVO.setDistributionFieldId(fieldDTO.getDistributionFieldId()); distributionCardVO.setClassPlanId(classPlanId); distributionCardVO.setDistributionId(distributionDTO.getDistributionId()); distributionCardVO.setDistributionCardPictures(base64); distributionCardVO.setDistributionCardUserSex(dataDTO.getDataName()); - distributionCardVO.setDistributionCardUserIdentity(userList.get(i).getApplyCardNumber()); + distributionCardVO.setDistributionCardUserIdentity(userList.get(j-1).getApplyCardNumber()); distributionCardVO.setDistributionCardUserResult(""); distributionCardVO.setDistributionCardUserStatus("0"); - save(userList.get(i).getApplyId(), distributionCardVO); + saveById(userList.get(j-1).getApplyId(), distributionCardVO); + j++; } } } @@ -167,7 +179,14 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I Map params = HashMapUtil.beanToMap(distributionCardVO); params.put("distributionCardId", distributionCardId); setSaveInfo(params); - distributionCardDao.save(params); + + /** + * 判断是否已经存在 + */ + DistributionCardDTO dto = distributionCardDao.get(params); + if(dto == null) { + distributionCardDao.save(params); + } } @Override diff --git a/src/main/resources/mybatis/mapper/distributioncard/distribution-card-mapper.xml b/src/main/resources/mybatis/mapper/distributioncard/distribution-card-mapper.xml index b978ec0..5946ed6 100644 --- a/src/main/resources/mybatis/mapper/distributioncard/distribution-card-mapper.xml +++ b/src/main/resources/mybatis/mapper/distributioncard/distribution-card-mapper.xml @@ -333,7 +333,9 @@ AND ( - t1.id LIKE CONCAT('%', #{keywords}, '%') + t1.distribution_card_user_name LIKE CONCAT('%', #{keywords}, '%') + OR + t1.distribution_card_user_identity LIKE CONCAT('%', #{keywords}, '%') ) diff --git a/src/main/resources/static/route/examination/distributioncard/list.html b/src/main/resources/static/route/examination/distributioncard/list.html index d8e51e7..6359c11 100644 --- a/src/main/resources/static/route/examination/distributioncard/list.html +++ b/src/main/resources/static/route/examination/distributioncard/list.html @@ -16,7 +16,7 @@
-
+
@@ -133,7 +133,7 @@ loop:true }); }, 50); - return '
  • 无
' + return '' + row['distributionCardUserName'] + '' } }, ]