Commit 7c68173f by 邓实川

Merge branch 'develop' of http://120.24.24.239:8082/8timerv2/8timerapiv200.git into dsc

parents 64fd58f5 3802c5bb
/**
* @date 2020年3月23日
* @author 翁东州
* @方法中文名称:
*/
package cn.timer.api.config.enuminterface;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
import lombok.Getter;
/**
* @date 2020年3月23日
* @author 翁东州
* @方法中文名称:
*/
public interface YgEnumInterface {
/**
* 男女
*/
@Getter
enum sex implements YgEnumInterface{
MAN(0,"男"),WOMAN(1,"女");
private Integer type;
private String name;
sex(Integer type, String name) {
this.type = type;
this.name = name;
}
public static String isMan(String index) {
sex mow = (index == null || index.length() == 0) ? sex.MAN : (index.indexOf(sex.MAN.name)!= -1)||(index.indexOf(sex.MAN.type)!= -1) ? sex.MAN:sex.WOMAN;
return mow.type.toString();
}
}
/**
* 员工类型
*/
@Getter
enum YgJobType implements YgEnumInterface{
QUANZHI(1, "全"),SHIXI(2, "实习"),JIANZHI(3, "兼"),LWPQ(4, "劳务派遣"),
LAOWU(5, "劳务"),PAIQIAN(6, "派遣"),WAIBAO(7, "外包"),TUIXIU(8, "退休");
private Integer type;
private String name;
YgJobType(Integer type, String name) {
this.type = type;
this.name = name;
}
public static String choose(String index) {
YgJobType result = YgJobType.QUANZHI;
if(index == null || index.length() == 0) return result.type.toString();
for (YgJobType item : YgJobType.values()) {
if (index.indexOf(item.getType()) !=-1 ||index.indexOf(item.getName()) !=-1 ) result = item;
}
return result.type.toString();
}
}
/**
* 员工状态
*/
@Getter
enum jobStatus implements YgEnumInterface{
ZHENSHI(0,"正式"),SHIYONG(1,"试用");
private Integer type;
private String name;
jobStatus(Integer type, String name) {
this.type = type;
this.name = name;
}
public static String isZhen(String index) {
jobStatus zos = (index == null || index.length() == 0) ? YgEnumInterface.jobStatus.ZHENSHI: (index.indexOf(jobStatus.ZHENSHI.name)!= -1)||(index.indexOf(jobStatus.ZHENSHI.type)!= -1) ? jobStatus.ZHENSHI:jobStatus.SHIYONG;
return zos.type.toString();
}
}
/**
* 入职日期
*/
@Getter
enum rzTime implements YgEnumInterface{
ZHEN("--","yyyy-M-d"),XIE("//","yyyy/M/d"),
DIAN("..","yyyy.M.d"),NYR("年月日","yyyy年M月d日");
private String type;
private String name;
rzTime(String type, String name) {
this.type = type;
this.name = name;
}
public static String tranTime(String index) {
DateFormat zhenFormat = new SimpleDateFormat(ZHEN.name);
String result = zhenFormat.format(new Date());
if (index == null || index.length() == 0) return result;
Pattern pattern = Pattern.compile("^[0-9]{8}$");
if (pattern.matcher(index).matches()) {
result = index.substring(0, 4) + "-" + index.substring(4, 6) + "-" + index.substring(6, 8);
return result;
}
String s = index.replaceAll("([1-9]+[0-9]*|0)(\\.[\\d]+)?", "");
for (rzTime item : rzTime.values()) {
if (s.indexOf(item.type) != -1) {
DateFormat dateFormat = new SimpleDateFormat(item.name);
try {
result = new SimpleDateFormat(ZHEN.name).format(dateFormat.parse(index));
return result;
} catch (ParseException e) {
e.printStackTrace();
return result;
}
}
}
return result;
}
public static String tranTime2(String result) {
String isYear ="^(?:(?!0000)[0-9]{4} -(?:(?:0[1-9]|1[0-2]) -(?:0[1-9]|1[0-9]|2[0-8]) |(?:0[13-9]|1[0-2]) -(?:29|30) |(?:0[13578]|1[02]) -31 )|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00) -02 -29 )$";
Pattern pattern = Pattern.compile(isYear);
if (pattern.matcher(result).matches()) {
return result;
}else {
result = new SimpleDateFormat(ZHEN.name).format(new Date());
return result;
}
}
}
/**
* 试用期
*/
@Getter
enum syq implements YgEnumInterface{
ZERO(0,"无"),ONE(1,"一"),TWO(2,"二"),THREE(3,"三"),FOUR(4,"四"),FIVE(5,"五"),SIX(6,"六");
private Integer type;
private String name;
syq(Integer type, String name) {
this.type = type;
this.name = name;
}
public static String choose(String index) {
syq result = syq.ZERO;
if (index == null || index.length() == 0) result.type.toString();
for (syq item : syq.values()) {
if (index.indexOf(item.getName()) !=-1 ||index.indexOf(item.getType()) !=-1 ) result=item;
}
return result.type.toString();
}
}
}
...@@ -55,6 +55,7 @@ import cn.timer.api.bean.yggl.YgglMainLzb; ...@@ -55,6 +55,7 @@ import cn.timer.api.bean.yggl.YgglMainLzb;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum; import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper; import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper; import cn.timer.api.dao.yggl.YgAreaDtoMapper;
...@@ -1057,17 +1058,12 @@ public class YgglController { ...@@ -1057,17 +1058,12 @@ public class YgglController {
public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean,@RequestBody YgDrsDto drList) { public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean,@RequestBody YgDrsDto drList) {
drList.setOrgCode(userBean.getOrgCode()); drList.setOrgCode(userBean.getOrgCode());
YgDrsDto tofList = errorFilter(drList);//滤嘴,过滤信息 YgDrsDto tofList = errorFilter(drList);//滤嘴,过滤信息
if (tofList.getDrList().size()==0) { if (tofList.getDrList().size()==0) return ResultUtil.data(tofList.getErrorList(), "导入发生错误人员名单");
return ResultUtil.data(tofList.getErrorList(), "导入发生错误人员名单");
}
YgDrsDto tof = optFilter(tofList);//彻底规范好数据 YgDrsDto tof = optFilter(tofList);//彻底规范好数据
List<YgDrjqbDto> trueList = tof.getDrList();//拿出正确的信息 List<YgDrjqbDto> trueList = tof.getDrList();//拿出正确的信息
List<YgDrjqbDto> errorList = tof.getErrorList();//拿出错误的信息 List<YgDrjqbDto> errorList = tof.getErrorList();//拿出错误的信息
if (trueList.size()==0) { if (trueList.size()==0) return ResultUtil.data(errorList, "导入发生错误人员名单");
return ResultUtil.data(errorList, "导入发生错误人员名单");
}
for (YgDrjqbDto e : trueList) { for (YgDrjqbDto e : trueList) {
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,e.getPhone()).one(); QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,e.getPhone()).one();
//证件类型为0 //证件类型为0
Integer jobType = Integer.valueOf(e.getJobType());//工作类型 Integer jobType = Integer.valueOf(e.getJobType());//工作类型
...@@ -1075,17 +1071,14 @@ public class YgglController { ...@@ -1075,17 +1071,14 @@ public class YgglController {
Integer sex=Integer.valueOf(e.getSex());//性别,还差一个岗位 Integer sex=Integer.valueOf(e.getSex());//性别,还差一个岗位
Integer gw= e.getHavebmid(); Integer gw= e.getHavebmid();
String jobNum = e.getYgnbgh(); String jobNum = e.getYgnbgh();
Integer jg = e.getJg();
Date birthday = e.getBirthday();
//入职日期 //入职日期
Date rzdate = new Date(); Date rzdate = new Date();
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");//正杠 SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");//正杠
SimpleDateFormat italics = new SimpleDateFormat("yyyy/MM/dd");//斜杠
SimpleDateFormat drop = new SimpleDateFormat("yyyy.MM.dd");//点
SimpleDateFormat didnot = new SimpleDateFormat("yyyyMMdd");//没有
if (e.getRzTime().indexOf("-")!=-1) { if (e.getRzTime().indexOf("-")!=-1) {
try { try {
rzdate = straight.parse(e.getRzTime()); rzdate = straight.parse(e.getRzTime());
} catch (ParseException PException) { } catch (ParseException PException) {
PException.printStackTrace(); PException.printStackTrace();
e.setError("请填写正确的时间格式"); e.setError("请填写正确的时间格式");
...@@ -1095,7 +1088,7 @@ public class YgglController { ...@@ -1095,7 +1088,7 @@ public class YgglController {
} }
//判断是否已有员工登录表 //判断是否已有员工登录表
if (login==null) { if (login==null) {// 添加三张表
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(e.getPhone()).pw(Md5.md5("123456")) QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(e.getPhone()).pw(Md5.md5("123456"))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(e.getName()).build(); .sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(e.getName()).build();
if (!qyzxEmpLogin.insert()) { if (!qyzxEmpLogin.insert()) {
...@@ -1104,7 +1097,6 @@ public class YgglController { ...@@ -1104,7 +1097,6 @@ public class YgglController {
errorList.add(e); errorList.add(e);
continue; continue;
} }
// 添加三张表
// 员工权限表(未定) // 员工权限表(未定)
// 员工企业关联表和员工档案,员工成长表(未定) // 员工企业关联表和员工档案,员工成长表(未定)
QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()) QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode())
...@@ -1116,15 +1108,19 @@ public class YgglController { ...@@ -1116,15 +1108,19 @@ public class YgglController {
.sex(sex).jobNum(jobNum).bmgwId(gw) .sex(sex).jobNum(jobNum).bmgwId(gw)
.empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()).build(); .empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert(); emp.insert();
boolean wanshan = new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getId, emp.getId())
.set(birthday!=null, YgglMainEmp::getBirthday, birthday)
.set(jg!=null && jg!=0, YgglMainEmp::getJg, jg).update();
//return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!"); //return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
}else { }else {
// 添加两张表 // 添加两张表
YgglMainEmp ishad = YgglMainEmp.builder().build() YgglMainEmp ishad = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>() .selectOne(new QueryWrapper<YgglMainEmp>()
.eq("phone", e.getPhone()).eq("org_code", userBean.getOrgCode())); .eq("phone", e.getPhone()).eq("org_code", userBean.getOrgCode()));
if (ishad == null) { if (ishad == null) {
// 员工权限表(未定) // 员工权限表(未定)
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(userBean.getOrgCode()).userType(2).build().insert();// 2普通员工 QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(userBean.getOrgCode()).userType(2).build().insert();// 2普通员工
YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone()) YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone())
...@@ -1134,6 +1130,11 @@ public class YgglController { ...@@ -1134,6 +1130,11 @@ public class YgglController {
.syq(syq).sex(sex) .syq(syq).sex(sex)
.jobNum(jobNum).empNum(login.getId()).orgCode(userBean.getOrgCode()).build(); .jobNum(jobNum).empNum(login.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert(); emp.insert();
boolean wanshan = new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getId, emp.getId())
.set(birthday!=null, YgglMainEmp::getBirthday, birthday)
.set(jg!=null && jg!=0, YgglMainEmp::getJg, jg).update();
//return ResultUtil.data(emp, "添加员工档案成功!"); //return ResultUtil.data(emp, "添加员工档案成功!");
} else { } else {
e.setError("该手机号码已被使用"); e.setError("该手机号码已被使用");
...@@ -1163,7 +1164,7 @@ public class YgglController { ...@@ -1163,7 +1164,7 @@ public class YgglController {
YgDrjqbDto d = newList.get(i);//计数器 YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) { if (itDr.hasNext()) {
a=itDr.next(); a=itDr.next();
System.out.println("a为:"+a+"此时i为"+i);
} }
//请填写必填项 //请填写必填项
String name = newList.get(i).getName(); String phone = newList.get(i).getPhone(); String name = newList.get(i).getName(); String phone = newList.get(i).getPhone();
...@@ -1187,7 +1188,6 @@ public class YgglController { ...@@ -1187,7 +1188,6 @@ public class YgglController {
boolean isMatch = m.matches(); boolean isMatch = m.matches();
if(!isMatch){ if(!isMatch){
d.setError("手机号格式不对"); d.setError("手机号格式不对");
System.out.println("错误的手机号"+d);
errorList.add(d);itDr.remove();i++;continue; errorList.add(d);itDr.remove();i++;continue;
} }
//手机号码已被使用 //手机号码已被使用
...@@ -1204,8 +1204,12 @@ public class YgglController { ...@@ -1204,8 +1204,12 @@ public class YgglController {
String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" + String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"; "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
boolean matches = zj.matches(regularExpression); boolean matches = zj.matches(regularExpression);
if (zj.length() == 18) { if (!matches) {
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
try { try {
if (zj.length() == 18) {
char[] charArray = zj.toCharArray(); char[] charArray = zj.toCharArray();
//前十七位加权因子 //前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
...@@ -1220,7 +1224,12 @@ public class YgglController { ...@@ -1220,7 +1224,12 @@ public class YgglController {
char idCardLast = charArray[17]; char idCardLast = charArray[17];
int idCardMod = sum % 11; int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) { if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
//System.out.println("成功"); //System.out.println("成功,接着完善员工的个人信息");
String birth = zj.substring(6, 14);
String birthday =birth.substring(0, 4)+"-"+birth.substring(4, 6)+"-"+birth.substring(6,8);
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
d.setBirthday(straight.parse(birthday));
d.setJg(Integer.parseInt(zj.substring(0, 6)));
} else { } else {
//System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() + //System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() +
// "错误,正确的应该是:" + idCardY[idCardMod].toUpperCase()); // "错误,正确的应该是:" + idCardY[idCardMod].toUpperCase());
...@@ -1228,6 +1237,14 @@ public class YgglController { ...@@ -1228,6 +1237,14 @@ public class YgglController {
d.setError("证件号码信息有误"); d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue; errorList.add(d);itDr.remove();i++;continue;
} }
}else {
//给15位数的添加生日籍贯
String birth = zj.substring(6, 12);
String birthday = "19" + birth.substring(0, 2) + "-" + birth.substring(2, 4) + "-" + birth.substring(4, 6);
SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");
d.setBirthday(straight.parse(birthday));
d.setJg(Integer.parseInt(zj.substring(0, 6)));
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
//System.out.println("异常:" + zj); //System.out.println("异常:" + zj);
...@@ -1235,7 +1252,6 @@ public class YgglController { ...@@ -1235,7 +1252,6 @@ public class YgglController {
d.setError("证件号码信息有误"); d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue; errorList.add(d);itDr.remove();i++;continue;
} }
}
//部门岗位有误 //部门岗位有误
String oneb = newList.get(i).getOneb();String twob = newList.get(i).getTwob(); String oneb = newList.get(i).getOneb();String twob = newList.get(i).getTwob();
String threeb = newList.get(i).getThreeb();String fourb = newList.get(i).getFourb(); String threeb = newList.get(i).getThreeb();String fourb = newList.get(i).getFourb();
...@@ -1273,7 +1289,7 @@ public class YgglController { ...@@ -1273,7 +1289,7 @@ public class YgglController {
Iterator<YgDrjqbDto> itDr = drList.iterator(); Iterator<YgDrjqbDto> itDr = drList.iterator();
YgDrjqbDto a = drList.get(0);//一个员工导入 YgDrjqbDto a = drList.get(0);//一个员工导入
Integer size = drList.size(); Integer size = drList.size();
for (Integer i=0; i<size;) {// for (Integer i=0; i<size;i++) {//
YgDrjqbDto d = newList.get(i);//计数器 YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) { if (itDr.hasNext()) {
a=itDr.next(); a=itDr.next();
...@@ -1300,96 +1316,17 @@ public class YgglController { ...@@ -1300,96 +1316,17 @@ public class YgglController {
String bh = format.format(new Date())+orgCode+i+System.currentTimeMillis(); String bh = format.format(new Date())+orgCode+i+System.currentTimeMillis();
d.setYgnbgh(bh); d.setYgnbgh(bh);
} }
//男女
if (sex != null && sex.length() != 0) {
if (sex.indexOf("1")!=-1 || sex.indexOf("男")!=-1) {
d.setSex("1");
}
if (sex.indexOf("2")!=-1 || sex.indexOf("女")!=-1) {
d.setSex("2");
}
}else {
d.setSex("1");
}
//工作性质(需要优化)
if (jobType != null && jobType.length() != 0) {
//8种情况
if ((jobType.indexOf("1"))!=-1 || jobType.indexOf("全") !=-1) {
d.setJobType("1");
}
if ((jobType.indexOf("2"))!=-1 || jobType.indexOf("实习") !=-1) {
d.setJobType("2");
}
if ((jobType.indexOf("3"))!=-1 || jobType.indexOf("兼") !=-1) {
d.setJobType("3");
}
if ((jobType.indexOf("5"))!=-1 || jobType.indexOf("劳务") !=-1) {
d.setJobType("5");
}
if ((jobType.indexOf("6"))!=-1 || jobType.indexOf("派遣") !=-1) {
d.setJobType("6");
}
if ((jobType.indexOf("4"))!=-1 || jobType.indexOf("劳务派遣") !=-1) {
d.setJobType("4");
}
if ((jobType.indexOf("7"))!=-1 || jobType.indexOf("外包") !=-1) {
d.setJobType("7");
}
if ((jobType.indexOf("8"))!=-1 || jobType.indexOf("退休") !=-1) {
d.setJobType("8");
}
if (Integer.valueOf(d.getJobType())>8 ||Integer.valueOf(d.getJobType())<1 ) {
d.setError("填写工作性质有误!");
errorList.add(d);itDr.remove();i++;continue;
}
}else {
d.setJobType("1");
}
//员工状态(需要优化)
if (jobStatus != null && jobStatus.length() != 0) {
if ((jobStatus.indexOf("1"))!=-1 || jobStatus.indexOf("正") !=-1) {
d.setJobStatus("1");
}
if ((jobStatus.indexOf("2"))!=-1 || jobStatus.indexOf("试") !=-1) {
d.setJobStatus("2");
}
}else {
d.setJobStatus("1");
}
//入职日期(需要枚举)
//SimpleDateFormat straight = new SimpleDateFormat("yyyy-MM-dd");//正杠 //男女(最大优化)
//SimpleDateFormat italics = new SimpleDateFormat("yyyy/MM/dd");//斜杠 d.setSex(YgEnumInterface.sex.isMan(sex));
//SimpleDateFormat drop = new SimpleDateFormat("yyyy.MM.dd");//点 //工作性质(最大优化)
//SimpleDateFormat didnot = new SimpleDateFormat("yyyyMMdd");//没有 d.setJobType(YgEnumInterface.YgJobType.choose(jobType));
//试用期 //员工状态(最大优化)
if (syq != null && syq.length() != 0) { d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
if ((syq.indexOf("0"))!=-1 || syq.indexOf("无") !=-1) { //入职日期(已优化)
d.setSyq("0"); d.setRzTime(YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)));
} //试用期(已优化)
if ((syq.indexOf("1"))!=-1 || syq.indexOf("一") !=-1) { d.setSyq(YgEnumInterface.syq.choose(syq));
d.setSyq("1");
}
if ((syq.indexOf("2"))!=-1 || syq.indexOf("二") !=-1) {
d.setSyq("2");
}
if ((syq.indexOf("3"))!=-1 || syq.indexOf("三") !=-1) {
d.setSyq("3");
}
if ((syq.indexOf("4"))!=-1 || syq.indexOf("四") !=-1) {
d.setSyq("4");
}
if ((syq.indexOf("5"))!=-1 || syq.indexOf("五") !=-1) {
d.setSyq("5");
}
if ((syq.indexOf("6"))!=-1 || syq.indexOf("六") !=-1) {
d.setSyq("6");
}
}else {
d.setSyq("0");
}
i++;
} }
YgDrsDto clear = new YgDrsDto(drList, errorList, orgCode); YgDrsDto clear = new YgDrsDto(drList, errorList, orgCode);
return clear; return clear;
...@@ -1488,23 +1425,31 @@ public class YgglController { ...@@ -1488,23 +1425,31 @@ public class YgglController {
@PostMapping(value = "/jg") @PostMapping(value = "/jg")
@ApiOperation(value = "展示籍贯所有省市区", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "展示籍贯所有省市区", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 65) @ApiOperationSupport(order = 65)
public Result<List<String>> selectjgs(@CurrentUser UserBean userBean, @RequestBody YgjgDto ygjgDto) { public Result<List<YgjgDto>> selectjgs(@CurrentUser UserBean userBean, @RequestBody YgjgDto ygjgDto) {
Integer type = ygjgDto.getType(); Integer type = ygjgDto.getType();
Integer upId = ygjgDto.getJgid(); Integer upId = ygjgDto.getJgid();
List<String> a =new ArrayList<String>(); List<YgjgDto> maps = new ArrayList<YgjgDto>();
Map<Integer, String> map = new HashMap<Integer, String>();
if (type == 1) { //省份 if (type == 1) { //省份
List<YgProDto> proList = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getName).orderByAsc(YgProDto::getProvince).list(); List<YgProDto> list = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getProvince,YgProDto::getName).orderByAsc(YgProDto::getProvince).list();
for (YgProDto pro : proList) { a.add(pro.getName());}} for (YgProDto pro : list) {
maps.add(new YgjgDto(pro.getId(), pro.getProvince(), pro.getName()));
}}
if (type == 2) { //城市 if (type == 2) { //城市
List<YgCityDto> cityList = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getName).eq(YgCityDto::getProvince, upId).orderByAsc(YgCityDto::getProvince).orderByAsc(YgCityDto::getCity).list(); List<YgCityDto> list = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getCity,YgCityDto::getName).eq(YgCityDto::getProvince, upId).orderByAsc(YgCityDto::getProvince).orderByAsc(YgCityDto::getCity).list();
for (YgCityDto city : cityList) { a.add(city.getName());}} for (YgCityDto city : list) {
maps.add(new YgjgDto(city.getId(), city.getCity(), city.getName()));
}}
if (type == 3) { //地区 if (type == 3) { //地区
List<YgAreaDto> areaList = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).select(YgAreaDto::getId,YgAreaDto::getName).eq(YgAreaDto::getCity, upId).orderByAsc(YgAreaDto::getProvince).orderByAsc(YgAreaDto::getCity).list(); List<YgAreaDto> list = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).select(YgAreaDto::getId,YgAreaDto::getName).eq(YgAreaDto::getCity, upId).orderByAsc(YgAreaDto::getProvince).orderByAsc(YgAreaDto::getCity).list();
for (YgAreaDto area : areaList) { a.add(area.getName());}} for (YgAreaDto area : list) {
maps.add(new YgjgDto(area.getId(), area.getId(), area.getName()));
}}
//IYgjgDto iYgjgDto = PunishFactory.getPunish(type); //IYgjgDto iYgjgDto = PunishFactory.getPunish(type);
//List<String> strings = iYgjgDto.exePunish(); //List<String> strings = iYgjgDto.exePunish();
//System.out.println(strings); //System.out.println(strings);
if (!a.isEmpty()) return ResultUtil.data(a, "展示籍贯成功"); if (!maps.isEmpty()) return ResultUtil.data(maps, "展示籍贯成功");
return ResultUtil.error("输入参数有误!"); return ResultUtil.error("输入参数有误!");
} }
...@@ -1516,7 +1461,7 @@ public class YgglController { ...@@ -1516,7 +1461,7 @@ public class YgglController {
String isCity =id.toString().substring(4,6); String isCity =id.toString().substring(4,6);
if ("00".equals(isPro)) { if ("00".equals(isPro)) {
YgProDto pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getName).eq(YgProDto::getId, id).one(); YgProDto pro = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getName).eq(YgProDto::getId, id).one();
if (pro!=null ) { return ResultUtil.data(pro.getName(),"显示所在籍贯"); }} if (pro!=null) { return ResultUtil.data(pro.getName(),"显示所在籍贯"); }}
if ("00".equals(isCity)) { if ("00".equals(isCity)) {
YgCityDto city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getName).eq(YgCityDto::getId, id).one(); YgCityDto city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getName).eq(YgCityDto::getId, id).one();
if (city!=null ) { return ResultUtil.data(city.getName(),"显示所在籍贯"); }} if (city!=null ) { return ResultUtil.data(city.getName(),"显示所在籍贯"); }}
......
package cn.timer.api.dto.yggl; package cn.timer.api.dto.yggl;
import java.util.Date;
import javax.persistence.Transient;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -79,6 +85,14 @@ public class YgDrjqbDto { ...@@ -79,6 +85,14 @@ public class YgDrjqbDto {
@ApiModelProperty(value="个人邮箱 ",example="个人邮箱") @ApiModelProperty(value="个人邮箱 ",example="个人邮箱")
private String email; private String email;
@Transient
@TableField(exist = false)//籍贯
private Integer jg;
@Transient
@TableField(exist = false)//生日
private Date birthday;
@ApiModelProperty(value="错误信息",example="错误信息") @ApiModelProperty(value="错误信息",example="错误信息")
private String error; private String error;
......
...@@ -7,6 +7,10 @@ package cn.timer.api.dto.yggl; ...@@ -7,6 +7,10 @@ package cn.timer.api.dto.yggl;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Transient;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -26,12 +30,14 @@ public class YgjgDto implements Serializable { ...@@ -26,12 +30,14 @@ public class YgjgDto implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value="省市区分类id",example="省pro,市city,区area") @ApiModelProperty(value="省市区分类id",example="省1,市2,区3")
private Integer type; private Integer type;
@ApiModelProperty(value="省市区籍贯id",example="110000") @ApiModelProperty(value="省市区籍贯id",example="110000")
private Integer jgid; private Integer jgid;
@Transient
@TableField(exist = false)
private String jgname;
} }
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