Jelajahi Sumber

财务结算政策列表功能

huangxuechao 4 tahun lalu
induk
melakukan
64e086cb1b
26 mengubah file dengan 1126 tambahan dan 3 penghapusan
  1. 5 3
      jeecg-boot-finance/pom.xml
  2. 338 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java
  3. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanySubject.java
  4. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyApprovalLog.java
  5. 137 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyInfo.java
  6. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyProduct.java
  7. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanySubjectMapper.java
  8. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyApprovalLogMapper.java
  9. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyInfoMapper.java
  10. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyProductMapper.java
  11. 5 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsCompanySubjectMapper.xml
  12. 5 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyApprovalLogMapper.xml
  13. 23 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml
  14. 7 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyProductMapper.xml
  15. 14 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanySubjectService.java
  16. 14 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyApprovalLogService.java
  17. 16 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyInfoService.java
  18. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyProductService.java
  19. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsCompanySubjectServiceImpl.java
  20. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyApprovalLogServiceImpl.java
  21. 55 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyInfoServiceImpl.java
  22. 28 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyProductServiceImpl.java
  23. 149 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/Check.java
  24. 24 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java
  25. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java
  26. 10 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

+ 5 - 3
jeecg-boot-finance/pom.xml

@@ -7,6 +7,7 @@
         <groupId>org.jeecgframework.boot</groupId>
         <version>2.4.5</version>
     </parent>
+    <version>1.0.0</version>
     <modelVersion>4.0.0</modelVersion>
 <!--
     <groupId>org.jeecg.framework.boot</groupId>-->
@@ -20,7 +21,6 @@
             <artifactId>jeecg-boot-starter-cloud</artifactId>
         </dependency>
 
-
         <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-base-core</artifactId>
@@ -32,7 +32,6 @@
             </exclusions>
         </dependency>
 
-
         <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-system-local-api</artifactId>
@@ -54,7 +53,10 @@
             <artifactId>poi-ooxml</artifactId>
             <version>3.15</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-module-system</artifactId>
+        </dependency>
 
 
     </dependencies>

