Commit 05a9eed8 authored by tangwei's avatar tangwei

修改bug

parent 52176c60
package com.yeejoin.amos.boot.module.jxiop.api.dto; package com.yeejoin.amos.boot.module.jxiop.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint; import com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint; import com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.Value;
import java.util.Date; import java.util.Date;
/** /**
...@@ -50,6 +54,8 @@ public class EXPersonUser { ...@@ -50,6 +54,8 @@ public class EXPersonUser {
@ExcelProperty(value = "生日", index = 7) @ExcelProperty(value = "生日", index = 7)
@ApiModelProperty(value = "生日") @ApiModelProperty(value = "生日")
@JsonFormat(pattern="yyyy-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
private Date birthday; private Date birthday;
@ExcelProperty(value = "年龄", index = 8) @ExcelProperty(value = "年龄", index = 8)
...@@ -96,8 +102,11 @@ public class EXPersonUser { ...@@ -96,8 +102,11 @@ public class EXPersonUser {
@ExcelProperty(value = "参加工作时间", index = 17) @ExcelProperty(value = "参加工作时间", index = 17)
@ApiModelProperty(value = "参加工作时间") @ApiModelProperty(value = "参加工作时间")
@JsonFormat(pattern="yyyy-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
private Date workTime; private Date workTime;
@JsonFormat(pattern="yyyy-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value = "进入本单位工作时间", index = 18) @ExcelProperty(value = "进入本单位工作时间", index = 18)
@ApiModelProperty(value = "进入本单位工作时间") @ApiModelProperty(value = "进入本单位工作时间")
private Date stationWorkTime; private Date stationWorkTime;
...@@ -137,9 +146,9 @@ public class EXPersonUser { ...@@ -137,9 +146,9 @@ public class EXPersonUser {
@ApiModelProperty(value = "技能等级key") @ApiModelProperty(value = "技能等级key")
private String skillLevelKey; private String skillLevelKey;
@ExcelProperty(value = "专业技术资格等级", index = 26) @ExcelProperty(value = "专业技能技术资格等级", index = 26)
@ExplicitConstraint(indexNum = 26, source = {"初级","中级","副高级","正高级","教授级"}) //固定下拉内容 @ExplicitConstraint(indexNum = 26, source = {"初级","中级","副高级","正高级","教授级"}) //固定下拉内容
@ApiModelProperty(value = "专业技术资格等级") @ApiModelProperty(value = "专业技能技术资格等级")
private String professionalTechnologyLevelKey; private String professionalTechnologyLevelKey;
@ExcelProperty(value = "岗位执业鉴定证书", index = 27) @ExcelProperty(value = "岗位执业鉴定证书", index = 27)
...@@ -182,6 +191,8 @@ public class EXPersonUser { ...@@ -182,6 +191,8 @@ public class EXPersonUser {
@ExcelProperty(value = "取证时间", index = 35) @ExcelProperty(value = "取证时间", index = 35)
@ApiModelProperty(value = "取证时间") @ApiModelProperty(value = "取证时间")
@JsonFormat(pattern="yyyy-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
private Date certificateTime; private Date certificateTime;
@ExcelProperty(value = "发证机关", index = 36) @ExcelProperty(value = "发证机关", index = 36)
......
package com.yeejoin.amos.boot.module.jxiop.api.dto; package com.yeejoin.amos.boot.module.jxiop.api.dto;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint; import com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint; import com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -40,6 +42,8 @@ public class ExStationBasicDto { ...@@ -40,6 +42,8 @@ public class ExStationBasicDto {
private String email; private String email;
@ExcelProperty(value = "运维时间", index = 7) @ExcelProperty(value = "运维时间", index = 7)
@ApiModelProperty(value = "运维时间") @ApiModelProperty(value = "运维时间")
@DateTimeFormat("yyyy-MM-dd")
@JsonFormat(pattern="yyyy-MM-dd")
private String devopsTime; private String devopsTime;
@ExcelProperty(value = "运维单位", index = 8) @ExcelProperty(value = "运维单位", index = 8)
@ApiModelProperty(value = "运维单位") @ApiModelProperty(value = "运维单位")
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
person_skill_education.work_name workName, person_skill_education.work_name workName,
person_skill_education.professional_technology_name professionalTechnologyName, person_skill_education.professional_technology_name professionalTechnologyName,
person_skill_education.skill_level_key skillLevelKey, person_skill_education.skill_level_key skillLevelKey,
person_skill_education.professional_technology_key professionalTechnologyLevelKey, person_skill_education.professional_technology_level_key professionalTechnologyLevelKey,
person_skill_education.professional_qualification_certificate professionalQualificationCertificate, person_skill_education.professional_qualification_certificate professionalQualificationCertificate,
person_skill_education.professional_career_certificate professionalCareerCertificate, person_skill_education.professional_career_certificate professionalCareerCertificate,
person_skill_education.initial_education_key initialEducationKey, person_skill_education.initial_education_key initialEducationKey,
......
...@@ -6,9 +6,11 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -6,9 +6,11 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.ExcelEnums; import com.yeejoin.amos.boot.module.jxiop.api.Enum.ExcelEnums;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.ExcelServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.ExcelServiceImpl;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -76,14 +78,22 @@ public class ExcelController extends BaseController { ...@@ -76,14 +78,22 @@ public class ExcelController extends BaseController {
excelEnums.getClassUrl(), excelEnums.getType()); excelEnums.getClassUrl(), excelEnums.getType());
excelService.commonUpload(multipartFile, excelDto); excelService.commonUpload(multipartFile, excelDto);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} catch (RuntimeException e) { }catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("文件格式不正确或excel 模板不匹配"); return this.buildResponseFalse(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
throw new BadRequest("文件格式不正确或excel 模板不匹配!"); throw new BadRequest("文件格式不正确或excel 模板不匹配!");
} }
} }
public ResponseModel buildResponseFalse(String message) {
ResponseModel response = new ResponseModel();
response.setResult(null);
response.setDevMessage("FAILURE");
response.setStatus(HttpStatus.BAD_REQUEST.value());
response.setMessage(message);
response.setDevMessage(message);
return response;
}
} }
...@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.ExStationBasicDto; ...@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.ExStationBasicDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*; import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.ugp.api.Util.Constants;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
...@@ -21,7 +23,8 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -21,7 +23,8 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
...@@ -153,6 +156,9 @@ public class ExcelServiceImpl { ...@@ -153,6 +156,9 @@ public class ExcelServiceImpl {
fireChemical.setPlatformStationId(companyModeldata.getSequenceNbr().toString()); fireChemical.setPlatformStationId(companyModeldata.getSequenceNbr().toString());
excelEntityList.add(fireChemical); excelEntityList.add(fireChemical);
}); });
stationBasicServiceImpl.saveBatch(excelEntityList); stationBasicServiceImpl.saveBatch(excelEntityList);
} }
...@@ -206,6 +212,41 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception { ...@@ -206,6 +212,41 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
List<PersonSkillEducation> listPersonSkillEducation = new ArrayList<>(); List<PersonSkillEducation> listPersonSkillEducation = new ArrayList<>();
List<PersonCertificate> listPersonCertificate = new ArrayList<>(); List<PersonCertificate> listPersonCertificate = new ArrayList<>();
//数据验证
for (int i = 0; i < excelDtoList.size(); i++) {
//手机号重复
String regex = "0?(13|14|15|18|17)[0-9]{9}"; // 正则表达式
if(excelDtoList.get(i).getPhone()!=null&&!excelDtoList.get(i).getPhone().matches(regex)) {
throw new InnerInvokException("第" + (i + 2) + "行,手机号码格式错误", "403", "第" + (i + 2) + "行,手机号码格式错误", 403);
}
//验证数据库重复
QueryWrapper<PersonBasic> wrapper = new QueryWrapper();
wrapper.eq("phone",excelDtoList.get(i).getPhone());
List<PersonBasic> personAccount1=personBasicServiceImpl.list(wrapper);
if(!personAccount1.isEmpty()){
throw new InnerInvokException("第" + (i + 2) + "行,手机号码重复", "403", "第" + (i + 2) + "行,手机号码重复", 403);
}
//身高和体重 ,字段验证
if(excelDtoList.get(i).getWeight()!=null&&(0 >= excelDtoList.get(i).getWeight()||excelDtoList.get(i).getWeight()>200)) {
throw new InnerInvokException("第" + (i + 2) + "行,体重必须大于0小于等于200", "403", "第" + (i + 2) + "行,体重必须大于0小于等于200", 403);
}
if(excelDtoList.get(i).getHeight()!=null&&(0 >= excelDtoList.get(i).getHeight()||excelDtoList.get(i).getHeight()>200)) {
throw new InnerInvokException("第" + (i + 2) + "行,身高必须大于0小于等于200", "403", "第" + (i + 2) + "行,身高必须大于0小于等于200", 403);
}
}
if(excelDtoList!=null){
Map<Object, Long> mapGroup = excelDtoList.stream().collect(Collectors.groupingBy(eXPersonUser->eXPersonUser.getPhone(),Collectors.counting()));
List<Object> stringStream = mapGroup.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList());
if(!stringStream.isEmpty()){
throw new InnerInvokException("导入数据中手机号码存在重复!", "403", "导入数据中手机号码存在重复!", 403);
}
}
for (EXPersonUser exPersonUser : excelDtoList) { for (EXPersonUser exPersonUser : excelDtoList) {
//根据平台账号获取用户id //根据平台账号获取用户id
QueryWrapper<PersonAccount> wrapper = new QueryWrapper(); QueryWrapper<PersonAccount> wrapper = new QueryWrapper();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment