|
@@ -5,6 +5,7 @@ import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -94,6 +95,9 @@ public class CwjsPolicyInfoController {
|
|
|
@Resource
|
|
|
private ReportSettlementServiceImpl reportSettlementService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICwjsSaleAssistantInfoService cwjsSaleAssistantInfoService;
|
|
|
+
|
|
|
|
|
|
@GetMapping(value = "/queryApprovalRejectReason")
|
|
|
public Result<CwjsPolicyApprovalLog> queryApprovalRejectReason(@RequestParam(name="id",required=true) Integer id){
|
|
@@ -214,22 +218,30 @@ public class CwjsPolicyInfoController {
|
|
|
public Result<PageInfo<CwjsPolicyInfo>> queryPageList(CwjsPolicyInfo cwjsPolicyInfo,
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- @RequestParam(name="userId",required=true) String userId,
|
|
|
+ @RequestParam(name="userId") String userId,
|
|
|
HttpServletRequest req) {
|
|
|
|
|
|
+ //查询用户角色
|
|
|
String roleCode = roleService.getRoleCodeByUserId(userId);
|
|
|
+ //查看用户是否为审核人员
|
|
|
List<CwjsCompanyApprovalUser> cwjsCompanyApprovalUserList = companyApprovalUserMapper.queryByUserId(userId);
|
|
|
+ //查询政策
|
|
|
List<CwjsPolicyInfo> cwjsPolicyInfoList = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
|
|
|
if(Check.isNull(cwjsPolicyInfoList)){
|
|
|
PageInfo<CwjsPolicyInfo> pageInfo = new PageInfo<>(cwjsPolicyInfoList);
|
|
|
- return Result.successMsg("目前没有政策,请新增",pageInfo);
|
|
|
+ return Result.successMsg("目前没有政策。",pageInfo);
|
|
|
}
|
|
|
/**如果是管理员,就全部看,该搜索搜索,不搜索就全看*/
|
|
|
|
|
|
- /**如果不是管理员,也不是审核人员。看自己和自己下属的所有政策。*/
|
|
|
+ //查询 对应的销售或 助理
|
|
|
+ List<String> userIds = cwjsSaleAssistantInfoService.getCwSaleAndAssistantListStr(userId);
|
|
|
+
|
|
|
+ /**如果不是管理员,也不是审核人员。
|
|
|
+ * (看自己和自己下属的所有政策) 修改为 销售-助理 关联关系查看。
|
|
|
+ * */
|
|
|
if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && Check.isNull(cwjsCompanyApprovalUserList)){
|
|
|
-// Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
|
|
|
- List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
|
|
|
+ //Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
|
|
|
+ //List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
|
|
|
List<CwjsPolicyInfo> removeList = new ArrayList<>();
|
|
|
cwjsPolicyInfoList.forEach(cwjsPolicy -> {
|
|
|
if(!userIds.contains(cwjsPolicy.getCreateUserId())){
|
|
@@ -241,8 +253,7 @@ public class CwjsPolicyInfoController {
|
|
|
/**如果不是管理员,是审核人员。看自己创建的和自己下属的所有政策、和该自己审核。*/
|
|
|
if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && !Check.isNull(cwjsCompanyApprovalUserList)){
|
|
|
// Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
|
|
|
- List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
|
|
|
-
|
|
|
+ //List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
|
|
|
List<CwjsPolicyInfo> removeList = new ArrayList<>();
|
|
|
cwjsPolicyInfoList.forEach(cwjsPolicy -> {
|
|
|
if(!userIds.contains(cwjsPolicy.getCreateUserId()) && !userId.equalsIgnoreCase(cwjsPolicy.getApprovedProgress())){
|
|
@@ -252,7 +263,6 @@ public class CwjsPolicyInfoController {
|
|
|
cwjsPolicyInfoList.removeAll(removeList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
cwjsPolicyInfoList.sort((CwjsPolicyInfo o1, CwjsPolicyInfo o2) -> o2.getCreateTime().after(o1.getCreateTime()) ? 1 : -1 );
|
|
|
List<CwjsPolicyInfo> cwjsPolicyInfos = ListPageUtil.page(cwjsPolicyInfoList, pageSize, pageNo);
|
|
|
|
|
@@ -261,20 +271,20 @@ public class CwjsPolicyInfoController {
|
|
|
if(!Check.isNull(log)){
|
|
|
cwjsPolicy.setApprovalContent(log.getApprovalContent());
|
|
|
}
|
|
|
- cwjsPolicy.setOperation("查看"); //所有人只要能看到就能有查看的按钮
|
|
|
- if(userId.equals(cwjsPolicy.getCreateUserId()) && cwjsPolicy.getApprovedStatus() == 4){ //创建人是自己且状态是审核拒绝的
|
|
|
+ //所有人只要能看到就能有查看的按钮
|
|
|
+ cwjsPolicy.setOperation("查看");
|
|
|
+ if(userIds.contains(userId) && cwjsPolicy.getApprovedStatus() == 4){ //创建人是自己且状态是审核拒绝的
|
|
|
cwjsPolicy.setOperation("查看|编辑|提交审核");
|
|
|
}
|
|
|
-
|
|
|
- if(userId.equals(cwjsPolicy.getApprovedProgress()) && (cwjsPolicy.getApprovedStatus() == 1 || cwjsPolicy.getApprovedStatus() == 2)){
|
|
|
+ if(userIds.contains(cwjsPolicy.getApprovedProgress()) && (cwjsPolicy.getApprovedStatus() == 1 || cwjsPolicy.getApprovedStatus() == 2)){
|
|
|
cwjsPolicy.setOperation("查看|审核通过|审核拒绝");
|
|
|
}
|
|
|
-
|
|
|
+ // 用户 公司
|
|
|
UserCompany userCompany = userCompanyService.getByUserId(cwjsPolicy.getCreateUserId());
|
|
|
-
|
|
|
if(!Check.isNull(userCompany) && Check.isNull(cwjsPolicy.getCreateUserName())){
|
|
|
cwjsPolicy.setCreateUserName(userCompany.getUserName());
|
|
|
}
|
|
|
+ //主体 以及 区域
|
|
|
CwjsCompanySubject cwjsCompanySubject = companySubjectService.getById(cwjsPolicy.getCompanySubjectId());
|
|
|
cwjsPolicy.setCompanySubjectName(cwjsCompanySubject.getCompanySubjectName());
|
|
|
cwjsPolicy.setAreaInfo(cwjsCompanySubject.getAreaInfo());
|