+ 338 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -0,0 +1,338 @@
+package org.jeecg.ctop.finance.policy.controller;
+
+import java.text.ParseException;
+import java.util.*;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.common.module.entity.SysUser;
+import cn.com.ctop.common.module.entity.UserCompany;
+import cn.com.ctop.common.module.mapper.SysUserMapper;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+import com.alibaba.fastjson.JSONArray;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyProductService;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 政策信息表
+ * @author jeecg-boot
+ * @date   2021-07-27
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="政策信息表")
+@RestController
+@RequestMapping("/finance/cwjsPolicyInfo")
+public class CwjsPolicyInfoController {
+	@Autowired
+	private ICwjsPolicyInfoService cwjsPolicyInfoService;
+	@Autowired
+	private ICwjsPolicyProductService cwjsPolicyProductService;
+	 @Autowired
+	 private ISysRoleService roleService;
+	 @Resource
+	 IUserCompanyService userCompanyService;
+	 @Resource
+	 private SysUserMapper userMapper;
+	/**
+	  * 分页列表查询
+	 * @param cwjsPolicyInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-分页列表查询", notes="政策信息表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<PageInfo<CwjsPolicyInfo>> queryPageList(CwjsPolicyInfo cwjsPolicyInfo,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+
+//		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		LoginUser user = new LoginUser();
+		user.setId("b161b7d9793942f980dbfe8c931cd1b0");	//a9ab18bf186c463dba715f39f9fa9267
+		String roleCode = roleService.getRoleCodeByUserId(user.getId());
+		if (roleCode.equals("admin")&&Check.isNull(cwjsPolicyInfo.getCreateUserId())) {	//1.当前登录用户为管理员角色,并且没有传递销售id来精确查询。  则不触发sql的过滤条件
+			cwjsPolicyInfo.setCreateUserIds(null);
+		}else if(roleCode.equals("admin")&&!Check.isNull(cwjsPolicyInfo.getCreateUserId())){//2.当前登录用户为管理员角色,并且传递了销售的id,则需要触发
+			List<String> userIds = new ArrayList<>();
+			userIds.add(cwjsPolicyInfo.getCreateUserId());
+			cwjsPolicyInfo.setCreateUserIds(userIds);
+		}else if(roleCode.equals("saleDirector")){	//3.如果是销售总监	查询自己和手下创建的所有政策
+			List<SysUser> allList = userMapper.selectAllUser();
+			List<SysUser>  mulUserList = treeCategoryData(allList, user.getId());
+			List<String> userIds = new ArrayList<>();
+			mulUserList.forEach(sysUser -> userIds.add(sysUser.getId()));
+			userIds.add(user.getId());
+			cwjsPolicyInfo.setCreateUserIds(userIds);
+			if(!Check.isNull(cwjsPolicyInfo.getCreateUserId())&& userIds.contains(cwjsPolicyInfo.getCreateUserId())){//总监精确查询了某个销售id的政策,那么先看这个销售是不是他的手下
+				List<String> newUserIds = new ArrayList<>();
+				newUserIds.add(cwjsPolicyInfo.getCreateUserId());
+				cwjsPolicyInfo.setCreateUserIds(newUserIds);
+			}
+		}else {	//其他的人,谁登录看谁自己的
+			List<String> userIds = new ArrayList<>();
+			userIds.add(user.getId());
+			cwjsPolicyInfo.setCreateUserIds(userIds);
+		}
+
+		PageHelper.startPage(pageNo,pageSize);
+		List<CwjsPolicyInfo> cwjsPolicyInfos = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
+		PageInfo<CwjsPolicyInfo> pageInfo = new PageInfo<>(cwjsPolicyInfos);
+		return Result.successMsg("成功。",pageInfo);
+	}
+
+
+	 public List<SysUser> treeCategoryData(List<SysUser> allList, String leaderId) {
+		 List<SysUser> mapList = new ArrayList<>();
+		 for (SysUser vo : allList) {
+			 if (leaderId.equals(vo.getLeaderId())){
+				 mapList.add(vo);
+				 mapList.addAll(treeCategoryData(allList,vo.getId()));
+			 }
+		 }
+		 return mapList;
+
+	 }
+
+	 /**
+	  * 分页列表查询
+	  * @param userId
+	  * @return
+	  */
+
+	 @ApiOperation(value="政策信息表-分页列表查询", notes="政策信息表-分页列表查询")
+	 @GetMapping(value = "/queryAeraByUserId")
+	 public Result<UserCompany> queryAeraByUserId(String userId) {
+		 Result<UserCompany> result = new Result<>();
+		 UserCompany userCompany = userCompanyService.getByUserId(userId);
+		 result.setSuccess(true);
+		 result.setResult(userCompany);
+		 return result;
+	 }
+
+	/**
+	  *   添加
+	 * @param cwjsPolicyInfo
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-添加", notes="政策信息表-添加")
+	@PostMapping(value = "/add")
+	public Result<CwjsPolicyInfo> add(@RequestBody CwjsPolicyInfo cwjsPolicyInfo) {
+		Result<CwjsPolicyInfo> result = new Result<>();
+		try {
+			cwjsPolicyInfoService.save(cwjsPolicyInfo);
+			JSONArray products = cwjsPolicyInfo.getPolicyProductName();
+			List<CwjsPolicyProduct> policyProductList = new ArrayList<>();
+			products.forEach(productName -> {
+				CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
+				policyProduct.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
+				policyProduct.setDelFlag(0);
+				policyProduct.setPolicyProductName((String) productName);
+				policyProduct.setPolicyId(cwjsPolicyInfo.getId());
+				policyProductList.add(policyProduct);
+			});
+			cwjsPolicyProductService.saveBatch(policyProductList);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param cwjsPolicyInfo
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-编辑", notes="政策信息表-编辑")
+	@PutMapping(value = "/edit")
+	public Result<CwjsPolicyInfo> edit(@RequestBody CwjsPolicyInfo cwjsPolicyInfo) {
+		Result<CwjsPolicyInfo> result = new Result<CwjsPolicyInfo>();
+		CwjsPolicyInfo cwjsPolicyInfoEntity = cwjsPolicyInfoService.getById(cwjsPolicyInfo.getId());
+		if(cwjsPolicyInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = cwjsPolicyInfoService.updateById(cwjsPolicyInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-通过id查询", notes="政策信息表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<CwjsPolicyInfo> queryById(@RequestParam(name="id",required=true) String id) throws ParseException {
+		Result<CwjsPolicyInfo> result = new Result<>();
+		CwjsPolicyInfo cwjsPolicyInfo = cwjsPolicyInfoService.getById(id);
+		Date startDate = DateUtils.parseDate(cwjsPolicyInfo.getPolicyStartDate(),"yyyy-MM-dd");
+		cwjsPolicyInfo.setPolicyStartDate(DateUtils.formatDate(startDate,"yyyy年MM月dd日"));
+		Date endDate = DateUtils.parseDate(cwjsPolicyInfo.getPolicyEndDate(),"yyyy-MM-dd");
+		cwjsPolicyInfo.setPolicyEndDate(DateUtils.formatDate(endDate,"yyyy年MM月dd日"));
+		List<CwjsPolicyProduct> policyProductList = cwjsPolicyProductService.queryProductsByPolicyId(id);
+		JSONArray jsonArr = new JSONArray();
+		policyProductList.forEach(policyProduct -> {
+			jsonArr.add(policyProduct.getPolicyProductName());
+		});
+		cwjsPolicyInfo.setPolicyProductName(jsonArr);
+		if(cwjsPolicyInfo==null) {
+			result.error500("未找到对应实体");
+		}else if(policyProductList==null){
+			result.error500("此政策的没有绑定产品,或者已绑定的产品被删除");
+		}else {
+			result.setResult(cwjsPolicyInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+
+
+	 /**
+	  *   通过id删除
+	  * @param id
+	  * @return
+	  */
+	 @ApiOperation(value="政策信息表-通过id删除", notes="政策信息表-通过id删除")
+	 @DeleteMapping(value = "/delete")
+	 public Result<?> delete(@RequestParam(name="id") String id) {
+		 try {
+			 cwjsPolicyInfoService.removeById(id);
+		 } catch (Exception e) {
+			 log.error("删除失败",e.getMessage());
+			 return Result.error("删除失败!");
+		 }
+		 return Result.ok("删除成功!");
+	 }
+
+	 /**
+	  *  批量删除
+	  * @param ids
+	  * @return
+	  */
+	 @ApiOperation(value="政策信息表-批量删除", notes="政策信息表-批量删除")
+	 @DeleteMapping(value = "/deleteBatch")
+	 public Result<CwjsPolicyInfo> deleteBatch(@RequestParam(name="ids") String ids) {
+		 Result<CwjsPolicyInfo> result = new Result<>();
+		 if(ids==null || "".equals(ids.trim())) {
+			 result.error500("参数不识别!");
+		 }else {
+			 this.cwjsPolicyInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			 result.success("删除成功!");
+		 }
+		 return result;
+	 }
+
+
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<CwjsPolicyInfo> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              CwjsPolicyInfo cwjsPolicyInfo = JSON.parseObject(deString, CwjsPolicyInfo.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(cwjsPolicyInfo, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<CwjsPolicyInfo> pageList = cwjsPolicyInfoService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "政策信息表列表");
+      mv.addObject(NormalExcelConstants.CLASS, CwjsPolicyInfo.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("政策信息表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<CwjsPolicyInfo> listCwjsPolicyInfos = ExcelImportUtil.importExcel(file.getInputStream(), CwjsPolicyInfo.class, params);
+              cwjsPolicyInfoService.saveBatch(listCwjsPolicyInfos);
+              return Result.ok("文件导入成功!数据行数:" + listCwjsPolicyInfos.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 57 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanySubject.java

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+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
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_company_subject")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_company_subject对象", description="公司主体表")
+public class CwjsCompanySubject {
+    
+	/**主键自增*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键自增")
+	private Integer id;
+	/**公司id-区域*/
+	@Excel(name = "公司id-区域", width = 15)
+    @ApiModelProperty(value = "公司id-区域")
+	private String companyId;
+	/**公司主体名称*/
+	@Excel(name = "公司主体名称", width = 15)
+    @ApiModelProperty(value = "公司主体名称")
+	private String companySubjectName;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 57 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyApprovalLog.java

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+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
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_approval_log")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_approval_log对象", description="政策审批记录日志")
+public class CwjsPolicyApprovalLog {
+    
+	/**主键自增*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键自增")
+	private Integer id;
+	/**policyId*/
+	@Excel(name = "policyId", width = 15)
+    @ApiModelProperty(value = "policyId")
+	private Integer policyId;
+	/**审核状态:0-审核通过  1-审核不通过*/
+	@Excel(name = "审核状态:0-审核通过  1-审核不通过", width = 15)
+    @ApiModelProperty(value = "审核状态:0-审核通过  1-审核不通过")
+	private Integer approvalStatus;
+	/**审核意见*/
+	@Excel(name = "审核意见", width = 15)
+    @ApiModelProperty(value = "审核意见")
+	private String approvalContent;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

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

@@ -0,0 +1,137 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+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
+ * @date   2021-07-27
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_info对象", description="政策信息表")
+public class CwjsPolicyInfo {
+    
+	/**自增主键*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "自增主键")
+	private Integer id;
+	/**公司名称*/
+	@Excel(name = "公司名称", width = 15)
+    @ApiModelProperty(value = "公司名称")
+	private String companyName;
+	/**广告主id*/
+	@Excel(name = "广告主名称", width = 15)
+    @ApiModelProperty(value = "广告主名称")
+	private String advertiserName;
+	/**媒体类型*/
+	@Excel(name = "媒体类型", width = 15)
+    @ApiModelProperty(value = "媒体类型")
+	private Integer mediaType;
+	/**区域 华北,华南,华东*/
+	@Excel(name = "区域 华北,华南,华东", width = 15)
+    @ApiModelProperty(value = "区域 华北,华南,华东")
+	private String userCompanyId;
+	/**我司主体*/
+	@Excel(name = "我司主体", width = 15)
+    @ApiModelProperty(value = "我司主体")
+	private String companySubjectId;
+	/**集团简称*/
+	@Excel(name = "集团简称", width = 15)
+    @ApiModelProperty(value = "集团简称")
+	private String groupAbbreviation;
+	/**状态 0:待审核 1:审核中 2:审核通过3:审核拒绝*/
+	@Excel(name = "状态 0:待审核 1:审核中 2:审核通过3:审核拒绝", width = 15)
+    @ApiModelProperty(value = "状态 0:待审核 1:审核中 2:审核通过3:审核拒绝")
+	private Integer approvedStatus;
+	/**是否预付:0:否  1:是 */
+	@Excel(name = "是否预付:0:否  1:是 ", width = 15)
+    @ApiModelProperty(value = "是否预付:0:否  1:是 ")
+	private Integer advancePay;
+	/**账期*/
+	@Excel(name = "账期", width = 15)
+    @ApiModelProperty(value = "账期")
+	private String accountingPeriod;
+	/**返点类型:0:返现  1:返货   2:返现+返货*/
+	@Excel(name = "返点类型:0:返现  1:返货   2:返现+返货", width = 15)
+    @ApiModelProperty(value = "返点类型:0:返现  1:返货   2:返现+返货")
+	private Integer rebateType;
+	/**返点比例*/
+	@Excel(name = "返点比例", width = 15)
+    @ApiModelProperty(value = "返点比例")
+	private java.math.BigDecimal rebateRate;
+	/**是否垫付:0:否  1:是 */
+	@Excel(name = "是否垫付:0:否  1:是 ", width = 15)
+    @ApiModelProperty(value = "是否垫付:0:否  1:是 ")
+	private Integer isDianPay;
+	/**垫付公司名称*/
+	@Excel(name = "垫付公司名称", width = 15)
+    @ApiModelProperty(value = "垫付公司名称")
+	private String dianPayCompanyName;
+	/**垫付公司返点比例*/
+	@Excel(name = "垫付公司返点比例", width = 15)
+    @ApiModelProperty(value = "垫付公司返点比例")
+	private java.math.BigDecimal dianPayCompanyRebateRate;
+	/**运营方式: 0:自运营  1:代运营*/
+	@Excel(name = "运营方式: 0:自运营  1:代运营", width = 15)
+    @ApiModelProperty(value = "运营方式: 0:自运营  1:代运营")
+	private Integer promotionType;
+	/**政策开始时间*/
+	@Excel(name = "政策开始时间", width = 15)
+    @ApiModelProperty(value = "政策开始时间")
+	private String policyStartDate;
+	/**政策结束时间*/
+	@Excel(name = "政策结束时间", width = 15)
+    @ApiModelProperty(value = "政策结束时间")
+	private String policyEndDate;
+	/**备注:如果没人填的话记录被拒次数*/
+	@Excel(name = "备注:如果没人填的话记录被拒次数", width = 15)
+    @ApiModelProperty(value = "备注:如果没人填的话记录被拒次数")
+	private Object remarks;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**销售人员(信息创建人)*/
+	@Excel(name = "创建人", width = 15)
+	@ApiModelProperty(value = "创建人")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+	/**接收前端传递的产品名称array*/
+	@TableField(exist = false)
+    private JSONArray policyProductName;
+	/**后端查询数据库后,sql映射时使用*/
+	@TableField(exist = false)
+	private String productName;
+
+	@TableField(exist = false)
+	private Date startTime;
+	@TableField(exist = false)
+	private Date endTime;
+	@TableField(exist = false)
+	private List<String> createUserIds;
+}

+ 57 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyProduct.java

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+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
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_product")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_product对象", description="政策产品关系表")
+public class CwjsPolicyProduct {
+    
+	/**主键id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+	private Integer id;
+	/**政策id*/
+	@Excel(name = "政策id", width = 15)
+    @ApiModelProperty(value = "政策id")
+	private Integer policyId;
+	/**产品名称*/
+	@Excel(name = "产品名称", width = 15)
+    @ApiModelProperty(value = "产品名称")
+	private String policyProductName;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanySubjectMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsCompanySubjectMapper extends BaseMapper<CwjsCompanySubject> {
+
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyApprovalLogMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsPolicyApprovalLogMapper extends BaseMapper<CwjsPolicyApprovalLog> {
+
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyInfoMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+public interface CwjsPolicyInfoMapper extends BaseMapper<CwjsPolicyInfo> {
+    List<CwjsPolicyInfo> selectPolicyInfos(CwjsPolicyInfo policyInfo);
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyProductMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsPolicyProductMapper extends BaseMapper<CwjsPolicyProduct> {
+    List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId);
+}

+ 5 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsCompanySubjectMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper">
+
+</mapper>

+ 5 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyApprovalLogMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.finance.policy.mapper.CwjsPolicyApprovalLogMapper">
+
+</mapper>

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

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<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
+        <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 t2.policy_product_name like concat(concat('%',#{productName}),'%')</if>
+        <if test="dianPayCompanyName != null and dianPayCompanyName != ''">and t2.dian_pay_company_name like concat(concat('%',#{dianPayCompanyName}),'%')</if>
+        <if test="mediaType != null and mediaType != ''">and t2.media_type = #{mediaType}</if>
+        <if test="rebateType != null and rebateType != ''">and t2.rebate_type = #{rebateType}</if>
+        <if test="createUserIds != null and createUserIds != ''">and  t2.create_user_id in
+         <foreach item="item" index="index" collection="createUserIds" open="(" separator="," close=")">
+            #{item}
+        </foreach></if>
+        <if test="promotionType != null and promotionType != ''">and t2.promotion_type = #{promotionType}</if>
+        <if test="approvedStatus != null and approvedStatus != ''">and t2.approved_status = #{approvedStatus}</if>
+        <if test="startTime != null and startTime != ''">and t2.create_time &gt;= #{startTime}</if>
+        <if test="endTime != null and endTime != ''">and t2.create_time &lt;= #{endTime}</if>
+        order by create_time desc
+    </select>
+</mapper>

+ 7 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyProductMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper">
+    <select id="queryProductsByPolicyId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct">
+        select * from ctop_cwjs_policy_product where policy_id = #{policyId} and del_flag = 0
+    </select>
+</mapper>

+ 14 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanySubjectService.java

@@ -0,0 +1,14 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsCompanySubjectService extends IService<CwjsCompanySubject> {
+
+}

+ 14 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyApprovalLogService.java

@@ -0,0 +1,14 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsPolicyApprovalLogService extends IService<CwjsPolicyApprovalLog> {
+
+}

+ 16 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyInfoService.java

@@ -0,0 +1,16 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+public interface ICwjsPolicyInfoService extends IService<CwjsPolicyInfo> {
+    List<CwjsPolicyInfo> queryPageList(CwjsPolicyInfo policyInfo);
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyProductService.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+
+import java.util.List;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsPolicyProductService extends IService<CwjsPolicyProduct> {
+
+    List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId);
+}

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

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsCompanySubjectService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsCompanySubjectServiceImpl extends ServiceImpl<CwjsCompanySubjectMapper, CwjsCompanySubject> implements ICwjsCompanySubjectService {
+
+}

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

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyApprovalLogMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyApprovalLogService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyApprovalLogServiceImpl extends ServiceImpl<CwjsPolicyApprovalLogMapper, CwjsPolicyApprovalLog> implements ICwjsPolicyApprovalLogService {
+
+}

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

@@ -0,0 +1,55 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyInfoService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper, CwjsPolicyInfo> implements ICwjsPolicyInfoService {
+    @Resource
+    CwjsPolicyInfoMapper policyInfoMapper;
+
+    @Override
+    public List<CwjsPolicyInfo> queryPageList(CwjsPolicyInfo policyInfo){
+
+        List<CwjsPolicyInfo> policyInfoList = policyInfoMapper.selectPolicyInfos(policyInfo);
+        List<CwjsPolicyInfo> result = new ArrayList<>();
+        //1.过滤所有已通过审核的政策到结果表中
+        policyInfoList.forEach(policy->{
+            if(policy.getApprovedStatus() == 2){
+                policy.getPolicyProductName().add(policy.getProductName());
+                result.add(policy);
+            }
+        });
+        policyInfoList.removeAll(result);
+        Map<Integer,CwjsPolicyInfo> map = new HashMap<>();
+        //2.未通过审核的政策需要通过政策id来进行聚合,把产品名称放到同一个列表里
+        policyInfoList.forEach(policy->{
+            if(map.containsKey(policy.getId())){
+                map.get(policy.getId()).getPolicyProductName().add(policy.getProductName());
+            }else{
+                policy.getPolicyProductName().add(policy.getProductName());
+                map.put(policy.getId(),policy);
+            }
+        });
+        //3.遍历聚合完成后的map,每一个key对应一条不通过的政策的数据,放入到结果集返回
+        Set<Integer> keys = map.keySet();
+        for(Integer key : keys){
+            result.add(map.get(key));
+        }
+        return result;
+    }
+}

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

@@ -0,0 +1,28 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyProductService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyProductServiceImpl extends ServiceImpl<CwjsPolicyProductMapper, CwjsPolicyProduct> implements ICwjsPolicyProductService {
+    @Resource
+    CwjsPolicyProductMapper policyProductMapper;
+
+    @Override
+    public List<CwjsPolicyProduct> queryProductsByPolicyId(String policyId){
+        return policyProductMapper.queryProductsByPolicyId(policyId);
+    }
+}

+ 149 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/Check.java

@@ -0,0 +1,149 @@
+package org.jeecg.ctop.finance.policy.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class Check {
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+
+    public static boolean isNull(Long l) {
+        return l == null || l == 0;
+    }
+
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
+    }
+
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.isEmpty();
+    }
+
+
+    public static boolean isNull(String str) {
+        return str == null || str.isEmpty();
+    }
+
+    public static boolean isNull(byte[] bytes) {
+        return bytes == null || bytes.length == 0;
+    }
+
+    public static boolean hasNull(Object... objects) {
+        for (Object obj : objects) {
+            if (obj == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean allEmpty(String... strs) {
+        for (String str : strs) {
+            if (StringUtils.isNotEmpty(str)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+
+
+    /**
+     * 移除 JSONObject 中 value 为空的 key
+     * @param
+     * @return
+     */
+    public static JSONObject jsonRemoveEmpty(JSONObject jsonObject){
+        JSONObject jsonResult = new JSONObject();
+        for (Object key :jsonObject.keySet() ) {
+            if (!Check.isNull(jsonObject.get(key)) && !jsonObject.get(key).equals("")){
+                jsonResult.put(key.toString(), jsonObject.get(key));
+            }
+        }
+        return jsonResult;
+    }
+
+
+
+    /**
+     * 将 Map对象转化为JavaBean
+     * @author loulan
+     * @param map
+     * @return Object对象
+     */
+    public static <T> T convertMap2Bean(Map map, Class T) throws Exception {
+        if(map==null || map.size()==0){
+            return null;
+        }
+        BeanInfo beanInfo = Introspector.getBeanInfo(T);
+        T bean = (T)T.newInstance();
+        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+        for (int i = 0, n = propertyDescriptors.length; i <n ; i++) {
+            PropertyDescriptor descriptor = propertyDescriptors[i];
+            String propertyName = descriptor.getName();
+            //将字母大写,这里先注掉,因为本例子直接读取名字匹配即可。
+            //String upperPropertyName = propertyName.toUpperCase();
+            if (map.containsKey(propertyName)) {
+                Object value = map.get(propertyName);
+                //这个方法不会报参数类型不匹配的错误。
+                BeanUtils.copyProperty(bean, propertyName, value);
+                //用这个方法对int等类型会报参数类型不匹配错误,需要我们手动判断类型进行转换,比较麻烦。
+                //descriptor.getWriteMethod().invoke(bean, value);
+                //用这个方法对时间等类型会报参数类型不匹配错误,也需要我们手动判断类型进行转换,比较麻烦。
+                //BeanUtils.setProperty(bean, propertyName, value);
+            }
+        }
+        return bean;
+    }
+
+    /**
+     * 将 List<Map>对象转化为List<JavaBean>
+     * @author loulan
+
+     * @return Object对象
+     */
+    public static <T> List<T> convertListMap2ListBean(List<Map<String,Object>> listMap, Class T) throws Exception {
+        List<T> beanList = new ArrayList<T>();
+        for(int i=0, n=listMap.size(); i<n; i++){
+            Map<String,Object> map = listMap.get(i);
+            T bean = convertMap2Bean(map,T);
+            beanList.add(bean);
+        }
+        return beanList;
+    }
+
+
+    public static void main(String[] args) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", "123");
+        params.put("campaign_id", "123");
+        params.put("modify_time", null);
+        System.out.println(jsonRemoveEmpty(params));
+    }
+
+
+
+}

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity;
 
 import java.util.Date;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -182,4 +183,27 @@ public class SysUser implements Serializable {
 
     /**设备id uniapp推送用*/
     private String clientId;
+
+
+    /**
+     * 领导 ID
+     */
+    private String leaderId;
+
+    /**
+     * 领导姓名
+     */
+    private String leaderName;
+
+    /**
+     * 角色
+     */
+    @TableField(exist = false)
+    private String roleName;
+
+    /**
+     * 组织机构名称
+     */
+    @TableField(exist = false)
+    private String departName;
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java

@@ -139,4 +139,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 	 * @return
 	 */
 	List<SysUser> queryByDepIds(@Param("departIds")List<String> departIds,@Param("username") String username);
+
+	List<SysUser> selectAllUser();
 }

+ 10 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

@@ -162,4 +162,14 @@
 			and username != #{username}
 		</if>
 	</select>
+
+	<select id="selectAllUser" resultType="org.jeecg.modules.system.entity.SysUser">
+		SELECT t1.*,t3.depart_name ,role.role_name,t2.create_time AS updTime,t3.id as departId2
+		FROM sys_user t1
+		LEFT JOIN sys_user_depart t2 ON t1.id = t2.user_id
+		LEFT JOIN sys_depart t3 ON t2.dep_id = t3.id
+		LEFT JOIN sys_user_role userRole ON t1.id = userRole.user_id
+		LEFT JOIN sys_role role ON userRole.role_id = role.id
+		where t1.del_flag = 0
+	</select>
 </mapper>