Commit e639914d by huluobin

update

parent a39eb5ec
......@@ -5,13 +5,14 @@ import com.bailuntec.cost.api.response.CostResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.auth.dto.request.CompanyReviewerListReq;
import com.blt.other.auth.dto.request.DepartmentReviewerListReq;
import com.blt.other.auth.model.OaCompany;
import com.blt.other.auth.model.OaDepartment;
import com.blt.other.auth.service.IOaCompanyService;
import com.blt.other.auth.service.IOaDepartmentService;
import com.blt.other.cost.service.CostCompanyService;
import com.blt.other.database.model.CostCompanyDomain;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -36,9 +37,8 @@ public class CostReviewerController {
@Resource
IOaDepartmentService oaDepartmentService;
@Resource
IOaCompanyService oaCompanyService;
CostCompanyService costCompanyService;
@ApiOperation("获取部门审核人配置列表")
@GetMapping("/departmentReviewerList")
......@@ -51,9 +51,10 @@ public class CostReviewerController {
@ApiOperation("/修改最终审核人")
@GetMapping("/modifyFinalReviewer")
public CostResult<Void> modifyFinalReviewer(@RequestParam Integer userId,
@RequestParam Integer oaCompanyId,
@RequestParam Integer finalReviewerUserId) {
oaCompanyService.modifyFinalReviewer(userId, oaCompanyId, finalReviewerUserId);
@RequestParam @ApiParam("财务公司主体 逗号分隔") List<String> companyNoList,
@RequestParam @ApiParam("oa用户id 逗号分隔") Integer finalReviewerUserId) {
// List<String> companyNoList = Lists.newArrayList(companyNos.split(","));
costCompanyService.modifyFinalReviewer(userId, companyNoList, finalReviewerUserId);
return CostResult.success();
}
......@@ -61,18 +62,19 @@ public class CostReviewerController {
@ApiOperation("/修改财务审核人")
@GetMapping("/modifyFinancialReviewer")
public CostResult<Void> modifyFinancialReviewer(@RequestParam Integer userId,
@RequestParam Integer oaCompanyId,
@RequestParam List<Integer> financialReviewerUserIds) {
oaCompanyService.modifyFinancialReviewer(userId, oaCompanyId, financialReviewerUserIds);
@RequestParam @ApiParam("财务公司主体 逗号分隔") List<String> companyNoList,
@RequestParam @ApiParam("oa用户id 逗号分隔") List<Integer> financialReviewerUserIdList) {
costCompanyService.modifyFinancialReviewer(userId, companyNoList, financialReviewerUserIdList);
return CostResult.success();
}
@ApiOperation("获取财务审核人配置列表")
@GetMapping("/companyReviewerList")
public CostResult<IPage<OaCompany>> companyReviewerList(CompanyReviewerListReq req) {
IPage<OaCompany> oaCompanyIPage = oaCompanyService.reviewerList(req);
return CostResult.success(oaCompanyIPage);
public CostResult<IPage<CostCompanyDomain>> companyReviewerList(CompanyReviewerListReq req) {
IPage<CostCompanyDomain> costCompanyDomainIPage = costCompanyService.reviewerList(req);
return CostResult.success(costCompanyDomainIPage);
}
......@@ -86,4 +88,5 @@ public class CostReviewerController {
return CostResult.success();
}
}
package com.blt.other.cost.dto;
package com.blt.other.auth.dto;
/**
* <p>
......@@ -6,7 +6,9 @@ package com.blt.other.cost.dto;
* </p>
*
* @author robbendev
* @since 2020/10/15 9:18 上午
* @since 2020/10/19 11:35 上午
*/
public class CostTemplateReq {
public class CostReviewerApiDto {
}
......@@ -2,6 +2,7 @@ package com.blt.other.auth.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
......@@ -31,12 +32,14 @@ public class CompanyReviewerListReq {
@ApiModelProperty("修改人id")
private Integer modifyUserId;
@ApiModelProperty("oa公司主体id")
private Integer oaCompanyId;
@ApiModelProperty("财务主体no")
private String companyNo;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@ApiModelProperty("修改时间上界")
private LocalDateTime startTime;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@ApiModelProperty("修改时间下界")
private LocalDateTime endTime;
}
......@@ -2,6 +2,7 @@ package com.blt.other.auth.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
......@@ -31,9 +32,11 @@ public class DepartmentReviewerListReq {
@ApiModelProperty("oa 一级部门id")
private Integer oaPrimaryDepartmentId;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@ApiModelProperty("修改时间上界")
private LocalDateTime startTime;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@ApiModelProperty("修改时间下界")
private LocalDateTime endTime;
......
package com.blt.other.auth.dto.request;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/19 11:40 上午
*/
public class ModifyFinalReviewerReq {
}
package com.blt.other.auth.dto.request;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/19 11:40 上午
*/
public class ModifyFinancialReviewerReq {
}
......@@ -32,7 +32,7 @@ public class CostReviewer implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "type=1:部门id ; type in (2,3):公司主体id;")
@ApiModelProperty(value = "type=1:部门id ; type in (2,3):财务主体id;")
private Integer referId;
@ApiModelProperty(value = "1-部门审核人 2-财务审核人 3-最终审核人")
......
//package com.blt.other.cost.controller.costplan;
//
//import com.blt.other.commons.utils.AxiosUtil;
//import com.blt.other.commons.utils.PathUtil;
//import com.blt.other.cost.service.CostPlanService;
//import com.blt.other.cost.service.UserCostFinansysService;
//import com.blt.other.cost.utils.CostFileUtil;
//import com.blt.other.cost.utils.CostPlanUtils;
//import com.blt.other.database.model.CostPlanDomain;
//import com.blt.other.database.model.UserCostFinansysDomain;
//import io.swagger.annotations.Api;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.HashMap;
//import java.util.Map;
//
//@Api(tags = "借支单接口")
//@RestController
//@RequestMapping("/cost/plan/new/lend1")
//public class CostPlanNewLend1Controller {
//
// @Autowired
// private CostPlanService costPlanService;
//
// @Autowired
// private UserCostFinansysService userCostFinansysService;
//
// @PostMapping("/saveFile")
// public Map<String, Object> save(HttpServletResponse response, HttpServletRequest request, @RequestParam("fileSelect") MultipartFile file) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String costPlanNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlan = CostPlanUtils.createCostPlan(request, costPlanNo);
//
// // 文件上传的路径
// String filePath = PathUtil.getBasePath() + PathUtil.getPath("cost/" + costPlan.getCostPlanNo() + "/");
// // 调用工具类执行保存,并返回 path
// String path = CostFileUtil.upload(file, filePath);
//
// costPlan.setFilePath(path);
//
// // 保存财务信息
// if (1 == costPlan.getCostForm() || (3 == costPlan.getCostForm() && 1 == costPlan.getIsLend())) {
// doSaveFinansyRecord(costPlan);
// }
//
// costPlanService.save(costPlan);
//
// try {
// result.put("msg", "借支计划已创建");
// result.put("costPlanNo", costPlan.getCostPlanNo());
// result.put("plan", costPlan);
// return result;
// } catch (Exception ex) {
// result.put("msg", "借支计划创建失败");
//
// }
// return result;
// }
//
// @PostMapping("/saveNoFile")
// public Map<String, Object> save(HttpServletResponse response, HttpServletRequest request) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String costPlanNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlan = CostPlanUtils.createCostPlan(request, costPlanNo);
//
// // 保存财务信息
// if (1 == costPlan.getCostForm() || (3 == costPlan.getCostForm() && 1 == costPlan.getIsLend())) {
// doSaveFinansyRecord(costPlan);
// }
//
// costPlanService.save(costPlan);
//
// try {
// result.put("msg", "借支计划已创建");
// result.put("plan", costPlan);
// result.put("costPlanNo", costPlan.getCostPlanNo());
// return result;
// } catch (Exception ex) {
// result.put("msg", "借支计划创建失败");
// }
// return result;
// }
//
// /**
// * 保存填写的财务信息
// *
// * @return
// */
// private Integer doSaveFinansyRecord(CostPlanDomain planDomain) {
// UserCostFinansysDomain finansyRecordByCostDomain = userCostFinansysService.createFinansyRecordByCostPlanDomain(planDomain);
// Integer integer = userCostFinansysService.saveFinansysRecord(finansyRecordByCostDomain);
// return integer;
// }
//}
//package com.blt.other.cost.controller.costplan;
//
//import com.blt.other.commons.utils.AxiosUtil;
//import com.blt.other.commons.utils.CurUtils;
//import com.blt.other.commons.utils.PathUtil;
//import com.blt.other.cost.service.CostPlanService;
//import com.blt.other.cost.service.UserCostFinansysService;
//import com.blt.other.cost.utils.CostFileUtil;
//import com.blt.other.cost.utils.CostPlanUtils;
//import com.blt.other.database.model.CostPlanDomain;
//import com.blt.other.database.model.UserCostFinansysDomain;
//import io.swagger.annotations.Api;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.math.BigDecimal;
//import java.util.HashMap;
//import java.util.Map;
//
//@Api(tags = "借还单接口")
//@RestController
//@RequestMapping("/cost/plan/new/lend2")
//public class CostPlanNewLend2Controller {
//
//
// @Autowired
// private CostPlanService costPlanService;
// @Autowired
// private UserCostFinansysService userCostFinansysService;
//
// @Value("${url.api.getExchangeRateApi}")
// private String getExchangeRateApi;
//
// /**
// * 保存借还单计划 不带附件
// *
// * @param response
// * @param request
// * @return
// */
// @PostMapping("/saveNoFile")
// public Map<String, Object> saveNoFile(HttpServletResponse response, HttpServletRequest request) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String costPlanNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlan = CostPlanUtils.createCostPlan(request, costPlanNo);
// this.doSaveFinansyRecord(costPlan);
// costPlanService.save(costPlan);
//
// try {
// result.put("msg", "费用单已创建");
// result.put("costPlan", costPlan);
// result.put("costPlanNo", costPlan.getCostPlanNo());
// return result;
// } catch (Exception ex) {
// return result;
// }
// }
//
// /**
// * 保存借还单 带附件
// *
// * @param response
// * @param request
// * @return
// */
// @PostMapping("/saveFile")
// public Map<String, Object> saveFile(HttpServletResponse response, HttpServletRequest request, @RequestParam("fileSelect") MultipartFile file) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String costPlanNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlanDomain = CostPlanUtils.createCostPlan(request, costPlanNo);
// Integer finansyRecord = doSaveFinansyRecord(costPlanDomain);
// // 文件上传的路径
// String filePath = PathUtil.getBasePath() + PathUtil.getPath("cost/" + costPlanDomain.getCostPlanNo() + "/");
// // 调用工具类执行保存,并返回 path
// String path = CostFileUtil.upload(file, filePath);
//
// costPlanDomain.setFilePath(path);
// costPlanService.save(costPlanDomain);
//
// try {
//
// result.put("costPlan", costPlanDomain);
// result.put("msg", "费用单已创建");
// result.put("costPlanNo", costPlanDomain.getCostPlanNo());
// return result;
// } catch (Exception ex) {
// result.put("msg", "费用单创建失败");
// result.put("costNo", null);
// }
// return result;
// }
//
// @PostMapping("/changeDic")
// public Map<String, Object> changeDic(HttpServletResponse response, HttpServletRequest request) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
// String fromDic = request.getParameter("fromDic");
// String payCounteractStr = request.getParameter("payCounteract");
// payCounteractStr = payCounteractStr.replace(" ", "");
// BigDecimal payCounteract = null;
// if (!payCounteractStr.isEmpty()) {
// payCounteract = new BigDecimal(payCounteractStr);
// } else {
// payCounteract = new BigDecimal(0);
// }
// String payLendBalanceStr = request.getParameter("payLendBalance");
// payLendBalanceStr = payLendBalanceStr.replace(" ", "");
// BigDecimal payLendBalance = null;
// if (null != payLendBalanceStr && !payLendBalanceStr.isEmpty()) {
// payLendBalance = new BigDecimal(payLendBalanceStr);
// } else {
//
// payLendBalance = new BigDecimal(0);
// }
//
//
// String toDic = request.getParameter("toDic");
//
// BigDecimal cur = CurUtils.getCur(fromDic, toDic, getExchangeRateApi);
//
// BigDecimal counteract = payCounteract.multiply(cur);
// BigDecimal lendBalance = payLendBalance.multiply(cur);
// BigDecimal planAmount = counteract.add(lendBalance);
// BigDecimal payPlanAmount = payCounteract.add(payLendBalance);
// result.put("success", true);
// result.put("counteract", counteract.setScale(2, BigDecimal.ROUND_HALF_UP));
// result.put("lendBalance", lendBalance);
// result.put("planAmount", planAmount.setScale(2, BigDecimal.ROUND_HALF_UP));
// result.put("payPlanAmount", payPlanAmount);
// result.put("cur", cur);
// return result;
// }
//
// /**
// * 保存填写的财务信息
// *
// * @return
// */
// private Integer doSaveFinansyRecord(CostPlanDomain planDomain) {
// UserCostFinansysDomain finansyRecordByCostDomain = userCostFinansysService.createFinansyRecordByCostPlanDomain(planDomain);
// return userCostFinansysService.saveFinansysRecord(finansyRecordByCostDomain);
// }
//}
//package com.blt.other.cost.controller.costplan;
//
//import com.bailuntec.cost.api.response.CostResult;
//import com.blt.other.cost.service.CostPlanService;
//import com.blt.other.cost.service.UserCostFinansysService;
//import com.blt.other.database.model.CostPlanDomain;
//import com.blt.other.database.model.UserCostFinansysDomain;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//@Api(tags = "付款费用计划接口")
//@RestController
//@RequestMapping("/cost/plan/new/pay")
//public class CostPlanNewPayController {
//
// @Autowired
// private CostPlanService costPlanService;
//
// @Autowired
// private UserCostFinansysService userCostFinansysService;
//
// @ApiOperation("保存费用计划")
// @PostMapping("/save")
// public CostResult<Void> save(CostPlanDomain planDomain) {
// // 保存财务信息
// if (1 == planDomain.getCostForm() || (3 == planDomain.getCostForm() && 1 == planDomain.getIsLend())) {
// doSaveFinansyRecord(planDomain);
// }
//
// costPlanService.save(planDomain);
// return CostResult.success();
// }
//
// @PostMapping("/reset")
// public CostResult<Void> reset(CostPlanDomain planDomain) {
// // 保存财务信息
// if (1 == planDomain.getCostForm() || (3 == planDomain.getCostForm() && 1 == planDomain.getIsLend())) {
// doSaveFinansyRecord(planDomain);
// }
//
// costPlanService.update(planDomain);
// return CostResult.success();
// }
//
// /**
// * 保存填写的财务信息
// *
// * @return
// */
// private Integer doSaveFinansyRecord(CostPlanDomain planDomain) {
// UserCostFinansysDomain finansyRecordByCostDomain = userCostFinansysService.createFinansyRecordByCostPlanDomain(planDomain);
// return userCostFinansysService.saveFinansysRecord(finansyRecordByCostDomain);
// }
//
//}
//package com.blt.other.cost.controller.costplan;
//
//import com.blt.other.commons.utils.AxiosUtil;
//import com.blt.other.commons.utils.PathUtil;
//import com.blt.other.cost.service.CostPlanService;
//import com.blt.other.cost.service.UserCostFinansysService;
//import com.blt.other.cost.utils.CostFileUtil;
//import com.blt.other.cost.utils.CostPlanUtils;
//import com.blt.other.database.model.CostPlanDomain;
//import com.blt.other.database.model.UserCostFinansysDomain;
//import io.swagger.annotations.Api;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.HashMap;
//import java.util.Map;
//
//@Api(tags = "收款费用计划接口")
//@RestController
//@RequestMapping("/cost/plan/new/receipt")
//public class CostPlanNewReceiptController {
//
// @Autowired
// private CostPlanService costPlanService;
// @Autowired
// private UserCostFinansysService userCostFinansysService;
//
// @PostMapping("/saveFile")
// public Map<String, Object> saveFile(HttpServletResponse response, HttpServletRequest request, @RequestParam("fileSelect") MultipartFile file) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String planNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlanDomain = costPlanService.getByPlanNo(planNo);
// if (null != costPlanDomain) {
// result.put("success", false);
// return result;
// }
// CostPlanDomain costPlan = CostPlanUtils.createCostPlan(request, planNo);
//
// // 文件上传的路径
// String filePath = PathUtil.getBasePath() + PathUtil.getPath("cost/" + costPlan.getCostPlanNo() + "/");
// // 调用工具类执行保存,并返回 path
// String path = CostFileUtil.upload(file, filePath);
// costPlan.setFilePath(path);
// // 保存财务信息
// Integer finansyRecord = doSaveFinansyRecord(costPlan);
// costPlanService.save(costPlan);
// try {
// result.put("msg", "费用单已创建");
// result.put("plan", costPlan);
// result.put("success", true);
// return result;
// } catch (Exception ex) {
// result.put("msg", "费用单创建失败");
//
// }
// return result;
// }
//
// @PostMapping("/saveNoFile")
// public Map<String, Object> saveNoFile(HttpServletResponse response, HttpServletRequest request) {
// AxiosUtil.setCors(response, request);
// Map<String, Object> result = new HashMap<>();
//
// String planNo = request.getParameter("costPlanNo");
// CostPlanDomain costPlanDomain = costPlanService.getByPlanNo(planNo);
// if (null != costPlanDomain) {
// result.put("success", false);
// return result;
// }
// CostPlanDomain costPlan = CostPlanUtils.createCostPlan(request, planNo);
//
// // 保存财务信息
// doSaveFinansyRecord(costPlan);
// costPlanService.save(costPlan);
//
// try {
// result.put("success", true);
// result.put("msg", "收款计划已创建");
// result.put("plan", costPlan);
// return result;
// } catch (Exception ex) {
// result.put("msg", "收款计划创建失败");
// }
// return result;
// }
//
// /**
// * 保存填写的财务信息
// *
// * @return
// */
// private Integer doSaveFinansyRecord(CostPlanDomain planDomain) {
// UserCostFinansysDomain finansyRecordByCostDomain = userCostFinansysService.createFinansyRecordByCostPlanDomain(planDomain);
// Integer integer = userCostFinansysService.saveFinansysRecord(finansyRecordByCostDomain);
// return integer;
// }
//}
package com.blt.other.cost.controller;
package com.blt.other.cost.controller.costtemplate;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.cost.dto.CostTemplateApiDto;
import com.blt.other.cost.model.CostTemplate;
import com.blt.other.cost.service.ICostTemplateService;
import io.swagger.annotations.Api;
......@@ -9,6 +10,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
......@@ -48,6 +50,13 @@ public class CostTemplateController {
return CostResult.success(costTemplate);
}
@ApiOperation("/查询费用单模板")
@GetMapping("/queryList")
public CostResult<List<CostTemplate>> queryList(CostTemplateApiDto.QueryListReq req) {
List<CostTemplate> costTemplateList = costTemplateService.queryList(req);
return CostResult.success(costTemplateList);
}
@ApiOperation("删除费用单模版")
@GetMapping("/delete")
......
package com.blt.other.cost.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.auth.dto.request.CompanyReviewerListReq;
import com.blt.other.database.model.CostCompanyDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface CostCompanyDao {
public interface CostCompanyDao extends BaseMapper<CostCompanyDomain> {
/**
* 添加主体
*
* @param costCompanyDomain
* @return
*/
......@@ -19,6 +24,7 @@ public interface CostCompanyDao {
/**
* 通过主体名称获取主体
*
* @param costCompanyDomain
* @return
*/
......@@ -26,6 +32,7 @@ public interface CostCompanyDao {
/**
* 通过 companyNo 获取主体
*
* @param no
* @return
*/
......@@ -33,6 +40,7 @@ public interface CostCompanyDao {
/**
* 通过 companyNo 修改主体信息
*
* @param costCompanyDomain
* @return
*/
......@@ -40,6 +48,7 @@ public interface CostCompanyDao {
/**
* 获取所有主体列表
*
* @return
*/
List<CostCompanyDomain> selectAll();
......@@ -48,8 +57,20 @@ public interface CostCompanyDao {
/**
* 根据主体名获取主体
*
* @param companyName
* @return
*/
CostCompanyDomain selectByName(String companyName);
/**
* <p>
* 查询财务审核人和最终审核人配置
* </p>
*
* @param page 分页参数
* @param req 查询参数
* @return
*/
IPage<CostCompanyDomain> reviewerList(@Param("page") IPage<CostCompanyDomain> page, @Param("req") CompanyReviewerListReq req);
}
package com.blt.other.cost.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/15 9:18 上午
*/
public class CostTemplateApiDto {
@Data
public static class QueryListReq {
@ApiModelProperty(value = "费用单模版名")
private String templateName;
@ApiModelProperty("创建人")
private Integer createUserId;
@ApiModelProperty("更信任")
private Integer updateUserId;
@ApiModelProperty("是否开启自动审核")
private Boolean enableAutoReview;
@ApiModelProperty("是否开启部门审核")
private Boolean enableDepartmentReview;
@ApiModelProperty("是否开启财务自动审核")
private Boolean enableFinancialAutoReview;
@ApiModelProperty("是否开启最终人审核")
private Boolean enableFinalReview;
private LocalDateTime startTime;
private LocalDateTime endTime;
}
}
......@@ -48,11 +48,16 @@ public class CostTemplate implements Serializable {
@ApiModelProperty("最终审核人最低审核金额")
private Boolean finalMinimumReviewAmount;
private Integer createUserId;
private String createUserName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新时间")
private LocalDateTime lastUpdateTime;
private Integer updateUserId;
private String updateUserName;
@TableField(exist = false)
private List<CostTemplateCol> costTemplateColList;
......
......@@ -41,7 +41,7 @@ public class CostTemplateBaseCol implements Serializable {
private Integer colType;
@ApiModelProperty(value = "表单字段数据来源 1. input 人工输入 2. api 网络请求 3. enum 枚举")
private Integer colDateSource;
private Integer colDataSource;
@ApiModelProperty(value = "如果字段数据来源是api网络请求(colDateSource = 2) 这里记获取可选值的api全链接。")
private String colApi;
......@@ -52,6 +52,8 @@ public class CostTemplateBaseCol implements Serializable {
@ApiModelProperty("是否扩展字段")
private Boolean isExtension;
private Integer createUserId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
......
package com.blt.other.cost.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.auth.dto.request.CompanyReviewerListReq;
import com.blt.other.database.model.CostCompanyDomain;
import java.util.List;
public interface CostCompanyService {
/**
* 新增主体
* @param companyName
* @return
*/
Integer saveCompany(String companyName);
public interface CostCompanyService extends IService<CostCompanyDomain> {
/**
* 从财务系统同步主体
*
* @return
*/
String syncCompany();
/**
* 获取所有主体
*
* @return
*/
List<CostCompanyDomain> getAllCompany();
......@@ -30,8 +28,42 @@ public interface CostCompanyService {
/**
* 根据 companyNo 获取付款主体
*
* @param companyNo
* @return
*/
CostCompanyDomain getCompanyByCompanyNo(String companyNo);
/**
* <p>
* 查询财务审核人和最终审核人配置
* </p>
*
* @param req req
* @return 财务审核人和最终审核人配置
*/
IPage<CostCompanyDomain> reviewerList(CompanyReviewerListReq req);
/**
* <p>
* 修改最终审核人
* </p>
*
* @param userId 当前用户oa userid
* @param companyNoList 公司财务主体自编No list
* @param finalReviewerUserId 最终审核核人oa userid
*/
void modifyFinalReviewer(Integer userId, List<String> companyNoList, Integer finalReviewerUserId);
/**
* <p>
* 修改财务审核人
* </p>
*
* @param userId 当前用户oa userid
* @param companyNoList 公司财务主体自编No list
* @param financialReviewerUserIdList 财务审核核人oa userid
*/
void modifyFinancialReviewer(Integer userId, List<String> companyNoList, List<Integer> financialReviewerUserIdList);
}
package com.blt.other.cost.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.cost.dto.CostTemplateApiDto;
import com.blt.other.cost.model.CostTemplate;
import java.util.List;
/**
* <p>
* 费用单模版 服务类
......@@ -49,4 +52,14 @@ public interface ICostTemplateService extends IService<CostTemplate> {
* @param id
*/
void delete(Integer id);
/**
* <p>
* 查询费用单模版
* </p>
*
* @param req req
* @return
*/
List<CostTemplate> queryList(CostTemplateApiDto.QueryListReq req);
}
package com.blt.other.cost.service.impl;
import com.bailuntec.common.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.auth.dao.CostReviewerMapper;
import com.blt.other.auth.dao.OaUserMapper;
import com.blt.other.auth.dto.request.CompanyReviewerListReq;
import com.blt.other.auth.model.CostReviewer;
import com.blt.other.auth.model.OaUser;
import com.blt.other.commons.utils.CompanyUtil;
import com.blt.other.cost.dao.CostCompanyDao;
import com.blt.other.cost.service.CostCompanyService;
......@@ -12,30 +22,26 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
@Service
public class CostCompanyServiceImpl implements CostCompanyService {
public class CostCompanyServiceImpl extends ServiceImpl<CostCompanyDao, CostCompanyDomain> implements CostCompanyService {
private static Logger logger = LoggerFactory.getLogger(CostCompanyServiceImpl.class);
@Autowired
private CostCompanyDao costCompanyDao;
@Value("${url.api.postCompanyListApi}")
private String postCompanyListApi;
@Autowired
CostReviewerMapper costReviewerMapper;
@Autowired
OaUserMapper oaUserMapper;
/**
* 新增主体
*
* @param companyName
* @return
*/
@Override
public Integer saveCompany(String companyName) {
return null;
}
@Override
public String syncCompany() {
......@@ -75,7 +81,6 @@ public class CostCompanyServiceImpl implements CostCompanyService {
@Override
public List<CostCompanyDomain> getAllCompany() {
return costCompanyDao.selectAll();
}
......@@ -95,6 +100,106 @@ public class CostCompanyServiceImpl implements CostCompanyService {
return costCompanyDao.selectByNo(companyNo);
}
@Override
public IPage<CostCompanyDomain> reviewerList(CompanyReviewerListReq req) {
IPage<CostCompanyDomain> page = new Page<>(req.getPageNum(), req.getPageSize());
page = baseMapper.reviewerList(page, req);
if (ListUtil.isNotEmpty(page.getRecords())) {
List<Integer> costCompanyIds = page.getRecords().stream().map(CostCompanyDomain::getId).collect(Collectors.toList());
//最终审核人
List<CostReviewer> finalCostReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.in(CostReviewer::getReferId, costCompanyIds)
.eq(CostReviewer::getType, CostReviewer.finalReviewer));
Map<Integer, CostReviewer> finalReviewerMap = finalCostReviewerList.stream().collect(Collectors.toMap(CostReviewer::getReferId, costReviewer -> costReviewer));
page.getRecords().forEach(record -> record.setFinalReviewer(finalReviewerMap.get(record.getId())));
//财务审核人
List<CostReviewer> financialCostReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.in(CostReviewer::getReferId, costCompanyIds)
.eq(CostReviewer::getType, CostReviewer.financialReviewer));
Map<Integer, List<CostReviewer>> financialReviewerMap = financialCostReviewerList.stream().collect(Collectors.groupingBy(CostReviewer::getReferId));
page.getRecords().forEach(record -> {
record.setFinancialReviewer(financialReviewerMap.get(record.getId()));
});
}
return page;
}
@Override
public void modifyFinalReviewer(Integer userId, List<String> companyNoList, Integer finalReviewerUserId) {
companyNoList.forEach(companyNo -> {
OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId);
CostCompanyDomain costCompanyDomain = baseMapper.selectByNo(companyNo);
//记录更新时间
costCompanyDomain.setLastUpdateTime(LocalDateTime.now());
costCompanyDomain.setUpdateUserId(userId);
costCompanyDomain.setUpdateUserName(currentOaUser.getUserName());
baseMapper.updateById(costCompanyDomain);
//删除旧审核人
costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.finalReviewer)
.eq(CostReviewer::getReferId, costCompanyDomain.getId()));
//新增审核人
OaUser oaUser = oaUserMapper.selectByOaUserId(finalReviewerUserId);
CostReviewer costReviewer = CostReviewer.builder()
.reviewerUserId(finalReviewerUserId)
.reviewerUserName(oaUser.getUserName())
.referId(costCompanyDomain.getId())
.type(CostReviewer.finalReviewer)
.build();
costReviewerMapper.insert(costReviewer);
});
}
@Override
public void modifyFinancialReviewer(Integer userId, List<String> companyNoList, List<Integer> financialReviewerUserIdList) {
companyNoList.forEach(companyNo -> {
OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId);
CostCompanyDomain costCompanyDomain = baseMapper.selectByNo(companyNo);
//记录更新时间
costCompanyDomain.setLastUpdateTime(LocalDateTime.now());
costCompanyDomain.setUpdateUserId(userId);
costCompanyDomain.setUpdateUserName(currentOaUser.getUserName());
baseMapper.updateById(costCompanyDomain);
//删除旧审核人
costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.financialReviewer)
.eq(CostReviewer::getReferId, costCompanyDomain.getId()));
financialReviewerUserIdList.forEach(financialReviewerUserId -> {
//新增审核人
OaUser financialReviewerOaUser = oaUserMapper.selectByOaUserId(financialReviewerUserId);
CostReviewer costReviewer = CostReviewer.builder()
.reviewerUserId(financialReviewerUserId)
.reviewerUserName(financialReviewerOaUser.getUserName())
.referId(costCompanyDomain.getId())
.type(CostReviewer.financialReviewer)
.build();
costReviewerMapper.insert(costReviewer);
});
});
}
/**
* 生成唯一的主体编号
*
......
package com.blt.other.cost.service.impl;
import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.cost.dao.CostTemplateMapper;
import com.blt.other.cost.dto.CostTemplateApiDto;
import com.blt.other.cost.model.CostTemplate;
import com.blt.other.cost.model.CostTemplateCol;
import com.blt.other.cost.service.ICostTemplateColService;
......@@ -60,4 +62,38 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
}
}
@Override
public List<CostTemplate> queryList(CostTemplateApiDto.QueryListReq req) {
LambdaQueryWrapper<CostTemplate> wrapper = new LambdaQueryWrapper<>();
if (req.getEnableAutoReview() != null) {
wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview());
}
if (StringUtils.isEmpty(req.getTemplateName())) {
wrapper.eq(CostTemplate::getTemplateName, req.getTemplateName());
}
if (req.getCreateUserId() != null) {
wrapper.eq(CostTemplate::getCreateUserId, req.getCreateUserId());
}
if (req.getUpdateUserId() != null) {
wrapper.eq(CostTemplate::getUpdateUserId, req.getUpdateUserId());
}
if (req.getEnableAutoReview() != null) {
wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview());
}
if (req.getEnableDepartmentReview() != null) {
wrapper.eq(CostTemplate::getEnableDepartmentReview, req.getEnableDepartmentReview());
}
if (req.getEnableFinalReview() != null) {
wrapper.eq(CostTemplate::getEnableFinalReview, req.getEnableFinalReview());
}
if (req.getStartTime() != null) {
wrapper.ge(CostTemplate::getLastUpdateTime, req.getStartTime());
}
if (req.getEndTime() != null) {
wrapper.le(CostTemplate::getLastUpdateTime, req.getEndTime());
}
return this.list(wrapper);
}
}
......@@ -41,8 +41,6 @@ public class CostPlanServiceFactory {
}
return SpringContextUtil.getBean(DefaultCostPlanServiceImpl.class);
}
}
package com.blt.other.database.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.auth.model.CostReviewer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@TableName("cost_company")
@Data
public class CostCompanyDomain {
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty("费用系统自编no")
private String companyNo;
@ApiModelProperty("财务主体名")
private String companyName;
private Integer value;
private LocalDateTime lastUpdateTime;
private LocalDateTime createTime;
private Integer createUserId;
private Integer updateUserId;
private String updateUserName;
@ApiModelProperty("最终审核人")
@TableField(exist = false)
private CostReviewer finalReviewer;
@ApiModelProperty("财务审核人")
@TableField(exist = false)
private List<CostReviewer> financialReviewer;
}
......@@ -12,7 +12,9 @@ spring:
cache: false
resources:
static-locations: classpath:/resources/, classpath:/static/
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
#mybatis plus 配置
mybatis-plus:
......
......@@ -12,7 +12,9 @@ spring:
cache: false
resources:
static-locations: classpath:/resources/, classpath:/static/
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
#mybatis plus 配置
mybatis-plus:
......
......@@ -12,7 +12,9 @@ spring:
cache: false
resources:
static-locations: classpath:/resources/, classpath:/static/
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
#mybatis plus 配置
mybatis-plus:
......
......@@ -3,41 +3,28 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.cost.dao.CostCompanyDao">
<insert id="insertCompany" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO
cost_company(
company_no,company_name,value
)
VALUE
(
#{companyNo},#{companyName},#{value}
)
INSERT INTO cost_company(company_no, company_name, value)
VALUE
(
#{companyNo}, #{companyName}, #{value}
)
</insert>
<select id="selectByNameOrValue" resultType="com.blt.other.database.model.CostCompanyDomain">
SELECT
*
FROM
cost_company
WHERE
value = #{value}
OR
company_name = #{companyName}
SELECT *
FROM cost_company
WHERE value = #{value}
OR company_name = #{companyName}
</select>
<select id="selectByName" resultType="com.blt.other.database.model.CostCompanyDomain">
SELECT
*
FROM
cost_company
WHERE
company_name = #{companyName}
SELECT *
FROM cost_company
WHERE company_name = #{companyName}
</select>
<select id="selectByNo" resultType="com.blt.other.database.model.CostCompanyDomain">
SELECT
*
FROM
cost_company
WHERE
company_no = #{companyNo}
SELECT *
FROM cost_company
WHERE company_no = #{companyNo}
</select>
<update id="update" parameterType="com.blt.other.database.model.CostCompanyDomain">
......@@ -52,18 +39,50 @@
</update>
<select id="selectAll" resultType="com.blt.other.database.model.CostCompanyDomain">
SELECT
*
FROM
cost_company
SELECT *
FROM cost_company
</select>
<select id="getAllCompanyAuthority" resultType="com.blt.other.database.model.CostCompanyDomain">
SELECT
value as id,
company_name,
value
FROM
cost_company
SELECT value as id,
company_name,
value
FROM cost_company
</select>
<select id="reviewerList" resultType="com.blt.other.database.model.CostCompanyDomain">
select t1.* from cost_company t1
<if test="req.financialReviewerUserId !=null">
left join cost_reviewer t2 on t1.id = t2.refer_id and t2.type = 2
</if>
<if test="req.finalReviewerUserId !=null">
left join cost_reviewer t3 on t1.id = t3.refer_id and t3.type = 3
</if>
where true
/*财务审核人*/
<if test="req.financialReviewerUserId !=null">
and t2.reviewer_user_id =#{req.financialReviewerUserId}
</if>
/*最终审核人*/
<if test="req.finalReviewerUserId !=null">
and t3.reviewer_user_id =#{req.finalReviewerUserId}
</if>
/*最后修改时间*/
<if test="req.startTime !=null">
and t1.last_update_time &gt; #{req.startTime}
</if>
/*最后修改时间*/
<if test="req.endTime !=null">
and t1.last_update_time &lt; #{req.endTime}
</if>
/*修改人*/
<if test="req.modifyUserId !=null">
and t1.update_user_id =#{req.modifyUserId}
</if>
<if test="req.companyNo !=null and req.companyNo!= '' ">
and t1.company_no =#{req.companyNo}
</if>
group by t1.id
</select>
</mapper>
......@@ -37,6 +37,7 @@
and t1.oa_company_id =#{req.oaCompanyId}
</if>
</select>
<select id="selectByCompanyId" resultType="com.blt.other.auth.model.OaCompany">
select *
from oa_company
......
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