diff --git a/src/main/java/cn/com/tenlion/controller/api/personfiles/PersonFilesController.java b/src/main/java/cn/com/tenlion/controller/api/personfiles/PersonFilesController.java new file mode 100644 index 0000000..b60bd62 --- /dev/null +++ b/src/main/java/cn/com/tenlion/controller/api/personfiles/PersonFilesController.java @@ -0,0 +1,40 @@ +package cn.com.tenlion.controller.api.personfiles; + +import cn.com.tenlion.service.personfiles.IPersonFilesService; +import ink.wgink.common.base.DefaultBaseController; +import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.result.SuccessResultList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * 人员档案controller + * @author xwangs + * @create 2021-06-24 15:56 + * @description + */ +@RestController +@RequestMapping(ISystemConstant.API_PREFIX + "/person-files") +public class PersonFilesController extends DefaultBaseController { + + @Autowired + private IPersonFilesService personFilesService; + + @GetMapping("list") + public SuccessResultList list(ListPage page) { + Map params = requestParams(); + page.setParams(params); + return personFilesService.list(page); + } + + @GetMapping("get-certificate") + public Map getCertificate() { + Map params = requestParams(); + return personFilesService.getCertificate(params); + } +} diff --git a/src/main/java/cn/com/tenlion/dao/personfiles/IPersonFilesDao.java b/src/main/java/cn/com/tenlion/dao/personfiles/IPersonFilesDao.java new file mode 100644 index 0000000..d9caafb --- /dev/null +++ b/src/main/java/cn/com/tenlion/dao/personfiles/IPersonFilesDao.java @@ -0,0 +1,29 @@ +package cn.com.tenlion.dao.personfiles; + +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * @author xwangs + * @create 2021-06-24 16:10 + * @description + */ +@Repository +public interface IPersonFilesDao { + + /** + * 人员档案列表 + * @param params + * @return + */ + List> list(Map params); + + /** + * 查询工种证件对应关系 + * @param params + * @return + */ + Map getCertificateMapping(Map params); +} diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/applystudents/ApplyStudentsDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/applystudents/ApplyStudentsDTO.java index b653afc..0b1665d 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/applystudents/ApplyStudentsDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/applystudents/ApplyStudentsDTO.java @@ -65,6 +65,8 @@ public class ApplyStudentsDTO { private Integer applyAuditState; @ApiModelProperty(name = "applyTestScores", value = "考试成绩") private String applyTestScores; + @ApiModelProperty(name = "bindUserAccount", value = "同意用户ID") + private String bindUserAccount; @ApiModelProperty(name = "creator", value = "创建人") private String creator; @ApiModelProperty(name = "gmtCreate", value = "创建时间") @@ -345,4 +347,12 @@ public class ApplyStudentsDTO { public void setExamEndTime(String examEndTime) { this.examEndTime = examEndTime; } + + public String getBindUserAccount() { + return bindUserAccount == null ? "" : bindUserAccount; + } + + public void setBindUserAccount(String bindUserAccount) { + this.bindUserAccount = bindUserAccount; + } } diff --git a/src/main/java/cn/com/tenlion/service/personfiles/IPersonFilesService.java b/src/main/java/cn/com/tenlion/service/personfiles/IPersonFilesService.java new file mode 100644 index 0000000..554fd77 --- /dev/null +++ b/src/main/java/cn/com/tenlion/service/personfiles/IPersonFilesService.java @@ -0,0 +1,28 @@ +package cn.com.tenlion.service.personfiles; + +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.result.SuccessResultList; + +import java.util.Map; + +/** + * @author xwangs + * @create 2021-06-24 16:07 + * @description + */ +public interface IPersonFilesService { + + /** + * 人员档案列表 + * @param page + * @return + */ + SuccessResultList list(ListPage page); + + /** + * 根据档案查询对应证件 + * @param params + * @return + */ + Map getCertificate(Map params); +} diff --git a/src/main/java/cn/com/tenlion/service/personfiles/impl/PersonFilesServiceImpl.java b/src/main/java/cn/com/tenlion/service/personfiles/impl/PersonFilesServiceImpl.java new file mode 100644 index 0000000..5195cde --- /dev/null +++ b/src/main/java/cn/com/tenlion/service/personfiles/impl/PersonFilesServiceImpl.java @@ -0,0 +1,76 @@ +package cn.com.tenlion.service.personfiles.impl; + +import cn.com.tenlion.dao.personfiles.IPersonFilesDao; +import cn.com.tenlion.pojo.dtos.applystudentsnew.ApplyStudentsNewDTO; +import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO; +import cn.com.tenlion.service.applystudentsnew.IApplyStudentsNewService; +import cn.com.tenlion.service.classplan.IClassPlanService; +import cn.com.tenlion.service.personfiles.IPersonFilesService; +import cn.com.tenlion.util.CertificateUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.SearchException; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.result.SuccessResultList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author xwangs + * @create 2021-06-24 16:08 + * @description + */ +@Service +public class PersonFilesServiceImpl extends DefaultBaseService implements IPersonFilesService { + + @Autowired + private IPersonFilesDao personFilesDao; + @Autowired + private IApplyStudentsNewService studentsNewService; + @Autowired + private IClassPlanService classPlanService; + @Autowired + private CertificateUtil certificateUtil; + + @Override + public SuccessResultList list(ListPage page) { + String orgId = page.getParams().get("orgId") == null ? "" : page.getParams().get("orgId").toString(); + if("".equals(orgId)){ + return new SuccessResultList(new ArrayList<>(), 0, 0L); + } + PageHelper.startPage(page.getPage(), page.getRows()); + List> list = personFilesDao.list(page.getParams()); + PageInfo> pageInfo = new PageInfo<>(list); + return new SuccessResultList(list, pageInfo.getPageNum(), pageInfo.getTotal()); + } + + @Override + public Map getCertificate(Map params) { + if(params.get("applyStudentsNewId") == null + || params.get("applyStudentsNewId").toString().length() == 0){ + throw new SearchException("主键丢失,查询不到人员档案"); + } + String applyStudentsNewId = params.get("applyStudentsNewId").toString(); + ApplyStudentsNewDTO applyStudentsNewDTO = studentsNewService.get(applyStudentsNewId); + ClassPlanDTO classPlanDTO = classPlanService.get(applyStudentsNewDTO.getClassPlanId()); + String workTypeId = classPlanDTO.getWorkerCatalog(); + params.put("workTypeId","9f1ac1a6-7c17-4e1f-a44b-0d2de9b623ef"); + Map certificateMapping = personFilesDao.getCertificateMapping(params); + String mappingCode = certificateMapping.get("mappingCode").toString(); + String certificateB64 = ""; + switch (mappingCode){ + case "TS0002" : + certificateB64 = certificateUtil.getTS0002(applyStudentsNewDTO); + break; + } + Map resultMap = new HashMap<>(4); + resultMap.put("certificateB64",certificateB64); + return resultMap; + } +} diff --git a/src/main/java/cn/com/tenlion/util/CertificateUtil.java b/src/main/java/cn/com/tenlion/util/CertificateUtil.java new file mode 100644 index 0000000..a689e99 --- /dev/null +++ b/src/main/java/cn/com/tenlion/util/CertificateUtil.java @@ -0,0 +1,65 @@ +package cn.com.tenlion.util; + +import cn.com.tenlion.buildingpictures.service.picturestemplatebuilding.IPicturesTemplateBuildingService; +import cn.com.tenlion.pojo.dtos.applystudents.ApplyStudentsDTO; +import cn.com.tenlion.pojo.dtos.applystudentsnew.ApplyStudentsNewDTO; +import cn.com.tenlion.pojo.dtos.cardential.CardentialDTO; +import cn.com.tenlion.service.applystudents.IApplyStudentsService; +import ink.wgink.module.dictionary.pojo.dtos.DataDTO; +import ink.wgink.module.dictionary.service.IDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * 生成证书的工具类 + * @author xwangs + * @create 2021-06-25 10:42 + * @description + */ +@Component +public class CertificateUtil { + + @Autowired + private IApplyStudentsService studentsService; + @Autowired + private IDataService dataService; + @Autowired + private IPicturesTemplateBuildingService picService; + + public String getTS0002(ApplyStudentsNewDTO applyStudentsNewDTO){ + Map query = new HashMap<>(8); + query.put("applyClassId", applyStudentsNewDTO.getClassPlanId()); + query.put("bindUserAccount",applyStudentsNewDTO.getUserId()); + ApplyStudentsDTO studentsDTO = studentsService.get(query); + CardentialDTO cardentialDTO = new CardentialDTO(); + cardentialDTO.setPhoto(studentsDTO.getApplyUserCardPhoto()); + cardentialDTO.setName(applyStudentsNewDTO.getName()); + cardentialDTO.setSex(applyStudentsNewDTO.getSex()); + // 查询文化程度 + if(applyStudentsNewDTO.getEducation() == null + || applyStudentsNewDTO.getEducation().length() == 0){ + cardentialDTO.setEducationDegree("EMPTY"); + } else { + DataDTO educationData = dataService.get(applyStudentsNewDTO.getEducation()); + cardentialDTO.setEducationDegree(educationData.getDataName()); + } + cardentialDTO.setIdentity(applyStudentsNewDTO.getCardNumber()); + cardentialDTO.setDepartment(applyStudentsNewDTO.getWorkUnit()); + cardentialDTO.setPosition(applyStudentsNewDTO.getWorkTitle()); + cardentialDTO.setSueDate(applyStudentsNewDTO.getGetCardTime()); + cardentialDTO.setStartDate(applyStudentsNewDTO.getGetCardTime()); + cardentialDTO.setEndDate(applyStudentsNewDTO.getGetCardTime()); + cardentialDTO.setNumber(applyStudentsNewDTO.getIdCard()); + cardentialDTO.setQrCode(""); + String certificateB64; + try { + certificateB64 = picService.buildingPictures("TS0002",cardentialDTO); + } catch (Exception e){ + return ""; + } + return certificateB64; + } +} diff --git a/src/main/resources/mybatis/mapper/applystudents/apply-students-mapper.xml b/src/main/resources/mybatis/mapper/applystudents/apply-students-mapper.xml index 1462105..28f8b42 100644 --- a/src/main/resources/mybatis/mapper/applystudents/apply-students-mapper.xml +++ b/src/main/resources/mybatis/mapper/applystudents/apply-students-mapper.xml @@ -27,6 +27,7 @@ + @@ -306,11 +307,22 @@ t1.apply_technical_titles, t1.apply_user_card_photo, t1.apply_audit_state, - t1.apply_test_scores + t1.apply_test_scores, + t1.bind_user_account FROM e_apply_students t1 WHERE - t1.is_delete = 0 AND t1.apply_id = #{applyId} + t1.is_delete = 0 + + AND t1.apply_id = #{applyId} + + + AND t1.apply_class_id = #{applyClassId} + + + AND t1.bind_user_account = #{bindUserAccount} + + limit 1 diff --git a/src/main/resources/mybatis/mapper/personfiles/personfiles-mapper.xml b/src/main/resources/mybatis/mapper/personfiles/personfiles-mapper.xml new file mode 100644 index 0000000..44391fa --- /dev/null +++ b/src/main/resources/mybatis/mapper/personfiles/personfiles-mapper.xml @@ -0,0 +1,49 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/personfiles/list-person-files-tree.html b/src/main/resources/static/route/personfiles/list-person-files-tree.html new file mode 100644 index 0000000..2f6aea1 --- /dev/null +++ b/src/main/resources/static/route/personfiles/list-person-files-tree.html @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
    +
    +
    +
    +
    +
    +
    +
    +
    所有人员档案
    + +
    +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/personfiles/list-person-files.html b/src/main/resources/static/route/personfiles/list-person-files.html new file mode 100644 index 0000000..4407b5a --- /dev/null +++ b/src/main/resources/static/route/personfiles/list-person-files.html @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/personfiles/show-certificate.html b/src/main/resources/static/route/personfiles/show-certificate.html new file mode 100644 index 0000000..4a67a9d --- /dev/null +++ b/src/main/resources/static/route/personfiles/show-certificate.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    + + + + + \ No newline at end of file