图片套版生成模块

This commit is contained in:
cuibaocheng 2021-05-05 18:17:17 +08:00
parent f58efac12a
commit 5b3577125d
4 changed files with 56 additions and 25 deletions

View File

@ -11,27 +11,37 @@ import io.swagger.annotations.ApiModelProperty;
* @Date: 2021-05-03 16:46:42 * @Date: 2021-05-03 16:46:42
* @Version: 3.0 * @Version: 3.0
**/ **/
@ApiModel // @ApiModel
public class DistributionCardUserVO { public class DistributionCardUserVO {
@ApiModelProperty(name = "name", value = "姓名") //@ApiModelProperty(name = "name", value = "姓名")
private String name; private String name;
@ApiModelProperty(name = "sex", value = "性别") //@ApiModelProperty(name = "sex", value = "性别")
private String sex; private String sex;
@ApiModelProperty(name = "identity", value = "身份证号码") //@ApiModelProperty(name = "identity", value = "身份证号码")
private String identity; private String identity;
@ApiModelProperty(name = "icon", value = "头像") //@ApiModelProperty(name = "icon", value = "头像")
private String icon; private String icon;
@ApiModelProperty(name = "time", value = "考试时间") //@ApiModelProperty(name = "time", value = "考试时间")
private String time; private String time;
@ApiModelProperty(name = "station", value = "考点") //@ApiModelProperty(name = "station", value = "考点")
private String station; private String station;
@ApiModelProperty(name = "field", value = "考场") //@ApiModelProperty(name = "field", value = "考场")
private String field; private String field;
@ApiModelProperty(name = "number", value = "考号") //@ApiModelProperty(name = "number", value = "考号")
private String number; private String number;
@ApiModelProperty(name = "unitName", value = "单位名称") //@ApiModelProperty(name = "unitName", value = "单位名称")
private String unitName; 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() { public String getUnitName() {
return unitName == null ? "" : unitName; return unitName == null ? "" : unitName;

View File

@ -88,6 +88,7 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I
} }
// 考试总人数 // 考试总人数
int number = distributionDTO.getDistributionNumber(); int number = distributionDTO.getDistributionNumber();
// 查找报名信息 // 查找报名信息
List<ApplyDTO> userList = iApplyService.listByClassId(classPlanId); List<ApplyDTO> userList = iApplyService.listByClassId(classPlanId);
if(userList.size() != distributionDTO.getDistributionNumber()) { 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++) { c:for(int i = 0 ; i < distributionFieldDTOList.size() ; i++) {
DistributionFieldDTO fieldDTO = distributionFieldDTOList.get(i); DistributionFieldDTO fieldDTO = distributionFieldDTOList.get(i);
int fieldumber = fieldDTO.getFieldNumber(); int fieldumber = fieldDTO.getFieldNumber();
for( ; j <= fieldumber ; j++) { for( ; j <= fieldumber ; ) {
if(j > userList.size()) { if(j > userList.size()) {
break c; 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.setField(fieldDTO.getFieldName());
userVO.setStation(institutionDTO.getInstitutionName()); userVO.setStation(institutionDTO.getInstitutionName());
userVO.setNumber(j+""); 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.setSex(dataDTO.getDataName());
userVO.setName(userList.get(i).getApplyName()); userVO.setName(userList.get(j-1).getApplyName());
userVO.setIcon(userList.get(i).getApplyUserCardPhoto()); userVO.setIcon(userList.get(j-1).getApplyUserCardPhoto());
userVO.setIdentity(userList.get(i).getApplyCardNumber()); userVO.setIdentity(userList.get(j-1).getApplyCardNumber());
userVO.setTime(distributionDTO.getDistributionAllotTime()); userVO.setTime(distributionDTO.getDistributionAllotTime());
userVO.setUnitName(userList.get(i).getApplyUnitName()); InstitutionDTO institutionDTO1 = iInstitutionService.get(userList.get(j-1).getApplyInstitutionId());
String base64 = iPicturesTemplateBuildingService.buildingPictures("TS0001", new Object()); userVO.setUnitName(institutionDTO1.getInstitutionName());
userVO.setClassPlanName(userList.get(j-1).getApplyClassName());
String base64 = iPicturesTemplateBuildingService.buildingPictures("TS0001", userVO);
if(base64 == null) { if(base64 == null) {
throw new SaveException("生成准考证出错"); throw new SaveException("生成准考证出错");
} }
@ -126,18 +137,19 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I
* 保存准考证生成信息 * 保存准考证生成信息
*/ */
DistributionCardVO distributionCardVO = new DistributionCardVO(); DistributionCardVO distributionCardVO = new DistributionCardVO();
distributionCardVO.setDistributionCardUserId(userList.get(i).getCreate()); distributionCardVO.setDistributionCardUserId(userList.get(j-1).getCreate());
distributionCardVO.setDistributionCardUserName(userList.get(i).getApplyName()); distributionCardVO.setDistributionCardUserName(userList.get(j-1).getApplyName());
distributionCardVO.setDistributionCardNumber(j + ""); distributionCardVO.setDistributionCardNumber(j + "");
distributionCardVO.setDistributionFieldId(fieldDTO.getDistributionFieldId()); distributionCardVO.setDistributionFieldId(fieldDTO.getDistributionFieldId());
distributionCardVO.setClassPlanId(classPlanId); distributionCardVO.setClassPlanId(classPlanId);
distributionCardVO.setDistributionId(distributionDTO.getDistributionId()); distributionCardVO.setDistributionId(distributionDTO.getDistributionId());
distributionCardVO.setDistributionCardPictures(base64); distributionCardVO.setDistributionCardPictures(base64);
distributionCardVO.setDistributionCardUserSex(dataDTO.getDataName()); distributionCardVO.setDistributionCardUserSex(dataDTO.getDataName());
distributionCardVO.setDistributionCardUserIdentity(userList.get(i).getApplyCardNumber()); distributionCardVO.setDistributionCardUserIdentity(userList.get(j-1).getApplyCardNumber());
distributionCardVO.setDistributionCardUserResult(""); distributionCardVO.setDistributionCardUserResult("");
distributionCardVO.setDistributionCardUserStatus("0"); 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<String, Object> params = HashMapUtil.beanToMap(distributionCardVO); Map<String, Object> params = HashMapUtil.beanToMap(distributionCardVO);
params.put("distributionCardId", distributionCardId); params.put("distributionCardId", distributionCardId);
setSaveInfo(params); setSaveInfo(params);
distributionCardDao.save(params);
/**
* 判断是否已经存在
*/
DistributionCardDTO dto = distributionCardDao.get(params);
if(dto == null) {
distributionCardDao.save(params);
}
} }
@Override @Override

View File

@ -333,7 +333,9 @@
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
<!-- 这里添加其他条件 --> <!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%') t1.distribution_card_user_name LIKE CONCAT('%', #{keywords}, '%')
OR
t1.distribution_card_user_identity LIKE CONCAT('%', #{keywords}, '%')
) )
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">

File diff suppressed because one or more lines are too long