Commit f442114b by 翁国栋

8小时运营后台--

插入审批人--重复审批
parent d95940e8
......@@ -80,7 +80,7 @@ import javax.annotation.Resource;
@Api(tags = "3.0审批模块")
@RestController
@Transactional
@RequestMapping(value = "/spmk", produces = { "application/json","multipart/form-data" })
@RequestMapping(value = "/spmk", produces = {"application/json", "multipart/form-data"})
public class SpmkController {
@Autowired
......@@ -127,16 +127,17 @@ public class SpmkController {
//TODO 审批模板组
/**
* 新增或编辑-审批模板组
*/
@PostMapping(value = "/save_approval_template_g")
@ApiOperation(value = "1.新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
public Result<Object> saveAtg(@Validated({Insert.class, Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG) {
if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda()
.ne(spmkApprovalTemplateG.getId() != null,SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.ne(spmkApprovalTemplateG.getId() != null, SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!");
}
......@@ -151,9 +152,9 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_template_g/{id}")
@ApiOperation(value = "2.删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组")
@ApiOperationSupport(order = 2)
public Result<Object> deleteAtgById(@PathVariable int id){
public Result<Object> deleteAtgById(@PathVariable int id) {
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0 )
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0)
return ResultUtil.error("审批模板组存在 模板,不可直接删除!");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ?
......@@ -166,7 +167,7 @@ public class SpmkController {
@GetMapping(value = "/list_approval_template_g")
@ApiOperation(value = "3.查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 3)
public Result<Object> selectListAtg(){
public Result<Object> selectListAtg() {
return ResultUtil.data(spmkApprovalTemplateGMapper.selectListAtInAtg());
}
......@@ -177,7 +178,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_template_g")
@ApiOperation(value = "4.排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组")
@ApiOperationSupport(order = 4)
public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list){
public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -186,13 +187,14 @@ public class SpmkController {
}
//TODO 审批模板
/**
* 新增或编辑-审批模板
*/
@PostMapping(value = "/save_approval_template")
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5)
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto) {
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId))
......@@ -201,9 +203,9 @@ public class SpmkController {
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().build();
// 克隆 SpmkApprovalTemplateDto对象 到 SpmkApprovalTemplate对象,排除属性froms,router
BeanUtil.copyProperties(spmkApprovalTemplateDto, at , "froms","router");
BeanUtil.copyProperties(spmkApprovalTemplateDto, at, "froms", "router");
// 序列化 后 写入 SpmkApprovalTemplate对象
at.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApprovalTemplateDto.getFroms()));
at.setFroms(ObjectUtil.serialize((List<JSONObject>) spmkApprovalTemplateDto.getFroms()));
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda()
......@@ -228,7 +230,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_template/{id}")
@ApiOperation(value = "6.删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板")
@ApiOperationSupport(order = 6)
public Result<Object> deleteAtById(@PathVariable int id){
public Result<Object> deleteAtById(@PathVariable int id) {
return SpmkApprovalTemplate.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象");
......@@ -240,11 +242,11 @@ public class SpmkController {
@GetMapping(value = "/select_approval_template/{id}")
@ApiOperation(value = "7.id查询-审批模板", httpMethod = "GET", notes = "id查询-审批模板")
@ApiOperationSupport(order = 7)
public Result<Object> selectAtById(@PathVariable int id){
public Result<Object> selectAtById(@PathVariable int id) {
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().id(id).build().selectById();
SpmkApprovalTemplateDto atd = SpmkApprovalTemplateDto.builder().build();
BeanUtil.copyProperties(at, atd,"froms","router");
BeanUtil.copyProperties(at, atd, "froms", "router");
atd.setFroms(ObjectUtil.deserialize(at.getFroms()));
atd.setRouter(ObjectUtil.deserialize(at.getRouter()));
return ResultUtil.data(atd);
......@@ -257,7 +259,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_template")
@ApiOperation(value = "8.排序-审批模板", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 8)
public Result<Object> ranksAt(@Validated({Ranks.class})@RequestBody ValidList<SpmkApprovalTemplate> list){
public Result<Object> ranksAt(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalTemplate> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -268,15 +270,15 @@ public class SpmkController {
}
//TODO 审批组
/**
* 新增或编辑-审批组
*/
@PostMapping(value = "/save_approval_g")
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalG spmkApprovalG){
public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class, Update.class}) @RequestBody SpmkApprovalG spmkApprovalG) {
if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda()
.ne(spmkApprovalG.getId() != null, SpmkApprovalG::getId, spmkApprovalG.getId())
......@@ -296,7 +298,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_g/{id}")
@ApiOperation(value = "10.删除-审批组", httpMethod = "DELETE", notes = "删除-审批组")
@ApiOperationSupport(order = 10)
public Result<Object> deleteAgById(@PathVariable int id){
public Result<Object> deleteAgById(@PathVariable int id) {
// if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 )
// return ResultUtil.error("审批组存在 自定义审批,不可直接删除!");
......@@ -312,7 +314,7 @@ public class SpmkController {
@GetMapping(value = "/all_approval_g")
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean){
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean) {
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts));
......@@ -325,10 +327,10 @@ public class SpmkController {
@GetMapping(value = "/all_approval_g1")
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin1(@CurrentUser UserBean userBean,@RequestParam("eaaname")String eaaname){
public Result<Object> selectListAgByAdmin1(@CurrentUser UserBean userBean, @RequestParam("eaaname") String eaaname) {
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin1(userBean.getOrgCode(), userBean.getEmpNum(), depts,eaaname));
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin1(userBean.getOrgCode(), userBean.getEmpNum(), depts, eaaname));
}
......@@ -338,7 +340,7 @@ public class SpmkController {
@GetMapping(value = "/list_approval_g")
@ApiOperation(value = "11.查询列表-审批组-个人审批", httpMethod = "GET", notes = "查询列表-审批组-个人审批")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
public Result<Object> selectListAg(@CurrentUser UserBean userBean) {
List<SpmkApprovalG> spmkApprovalGS = spmkService.selectListAg(userBean);
return ResultUtil.data(spmkService.selectListAg(userBean));
}
......@@ -349,7 +351,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_g")
@ApiOperation(value = "12.排序-审批组", httpMethod = "PUT", notes = "排序-审批组")
@ApiOperationSupport(order = 12)
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list){
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list) {
if (list == null || list.size() <= 0) {
return ResultUtil.success();
......@@ -367,11 +369,11 @@ public class SpmkController {
@ApiOperation(value = "13.新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 13)
@Transactional(rollbackFor = Exception.class)
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception{
public Result<Object> saveCa(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build();
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
BeanUtil.copyProperties(spmkCustomApprovalDto, ca, "froms", "router", "initiatorConfigs");
if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda()
.ne(ca.getId() != null, SpmkCustomApproval::getId, ca.getId())
......@@ -424,13 +426,14 @@ public class SpmkController {
/**
* 删除-自定义审批
*
* @throws Exception
*/
@DeleteMapping(value = "/delete_custom_approval/{id}")
@ApiOperation(value = "14.删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批")
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 14)
public Result<Object> deleteCaById(@PathVariable int id) throws Exception{
public Result<Object> deleteCaById(@PathVariable int id) throws Exception {
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
if (!SpmkCustomApproval.builder().id(id).build().deleteById()) {
......@@ -446,14 +449,14 @@ public class SpmkController {
@GetMapping(value = "/select_custom_approval/{id}")
@ApiOperation(value = "15.id查询-自定义审批", httpMethod = "GET", notes = "id查询-自定义审批")
@ApiOperationSupport(order = 15)
public Result<Object> selectCaById(@PathVariable int id){
public Result<Object> selectCaById(@PathVariable int id) {
SpmkCustomApproval ca = SpmkCustomApproval.builder().id(id).build().selectById();
List<SpmkInitiatorConfig> listIc = SpmkInitiatorConfig.builder().build().selectList(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
SpmkCustomApprovalDto caD = SpmkCustomApprovalDto.builder()
.froms(ObjectUtil.deserialize(ca.getFroms()))
.router(ObjectUtil.deserialize(ca.getRouter()))
.build();
BeanUtil.copyProperties(ca, caD,"froms","router");
BeanUtil.copyProperties(ca, caD, "froms", "router");
caD.setInitiatorConfigs(listIc);
return ResultUtil.data(caD);
}
......@@ -464,7 +467,7 @@ public class SpmkController {
@PutMapping(value = "/update_custom_approval")
@ApiOperation(value = "16.排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -482,7 +485,7 @@ public class SpmkController {
@PutMapping(value = "/test_spmk")
@ApiOperation(value = "16.测试", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list) {
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
......@@ -499,11 +502,11 @@ public class SpmkController {
}
//遍历
public static Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
public static Set<Integer> empNumupdept2(Set<Integer> lanzi, List<ZzglBmgwM> bmgws, Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
if (z.getUpId() == null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
......@@ -514,8 +517,10 @@ public class SpmkController {
}
// TODO 审批汇总(发起审批)
/**
* 发起审批
*
* @throws Exception
*/
@PostMapping(value = "/start_approval")
......@@ -523,10 +528,10 @@ public class SpmkController {
@ApiOperationSupport(order = 17)
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-发起审批", businessType = BusinessType.INSERT)
public Result<Object> saveA(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
public Result<Object> saveA(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.select(YgglMainEmp::getHeadUrl, YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
);
......@@ -540,17 +545,17 @@ public class SpmkController {
// routers = RouterUtils.clearRouters(routers);
/*TODO 验证是否拥有添加审核人的权限 只用于华颐*/
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if (ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId,userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId,"/Approvalspbutonspbuton020101"));
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020101"));
/*如果没有该权限*/
if(zzglAuth==null){
if (zzglAuth == null) {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build().selectOne(new QueryWrapper<SpmkCustomApproval>().lambda()
.eq(SpmkCustomApproval::getName,spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode,userBean.getOrgCode()));
Router oldRouter=ObjectUtil.deserialize(ca.getRouter());
if(isTrue(router.getChildren(),oldRouter.getChildren())){
.eq(SpmkCustomApproval::getName, spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode, userBean.getOrgCode()));
Router oldRouter = ObjectUtil.deserialize(ca.getRouter());
if (isTrue(router.getChildren(), oldRouter.getChildren())) {
return ResultUtil.error("您没有新增审批人的权限");
}
}
......@@ -558,7 +563,7 @@ public class SpmkController {
}
List<Router> routers = router.getChildren();
if(routers==null){
if (routers == null) {
return ResultUtil.error("无法发起,请完善审批流程");
}
if (CollectionUtil.isNotEmpty(routers)) {
......@@ -581,7 +586,7 @@ public class SpmkController {
// if(!hasAudit){
// return ResultUtil.error("请选择审批人!");
// }
}else {
} else {
return ResultUtil.error("无法发起,请完善审批流程");
}
......@@ -595,17 +600,17 @@ public class SpmkController {
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
RouterUtils.getIsFlowChildren(listRouter, listFlowChildren);
if(listFlowChildren.isEmpty()){
if (listFlowChildren.isEmpty()) {
return ResultUtil.error("无法发起,请完善审批流程");
}
List<FlowChildren> listFlowChildren1 = (ArrayList<FlowChildren>) SerializationUtils.clone((Serializable) listFlowChildren);
List<String> uidlist = new ArrayList<>();
int i=0;
int i = 0;
int fsize = listFlowChildren.size();
int f=0;//listFlowChildren删除次数
for (FlowChildren flowChildrenItem: listFlowChildren) {
int f = 0;//listFlowChildren删除次数
for (FlowChildren flowChildrenItem : listFlowChildren) {
if ("audit".equals(flowChildrenItem.getClassName())) {
boolean hasAudit = false;
......@@ -613,29 +618,29 @@ public class SpmkController {
if (relation.getUsers().size() > 0) {
hasAudit = true;
//审批人去重
if (relation.getUsers().size() > 1){
int j=0;
int usize=relation.getUsers().size();//
int r=0;//user list删除次数
for (User user:relation.getUsers()
if (relation.getUsers().size() > 1) {
int j = 0;
int usize = relation.getUsers().size();//
int r = 0;//user list删除次数
for (User user : relation.getUsers()
) {
if (!uidlist.contains(user.getId())) {
uidlist.add(user.getId());
}else {
listFlowChildren1.get(i).getRelation().get(0).getUsers().remove(j-r);
} else {
listFlowChildren1.get(i).getRelation().get(0).getUsers().remove(j - r);
r++;
}
j++;
}
if (usize==r){
listFlowChildren1.remove(i-f);
if (usize == r) {
listFlowChildren1.remove(i - f);
f++;
}
}else {
} else {
if (!uidlist.contains(relation.getUsers().get(0).getId())) {
uidlist.add(relation.getUsers().get(0).getId());
}else {
listFlowChildren1.remove(i-f);
} else {
listFlowChildren1.remove(i - f);
f++;
}
}
......@@ -698,7 +703,7 @@ public class SpmkController {
adm.setFlowChildren(JSONArray.fromObject(listFlowChildren).toString());
try {
spmkApproveDetailSummaryMapper.insert(adm);
}catch (Exception e){
} catch (Exception e) {
throw new CustomException("审批详情-新增异常");
}
......@@ -706,8 +711,10 @@ public class SpmkController {
}
//TODO 审批汇总
/**
* 审批汇总
*
* @param summaryQueryDto
* @return
* @throws
......@@ -745,6 +752,7 @@ public class SpmkController {
}
//TODO 审批详情
/**
* 审批详情
*/
......@@ -752,8 +760,8 @@ public class SpmkController {
@ApiOperation(value = "19.审批详情", httpMethod = "GET", notes = "审批详情")
@ApiOperationSupport(order = 19)
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectAd(@CurrentUser UserBean userBean,@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id,userBean.getEmpNum());
public Result<Object> selectAd(@CurrentUser UserBean userBean, @PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id, userBean.getEmpNum());
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
......@@ -765,7 +773,7 @@ public class SpmkController {
@GetMapping(value = "/select_drafts_detail/{id}")
@ApiOperation(value = "草稿箱审批详情", httpMethod = "GET", notes = "审批详情")
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectdd(@CurrentUser UserBean userBean,@PathVariable(required = true) Integer id) {
public Result<Object> selectdd(@CurrentUser UserBean userBean, @PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectDraftsDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
......@@ -773,6 +781,7 @@ public class SpmkController {
}
//TODO 审批人审批
/**
* 审批人审批
*/
......@@ -782,15 +791,15 @@ public class SpmkController {
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
// @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
public Result<Object> approving(@CurrentUser UserBean userBean, @Validated @RequestBody ApprovingDto approvingDto) throws Exception {
/*判断是否有权限转派*/
if(approvingDto.getSts()==4){
if (approvingDto.getSts() == 4) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if (ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020102"));
if (zzglAuth == null) {
......@@ -801,11 +810,11 @@ public class SpmkController {
}
Integer asId = approvingDto.getAsId();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer approStatus=Integer.parseInt(redisUtil.get(asId.toString())==null?"0":redisUtil.get(asId.toString()).toString());
if(approStatus==1){
Integer approStatus = Integer.parseInt(redisUtil.get(asId.toString()) == null ? "0" : redisUtil.get(asId.toString()).toString());
if (approStatus == 1) {
return ResultUtil.error("该审批已在审批中!");
}else{
redisUtil.set(asId.toString(),1,2);
} else {
redisUtil.set(asId.toString(), 1, 2);
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
......@@ -821,7 +830,7 @@ public class SpmkController {
.eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("该审批已结束!");
}
......@@ -831,11 +840,11 @@ public class SpmkController {
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal()));
if (count == 0) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("您已审批过!");
}
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
if (spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal())) == 0) {
......@@ -843,18 +852,18 @@ public class SpmkController {
Integer adminNum = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN)
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN, SysRoleType.U_TYPE_C_ADMIN)
.count();
if (adminNum <= 0) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("非当前审批人 或 管理员,无法操作!");
}
}
if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class);
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class);
// 审批逻辑
RouterUtils.approving(
listFlowChildren,
......@@ -873,7 +882,7 @@ public class SpmkController {
// 更新 flowChildren
SpmkApproveDetailSummary sadsUpdate = SpmkApproveDetailSummary.builder().id(ad.getId()).flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build();
// 审批详情 审批时添加 附件
if(RequestDataUtils.addFileList(ad,approvingDto.getFileList())){
if (RequestDataUtils.addFileList(ad, approvingDto.getFileList())) {
sadsUpdate.setRequestData(ad.getRequestData());
}
sadsUpdate.updateById();
......@@ -882,36 +891,37 @@ public class SpmkController {
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.select(SpmkApproveSummary::getSts, SpmkApproveSummary::getAssoType)
.eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() != ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(),JSONObject.class);
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(), JSONObject.class);
jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build());
jSONObject.set("orgCode", userBean.getOrgCode());
//审批完成后 业务
SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null)
Logoutput("1----------"+ sab);
Logoutput("2----------"+ jSONObject);
Logoutput("1----------" + sab);
Logoutput("2----------" + jSONObject);
sab.handleApprove(jSONObject);
}
}
}else {
redisUtil.set(asId.toString(),0,500);
} else {
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("该审批已结束!");
}
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.success();
}
@Autowired
private PunchRecordMapper punchrecordmapper;
//TODO 我发起的/我审批的/抄送我的
/**
* 查询列表-我发起的/我审批的/抄送我的-分页
*/
......@@ -919,17 +929,17 @@ public class SpmkController {
@ApiOperation(value = "21.查询列表-我发起的/我审批的/抄送我的-分页", httpMethod = "POST", notes = "查询列表-我审批的-关键字、审批状态、发起时间-分页")
@ApiOperationSupport(order = 21)
@Log(title = "审批-我发起的/我审批的/抄送我的", businessType = BusinessType.OTHER)
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException{
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException {
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if(mySummaryQueryDto.getSts() == null) {
if (mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0);
}
//我发起的
if(mySummaryQueryDto.getType() == 0) {
if (mySummaryQueryDto.getType() == 0) {
// mySummaryQueryDto.setSts(null);
}
// 缺-部门id 搜索
......@@ -937,40 +947,52 @@ public class SpmkController {
List<SpmkApproveSummary> listAs = pageAs.getRecords();
for(SpmkApproveSummary sp : listAs) {
for (SpmkApproveSummary sp : listAs) {
String requerstr = "";
try {
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, sp.getId()).last("limit 1"));
JSONObject as =jsonObject.parseObject(ad.getRequestData().toString(),JSONObject.class);
JSONObject as = jsonObject.parseObject(ad.getRequestData().toString(), JSONObject.class);
// Logoutput(as);
// Logoutput(sp.getId()+"==========================================="+sp.getAssoType());
requerstr = "";
//assoType : 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡
switch (sp.getAssoType()) {
case 1:requerstr = "转正时间:"+as.getJSONObject("__newConfirmationTime").getStr("value");break;
case 2:requerstr = "离职时间:"+as.getJSONObject("__terminationDate").getStr("value");break;
case 1:
requerstr = "转正时间:" + as.getJSONObject("__newConfirmationTime").getStr("value");
break;
case 2:
requerstr = "离职时间:" + as.getJSONObject("__terminationDate").getStr("value");
break;
case 3:
String namepos = "";
PunchRecord pu = punchrecordmapper.organizationalStructure(Integer.valueOf(as.getJSONObject("__TransferInDepartment").getStr("value")));
if(pu != null) {
if (pu != null) {
namepos = pu.getPost();
}
requerstr = "调入岗位:"+namepos;
requerstr = "调入岗位:" + namepos;
break;
case 5:
requerstr = "加班时长:" + as.getJSONObject("__timeLong").getStr("value") + "(小时)";
break;
case 5:requerstr = "加班时长:"+as.getJSONObject("__timeLong").getStr("value")+"(小时)";break;
case 6:
String name = "";
KqglAssoLeaveRules rul = KqglAssoLeaveRules.builder().build().selectById(as.getJSONObject("__LeaveType").getStr("value"));
if(rul != null) {
if (rul != null) {
name = rul.getName();
}
requerstr = "请假类型:"+name;
requerstr = "请假类型:" + name;
break;
case 7:
requerstr = "出差时长:" + as.getJSONObject("__longTime").getStr("value") + "(小时)";
break;
case 8:
requerstr = "外出时长:" + as.getJSONObject("__longTime").getStr("value") + "(小时)";
break;
case 9:
requerstr = "补卡时间:" + as.getJSONObject("__PatchCardTime").getStr("value");
break;
case 7:requerstr = "出差时长:"+as.getJSONObject("__longTime").getStr("value")+"(小时)";break;
case 8:requerstr = "外出时长:"+as.getJSONObject("__longTime").getStr("value")+"(小时)";break;
case 9:requerstr = "补卡时间:"+as.getJSONObject("__PatchCardTime").getStr("value");break;
default:
break;
}
......@@ -988,6 +1010,7 @@ public class SpmkController {
}
//TODO 撤销审批
/**
* 撤销审批
*/
......@@ -1014,7 +1037,7 @@ public class SpmkController {
@ApiOperation(value = "23.删除-审批(发起的审批)-根据审批汇总id", httpMethod = "DELETE", notes = "删除-审批(发起的审批)-根据审批汇总id")
@ApiOperationSupport(order = 23)
@Log(title = "审批-删除审批", businessType = BusinessType.DELETE)
public Result<Object> deleteApprovalData(@PathVariable Integer id){
public Result<Object> deleteApprovalData(@PathVariable Integer id) {
/*
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectList(new QueryWrapper<SpmkApproveExecuteRecord>()
.lambda()
......@@ -1043,7 +1066,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_data")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 90)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean) {
spmkApprovalGMapper.delete(null);
spmkCustomApprovalMapper.delete(null);
spmkApproveSummaryMapper.delete(null);
......@@ -1058,24 +1081,24 @@ public class SpmkController {
@GetMapping(value = "/icon")
@ApiOperation(value = "99.图标列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 99)
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean){
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean) {
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"获取图标列表成功");
return ResultUtil.data(spmkIcons, "获取图标列表成功");
}
//TODO 测试-生成 审批组 和 自定义审批
@GetMapping(value = "/test")
@ApiOperation(value = "98.测试-生成 审批组 和 自定义审批", httpMethod = "GET", notes = "测试-生成 审批组 和 自定义审批")
@ApiOperationSupport(order = 98)
public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode){
public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode) {
spmkService.createCustomApproval(orgCode);
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"生成 审批组 和 自定义审批成功");
return ResultUtil.data(spmkIcons, "生成 审批组 和 自定义审批成功");
}
@GetMapping(value = "/verification_staff")
......@@ -1084,7 +1107,7 @@ public class SpmkController {
String msg = "";
YgglMainEmp ygem = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum()));
if(ygem.getJobStatus() == 1) {
if (ygem.getJobStatus() == 1) {
msg = "正式员工不能发起转正审批";
}
......@@ -1093,7 +1116,7 @@ public class SpmkController {
@PostMapping(value = "/approved_quantity")
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto) {
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
......@@ -1104,22 +1127,22 @@ public class SpmkController {
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0;
int istartedit = 0, ccme = 0, iapprovedit = 0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
if (istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
if (ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
if (iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
......@@ -1136,10 +1159,10 @@ public class SpmkController {
public void Logoutput(String science) {
if(!("pro").equals(environmental_science)) {
if (!("pro").equals(environmental_science)) {
System.out.println(science);
}else {
} else {
System.out.println("");
}
......@@ -1150,32 +1173,33 @@ public class SpmkController {
*/
@PostMapping(value = "/approved_addDetail")
@ApiOperation(value = "A审核详情数据转换", httpMethod = "POST", notes = "")
public String addApproveDetail(){
public String addApproveDetail() {
return spmkService.addApproveDetail();
}
/**
* 判断人员是否一致
*
* @param olist
* @param list
* @return
*/
private boolean isTrue(List<Router>olist ,List<Router> list){
if(olist.size()==0&&list.size()==0){
private boolean isTrue(List<Router> olist, List<Router> list) {
if (olist.size() == 0 && list.size() == 0) {
return false;
}else if(olist.size()!=list.size()){
} else if (olist.size() != list.size()) {
return true;
}
if(list.get(0).getClassName().equals("audit")&&list.get(0).getName().equals("审批人")){
if(list.get(0).getRelation().get(0).getType().equals("executive")&&list.get(0).getRelation().get(0).getName().equals("主管")){
return isTrue(olist.get(0).getChildren(),list.get(0).getChildren());
if (list.get(0).getClassName().equals("audit") && list.get(0).getName().equals("审批人")) {
if (list.get(0).getRelation().get(0).getType().equals("executive") && list.get(0).getRelation().get(0).getName().equals("主管")) {
return isTrue(olist.get(0).getChildren(), list.get(0).getChildren());
}
if(list.get(0).getRelation().get(0).getUsers().size()!=olist.get(0).getRelation().get(0).getUsers().size()){
if (list.get(0).getRelation().get(0).getUsers().size() != olist.get(0).getRelation().get(0).getUsers().size()) {
return true;
}else{
return isTrue(olist.get(0).getChildren(),list.get(0).getChildren());
} else {
return isTrue(olist.get(0).getChildren(), list.get(0).getChildren());
}
}else if(list.get(0).getClassName().equals("copy")&&list.get(0).getName().equals("抄送人")){
} else if (list.get(0).getClassName().equals("copy") && list.get(0).getName().equals("抄送人")) {
return false;
}
return false;
......@@ -1183,18 +1207,63 @@ public class SpmkController {
/**
* 更新审批流程通过节点
*
* @param userBean
* @param spmkApproveDetailDto
* @return
*/
@PostMapping(value = "/updateFlowChildren")
@ApiOperation(value = "更新审批流程通过节点", httpMethod = "POST", notes = "")
public Result<Object> updateFlowChildren(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
public Result<Object> updateFlowChildren(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
try {
SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
//只有添加审批人才会有值
if (spmkApproveDetailDto.getIndex() != null) {
//如果当前索引下的都要变更为0未执行
int currentIndex=spmkApproveDetailDto.getIndex();
for (int i = currentIndex+1; i < listFlowChildren.size(); i++) {
if (i == currentIndex + 1) {
if (!listFlowChildren.get(currentIndex).getExecute().equals("1")) {
listFlowChildren.get(i).setExecute("1");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> {
u.setExecute("1");
//添加审批记录
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
.name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
.type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
.sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
spmkApproveExecuteRecord.insert();
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord.getId())
.empNum(Integer.parseInt(u.getId()))
.operatorHeaderUrl(u.getHeadUrl())
.executorName(u.getName())
.sts(1)
.build().insert();
SpmkApproveSummary.builder().currentApprover(u.getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
});
});
continue;
}
}
listFlowChildren.get(i).setExecute("0");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> u.setExecute("0"));
});
}
SpmkApproveSummary.builder().sts(0).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
}
// 更新 flowChildren
SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId())
.flowChildren(JSONArray.fromObject(spmkApproveDetailDto.getFlowChildren()).toString()).build().updateById();
.flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
} catch (Exception e) {
return ResultUtil.error(e);
}
......@@ -1204,15 +1273,16 @@ public class SpmkController {
return ResultUtil.data(JSON.toJSONString(detailSummary));
}
@PostMapping(value = "/save_drafts")
@ApiOperation(value = "存入草稿箱", httpMethod = "POST", notes = "存入草稿箱")
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-存入草稿箱", businessType = BusinessType.INSERT)
public Result<Object> saveDrafts(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
public Result<Object> saveDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception {
try {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.select(YgglMainEmp::getHeadUrl, YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
);
......@@ -1225,17 +1295,17 @@ public class SpmkController {
// routers = RouterUtils.clearRouters(routers);
/*TODO 验证是否拥有添加审核人的权限 只用于华颐*/
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if (ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId,userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId,"/Approvalspbutonspbuton020101"));
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020101"));
/*如果没有该权限*/
if(zzglAuth==null){
if (zzglAuth == null) {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build().selectOne(new QueryWrapper<SpmkCustomApproval>().lambda()
.eq(SpmkCustomApproval::getName,spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode,userBean.getOrgCode()));
Router oldRouter=ObjectUtil.deserialize(ca.getRouter());
if(isTrue(router.getChildren(),oldRouter.getChildren())){
.eq(SpmkCustomApproval::getName, spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode, userBean.getOrgCode()));
Router oldRouter = ObjectUtil.deserialize(ca.getRouter());
if (isTrue(router.getChildren(), oldRouter.getChildren())) {
return ResultUtil.error("您没有新增审批人的权限");
}
}
......@@ -1249,9 +1319,9 @@ public class SpmkController {
.set("initiator", ygglMainEmp.getName())
.set("headUrl", ygglMainEmp.getHeadUrl())
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST,true);
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST, true);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
RouterUtils.getIsFlowChildren(listRouter, listFlowChildren);
String currentApprover = jSONObject.getStr("current_approver");
SpmkApproveDrafts as = SpmkApproveDrafts
......@@ -1267,7 +1337,7 @@ public class SpmkController {
.updateTime(new Date())
.currentApprover(currentApprover).isUrgent(spmkApproveSummaryDto.getIsUrgent())
.build();
if(spmkApproveSummaryDto.getId()!=null){
if (spmkApproveSummaryDto.getId() != null) {
as.setId(spmkApproveSummaryDto.getId());
}
......@@ -1287,37 +1357,41 @@ public class SpmkController {
adm.setRouter(listRouter.get(0).toJSONString());
adm.setFlowChildren(JSONArray.fromObject(listFlowChildren).toString());
if(spmkApproveSummaryDto.getId()!=null){
SpmkApproveDetailDrafts sp = SpmkApproveDetailDrafts.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId,spmkApproveSummaryDto.getId()));
if (spmkApproveSummaryDto.getId() != null) {
SpmkApproveDetailDrafts sp = SpmkApproveDetailDrafts.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId, spmkApproveSummaryDto.getId()));
adm.setId(sp.getId());
spmkApproveDetailDraftsMapper.updateById(adm);
}else {
} else {
spmkApproveDetailDraftsMapper.insert(adm);
}
return ResultUtil.data(as.getId());
}catch (Exception e){
} catch (Exception e) {
// throw new CustomException("审批草稿详情-新增异常");
e.printStackTrace();
}
return ResultUtil.error("审批草稿详情-新增异常");
};
}
;
@PostMapping(value = "/my_drafts")
@ApiOperation(value = "我的草稿箱", httpMethod = "POST", notes = "我的草稿箱")
@Log(title = "审批-我的草稿箱", businessType = BusinessType.OTHER)
public Result<Object> myDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto){
public Result<Object> myDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) {
IPage<SpmkApproveDrafts> page = new Page<SpmkApproveDrafts>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if(mySummaryQueryDto.getSts() == null) {
if (mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0);
}
IPage<SpmkApproveDrafts> pageAs = spmkApproveDraftsMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveDrafts> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs,listAs);
return ResultUtil.data(pageAs, listAs);
}
@PostMapping(value = "/del_drafts")
@ApiOperation(value = "删除草稿", httpMethod = "POST", notes = "删除草稿")
@Log(title = "审批-删除草稿", businessType = BusinessType.OTHER)
......@@ -1331,10 +1405,10 @@ public class SpmkController {
@PostMapping(value = "/add_files")
@ApiOperation(value = "添加附件", httpMethod = "POST", notes = "添加附件")
@Log(title = "审批-添加附件", businessType = BusinessType.OTHER)
public Result<Object> addFiles(@CurrentUser UserBean userBean,@RequestBody ApprovingDto approvingDto) {
public Result<Object> addFiles(@CurrentUser UserBean userBean, @RequestBody ApprovingDto approvingDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if(ent.getUserType() == 2) {
if (ent != null) {
if (ent.getUserType() == 2) {
return ResultUtil.error("暂无权限");
}
}
......@@ -1347,7 +1421,7 @@ public class SpmkController {
.eq(SpmkApproveDetailSummary::getId, approvingDto.getAsId()));
// 审批详情 审批时添加 附件
try {
if(RequestDataUtils.addFileList(ad,approvingDto.getFileList())){
if (RequestDataUtils.addFileList(ad, approvingDto.getFileList())) {
ad.updateById();
}
} catch (Exception e) {
......@@ -1355,13 +1429,14 @@ public class SpmkController {
}
return ResultUtil.data("添加附件成功");
}
@PostMapping(value = "/del_file")
@ApiOperation(value = "添加附件", httpMethod = "POST", notes = "添加附件")
@Log(title = "审批-添加附件", businessType = BusinessType.OTHER)
public Result<Object> delFileList(@CurrentUser UserBean userBean,@RequestBody ApprovingDto approvingDto) {
public Result<Object> delFileList(@CurrentUser UserBean userBean, @RequestBody ApprovingDto approvingDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if(ent.getUserType() == 2) {
if (ent != null) {
if (ent.getUserType() == 2) {
return ResultUtil.error("暂无权限");
}
}
......@@ -1374,7 +1449,7 @@ public class SpmkController {
.eq(SpmkApproveDetailSummary::getId, approvingDto.getAsId()));
// 审批详情 审批时添加 附件
try {
if(RequestDataUtils.delFileList(ad,approvingDto.getFileList())){
if (RequestDataUtils.delFileList(ad, approvingDto.getFileList())) {
ad.updateById();
}
} catch (Exception e) {
......
......@@ -61,4 +61,6 @@ public class SpmkApproveDetailDto {
private Date launchTime; //审批发起时间
private Integer index;//插入审批人的索引
}
......@@ -997,8 +997,12 @@ public class RouterUtils {
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(sts)
.signatureImg(signatureImg)
.build()
.updateById();
.build().updateById();
// if(spmkExecutor.getId()==0){
// spmkExecutor.insert();
// }else{
// spmkExecutor.updateById();
// }
listUser.get(i_user).setExecute(EXECUTED);
......
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