Commit 25b48770 by tangzhaoqian

审批人审批优化,员工管理、组织管理Bug修复

parent 495b7aae
......@@ -94,7 +94,7 @@ public class LogAspect
// 获取当前的用户
// LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
QyzxEmpLogin eld = (QyzxEmpLogin)session.getAttribute("ui");
System.out.println(eld);
// *========数据库日志=========*//
QyzxOperLog operLog = new QyzxOperLog();
......
package cn.timer.api.config.enuminterface;
import lombok.Getter;
public interface SpmkEnumInterface {
/**
* 员工类型
*/
@Getter
enum ExecutorSts implements SpmkEnumInterface {
NON_EXECUTION(0, "未执行"), IN_EXECUTION(1, "执行中"), AGREE(2, "同意"), REFUSE(3, "拒绝"), REDEPLOY(4, "转派");
private Integer type;
private String name;
ExecutorSts(Integer type, String name) {
this.type = type;
this.name = name;
}
}
}
/**
* @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.HashMap;
......@@ -46,6 +39,24 @@ public interface YgEnumInterface {
return mow.type.toString();
}
}
/**
* 部门 岗位
*/
@Getter
enum OrgType implements YgEnumInterface {
DEPARTMENT(0, "部门"), POST(1, "岗位");
private Integer type;
private String name;
OrgType(Integer type, String name) {
this.type = type;
this.name = name;
}
}
/**
* 员工类型
......
......@@ -9,6 +9,7 @@ import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -326,11 +327,8 @@ public class QyzxController {
wp.select(ZzglAuth::getMenuId).eq(ZzglAuth::getOrgCode, ctrl.getId())
.and(i -> i.in(ZzglAuth::getBmgwId, list.toArray()));
List<ZzglAuth> zas = ZzglAuth.builder().build().selectList(wp);
if (zas.size() == 0)
return ResultUtil.error(null, "切换企业失败,在该公司没有权限");
zas.stream().forEach(o -> menus.add(o.getMenuId()));
} else {
return ResultUtil.error(null, "切换企业失败,在该公司没有权限");
if (zas != null && zas.size() != 0)
zas.stream().forEach(o -> menus.add(o.getMenuId()));
}
}
emp.setOrgId(orgCode);
......@@ -538,5 +536,21 @@ public class QyzxController {
return ResultUtil.data(pages, listOl, "操作成功!");
}
/**
* 删除-操作日志
*
* @param
* @return
*/
@DeleteMapping(value = "/delete_oper_log")
@ApiOperation(value = "删除-操作日志", httpMethod = "DELETE", notes = "查询-操作日志")
public Result<Object> deleteOperLog(@CurrentUser UserBean userBean,@RequestBody Integer[] ids) {
ArrayList<Integer> list = CollUtil.toList(ids);
int delCount = qyzxOperLogMapper.deleteBatchIds(list);
return ResultUtil.data(delCount, "操作成功!");
}
}
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.druid.sql.visitor.functions.Nil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -45,6 +46,7 @@ import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.SpmkEnumInterface;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.spmk.service.SpmkServiceImpl;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
......@@ -119,6 +121,7 @@ public class SpmkController {
public Result<Object> saveAtg(@RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda()
.ne(SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!");
}
......@@ -189,6 +192,7 @@ public class SpmkController {
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda()
.ne(SpmkApprovalTemplate::getId, at.getId())
.eq(SpmkApprovalTemplate::getName, at.getName())) > 0) {
return ResultUtil.error("审批模板名重复!");
}
......@@ -256,6 +260,7 @@ public class SpmkController {
public Result<Object> saveAg(@CurrentUser UserBean userBean, @RequestBody SpmkApprovalG spmkApprovalG){
if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda()
.ne(SpmkApprovalG::getId, spmkApprovalG.getId())
.eq(SpmkApprovalG::getName, spmkApprovalG.getName())
.eq(SpmkApprovalG::getOrgCode, userBean.getOrgCode())) > 0) {
return ResultUtil.error("审批组名重复!");
......@@ -338,6 +343,7 @@ public class SpmkController {
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda()
.ne(SpmkCustomApproval::getId, ca.getId())
.eq(SpmkCustomApproval::getName, ca.getName())
.eq(SpmkCustomApproval::getOrgCode, userBean.getOrgCode())) > 0) {
return ResultUtil.error("自定义审批名重复!");
......@@ -575,7 +581,15 @@ public class SpmkController {
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
// @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
if (spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, SpmkEnumInterface.ExecutorSts.NON_EXECUTION)) == 0) {
return ResultUtil.error("非当前审批人,无法审批!");
}
SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda()
.select(SpmkApproveDetail::getId,
......@@ -588,6 +602,8 @@ public class SpmkController {
.select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, approvingDto.getAsId()));
if (aSummary.getSts() == 1 || aSummary.getSts() == 2 || aSummary.getSts() == 3) {
return ResultUtil.error("该审批已结束!");
}
......
......@@ -22,7 +22,9 @@ import java.util.stream.Collectors;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -113,10 +115,13 @@ import io.swagger.annotations.ApiOperation;
*/
@Api(tags = "3.员工管理")
@RestController
@Transactional
@Transactional(rollbackOn = Exception.class)
@RequestMapping(value = "/yggl", produces = { "application/json" })
public class YgglController {
@Value(value = "${config-8timer.init-password}")
private String pwd;
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
......@@ -331,8 +336,6 @@ public class YgglController {
gw = zzglBmgwM.getName();
bmid = zzglBmgwM.getUpId();
}
// QueryWrapper<ZzglBmgwM> queryWrapper1 = new QueryWrapper<>();
// queryWrapper1.eq("org_code", orgCode).eq("up_dept_id", gwid);
ZzglBmgwM z = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().eq("org_code", orgCode).eq("id", bmid));
String bm = null;
......@@ -344,22 +347,21 @@ public class YgglController {
}
/**
* 添加员工档案(weng)
*
* @param
* 添加员工档案
* @param userBean
* @param addygdaDto
* @return
*/
@PostMapping(value = "/addygda")
@ApiOperation(value = "添加员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 4)
public Result<Object> addygda(@CurrentUser UserBean userBean, @RequestBody AddygdaDto addygdaDto) {
public Result<Object> addygda(@CurrentUser UserBean userBean,@Validated @RequestBody AddygdaDto addygdaDto) throws Exception{
Integer orgCode = userBean.getOrgCode();
String name = addygdaDto.getName();
String phone = addygdaDto.getPhone();
Integer zjType = addygdaDto.getZjType();
String zjNum = addygdaDto.getZjNum();
Integer jobType = addygdaDto.getJobType();
// Date rzTime = addygdaDto.getRzTime();// ?????????????为什么新添加员工不给默认入职日期?????????????????????????
Date rzTime = new Date();
Integer syq = addygdaDto.getSyq();
Integer sex = addygdaDto.getSex();
......@@ -369,7 +371,8 @@ public class YgglController {
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
if (login == null) {
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5("123456"))
// 初始化密码 pwd
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
if (!qyzxEmpLogin.insert()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
......@@ -378,38 +381,72 @@ public class YgglController {
// 添加三张表
// 员工权限表(未定)
// 员工企业关联表和员工档案,员工成长表(未定)
QyzxEmpEntAsso.builder().empNum(qyzxEmpLogin.getId()).orgCode(orgCode)
.userType(CommonEnum.U_TYPE_EMP.getType()).status(1).build().insert();// usertype2普通员工 status1正常
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum)
.jobType(jobType).rzTime(rzTime).syq(syq).sex(sex).empNum(qyzxEmpLogin.getId()).orgCode(orgCode)
QyzxEmpEntAsso.builder()
.empNum(qyzxEmpLogin.getId())
.orgCode(orgCode)
.userType(CommonEnum.U_TYPE_EMP.getType())
.status(1)
.build()
.insert();// usertype2普通员工 status1正常
YgglMainEmp ygglMainEmp = YgglMainEmp.builder()
.name(name)
.phone(phone)
.zjType(zjType)
.zjNum(zjNum)
.jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType())
.rzTime(rzTime)
.syq(syq)
.sex(sex)
.empNum(qyzxEmpLogin.getId())
.orgCode(orgCode)
.build();
ygglMainEmp.insert();
if (addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(addygdaDto.getBmgwId() != null, YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.set(YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
}
return ResultUtil.data(ygglMainEmp, "新添加员工档案成功!");
} else {
YgglMainEmp ishad = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().eq("phone", phone).eq("org_code", orgCode));
YgglMainEmp ishad = ygglMainEmpMapper.selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.eq(YgglMainEmp::getPhone, phone)
.eq(YgglMainEmp::getOrgCode, orgCode));
if (ishad == null) {
// 添加三张表
// 员工权限表(未定)
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode).userType(2).status(1).build().insert();// usertype2普通员工
QyzxEmpEntAsso.builder()
.empNum(login.getId())
.orgCode(orgCode)
.userType(2)
.status(1)
.build()
.insert();// usertype2普通员工
// status1正常
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum)
.jobType(jobType).rzTime(rzTime).syq(syq).sex(sex).empNum(login.getId()).orgCode(orgCode)
YgglMainEmp ygglMainEmp = YgglMainEmp.builder()
.name(name)
.phone(phone)
.zjType(zjType)
.zjNum(zjNum)
.jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType())
.rzTime(rzTime)
.syq(syq)
.sex(sex)
.empNum(login.getId())
.orgCode(orgCode)
.build();
ygglMainEmp.insert();
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(addygdaDto.getBmgwId() != null, YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
if (addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
}
return ResultUtil.data(ygglMainEmp, "添加员工档案成功!");
} else {
return ResultUtil.error("该手机号已被使用,请输入正确手机号");
......@@ -1566,22 +1603,15 @@ public class YgglController {
@ApiOperationSupport(order = 55)
public Result<Void> addlzb(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
Integer empNum = lzygQueryDto.getEmpNum();
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<YgglMainEmp>();
queryWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).build()
.update(updateWrapper);
// 删除员工档案表
ygglMainEmpMapper.delete(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
.build().update(updateWrapper1);
// 查询该员工的关联表
QueryWrapper<QyzxEmpEntAsso> queryWrapper1 = new QueryWrapper<QyzxEmpEntAsso>();
queryWrapper1.eq("emp_num", empNum);
.build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
// 确认离职 删除员工关联表
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(lzygQueryDto.getEmpNum()).build();
qyzxEmpEntAsso.delete(queryWrapper1);
QyzxEmpEntAsso.builder().empNum(lzygQueryDto.getEmpNum()).build()
.delete(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum));
// 初始化 部门主管
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
......
......@@ -37,11 +37,13 @@ import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth;
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.enuminterface.YgEnumInterface;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
......@@ -89,7 +91,7 @@ public class ZzglController {
* @param
* @return
*/
@GetMapping(value = "/deptlist2")
@GetMapping(value = "/deptlist_plus")
@ApiOperation(value = "1.获取部门岗位-升级版", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<List<Tree<String>>> selectlistdept2(@CurrentUser UserBean userBean) {
......@@ -128,11 +130,14 @@ public class ZzglController {
}
@GetMapping(value = "/depts")
@ApiOperation(value = "只获取部门", httpMethod = "GET", notes = "接口发布说明")
@ApiOperation(value = "2.获取部门", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 2)
public Result<List<ZzglBmgwM>> selectdepts(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getType, 0).list();//0:部门;1:岗位
.eq(ZzglBmgwM::getOrgCode, orgCode)
.eq(ZzglBmgwM::getType, YgEnumInterface.OrgType.DEPARTMENT)
.list();
return ResultUtil.data(zzglBmgwMs);
}
......@@ -240,16 +245,17 @@ public class ZzglController {
// 根部门upId 默认为0
zzglBmgwM.setUpId(0);
}
if (zzglBmgwM.getName().trim().length()==0)
if (zzglBmgwM.getLeader() == null && StrUtil.length(StrUtil.trim(zzglBmgwM.getName())) == 0)
return ResultUtil.error("部门岗位名称不能为空");
Boolean a = zzglBmgwM.getId() == null;
if (a && zzglBmgwM.getType() == null)
Boolean notId = zzglBmgwM.getId() == null;
if (notId && zzglBmgwM.getType() == null)
zzglBmgwM.setType((Integer) 0);
zzglBmgwM.setOrgCode(userBean.getOrgCode());
zzglBmgwM.insertOrUpdate();
if (a)
return ResultUtil.data(zzglBmgwM);
return ResultUtil.success();
zzglBmgwM.setOrgCode(userBean.getOrgCode());
zzglBmgwM.insertOrUpdate();
return notId ? ResultUtil.data(zzglBmgwM) : ResultUtil.success();
}
......
......@@ -8,6 +8,11 @@ package cn.timer.api.dto.yggl;
import java.io.Serializable;
import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -28,30 +33,39 @@ public class AddygdaDto extends Page implements Serializable{
private static final long serialVersionUID = -1230023773946170942L;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value="员工姓名",example="华仔")
private String name;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value="手机号",example="101")
private String phone;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="证件类型 0:身份证;1:港澳居民来往内地通行证;2:台湾居民来往大陆通行证;3:外国护照;4:其他",example="0")
private Integer zjType;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value="证件号码 ",example="证件号码")
private String zjNum;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘",example="0")
private Integer jobType;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="入职日期 ",example="客户注册后的时间为入职时间")
private Date rzTime;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="试用期 0:无试用期;1:1个月;2:2个月;3:3个月;4:4个月;5:5个月;6:6个月(有试用期显示选项)",example="0")
private Integer syq;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="性别 0:男;1:女",example="0")
private Integer sex;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value="部门岗位id",example="0")
private Integer bmgwId;
......
......@@ -175,7 +175,7 @@ config-8timer:
one: 3
two: 7
three: 30
init-password: 123456
......@@ -146,4 +146,5 @@ config-8timer:
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
three: 30
\ No newline at end of file
three: 30
init-password: 123456
\ No newline at end of file
......@@ -146,4 +146,5 @@ config-8timer:
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
three: 30
\ No newline at end of file
three: 30
init-password: 123456
\ No newline at end of file
......@@ -38,7 +38,7 @@
oper_url,
oper_ip,
oper_location,
oper_param,
<!-- oper_param, -->
json_result,
status,
error_msg,
......
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