图片套版生成模块

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
* @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;

View File

@ -88,6 +88,7 @@ public class DistributionCardServiceImpl extends DefaultBaseService implements I
}
// 考试总人数
int number = distributionDTO.getDistributionNumber();
// 查找报名信息
List<ApplyDTO> 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<String, Object> 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

View File

@ -333,7 +333,9 @@
<if test="keywords != null and keywords != ''">
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 test="startTime != null and startTime != ''">

File diff suppressed because one or more lines are too long