Commit afea856a by tangzhaoqian Committed by chenzg

修复审批bug、查询组织架构Api优化

parent 021311ec
......@@ -81,7 +81,7 @@ public interface YgEnumInterface {
*/
@Getter
enum jobStatus implements YgEnumInterface {
SHIYONG(0, "试用"), ZHENSHI(1, "正式"), LIZHIZHONG(2, "离职中"), YILIZHI(3, "已离职");
SHIYONG(1, "试用"), ZHENSHI(2, "正式"), LIZHIZHONG(3, "离职中"), YILIZHI(4, "已离职");
private Integer type;
......
......@@ -508,7 +508,7 @@ public class LoginController {
}
boolean b4 = YgglMainEmp.builder().orgCode(qyzxEntInfoM.getId()).empNum(login.getId()).rzTime(new Date())
.name(username).build().insert();
.name(username).jobStatus(1).build().insert();
if (!b4) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("注册企业失败3");
......
......@@ -4,11 +4,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -23,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
......@@ -118,6 +116,11 @@ public class SpmkController {
@ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
if (spmkApprovalTemplateG.selectCount(Wrappers.lambdaQuery(spmkApprovalTemplateG)
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!");
}
return spmkApprovalTemplateG.insertOrUpdate() ?
ResultUtil.data(spmkApprovalTemplateG, "操作成功!") : ResultUtil.error("操作失败!");
......@@ -170,6 +173,7 @@ public class SpmkController {
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5)
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId))
return ResultUtil.error("操作失败!-1");
......@@ -182,6 +186,11 @@ public class SpmkController {
at.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApprovalTemplateDto.getFroms()));
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(Wrappers.lambdaQuery(at)
.eq(SpmkApprovalTemplate::getName, at.getName())) > 0) {
return ResultUtil.error("审批模板名重复!");
}
if (!at.insertOrUpdate())
return ResultUtil.error("操作失败!-2");
......@@ -243,6 +252,12 @@ public class SpmkController {
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean, @RequestBody SpmkApprovalG spmkApprovalG){
if (spmkApprovalG.selectCount(Wrappers.lambdaQuery(spmkApprovalG)
.eq(SpmkApprovalG::getName, spmkApprovalG.getName())) > 0) {
return ResultUtil.error("审批组名重复!");
}
spmkApprovalG.setOrgCode(userBean.getOrgCode());
return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG, "操作成功!") : ResultUtil.error("操作失败!");
......@@ -318,6 +333,12 @@ public class SpmkController {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build();
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
if (ca.selectCount(Wrappers.lambdaQuery(ca)
.eq(SpmkCustomApproval::getName, ca.getName())) > 0) {
return ResultUtil.error("自定义审批名重复!");
}
ca.setFroms(ObjectUtil.serialize(spmkCustomApprovalDto.getFroms()));
ca.setRouter(ObjectUtil.serialize(spmkCustomApprovalDto.getRouter()));
......@@ -645,7 +666,7 @@ public class SpmkController {
.eq(SpmkApproveSummary::getId, id));
return as != null && as.getSts() != 2 ? (SpmkApproveSummary.builder().id(id).endTime(new Date()).sts(1).build().updateById() ?
ResultUtil.success("操作成功!") : ResultUtil.error("操作失败_1!")) : ResultUtil.error("操作失败_2!");
ResultUtil.success("操作成功!") : ResultUtil.error("操作失败_1!")) : ResultUtil.error("审批已结束,无法撤销!");
}
/**
......
......@@ -11,10 +11,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -31,7 +33,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -44,14 +45,11 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.tree.Tree;
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.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb;
......@@ -73,6 +71,7 @@ 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.config.enums.CommonEnum;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper;
......@@ -155,22 +154,26 @@ public class YgglController {
Integer orgCode = userBean.getOrgCode();
LoginInfoDto loginInfo = LoginInfoDto.builder().build();
YgglMainEmp ygglMainEmp = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId, YgglMainEmp::getName, YgglMainEmp::getRzTime, YgglMainEmp::getZzTime,
.select(YgglMainEmp::getBmgwId,
YgglMainEmp::getName,
YgglMainEmp::getRzTime,
YgglMainEmp::getZzTime,
YgglMainEmp::getEmpNum)
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, orgCode).one();
if (ygglMainEmp != null) {
Integer gw = ygglMainEmp.getBmgwId();
ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.select(ZzglBmgwM::getUpId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gw)
.eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM gwObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getUpId,ZzglBmgwM::getName)
.eq(ZzglBmgwM::getId, gw).eq(ZzglBmgwM::getOrgCode, orgCode).one();
ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.select(ZzglBmgwM::getId, ZzglBmgwM::getName).eq(ZzglBmgwM::getId, gwObj.getUpId())
.eq(ZzglBmgwM::getOrgCode, orgCode).one();
loginInfo.setEmpNum(ygglMainEmp.getEmpNum());
loginInfo.setName(ygglMainEmp.getName());
if (gwObj != null) {
ZzglBmgwM bmObj = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).select(ZzglBmgwM::getId,ZzglBmgwM::getName)
.eq(ZzglBmgwM::getId, gwObj.getUpId()).eq(ZzglBmgwM::getOrgCode, orgCode).one();
loginInfo.setBmId(bmObj != null ? bmObj.getId() : null);
loginInfo.setBmName(bmObj != null ? bmObj.getName() : null);
}
loginInfo.setEmpNum(ygglMainEmp.getEmpNum());
loginInfo.setName(ygglMainEmp.getName());
loginInfo.setGwId(gw);
loginInfo.setGwName(gwObj != null ? gwObj.getName() : "");
loginInfo.setEntryTime(ygglMainEmp.getRzTime());
......@@ -243,6 +246,7 @@ public class YgglController {
return one;
}
/**
* 获取用户头像
*
......@@ -384,7 +388,7 @@ public class YgglController {
ygglMainEmp.insert();
if (addygdaDto.getBmgwId() != null) {
if(addygdaDto.getBmgwId() != null) {
new LambdaUpdateChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.set(addygdaDto.getBmgwId() != null, YgglMainEmp::getBmgwId, addygdaDto.getBmgwId())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getId, ygglMainEmp.getId()).update();
......@@ -424,8 +428,7 @@ public class YgglController {
@PostMapping(value = "/updateygda")
@ApiOperation(value = "修改员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 5)
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp)
throws Exception {
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp) throws Exception{
if (ygglMainEmp.getEmpNum() != null) {
UpdateWrapper<YgglMainEmp> updateWrapper = new UpdateWrapper<YgglMainEmp>();
......@@ -461,6 +464,7 @@ public class YgglController {
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
ZzglBmgwM.getDepts(bList, b, zzglBmgwMs);
Integer j = ygQueryDto.getJobStatus();
Integer t = ygQueryDto.getJobType();
String q = ygQueryDto.getQuery();
......@@ -469,11 +473,13 @@ public class YgglController {
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.select("name", "emp_num", "bmgw_id", "rz_time", "job_type", "phone", "job_status")
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType()).eq("org_code", orgCode)
.ne("job_status", YgEnumInterface.jobStatus.YILIZHI.getType())
.eq("org_code", orgCode)
.eq(t != null && t > -1, "job_type", t).eq(j != null && j > -1, "job_status", j)
.in(!bList.isEmpty(), "bmgw_id", bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like("name", q).or().like("phone", q));
// List<YgglMainEmp> lo = YgglMainEmp.builder().build().selectList(queryWrapper);
IPage<YgglMainEmp> ygglMainEmpPage = YgglMainEmp.builder().build().selectPage(page, queryWrapper);
// List<YgglMainEmp> ygglMainEmps = ygglMainEmpPage.getRecords();
......@@ -793,8 +799,7 @@ public class YgglController {
// 员工状态(最大优化)
d.setJobStatus(YgEnumInterface.jobStatus.isZhen(jobStatus));
// 入职日期(最大优化)
d.setRzTime(
rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
d.setRzTime(rzTime != null ? YgEnumInterface.rzTime.tranTime2(YgEnumInterface.rzTime.tranTime(rzTime)) : null);
// 试用期(最大优化)
d.setSyq(YgEnumInterface.syq.choose(syq));
}
......@@ -805,7 +810,7 @@ public class YgglController {
// 浴池,洗去选填项字节大于100的选项
public boolean takeshower(String[] bathroom) {
for (String b : bathroom) {
if (b != null && b.length() > 100) {
if (b!=null&& b.length() > 100) {
return false;
}
......@@ -1570,10 +1575,10 @@ public class YgglController {
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);
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
.build().update(updateWrapper1);
YgglMainEmp.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType())
.build().update(updateWrapper);
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);
......@@ -1582,8 +1587,9 @@ public class YgglController {
qyzxEmpEntAsso.delete(queryWrapper1);
// 初始化 部门主管
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
new UpdateWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getLeader, empNum));
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(), new UpdateWrapper<ZzglBmgwM>()
.lambda()
.eq(ZzglBmgwM::getLeader, empNum));
return ResultUtil.success("确认离职员工成功");
}
......@@ -2026,30 +2032,4 @@ public class YgglController {
.delete(new QueryWrapper<YgglAttaSbgjj>().eq("org_code", orgCode).eq("id", id)), "删除员工社保公积金成功");
}
@GetMapping(value = "/sysRegion")
@ApiOperation(value = "省市区字典(贼全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Tree<String>>> sysRegion() {
List<SysRegion> nodeList = SysRegion.builder().build()
.selectList(new LambdaQueryWrapper<SysRegion>().select(SysRegion::getKeyId, SysRegion::getRegionCode,
SysRegion::getRegionName, SysRegion::getMerName, SysRegion::getLevel));
// 配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("key_id");
treeNodeConfig.setParentIdKey("region_code");
// 最大递归深度
treeNodeConfig.setDeep(4);
List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig, (treeNode, tree) -> {
tree.setId(treeNode.getKeyId().toString());
tree.setParentId(treeNode.getRegionCode());
tree.setName(treeNode.getRegionName());
// 扩展属性 ...
tree.putExtra("mer_name", treeNode.getMerName());
});
return ResultUtil.data(treeNodes, "获取成功");
}
}
package cn.timer.api.controller.zzgl;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.transaction.Transactional;
......@@ -22,8 +25,18 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.bean.copier.ValueProvider;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
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.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
......@@ -70,6 +83,50 @@ public class ZzglController {
return ResultUtil.data(zzglBmgwMs);
}
/**
* 架构树/架构图/导出
*
* @param
* @return
*/
@GetMapping(value = "/deptlist2")
@ApiOperation(value = "1.获取部门岗位-升级版", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<List<Tree<String>>> selectlistdept2(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
.eq(ZzglBmgwM::getOrgCode, orgCode).list();
// 构建node列表
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
zzglBmgwMs.forEach(z -> {
nodeList.add(new TreeNode<>(Convert.toStr(z.getId()), Convert.toStr(z.getUpId()), z.getName(), 0));
});
//配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("id");
treeNodeConfig.setParentIdKey("upId");
// 最大递归深度
// treeNodeConfig.setDeep(10);
//转换器
List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig,
(treeNode, tree) -> {
tree.setId(treeNode.getId());
tree.setParentId(treeNode.getParentId());
tree.setWeight(treeNode.getWeight());
tree.setName(treeNode.getName());
// 扩展属性 ...
// tree.putExtra("extraField", 666);
// tree.putExtra("other", new Object());
});
return ResultUtil.data(treeNodes);
}
@GetMapping(value = "/depts")
@ApiOperation(value = "只获取部门", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ZzglBmgwM>> selectdepts(@CurrentUser UserBean userBean) {
......@@ -176,6 +233,13 @@ public class ZzglController {
@PostMapping(value = "/dept")
@ApiOperation(value = "添加/修改部门", httpMethod = "POST", notes = "接口发布说明")
public Result<ZzglBmgwM> adddept(@CurrentUser UserBean userBean, @RequestBody ZzglBmgwM zzglBmgwM) {
Integer count = zzglBmgwMMapper.selectCount(new QueryWrapper<ZzglBmgwM>().lambda()
.eq(ZzglBmgwM::getOrgCode, userBean.getOrgCode()));
if (count <= 0) {
// 根部门upId 默认为0
zzglBmgwM.setUpId(0);
}
if (zzglBmgwM.getName().trim().length()==0)
return ResultUtil.error("部门岗位名称不能为空");
Boolean a = zzglBmgwM.getId() == null;
......
......@@ -289,6 +289,7 @@ public class RouterUtils {
// 审批执行记录 持久化
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) throws Exception{
for_insert:
for (int i = 0,m = listFlowChildren.size() ; i < m; i++) {
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
i++;
......@@ -345,14 +346,12 @@ public class RouterUtils {
case EXECUTING:
executor.setSts(1);
executor.insert();
break executor;
break for_insert;
case EXECUTED:
executor.setSts(2);
executor.insert();
break;
}
}
break;
case COPY:
......
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