Commit 4b1f9eaf by Administrator

Merge branch 'wdz' into 'develop'

Wdz

See merge request 8timerv2/8timerapiv200!3
parents 9b5129e6 965434d0
......@@ -150,7 +150,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
private Integer isJrkq;
@ApiModelProperty(value="公司内部工号 就是公司内部自己设置的工号",example="101")
private Integer jobNum;
private String jobNum;
@ApiModelProperty(value="工作地点 ",example="工作地点")
private String workAddress;
......@@ -167,17 +167,11 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty(value="部门岗位id 部门岗位id",example="101")
private Integer bmgwId;
@Transient
@TableField(exist = false)
@IgnoreSwaggerParameter
@ApiModelProperty(value="部门名称",example="部门")
private String bmName;
@ApiModelProperty(value="修改时间",example="修改时间")
private Date updateTime;
@Transient
@TableField(exist = false)
@IgnoreSwaggerParameter
@ApiModelProperty(value="岗位名称",example="岗位")
private String gwName;
@ApiModelProperty(value="修改人",example="修改人")
private Integer updateMan;
@ApiModelProperty(value="组织机构代码 组织机构代码",example="101")
private Integer orgCode;
......@@ -194,4 +188,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty(value="手机APPid ",example="appopenid手机app")
private String appopenid;
@Transient
@TableField(exist = false)
private String error;//错误信息提示
}
\ No newline at end of file
......@@ -5,14 +5,20 @@
*/
package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.transaction.Transactional;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -21,6 +27,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -28,6 +35,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.additional.update.impl.LambdaUpdateChainWrapper;
import com.github.pagehelper.util.StringUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
......@@ -47,19 +56,32 @@ import cn.timer.api.bean.yggl.YgglAttaZcxxb;
import cn.timer.api.bean.yggl.YgglAttaZszjb;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.yggl.YgglMainLzb;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.yggl.YgglMainLzbMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.IYgjgDto;
import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.PunishFactory;
import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgjgDto;
import cn.timer.api.dto.yggl.YgProDto;
import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
......@@ -91,6 +113,17 @@ public class YgglController {
@Autowired
private ZzglBmgwMMapper zzglBmgwMMapper;
//weng(籍贯)
@Autowired
private YgAreaDtoMapper ygAreaDtoMapper;
@Autowired
private YgCityDtoMapper ygCityDtoMapper;
@Autowired
private YgProDtoMapper ygProDtoMapper;
//weng
@Autowired
private YgMzDtoMapper ygMzDtoMapper;
/**
* 获取员工档案
*
......@@ -110,22 +143,6 @@ public class YgglController {
}
/**
* 展示所有部门岗位
*
* @param
* @return
*/
@GetMapping(value = "/bmgw")
@ApiOperation(value = "获取所有部门岗位id和名称", httpMethod = "GET", notes = "获取所有部门岗位id和名称")
@ApiOperationSupport(order = 2)
public Result<List<ZzglBmgwM>> allbmgw(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> bmgws = ZzglBmgwM.builder().build()
.selectList(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode));
return ResultUtil.data(bmgws, "获取员工档案成功");
}
/**
* 根据岗位id获取员工档案部门岗位名称
*
* @param
......@@ -134,20 +151,23 @@ public class YgglController {
@GetMapping(value = "/ygdabm")
@ApiOperation(value = "获取员工档案部门岗位名称", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 2)
public Result<String> selectbmgw(@CurrentUser UserBean userBean, @PathVariable Integer gwid) {
public Result<String> selectbmgw(@CurrentUser UserBean userBean,@PathVariable Integer gwid) {
if (gwid==null||gwid==0) {
return ResultUtil.data("无岗位","获取员工档案部门岗位名称成功");
}
Integer orgCode = userBean.getOrgCode();
QueryWrapper<ZzglBmgwM> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode).eq("id", gwid);
String gw = ZzglBmgwM.builder().build().selectOne(queryWrapper).getName();
Integer bmid = ZzglBmgwM.builder().build().selectOne(queryWrapper).getUpId();
// QueryWrapper<ZzglBmgwM> queryWrapper1 = new QueryWrapper<>();
// queryWrapper1.eq("org_code", orgCode).eq("up_dept_id", gwid);
String bm = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid)).getName();
String bmgw = bm + "/" + gw;
return ResultUtil.data(bmgw, "获取员工档案成功");
//QueryWrapper<ZzglBmgwM> queryWrapper1 = new QueryWrapper<>();
//queryWrapper1.eq("org_code", orgCode).eq("up_dept_id", gwid);
String bm = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid)).getName();
String bmgw = bm+"/"+gw;
return ResultUtil.data(bmgw,"获取员工档案部门岗位名称成功");
}
/**
* 获取员工教育经历表
*
......@@ -338,25 +358,7 @@ public class YgglController {
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode).eq("emp_num", empNum);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(queryWrapper);
if (ygglMainEmp != null) {
Integer bmgwId = ygglMainEmp.getBmgwId();
if (bmgwId != null) {
ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().select("name", "up_id").eq("id", bmgwId));
if (zzglBmgwM != null) {
ygglMainEmp.setGwName(zzglBmgwM.getName());
Integer upId = zzglBmgwM.getUpId();
if (upId != null) {
ZzglBmgwM zzglBmM = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().select("name").eq("up_id", upId));
if (zzglBmM != null) {
ygglMainEmp.setBmName(zzglBmM.getName());
}
}
}
}
}
return ResultUtil.data(ygglMainEmp, "获取员工档案成功");
}
......@@ -478,7 +480,7 @@ public class YgglController {
public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaCzjlb>().eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
return ResultUtil.data(ygglAttaCzjlbs, "获取员工成长记录表成功");
return ResultUtil.data(ygglAttaCzjlbs, "获取员工合同信息表成功");
}
/**
......@@ -839,8 +841,8 @@ public class YgglController {
@ApiOperation(value = "添加/修改员工材料附件表", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 41)
public Result<YgglAttaClfjb> addclfjb(@CurrentUser UserBean userBean, @RequestBody YgglAttaClfjb ygglAttaClfjb) {
ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
ygglAttaClfjb.setOrgCode(userBean.getOrgCode());
ygglAttaClfjb.setEmpNum(ygglAttaClfjb.getEmpNum());
ygglAttaClfjb.insertOrUpdate();
return ResultUtil.data(ygglAttaClfjb, "添加/修改员工材料附件表成功");
}
......@@ -1006,32 +1008,25 @@ public class YgglController {
@ApiOperation(value = "员工搜索/分页", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 52)
public Result<Object> ygquery(@CurrentUser UserBean userBean, @RequestBody YgQueryDto ygQueryDto) {
Integer orgCode = userBean.getOrgCode();
Integer b = ygQueryDto.getBmgwid();
ArrayList<Integer> bList = new ArrayList<Integer>();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
Integer j = ygQueryDto.getJobStatus();
Integer t = ygQueryDto.getJobType();
String q = ygQueryDto.getQuery();
Page<YgglMainEmp> page = new Page<YgglMainEmp>(
ygQueryDto.getCurrentPage() == null ? 1 : ygQueryDto.getCurrentPage(),
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode).eq(t != null && t > -1, "job_type", t)
.eq(j != null && j > -1, "job_status", j).in(!bList.isEmpty(), "id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
queryWrapper.eq("org_code", userBean.getOrgCode()).eq(t != null && t > -1, "job_type", t)
.eq(b != null && b > -1, "bmgw_id", b).eq(j != null && j > -1, "job_status", j)
.and(!StrUtil.hasBlank(q), wq -> wq.likeRight("name", q).or().likeRight("phone", q));
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
ygglMainEmpPage.getCurrent();
ygglMainEmpPage.getPages();
ygglMainEmpPage.getTotal();
ygglMainEmpPage.getSize();
return ResultUtil.data(ygglMainEmpPage, "员工搜索成功");
// return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
return ResultUtil.data(ygglMainEmpPage, ygglMainEmps, "员工搜索成功");
}
/**
......@@ -1052,25 +1047,484 @@ public class YgglController {
return ResultUtil.data(page, lzb, "离职员工搜索成功");
}
//威力加强版
@PostMapping(value = "/ygdas")
@ApiOperation(value = "导入威力加强版", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 70)
public Result<List<YgDrjqbDto>> ygdr(@CurrentUser UserBean userBean,@RequestBody YgDrsDto drList) {
drList.setOrgCode(userBean.getOrgCode());
YgDrsDto tofList = errorFilter(drList);//滤嘴,过滤信息
if (tofList.getDrList().size()==0) {
return ResultUtil.data(tofList.getErrorList(), "导入发生错误人员名单");
}
YgDrsDto tof = optFilter(tofList);//彻底规范好数据
List<YgDrjqbDto> trueList = tof.getDrList();//拿出正确的信息
List<YgDrjqbDto> errorList = tof.getErrorList();//拿出错误的信息
if (trueList.size()==0) {
return ResultUtil.data(errorList, "导入发生错误人员名单");
}
for (YgDrjqbDto e : trueList) {
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,e.getPhone()).one();
//证件类型为0
Integer jobType = Integer.valueOf(e.getJobType());//工作类型
Integer syq=Integer.valueOf(e.getSyq());//试用期
Integer sex=Integer.valueOf(e.getSex());//性别,还差一个岗位
Integer gw= e.getHavebmid();
String jobNum = e.getYgnbgh();
//入职日期
Date rzdate = new Date();
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) {
try {
rzdate = straight.parse(e.getRzTime());
} catch (ParseException PException) {
PException.printStackTrace();
e.setError("请填写正确的时间格式");
errorList.add(e);
continue;
}
}
//判断是否已有员工登录表
if (login==null) {
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(e.getPhone()).pw(Md5.md5("123456"))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(e.getName()).build();
if (!qyzxEmpLogin.insert()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.setError("员工无法添加!");
errorList.add(e);
continue;
}
// 添加三张表
// 员工权限表(未定)
// 员工企业关联表和员工档案,员工成长表(未定)
QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode())
.userType(2).status(1).build().insert();// userType2普通员工
YgglMainEmp emp = YgglMainEmp.builder()
.name(e.getName()).phone(e.getPhone()).zjType(0)
.zjNum(e.getZj()).jobType(jobType).rzTime(rzdate)
.updateTime(new Date()).updateMan(userBean.getEmpNum()).syq(syq)
.sex(sex).jobNum(jobNum).bmgwId(gw)
.empNum(qyzxEmpLogin.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert();
//return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
}else {
// 添加两张表
YgglMainEmp ishad = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>()
.eq("phone", e.getPhone()).eq("org_code", userBean.getOrgCode()));
if (ishad == null) {
// 员工权限表(未定)
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(userBean.getOrgCode()).userType(2).build().insert();// 2普通员工
YgglMainEmp emp = YgglMainEmp.builder().name(e.getName()).phone(e.getPhone())
.zjType(0).zjNum(e.getZj())
.jobType(jobType).rzTime(rzdate)
.updateTime(new Date()).updateMan(userBean.getEmpNum())
.syq(syq).sex(sex)
.jobNum(jobNum).empNum(login.getId()).orgCode(userBean.getOrgCode()).build();
emp.insert();
//return ResultUtil.data(emp, "添加员工档案成功!");
} else {
e.setError("该手机号码已被使用");
errorList.add(e);
continue;
}
}
}
if (errorList.size()==0) {
return ResultUtil.success("员工全部导入成功!");
}
return ResultUtil.data(errorList, "导入发生错误人员名单");
}
//错误选项过滤器
public YgDrsDto errorFilter(YgDrsDto ygDrsDto) {
List<YgDrjqbDto> drList = ygDrsDto.getDrList();
List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
Integer orgCode = ygDrsDto.getOrgCode();
Iterator<YgDrjqbDto> itDr = drList.iterator();
YgDrjqbDto a = drList.get(0);//一个员工导入
Integer size = drList.size();
for (Integer i=0; i<size;) {//
YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) {
a=itDr.next();
System.out.println("a为:"+a+"此时i为"+i);
}
//请填写必填项
String name = newList.get(i).getName(); String phone = newList.get(i).getPhone();
String sex = newList.get(i).getSex(); String zj = newList.get(i).getZj();
if (StrUtil.hasBlank(name)
|| StrUtil.hasBlank(phone)
|| StrUtil.hasBlank(sex)
|| StrUtil.hasBlank(zj)) {
d.setError("请填写必填项");
errorList.add(d);itDr.remove();i++;continue;
}
//手机号码格式不对
String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
if (phone.length()!= 11) {
d.setError("手机号应为11位数");
errorList.add(d);itDr.remove();i++;continue;
}
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(phone);
boolean isMatch = m.matches();
if(!isMatch){
d.setError("手机号格式不对");
System.out.println("错误的手机号"+d);
errorList.add(d);itDr.remove();i++;continue;
}
//手机号码已被使用
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper).eq(QyzxEmpLogin::getPhone,phone).eq(QyzxEmpLogin::getOrgId, orgCode).one();
if (login!=null) {
d.setError("手机号码已被使用");
errorList.add(d);itDr.remove();i++;continue;
}
//证件号码信息有误
if (zj == null || "".equals(zj)) {
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
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}$)";
boolean matches = zj.matches(regularExpression);
if (zj.length() == 18) {
try {
char[] charArray = zj.toCharArray();
//前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
//这是除以11后,可能产生的11位余数对应的验证码
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
int sum = 0;
for (Integer j = 0; j < idCardWi.length; j++) {
int current = Integer.parseInt(String.valueOf(charArray[j]));
int count = current * idCardWi[j];
sum += count;
}
char idCardLast = charArray[17];
int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
//System.out.println("成功");
} else {
//System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() +
// "错误,正确的应该是:" + idCardY[idCardMod].toUpperCase());
//return false;
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
} catch (Exception e) {
e.printStackTrace();
//System.out.println("异常:" + zj);
//return false;
d.setError("证件号码信息有误");
errorList.add(d);itDr.remove();i++;continue;
}
}
//部门岗位有误
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 gw = newList.get(i).getGw();
String[] bms = {oneb,twob,threeb,fourb};
if (StrUtil.hasBlank(gw) && StrUtil.hasBlank(oneb)
&& StrUtil.hasBlank(twob) && StrUtil.hasBlank(threeb)
&& StrUtil.hasBlank(fourb)) { //没填写岗位,通过~ //
}else {
//填写了部门岗位,办他!
Integer isHaveBmgw = isHavebmgw(bms,gw,orgCode);
if (isHaveBmgw == 0) {
d.setError("部门岗位有误");
errorList.add(d);itDr.remove();i++;continue;
}else {
//获取到部门岗位id啦!
d.setHavebmid(isHaveBmgw);
}
}
i++;
}//for循环完毕!
YgDrsDto tofList = new YgDrsDto(drList, errorList, orgCode);
return tofList;
}
//选填项过滤器
public YgDrsDto optFilter(YgDrsDto ygDrsDto) {
List<YgDrjqbDto> drList = ygDrsDto.getDrList();
List<YgDrjqbDto> newList = new ArrayList<YgDrjqbDto>(drList);
List<YgDrjqbDto> errorList = ygDrsDto.getErrorList();
Integer orgCode = ygDrsDto.getOrgCode();
Iterator<YgDrjqbDto> itDr = drList.iterator();
YgDrjqbDto a = drList.get(0);//一个员工导入
Integer size = drList.size();
for (Integer i=0; i<size;) {//
YgDrjqbDto d = newList.get(i);//计数器
if (itDr.hasNext()) {
a=itDr.next();
}
//for (YgDrjqbDto d : drList) {
String ygnbgh = d.getYgnbgh(); String sex = d.getSex();
String jobType = d.getJobType();String jobStatus = d.getJobStatus();
String rzTime = d.getRzTime();String syq = d.getSyq();
String zy = d.getZy();String address = d.getAddress();
String hjAddress = d.getHkAddress();String qq = d.getQq();
String weixin =d.getWeixin(); String email = d.getEmail();
String[] bathroom = {ygnbgh,jobType,jobStatus,rzTime,syq,zy,address,hjAddress,qq,weixin,email};
boolean child=takeshower(bathroom);
if (child == false) {
d.setError("填写内容不要大于50字数");
errorList.add(d);itDr.remove();i++;continue;
}
//公司内部工号
if (ygnbgh != null && ygnbgh.length() != 0) {
d.setYgnbgh(ygnbgh.trim());
}else {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String bh = format.format(new Date())+orgCode+i+System.currentTimeMillis();
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");//斜杠
//SimpleDateFormat drop = new SimpleDateFormat("yyyy.MM.dd");//点
//SimpleDateFormat didnot = new SimpleDateFormat("yyyyMMdd");//没有
//试用期
if (syq != null && syq.length() != 0) {
if ((syq.indexOf("0"))!=-1 || syq.indexOf("无") !=-1) {
d.setSyq("0");
}
if ((syq.indexOf("1"))!=-1 || syq.indexOf("一") !=-1) {
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);
return clear;
}
//浴池,洗去选填项字节大于100的选项
public boolean takeshower(String[] bathroom){
for (String b : bathroom) {
if (b.length()>100) {
return false;}}
return true;}
//判断是否导入组织部门
public Integer isHavebmgw(String[] bms,String gw,Integer orgCode) {
//将姓名转为部门岗位对象
List<ZzglBmgwM> gwList = new ArrayList<ZzglBmgwM>();
//判断有几个部门,且这几个部门是否属实,里面不包括岗位
for (String bm : bms) {
if(!StrUtil.hasBlank(bm)){
ZzglBmgwM ibm = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getName, bm)
.eq(ZzglBmgwM::getOrgCode,orgCode)
.eq(ZzglBmgwM::getType, 0).one(); //选择部门类型0为部门,1为岗位
if (ibm == null) { return 0;} //找不到有相关名称的部门则报错
gwList.add(ibm);
}else {
break;
}
}
Integer qiantao = qiantao(gwList,gw,0,orgCode);
if (qiantao!=0) {
return qiantao;//组织部门成立!
}else {
return 0;//失败
}
};
//判断是否导入组织部门的嵌套并寻找到正确岗位id
public Integer qiantao(List<ZzglBmgwM>gwList,String gw,Integer upid,Integer orgCode) {
//重写
if (upid!=0 && !gwList.get(0).getUpId().equals(upid)) {
return 0;
}
upid = gwList.get(0).getId();
if (gwList.size() == 1) {
ZzglBmgwM igw = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getName, gw)
.eq(ZzglBmgwM::getUpId, upid)
.eq(ZzglBmgwM::getOrgCode,orgCode)
.eq(ZzglBmgwM::getType, 1).one();
if (igw==null) {
return 0;
}
return igw.getId();
}
gwList.remove(0);
Integer q = qiantao(gwList,gw,upid,orgCode);
return q;
};
/**
* 导入/批量添加/修改员工
*
* 部门导入(未完成)
* @param
* @return
*/
@PostMapping(value = "/ygdas")
@ApiOperation(value = "导入/批量添加/修改员工", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 54)
public Result<List<YgglMainEmp>> addygdas(UserBean userBean, List<YgglMainEmp> ygglMainEmpList) {
for (YgglMainEmp ygglMainEmp : ygglMainEmpList) {
ygglMainEmp.insertOrUpdate();
@PostMapping(value = "/ygbmdr")
@ApiOperation(value = "员工部门导入", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 59)
public Result<List<YgglMainEmp>> ygbmdr(UserBean userBean, List<YgglMainEmp> EmpList) {
return ResultUtil.success("员工导入成功!");
}
return ResultUtil.data(ygglMainEmpList, "导入/批量添加/修改员工成功");
/**
* 展示民族/展示所有民族
* @param
* @return
*/
@PostMapping(value = "/mz/{id}")
@ApiOperation(value = "展示民族/展示所有民族", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 60)
public Result<List<YgmzDto>> selectmzs(@CurrentUser UserBean userBean, @PathVariable Integer id) {
if (id==null||id==0) {
List<YgmzDto> allmz =new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).list();
return ResultUtil.data(allmz,"展示所有民族");
}
List<YgmzDto> mz =new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).eq(YgmzDto::getNumber, id).list();
return ResultUtil.data(mz,"展示该民族");
}
/**
* 展示籍贯/展示所有籍贯
* @param
* @return
*/
@PostMapping(value = "/jg")
@ApiOperation(value = "展示籍贯所有省市区", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 65)
public Result<List<String>> selectjgs(@CurrentUser UserBean userBean, @RequestBody YgjgDto ygjgDto) {
Integer type = ygjgDto.getType();
Integer upId = ygjgDto.getJgid();
List<String> a =new ArrayList<String>();
if (type == 1) { //省份
List<YgProDto> proList = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).select(YgProDto::getId,YgProDto::getName).orderByAsc(YgProDto::getProvince).list();
for (YgProDto pro : proList) { a.add(pro.getName());}}
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();
for (YgCityDto city : cityList) { a.add(city.getName());}}
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();
for (YgAreaDto area : areaList) { a.add(area.getName());}}
//IYgjgDto iYgjgDto = PunishFactory.getPunish(type);
//List<String> strings = iYgjgDto.exePunish();
//System.out.println(strings);
if (!a.isEmpty()) return ResultUtil.data(a, "展示籍贯成功");
return ResultUtil.error("输入参数有误!");
}
@PostMapping(value = "/jgp/{id}")
@ApiOperation(value = "显示籍贯省市区", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 66)
public Result<String> selectjg(@CurrentUser UserBean userBean, @PathVariable Integer id) {
String isPro =id.toString().substring(2,4);
String isCity =id.toString().substring(4,6);
if ("00".equals(isPro)) {
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 ("00".equals(isCity)) {
YgCityDto city = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).select(YgCityDto::getId,YgCityDto::getName).eq(YgCityDto::getId, id).one();
if (city!=null ) { return ResultUtil.data(city.getName(),"显示所在籍贯"); }}
YgAreaDto area = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).select(YgAreaDto::getId,YgAreaDto::getName).eq(YgAreaDto::getId, id).one();
if (area!=null ) { return ResultUtil.data(area.getName(),"显示所在籍贯");}
return ResultUtil.error("编码有误,显示不到所在籍贯");
}
/**
* 导出/批量添加/修改员工
*
* 导出员工
* @param
* @return
*/
......@@ -1082,7 +1536,7 @@ public class YgglController {
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", orgCode);
List<YgglMainEmp> ygglMainEmpList = YgglMainEmp.builder().build().selectList(queryWrapper);
return ResultUtil.data(ygglMainEmpList, "导出/批量添加/修改员工成功");
return ResultUtil.data(ygglMainEmpList, "导出员工成功");
}
/**
......@@ -1125,9 +1579,7 @@ public class YgglController {
List<YgglCartogramDto> ygglCartogramDto11 = ygglMainEmpMapper.queryWorkingAge(userBean);
map.put("positive", ygglCartogramDto1.getPositive());
if (ygglCartogramDto2 != null) {
map.put("avgAge", ygglCartogramDto2.getAvgAge());
}
map.put("induction", ygglCartogramDto3.getInduction());
map.put("probation", ygglCartogramDto4.getProbation());
map.put("regular", ygglCartogramDto4.getRegular());
......@@ -1152,10 +1604,9 @@ public class YgglController {
@GetMapping(value = "/ygsbgjj/{empNum}")
@ApiOperation(value = "获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 12)
public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
public Result<YgglAttaSbgjj> selectygsbgjj(@CurrentUser UserBean userBean,@PathVariable Integer empNum) {
YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build()
.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
YgglAttaSbgjj ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
return ResultUtil.data(ygglAttaSbgjj, "获取员工社保公积金成功");
}
......@@ -1169,16 +1620,15 @@ public class YgglController {
@PostMapping(value = "/ygsbgjj")
@ApiOperation(value = "添加/修改员工社保公积金", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 12)
public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean, @RequestBody YgglAttaSbgjj ygglAttaSbgjj) {
public Result<YgglAttaSbgjj> addygsbgjj(@CurrentUser UserBean userBean,@RequestBody YgglAttaSbgjj ygglAttaSbgjj) {
Integer empNum = ygglAttaSbgjj.getEmpNum();
if (empNum == null) {
return ResultUtil.error();
}
YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build()
.selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
YgglAttaSbgjj AttaSbgjj = YgglAttaSbgjj.builder().build().selectOne(new QueryWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
if (AttaSbgjj != null) {
ygglAttaSbgjj.update(new UpdateWrapper<YgglAttaSbgjj>().eq("emp_num", empNum));
} else {
}else {
ygglAttaSbgjj.insert();
}
......
package cn.timer.api.dao.yggl;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.dto.yggl.YgAreaDto;
/**
* 地区表
* @author Tang 2019-11-15
*/
@Repository
public interface YgAreaDtoMapper extends BaseMapper<YgAreaDto> {
}
package cn.timer.api.dao.yggl;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgProDto;
/**
* 城市表
* @author Tang 2019-11-15
*/
@Repository
public interface YgCityDtoMapper extends BaseMapper<YgCityDto> {
}
package cn.timer.api.dao.yggl;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.dto.yggl.YgmzDto;
/**
* 民族表
* @author Tang 2019-11-15
*/
@Repository
public interface YgMzDtoMapper extends BaseMapper<YgmzDto> {
}
package cn.timer.api.dao.yggl;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.dto.yggl.YgProDto;
/**
* 省份表
* @author Tang 2019-11-15
*/
@Repository
public interface YgProDtoMapper extends BaseMapper<YgProDto> {
}
/**
* @date 2020年3月10日
* @author 翁东州
* @方法中文名称:
*/
package cn.timer.api.dto.yggl;
import java.util.List;
/**
* @date 2020年3月10日
* @author 翁东州
* @方法中文名称:
*/
public interface IYgjgDto {
List<String> exePunish();
}
package cn.timer.api.dto.yggl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PunishFactory {
private static Map<String,IYgjgDto> punishMap = new HashMap<String,IYgjgDto>();
private PunishFactory() {}
private static final IYgjgDto EMPTY = new EmptyPunish();
//获取
public static IYgjgDto getPunish(String state) {
IYgjgDto result = punishMap.get(state);
return result == null ? EMPTY : result;
}
//将处罚对象注册到这里
public static void registerPunish(String state,IYgjgDto o){
punishMap.put(state, o);
}
private static class EmptyPunish implements IYgjgDto {
public List<String> exePunish() {
return null;
}
}
}
\ No newline at end of file
package cn.timer.api.dto.yggl;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-15
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("pro_city_area_class")
@ApiModel("籍贯:地区")
public class YgAreaDto implements IYgjgDto,InitializingBean{
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="省编码 ",example="省编码")
private Integer province;
@ApiModelProperty(value="市编码",example="市编码")
private Integer city;
@ApiModelProperty(value="名字",example="名字")
private String name;
@Autowired
private YgAreaDtoMapper ygAreaDtoMapper;
public List<String> exePunish() {
List<YgAreaDto> areaList = new LambdaQueryChainWrapper<YgAreaDto>(ygAreaDtoMapper).orderByAsc(YgAreaDto::getProvince).list();
List<String> a =new ArrayList<String>();
for (YgAreaDto area : areaList) { a.add(area.getName()); }
return a;
}
public void afterPropertiesSet(){
PunishFactory.registerPunish("area", this);
}
}
package cn.timer.api.dto.yggl;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-15
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("pro_city_class")
@ApiModel("籍贯:城市")
public class YgCityDto implements IYgjgDto,InitializingBean{
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="省编码 ",example="省编码")
private Integer province;
@ApiModelProperty(value="市编码",example="市编码")
private Integer city;
@ApiModelProperty(value="名字",example="名字")
private String name;
@Autowired
private YgCityDtoMapper ygCityDtoMapper;
public List<String> exePunish() {
List<YgCityDto> cityList = new LambdaQueryChainWrapper<YgCityDto>(ygCityDtoMapper).orderByAsc(YgCityDto::getProvince).list();
List<String> c =new ArrayList<String>();
for (YgCityDto city : cityList) { c.add(city.getName()); }
return c;
}
public void afterPropertiesSet(){
PunishFactory.registerPunish("city", this);
}
}
package cn.timer.api.dto.yggl;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author weng 2020-3-13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class YgDrjqbDto {
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="公司内部工号 ",example="公司内部工号")
private String ygnbgh;
@ApiModelProperty(value="姓名 ",example="姓名")
private String name;
@ApiModelProperty(value="手机号码 ",example="12345678901")
private String phone;
@ApiModelProperty(value="性别 ",example="男")
private String sex;
@ApiModelProperty(value="证件号码 ",example="123456789012345678")
private String zj;
@ApiModelProperty(value="一级部门 ",example="一级部门")
private String oneb;
@ApiModelProperty(value="二级部门 ",example="二级部门 ")
private String twob;
@ApiModelProperty(value="三级部门 ",example="三级部门 ")
private String threeb;
@ApiModelProperty(value="四级部门 ",example="四级部门 ")
private String fourb;
@ApiModelProperty(value="岗位 ",example="岗位")
private String gw;
@ApiModelProperty(value="工作性质 ",example="1")
private String jobType;
@ApiModelProperty(value="员工状态 ",example="1")
private String jobStatus;
@ApiModelProperty(value="入职日期 ",example="2020-3-12")
private String rzTime;
@ApiModelProperty(value="试用期 ",example="试用期")
private String syq;
@ApiModelProperty(value="专业 ",example="专业")
private String zy;
@ApiModelProperty(value="工作地点 ",example="工作地点")
private String address;
@ApiModelProperty(value="户籍地址 ",example="户籍地址")
private String hkAddress;
@ApiModelProperty(value="QQ ",example="123456789")
private String qq;
@ApiModelProperty(value="微信 ",example="weixin123456789")
private String weixin;
@ApiModelProperty(value="个人邮箱 ",example="个人邮箱")
private String email;
@ApiModelProperty(value="错误信息",example="错误信息")
private String error;
@ApiModelProperty(value="有部门id了!",example="0")
private Integer havebmid;
}
package cn.timer.api.dto.yggl;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author weng 2020-3-13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class YgDrsDto {
@ApiModelProperty(value="导入列表")
List<YgDrjqbDto> drList;
@ApiModelProperty(value="错误列表")
List<YgDrjqbDto> errorList;
@ApiModelProperty(value="组织机构代码")
Integer orgCode;
}
package cn.timer.api.dto.yggl;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-15
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("province_class")
@ApiModel("籍贯:省份")
public class YgProDto implements IYgjgDto,InitializingBean{
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="省编码 ",example="省编码")
private Integer province;
@ApiModelProperty(value="名字",example="名字")
private String name;
@Autowired
private YgProDtoMapper ygProDtoMapper;
public List<String> exePunish() {
List<YgProDto> proList = new LambdaQueryChainWrapper<YgProDto>(ygProDtoMapper).orderByAsc(YgProDto::getProvince).list();
List<String> pList =new ArrayList<String>();
for (YgProDto pro : proList) { pList.add(pro.getName()); }
return pList;
}
public void afterPropertiesSet(){
System.out.println("初始化注入成功!");
PunishFactory.registerPunish("pro", this);
}
}
/**
* @date 2020年3月10日
* @author 翁东州
* @方法中文名称:
*/
package cn.timer.api.dto.yggl;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @date 2020年3月10日
* @author 翁东州
* @方法中文名称:
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class YgjgDto implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value="省市区分类id",example="省pro,市city,区area")
private Integer type;
@ApiModelProperty(value="省市区籍贯id",example="110000")
private Integer jgid;
}
package cn.timer.api.dto.yggl;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-15
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("nation_class")
@ApiModel("民族")
public class YgmzDto {
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="民族名称 ",example="民族名称")
private String name;
@ApiModelProperty(value="拼音",example="pinyin")
private String pinyin;
@ApiModelProperty(value="简写",example="PY")
private String letter;
@ApiModelProperty(value="这个才是排序",example="number")
private Integer number;
@ApiModelProperty(value="排序",example="排序")
private String sort;
}
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