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("审批已结束,无法撤销!");
}
/**
......
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