|
|
@ -18,6 +18,7 @@ import com.qs.serve.modules.seeyon.entity.CtpAffairQo; |
|
|
|
import com.qs.serve.modules.seeyon.service.SeeYonService; |
|
|
|
import com.qs.serve.modules.sys.entity.SysUser; |
|
|
|
import com.qs.serve.modules.sys.service.SysConfigService; |
|
|
|
import com.qs.serve.modules.sys.service.SysUserSalesService; |
|
|
|
import com.qs.serve.modules.sys.service.SysUserService; |
|
|
|
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
|
|
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
|
|
@ -60,7 +61,7 @@ public class TbsCostApplyController { |
|
|
|
private SeeYonService seeYonService; |
|
|
|
|
|
|
|
private TbsBudgetApplicationService budgetApplicationService; |
|
|
|
|
|
|
|
private SysUserSalesService sysUserSalesService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 预览 |
|
|
@ -74,6 +75,17 @@ public class TbsCostApplyController { |
|
|
|
return R.ok(result.getTableData()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 预览2 提交审批后调用 |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("preview2") |
|
|
|
public R<TbsBudgetTableVo> viewTable(Long id){ |
|
|
|
TbsBudgetTableVo result = budgetApplicationService.buildResultTable(id); |
|
|
|
return R.ok(result); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 列表 |
|
|
|
* @param param |
|
|
@ -90,27 +102,64 @@ public class TbsCostApplyController { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 列表 |
|
|
|
* 列表(个人及下属的费用申请) |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/listMy") |
|
|
|
public R<List<TbsCostApply>> getListMy(TbsCostApplyVo param){ |
|
|
|
String userId = AuthContextUtils.getSysUserId(); |
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
if(param.getLoadChild()!=null&¶m.getLoadChild().equals(1)){ |
|
|
|
userIds = sysUserSalesService.listByChildIds(userId); |
|
|
|
}else { |
|
|
|
userIds.add(userId); |
|
|
|
} |
|
|
|
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply()); |
|
|
|
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity); |
|
|
|
lqw.eq(TbsCostApply::getCreateBy,AuthContextUtils.getSysUserId()); |
|
|
|
lqw.in(TbsCostApply::getCreateBy,userIds); |
|
|
|
PageUtil.startPage(); |
|
|
|
List<TbsCostApply> list = tbsCostApplyService.list(lqw); |
|
|
|
for (TbsCostApply costApply : list) { |
|
|
|
SysUser sysUser = sysUserService.getById(costApply.getCreateBy()); |
|
|
|
costApply.setUserInfo(sysUser.toSysUserVo()); |
|
|
|
} |
|
|
|
return R.ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 翻页(个人及下属的费用申请) |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/pageMy") |
|
|
|
@PreAuthorize("hasRole('tbs:costApply:query')") |
|
|
|
public R<PageVo<TbsCostApply>> getPageMy(TbsCostApplyVo param){ |
|
|
|
String userId = AuthContextUtils.getSysUserId(); |
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
if(param.getLoadChild()!=null&¶m.getLoadChild().equals(1)){ |
|
|
|
userIds = sysUserSalesService.listByChildIds(userId); |
|
|
|
}else { |
|
|
|
userIds.add(userId); |
|
|
|
} |
|
|
|
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply()); |
|
|
|
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity); |
|
|
|
lqw.orderByDesc(TbsCostApply::getId); |
|
|
|
PageUtil.startPage(); |
|
|
|
List<TbsCostApply> list = tbsCostApplyService.list(lqw); |
|
|
|
for (TbsCostApply costApply : list) { |
|
|
|
SysUser sysUser = sysUserService.getById(costApply.getCreateBy()); |
|
|
|
costApply.setUserInfo(sysUser.toSysUserVo()); |
|
|
|
} |
|
|
|
return R.byPageHelperList(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 翻页 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/page") |
|
|
|
@PreAuthorize("hasRole('tbs:costApply:query')") |
|
|
|
public R<PageVo<TbsCostApply>> getPage(TbsCostApplyVo param){ |
|
|
|
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply()); |
|
|
|
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity); |
|
|
@ -205,6 +254,46 @@ public class TbsCostApplyController { |
|
|
|
return R.isTrue(result); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 审批列表(用于详情页) |
|
|
|
* @param costApplyId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/ListAffairs") |
|
|
|
public R<PageVo<CtpAffairVo>> pageMemberAffair(Long costApplyId){ |
|
|
|
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); |
|
|
|
if(!StringUtils.hasText(sysUser.getSyUserId())||!StringUtils.hasText(sysUser.getSyAccount())){ |
|
|
|
return R.error("当前账号未绑定致远用户信息"); |
|
|
|
} |
|
|
|
TbsCostApply costApplyParam = tbsCostApplyService.getById(costApplyId); |
|
|
|
CtpAffairQo param = new CtpAffairQo(); |
|
|
|
param.setMemberId(sysUser.getSyUserId()); |
|
|
|
param.setFormMainId(costApplyParam.getSyFormId()); |
|
|
|
param.setTemplateCodes(Arrays.asList(TbsSeeYonConst.COST_APPLY_FORM)); |
|
|
|
R<PageVo<CtpAffair>> syResult = seeYonService.pageMemberAffair(param); |
|
|
|
PageVo<CtpAffair> pageVo = syResult.getData(); |
|
|
|
List<CtpAffair> ctpAffairs = pageVo.getList(); |
|
|
|
if(ctpAffairs.size()>0){ |
|
|
|
List<String> costApplyIds = ctpAffairs.stream().map(CtpAffair::getCostApplyId).collect(Collectors.toList()); |
|
|
|
List<TbsCostApply> costApplyList = tbsCostApplyService.listByIds(costApplyIds); |
|
|
|
List<CtpAffairVo> result = new ArrayList<>(); |
|
|
|
for (CtpAffair ctpAffair : ctpAffairs) { |
|
|
|
CtpAffairVo ctpAffairVo = new CtpAffairVo(); |
|
|
|
for (TbsCostApply costApply : costApplyList) { |
|
|
|
if(costApply.getId().toString().equals(ctpAffair.getCostApplyId())){ |
|
|
|
ctpAffairVo.setCostApply(costApply); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
ctpAffairVo.setAffairInfo(ctpAffair); |
|
|
|
result.add(ctpAffairVo); |
|
|
|
} |
|
|
|
PageVo<CtpAffairVo> costApplyPageVo = PageVo.initNewList(pageVo,result); |
|
|
|
return R.ok(costApplyPageVo); |
|
|
|
} |
|
|
|
return R.byEmptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 审批列表(翻页) |
|
|
|
* @param state 状态:0-未完成与已完成(默认);1-未完成;2已完成;3-我发起的;其它-被拦截 |
|
|
@ -213,7 +302,6 @@ public class TbsCostApplyController { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/pageMemberAffair") |
|
|
|
@SysLog(module = SystemModule.Budget, title = "费用申请", biz = BizType.DELETE) |
|
|
|
public R<PageVo<CtpAffairVo>> pageMemberAffair(Integer state,Integer pageNum,Integer pageSize){ |
|
|
|
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); |
|
|
|
if(!StringUtils.hasText(sysUser.getSyUserId())||!StringUtils.hasText(sysUser.getSyAccount())){ |
|
|
|