|
@@ -0,0 +1,369 @@
|
|
|
|
+package com.jeeplus.modules.ruralprojectrecords.service;
|
|
|
|
+
|
|
|
|
+import com.jeeplus.common.service.CrudService;
|
|
|
|
+import com.jeeplus.common.utils.MyBeanUtils;
|
|
|
|
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
|
|
|
|
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectMessageElectronicSealDao;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.ProjectReportSignatureInfo;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant;
|
|
|
|
+import com.jeeplus.modules.sys.entity.MainDictDetail;
|
|
|
|
+import com.jeeplus.modules.sys.entity.User;
|
|
|
|
+import com.jeeplus.modules.sys.service.UserService;
|
|
|
|
+import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
|
+import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
|
+import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
|
|
|
|
+import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
|
|
|
|
+import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
|
|
|
|
+import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
|
|
|
|
+import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author: 徐滕
|
|
|
|
+ * @create: 2021-11-10 16:24
|
|
|
|
+ **/
|
|
|
|
+public class RuralProjectMessageElectronicSealService extends CrudService<RuralProjectMessageElectronicSealDao, ProjectReportSignatureInfo> {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RuralProjectMessageNewService ruralProjectMessageService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ProjectReportDataService projectReportDataService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RuralProjectRecordsService ruralProjectRecordsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WorkContractInfoService workContractInfoService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 质量流程控制单文件数据处理
|
|
|
|
+ * @param projectReportData
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Map<String,Object> disposeProjectReportdata(ProjectReportData projectReportData){
|
|
|
|
+ //获取报告信息
|
|
|
|
+ projectReportData = projectReportDataService.get(projectReportData.getId());
|
|
|
|
+ //获取项目信息
|
|
|
|
+ RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(projectReportData.getProject().getId());
|
|
|
|
+ ruralProjectRecordsService.queryUserNames(ruralProjectRecords);
|
|
|
|
+ // 将项目负责人替换为项目中的负责人
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
|
+ User user = UserUtils.get(ruralProjectRecords.getProjectMasterId());
|
|
|
|
+ projectReportData.setPrincipal(user);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取合同信息
|
|
|
|
+ WorkContractInfo workContractInfo = workContractInfoService.get(ruralProjectRecords.getWorkContractInfo().getId());
|
|
|
|
+ //无合同状态下,获取委托方的名称
|
|
|
|
+ if (workContractInfo == null) {
|
|
|
|
+ ruralProjectRecordsService.queryLinkmanInfos(ruralProjectRecords);
|
|
|
|
+ if (ruralProjectRecords.getWorkClientLinkmanList() != null && ruralProjectRecords.getWorkClientLinkmanList().size() > 0) {
|
|
|
|
+ WorkClientLinkman linkman = ruralProjectRecords.getWorkClientLinkmanList().get(0);
|
|
|
|
+ workContractInfo = new WorkContractInfo();
|
|
|
|
+ workContractInfo.setClient(linkman.getClientId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<RuralReportConsultant> consultants = com.google.common.collect.Lists.newArrayList();
|
|
|
|
+ //将自己添加到咨询员数据中
|
|
|
|
+ //根据用户查询技能信息(项目负责人信息)
|
|
|
|
+ RuralReportConsultant currentConsultant = new RuralReportConsultant();
|
|
|
|
+ //查询总审人员信息
|
|
|
|
+ RuralReportConsultant bzshbConsultant = new RuralReportConsultant();
|
|
|
|
+ List<WorkStaffCertificate> userCertificateList = com.google.common.collect.Lists.newArrayList();
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
|
+ userCertificateList = ruralProjectMessageService.getCertificateByUser(ruralProjectRecords.getProjectMasterId());
|
|
|
|
+ }
|
|
|
|
+ //获取专业类型
|
|
|
|
+ List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("certificate_major");
|
|
|
|
+ for (WorkStaffCertificate certificateInfo: userCertificateList) {
|
|
|
|
+ currentConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
|
+ currentConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
|
|
+ for (MainDictDetail type : certificateMajor) {
|
|
|
|
+ if(certificateInfo.getMajor().equals(type.getValue())){
|
|
|
|
+ currentConsultant.setMajor(type.getLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ User currentUser=userService.get(ruralProjectRecords.getProjectMasterId());
|
|
|
|
+ currentConsultant.setZixunyuanName(currentUser.getName());
|
|
|
|
+ currentConsultant.setZixunyuan(currentUser.getId());
|
|
|
|
+ currentConsultant.setRole("负责人");
|
|
|
|
+ consultants.add(currentConsultant);
|
|
|
|
+ }
|
|
|
|
+ //根据项目id查找报告咨询员信息
|
|
|
|
+ List<RuralReportConsultant> consultantList = ruralProjectMessageService.getConsultantsList(ruralProjectRecords.getId());
|
|
|
|
+ Iterator<RuralReportConsultant> it = consultantList.iterator();
|
|
|
|
+ while(it.hasNext()){
|
|
|
|
+ RuralReportConsultant consultant = it.next();
|
|
|
|
+ String auditOpinion = consultant.getAuditOpinion().replaceAll(" ","");
|
|
|
|
+ consultant.setAuditOpinion(auditOpinion);
|
|
|
|
+ if(consultant.getZixunyuan().equals(currentConsultant.getZixunyuan())){
|
|
|
|
+ try {
|
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(consultant, currentConsultant);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ it.remove();
|
|
|
|
+ }else if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
|
|
|
|
+ List<WorkStaffCertificate> bzshbCertificateList = ruralProjectMessageService.getCertificateByUser(projectReportData.getBzshbUserId());
|
|
|
|
+ for (WorkStaffCertificate certificateInfo: bzshbCertificateList) {
|
|
|
|
+ bzshbConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
|
+ bzshbConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
|
|
+ for (MainDictDetail dictType : certificateMajor) {
|
|
|
|
+ if(certificateInfo.getMajor().equals(dictType.getValue())){
|
|
|
|
+ bzshbConsultant.setMajor(dictType.getLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ User bzshbUser=userService.get(projectReportData.getBzshbUserId());
|
|
|
|
+ bzshbConsultant.setZixunyuanName(bzshbUser.getName());
|
|
|
|
+ bzshbConsultant.setZixunyuan(bzshbUser.getId());
|
|
|
|
+ bzshbConsultant.setRole("技术负责人");
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(consultant, bzshbConsultant);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ it.remove();
|
|
|
|
+ }else{
|
|
|
|
+ //根据用户查询技能信息
|
|
|
|
+ List<WorkStaffCertificate> certificateList = ruralProjectMessageService.getCertificateByUser(consultant.getZixunyuan());
|
|
|
|
+ for (WorkStaffCertificate certificateInfo: certificateList) {
|
|
|
|
+ if(certificateInfo.getName().equals(consultant.getZhucezigezhKey())){
|
|
|
|
+ consultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
|
+ }
|
|
|
|
+ for (MainDictDetail type : certificateMajor) {
|
|
|
|
+ if(certificateInfo.getMajor().equals(type.getValue())){
|
|
|
|
+ consultant.setMajor(type.getLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ User user=userService.get(consultant.getZixunyuan());
|
|
|
|
+ consultant.setZixunyuanName(user.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ consultants.addAll(consultantList);
|
|
|
|
+
|
|
|
|
+ //如果项目负责人名称为空
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(bzshbConsultant.getZixunyuanName())){
|
|
|
|
+ User user=userService.get(projectReportData.getBzshbUserId());
|
|
|
|
+ bzshbConsultant.setZixunyuanName(user.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*//获取咨询员信息
|
|
|
|
+ List<RuralReportConsultant> consultantList = projectReportDataService.getConsultantList(ruralProjectRecords.getId());
|
|
|
|
+ //获取专业类型
|
|
|
|
+ List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("certificate_major");*/
|
|
|
|
+ //根据 职业资格名称查询字典表并比对当前人员是否已添加该职业资格信息
|
|
|
|
+ List<MainDictDetail> certificateType = DictUtils.getMainDictList("certificate_type");
|
|
|
|
+ for (RuralReportConsultant entity: consultants) {
|
|
|
|
+ for (MainDictDetail type : certificateType) {
|
|
|
|
+ if(entity.getZhucezigezhKey().equals(type.getValue())){
|
|
|
|
+ entity.setZhucezigezh(type.getLabel());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //处理咨询员专业
|
|
|
|
+ /*for (MainDictDetail type : certificateMajor) {
|
|
|
|
+ if(entity.getMajor().equals(type.getValue())){
|
|
|
|
+ entity.setMajor(type.getLabel());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(entity.getZhucezigezh())){
|
|
|
|
+ entity.setZhucezigezh("");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<MainDictDetail> mainDictList = com.google.common.collect.Lists.newArrayList();
|
|
|
|
+ //工程咨询
|
|
|
|
+ if("1".equals(ruralProjectRecords.getProjectType())){
|
|
|
|
+ mainDictList = DictUtils.getMainDictList("attachment_project_sort");
|
|
|
|
+ //造价审核
|
|
|
|
+ } else if("2".equals(ruralProjectRecords.getProjectType())){
|
|
|
|
+ mainDictList = DictUtils.getMainDictList("attachment_project_sort_cost");
|
|
|
|
+ }
|
|
|
|
+ String consultType = "";
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isNotBlank(ruralProjectRecords.getAttachmentProjectSort())){
|
|
|
|
+ //处理项目类别
|
|
|
|
+ for (MainDictDetail info: mainDictList) {
|
|
|
|
+ if(ruralProjectRecords.getAttachmentProjectSort().equals(info.getValue())){
|
|
|
|
+ consultType = info.getLabel();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //约定作业期处理
|
|
|
|
+ String promiseTime = "";
|
|
|
|
+ if(null!= ruralProjectRecords.getStartDate() && null != ruralProjectRecords.getEndingDate()){
|
|
|
|
+ String startDateStr = dateStr(ruralProjectRecords.getStartDate());
|
|
|
|
+ String endingDateStr = dateStr(ruralProjectRecords.getEndingDate());
|
|
|
|
+ promiseTime = startDateStr + "至" + endingDateStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //freemarker参数值准备
|
|
|
|
+ Map<String,Object> data = new LinkedHashMap<>();
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(projectReportData.getNumber())){
|
|
|
|
+ data.put("number","");
|
|
|
|
+ }else{
|
|
|
|
+ data.put("number",projectReportData.getNumber()+" 号");
|
|
|
|
+ }
|
|
|
|
+ //项目名称含html转义字符的进行处理
|
|
|
|
+ String newJson = StringEscapeUtils.unescapeHtml4(ruralProjectRecords.getProjectName());
|
|
|
|
+ data.put("projectName",newJson);
|
|
|
|
+ //咨询类别
|
|
|
|
+ data.put("consultType",consultType);
|
|
|
|
+ //委托单位
|
|
|
|
+ if(null != workContractInfo){
|
|
|
|
+ if (null != workContractInfo.getClient()) {
|
|
|
|
+ data.put("entrustUnit",workContractInfo.getClient().getName());
|
|
|
|
+ }else{
|
|
|
|
+ data.put("entrustUnit","");
|
|
|
|
+ }
|
|
|
|
+ if (com.jeeplus.common.utils.StringUtils.isNotBlank(workContractInfo.getContractNum())){
|
|
|
|
+ data.put("contractNumber",workContractInfo.getContractNum());
|
|
|
|
+ }else{
|
|
|
|
+ data.put("contractNumber","");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ data.put("entrustUnit","");
|
|
|
|
+ data.put("contractNumber","");
|
|
|
|
+ }
|
|
|
|
+ //约定作业期
|
|
|
|
+ data.put("promiseTime",promiseTime);
|
|
|
|
+ data.put("projectMaster",ruralProjectRecords.getLeaderNameStr());
|
|
|
|
+ //咨询员信息
|
|
|
|
+ if(null != consultants){
|
|
|
|
+ for (int i = 0; i<consultants.size(); i++){
|
|
|
|
+ if (i >=6){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ data.put("consultantName"+i,consultants.get(i).getZixunyuanName());
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(consultants.get(i).getMajor())){
|
|
|
|
+ data.put("consultantProfession"+i,"");
|
|
|
|
+ }else{
|
|
|
|
+ data.put("consultantProfession"+i,consultants.get(i).getMajor());
|
|
|
|
+ }
|
|
|
|
+ data.put("consultantQualification"+i,consultants.get(i).getZhucezigezh());
|
|
|
|
+ }
|
|
|
|
+ if(consultants.size()<6){
|
|
|
|
+ for (int i = consultants.size(); i<6; i++){
|
|
|
|
+ data.put("consultantName"+i,"");
|
|
|
|
+ data.put("consultantProfession"+i,"");
|
|
|
|
+ data.put("consultantQualification"+i,"");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ for (int i = 0; i<6; i++){
|
|
|
|
+ data.put("consultantName"+i,"");
|
|
|
|
+ data.put("consultantProfession"+i,"");
|
|
|
|
+ data.put("consultantQualification"+i,"");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //专业咨询员处理(添加序号)
|
|
|
|
+ for(int i = 1; i <=consultantList.size();i++){
|
|
|
|
+ consultantList.get(i-1).setId(i+"");
|
|
|
|
+ }
|
|
|
|
+ for (RuralReportConsultant info: consultantList) {
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(info.getAuditOpinion())){
|
|
|
|
+ info.setAuditOpinion("");
|
|
|
|
+ }
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(info.getZixunyuanName())){
|
|
|
|
+ info.setZixunyuanName("");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data.put("list",consultantList);
|
|
|
|
+ /*if(null != projectReportData.getPrincipalDate()){
|
|
|
|
+ //专业咨询员
|
|
|
|
+ data.put("consultantName",currentConsultant.getZixunyuanName());
|
|
|
|
+ data.put("consultantRemarks",currentConsultant.getAuditOpinion());
|
|
|
|
+ data.put("consultantYear","");
|
|
|
|
+ data.put("consultantMonth","");
|
|
|
|
+ data.put("consultantDay","");
|
|
|
|
+ }else{
|
|
|
|
+ //专业咨询员
|
|
|
|
+ data.put("consultantName","");
|
|
|
|
+ data.put("consultantRemarks","");
|
|
|
|
+ data.put("consultantYear","");
|
|
|
|
+ data.put("consultantMonth","");
|
|
|
|
+ data.put("consultantDay","");
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ if(null != projectReportData.getPrincipalDate()){
|
|
|
|
+ //项目负责人
|
|
|
|
+ data.put("projectMaster",currentConsultant.getZixunyuanName());
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(currentConsultant.getAuditOpinion())){
|
|
|
|
+ data.put("projectMasterRemarks","");
|
|
|
|
+ }else{
|
|
|
|
+ data.put("projectMasterRemarks",currentConsultant.getAuditOpinion());
|
|
|
|
+ }
|
|
|
|
+ data.put("projectYear","");
|
|
|
|
+ data.put("projectMonth","");
|
|
|
|
+ data.put("projectDay","");
|
|
|
|
+ }else{
|
|
|
|
+ //项目负责人
|
|
|
|
+ data.put("projectMaster","");
|
|
|
|
+ data.put("projectMasterRemarks","");
|
|
|
|
+ data.put("projectYear","");
|
|
|
|
+ data.put("projectMonth","");
|
|
|
|
+ data.put("projectDay","");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(null != projectReportData.getTechnicistDate()){
|
|
|
|
+ //技术负责人
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(bzshbConsultant.getZixunyuanName())){
|
|
|
|
+ data.put("technicistName","");
|
|
|
|
+ }else{
|
|
|
|
+ data.put("technicistName",bzshbConsultant.getZixunyuanName());
|
|
|
|
+ }
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(bzshbConsultant.getAuditOpinion())){
|
|
|
|
+ data.put("technicistRemarks","");
|
|
|
|
+ }else{
|
|
|
|
+ data.put("technicistRemarks",bzshbConsultant.getAuditOpinion());
|
|
|
|
+ }
|
|
|
|
+ data.put("technicistYear","");
|
|
|
|
+ data.put("technicistMonth","");
|
|
|
|
+ data.put("technicistDay","");
|
|
|
|
+ }else{
|
|
|
|
+ //技术负责人
|
|
|
|
+ data.put("technicistName","");
|
|
|
|
+ data.put("technicistRemarks","");
|
|
|
|
+ data.put("technicistYear","");
|
|
|
|
+ data.put("technicistMonth","");
|
|
|
|
+ data.put("technicistDay","");
|
|
|
|
+ }
|
|
|
|
+ //获取报告发起时间
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy年 MM月 dd日");
|
|
|
|
+ Date ziDate=projectReportData.getCreateDate();
|
|
|
|
+ String str = sdf.format(ziDate);
|
|
|
|
+ data.put("ziDate",str);
|
|
|
|
+ //报告状态
|
|
|
|
+ String dataStatus=projectReportData.getStatus();
|
|
|
|
+ if (dataStatus.equals("5")){
|
|
|
|
+ String ss = sdf.format(projectReportData.getAuditPassDate());
|
|
|
|
+ data.put("shenDate",ss);
|
|
|
|
+ }else{
|
|
|
|
+ data.put("shenDate"," 年 月 日");
|
|
|
|
+ }
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * date转String
|
|
|
|
+ * @param date
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String dateStr(Date date){
|
|
|
|
+ String pattern = "yyyy年MM月dd日";
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
|
|
|
|
+ String format = simpleDateFormat.format(date);
|
|
|
|
+ return format;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|