yangzian 3 gadi atpakaļ
vecāks
revīzija
78db2b83a2

+ 24 - 14
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -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());

+ 3 - 3
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyInfo.java

@@ -14,10 +14,10 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+
+
 /**
  * 政策信息表
  * @author jeecg-boot
@@ -29,7 +29,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value="ctop_cwjs_policy_info对象", description="政策信息表")
-public class CwjsPolicyInfo {
+public class CwjsPolicyInfo implements Serializable{
     
 	/**自增主键*/
 	@TableId(type = IdType.AUTO)

+ 1 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper">
     <select id="selectPolicyInfos" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo">
         select t1.policy_product_name as productName,t2.* from ctop_cwjs_policy_product t1 LEFT JOIN ctop_cwjs_policy_info t2 on t1.policy_id = t2.id
-        where 1=1
+        where t1.del_flag = 0 and t2.del_flag = 0
         <if test="companyName != null and companyName != ''">and t2.company_name like concat(concat('%',#{companyName}),'%')</if>
         <if test="advertiserName != null and advertiserName != ''">and t2.advertiser_name like concat(concat('%',#{advertiserName}),'%')</if>
         <if test="productName != null and productName != ''">and t1.policy_product_name like concat(concat('%',#{productName}),'%')</if>

+ 0 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyInfoServiceImpl.java

@@ -60,8 +60,6 @@ public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper,
         for(Integer key : keys){
             result.add(map.get(key));
         }
-
-
         return result;
     }