Commit e827041b authored by tangwei's avatar tangwei

修改bug

parent 6f91232e
......@@ -40,25 +40,28 @@ public class EXPersonUser {
@ExcelProperty(value = "证件编号", index = 4)
@ApiModelProperty(value = "证件编号")
private String idNumber;
@ExcelProperty(value = "平台账号名称", index = 5)
@ExcelProperty(value = "电话", index = 5)
@ApiModelProperty(value = "电话")
private String phoneNum;
@ExcelProperty(value = "平台账号名称", index = 6)
@ApiModelProperty(value = "平台账号名称")
private String accountName;
@ExplicitConstraint(indexNum = 6, source = {"男","女"}) //固定下拉内容
@ExcelProperty(value = "性别", index = 6)
@ExplicitConstraint(indexNum = 7, source = {"男","女"}) //固定下拉内容
@ExcelProperty(value = "性别", index = 7)
@ApiModelProperty(value = "性别( 0-男 1-女 )")
private String sex;
@ExcelProperty(value = "生日", index = 7)
@ExcelProperty(value = "生日", index = 8)
@ApiModelProperty(value = "生日")
@JsonFormat(pattern="yyyy-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
private Date birthday;
@ExcelProperty(value = "年龄", index = 8)
@ExcelProperty(value = "年龄", index = 9)
@ApiModelProperty(value = "年龄")
private Integer age;
......@@ -66,31 +69,29 @@ public class EXPersonUser {
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ExcelProperty(value = "民族", index = 9)
@ExplicitConstraint(indexNum = 9, sourceClass = CommonExplicitConstraint.class,type="MZ") //固定下拉内容
@ExcelProperty(value = "民族", index = 10)
@ExplicitConstraint(indexNum = 10, sourceClass = CommonExplicitConstraint.class,type="MZ") //固定下拉内容
@ApiModelProperty(value = "民族")
private String folkKey;
@ExcelProperty(value = "政治面貌", index =10)
@ExplicitConstraint(indexNum = 10, source = {"群众","共青团员","预备党员","中共党员"}) //固定下拉内容
@ExcelProperty(value = "政治面貌", index =11)
@ExplicitConstraint(indexNum = 11, source = {"群众","共青团员","预备党员","中共党员"}) //固定下拉内容
@ApiModelProperty(value = "政治面貌")
private String politicCountenance;
@ExcelProperty(value = "户籍地址", index = 11)
@ExcelProperty(value = "户籍地址", index = 12)
@ApiModelProperty(value = "户籍地址")
private String registeredResidenceAddress;
@ExcelProperty(value = "现住址", index = 12)
@ExcelProperty(value = "现住址", index = 13)
@ApiModelProperty(value = "现住址")
private String presentAddress;
@ExcelProperty(value = "应急电话", index = 13)
@ExcelProperty(value = "应急电话", index = 14)
@ApiModelProperty(value = "应急电话")
private String emergencyPhone;
@ExcelProperty(value = "电话", index = 14)
@ApiModelProperty(value = "电话")
private String phone;
@ExcelProperty(value = "身高(厘米)", index = 15)
@ApiModelProperty(value = "身高(厘米)")
......@@ -186,7 +187,7 @@ public class EXPersonUser {
@ExcelProperty(value = "证书名称", index = 34)
@ApiModelProperty(value = "证书名称")
@ExplicitConstraint(indexNum = 34, sourceClass = CommonExplicitConstraint.class,type="ZYJSZGMC") //固定下拉内容
//@ExplicitConstraint(indexNum = 34, sourceClass = CommonExplicitConstraint.class,type="ZYJSZGMC") //固定下拉内容
private String certificateName;
@ExcelProperty(value = "取证时间", index = 35)
......
......@@ -120,5 +120,7 @@ public class PersonAccount extends BaseEntity {
*/
@TableField("ID_number")
private String idNumber;
@TableField(exist = false)
private String phoneNum;
}
......@@ -132,7 +132,7 @@
person_basic.registered_residence_address registeredResidenceAddress,
person_basic.present_address presentAddress,
person_basic.emergency_phone emergencyPhone,
person_basic.phone,
person_basic.phone phoneNum,
person_basic.height,
person_basic.weight,
person_basic.work_time workTime,
......
......@@ -82,6 +82,7 @@ public class ExcelController extends BaseController {
e.printStackTrace();
return this.buildResponseFalse(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("文件格式不正确或excel 模板不匹配!");
}
......
......@@ -59,7 +59,7 @@ public class PrivilegeController extends BaseController{
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subcompany")
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位", notes = "查询单位、子单位")
public ResponseModel< Collection<CompanyModel>> subcompany(String orgCode) {
public ResponseModel< Collection<CompanyModel>> subcompany(String orgCode,String type) {
Long companyId =null;
if(orgCode!=null){
......@@ -96,11 +96,17 @@ public class PrivilegeController extends BaseController{
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
//如果是场站获取片区
if(!"add".equals(type)){
if(companyModel.getLevel().equals("station")){
FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
list.add(areaInfo.getResult());
}
}
//如果是场站获取片区
// if(companyModel.getLevel().equals("station")){
// FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
// list.add(areaInfo.getResult());
// }
return ResponseHelper.buildResponse(list);
}
......
......@@ -15,8 +15,11 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.annotations.Case;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -65,8 +68,8 @@ public class ExcelServiceImpl {
switch (excelDto.getType()) {
case "RYXX":
List<EXPersonUser> data=this.getEXPersonUser( par);
//List<EXPersonUser> data=this.getEXPersonUser( par);
List<EXPersonUser> data=this.getEXPersonUserAll( par);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
clz, dataSourcesImpl, true);
break;
......@@ -246,29 +249,49 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
}
private List<String> getDataDictionary(String type) {
List<String> collect =new ArrayList<>();
FeignClientResult<List<DictionarieValueModel>> de= Systemctl.dictionarieClient.dictValues(type);
List<DictionarieValueModel> listco=new ArrayList<>();
if (!ObjectUtils.isEmpty(de)) {
if (de.getStatus() == 200) {
listco = de.getResult();
for (DictionarieValueModel dictionarieValueModel : listco) {
collect.add(dictionarieValueModel.getDictDataValue());
}
} else {
throw new RuntimeException(de.getMessage());
}
}
return collect;
}
public void getdata( List<String> list,String name,int i){
if(name!=null&&!list.contains(name)){
throw new InnerInvokException("第" + (i + 2) + "行,证件类型和证件类型不匹配", "403", "第" + (i + 2) + "行,证件类型和证件类型不匹配", 403);
}
}
@Transactional
public void updateEXPersonUserda(List<EXPersonUser> excelDtoList) {
List<PersonBasic> listPersonBasic = new ArrayList<>();
List<PersonSkillEducation> listPersonSkillEducation = new ArrayList<>();
List<PersonCertificate> listPersonCertificate = new ArrayList<>();
//效验证件类型获取四种字典
List<String> list1= getDataDictionary("职业技能鉴定证书");
List<String> list2= getDataDictionary("专业技术资格证书");
List<String> list3= getDataDictionary("岗位资质鉴定证书");
List<String> list4= getDataDictionary("技能鉴定工种");
//数据验证
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);
......@@ -277,17 +300,35 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
throw new InnerInvokException("第" + (i + 2) + "行,身高必须大于0小于等于200", "403", "第" + (i + 2) + "行,身高必须大于0小于等于200", 403);
}
//效验类型
if(excelDtoList.get(i).getDocumentType()!=null){
switch (excelDtoList.get(i).getDocumentType()) {
case "职业技能鉴定证书":
getdata(list1,excelDtoList.get(i).getCertificateName(),i);
break;
case "专业技术资格证书":
getdata(list2,excelDtoList.get(i).getCertificateName(),i);
break;
case "岗位资质鉴定证书":
getdata(list3,excelDtoList.get(i).getCertificateName(),i);
break;
case "技能鉴定工种":
getdata(list4,excelDtoList.get(i).getCertificateName(),i);
break;
default:
break;
}
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) {
//根据平台账号获取用户id
QueryWrapper<PersonAccount> wrapper = new QueryWrapper();
......
......@@ -80,6 +80,8 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
PersonCertificate personCertificate = model.getPersonCertificate();
//获取人员账号信息
PersonAccount personAccount = model.getPersonAccount();
personUser.setPhone(personAccount.getPhoneNum());
//人员基础信息
PersonBasic personBasic = new PersonBasic();
BeanUtils.copyProperties(personUser, personBasic);
......@@ -160,6 +162,8 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
PersonCertificate personCertificate = model.getPersonCertificate();
//获取人员账号信息
PersonAccount personAccount = model.getPersonAccount();
personUser.setPhone(personAccount.getPhoneNum());
//人员基础信息
PersonBasic personBasic = new PersonBasic();
personBasic.setSequenceNbr(sequenceNbr);
......@@ -257,7 +261,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
wrapper4.eq("person_id", sequenceNbr);
//人员账号信息
PersonAccount personAccount = personAccountService.getOne(wrapper4);
personAccount.setPhoneNum(personBasic.getPhone());
if (personBasic.getNativePlace() != null) {
personUser.setNativePlace(JSON.parseArray(personBasic.getNativePlace(), Integer.class));
}
......
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