Commit 1b6044af by huluobin

部门审核人

parent 1ba1a5d1
...@@ -212,6 +212,10 @@ public class CostDto { ...@@ -212,6 +212,10 @@ public class CostDto {
@TableField(exist = false) @TableField(exist = false)
private String costCurrentReviewer;
@TableField(exist = false)
private CostTemplateDto costTemplate; private CostTemplateDto costTemplate;
} }
...@@ -2,14 +2,14 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -2,14 +2,14 @@ package com.blt.other.module.cost.service.impl.costcheck;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.database.model.CostLogDomain;
import com.blt.other.module.auth.dao.OaDepartmentMapper; import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.sys.model.CostReviewer;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.database.model.CostLogDomain; import com.blt.other.module.sys.model.CostReviewer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -52,6 +52,8 @@ public class DepartmentCheckState extends CostState { ...@@ -52,6 +52,8 @@ public class DepartmentCheckState extends CostState {
//如果不需要审核 直接通过 //如果不需要审核 直接通过
OaUser oaUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid()); OaUser oaUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(oaUser.getPrimaryDepartmentId()); OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(oaUser.getPrimaryDepartmentId());
//是否通过部门
if (!costTemplate.shouldDepartmentCheck(costDomain, oaDepartment.getDepartmentMinimumReviewAmount())) { if (!costTemplate.shouldDepartmentCheck(costDomain, oaDepartment.getDepartmentMinimumReviewAmount())) {
costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK); costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK);
...@@ -83,6 +85,7 @@ public class DepartmentCheckState extends CostState { ...@@ -83,6 +85,7 @@ public class DepartmentCheckState extends CostState {
} }
} }
//人工审核 //人工审核
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid()); OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
if (costContext.currentUserId != null) { if (costContext.currentUserId != null) {
......
...@@ -10,10 +10,7 @@ import com.blt.other.module.sys.dto.response.DepartmentReviewerListItem; ...@@ -10,10 +10,7 @@ import com.blt.other.module.sys.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.sys.service.IDepartmentReviewerService; import com.blt.other.module.sys.service.IDepartmentReviewerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -34,22 +31,21 @@ public class DepartmentReviewerController { ...@@ -34,22 +31,21 @@ public class DepartmentReviewerController {
IDepartmentReviewerService departmentReviewerService; IDepartmentReviewerService departmentReviewerService;
@ApiOperation("获取部门审核人配置列表") @ApiOperation("获取部门审核人配置列表")
@GetMapping("/departmentReviewerList") @PostMapping("/departmentReviewerList")
public CostResult<IPage<DepartmentReviewerListItem>> departmentReviewerList(DepartmentReviewerListReq req) { public CostResult<IPage<DepartmentReviewerListItem>> departmentReviewerList(@RequestBody DepartmentReviewerListReq req) {
IPage<DepartmentReviewerListItem> oaDepartmentIPage = departmentReviewerService.departmentReviewerList(req); IPage<DepartmentReviewerListItem> oaDepartmentIPage = departmentReviewerService.departmentReviewerList(req);
return CostResult.success(oaDepartmentIPage); return CostResult.success(oaDepartmentIPage);
} }
@ApiOperation("/修改部门审核人") @ApiOperation("/修改部门审核人")
@GetMapping("/modifyDepartmentReviewer") @PostMapping("/modifyDepartmentReviewer")
public CostResult<Void> modifyDepartmentReviewer(@RequestBody ModifyDepartmentReviewerReq req) { public CostResult<Void> modifyDepartmentReviewer(@RequestBody ModifyDepartmentReviewerReq req) {
departmentReviewerService.modifyDepartmentReviewer(req); departmentReviewerService.modifyDepartmentReviewer(req);
return CostResult.success(); return CostResult.success();
} }
@Deprecated
@ApiOperation("新增部门审核人") @ApiOperation("新增部门审核人")
@GetMapping("/addDepartmentReviewer") @PostMapping("/addDepartmentReviewer")
public CostResult<Void> addDepartmentReviewer(@RequestBody AddDepartmentReviewerReq req) { public CostResult<Void> addDepartmentReviewer(@RequestBody AddDepartmentReviewerReq req) {
departmentReviewerService.addDepartmentReviewer(req); departmentReviewerService.addDepartmentReviewer(req);
return CostResult.success(); return CostResult.success();
......
package com.blt.other.module.sys.dto.response; package com.blt.other.module.sys.dto.response;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.blt.other.module.sys.model.CostReviewer; import com.blt.other.module.sys.model.CostReviewer;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -40,9 +42,11 @@ public class DepartmentReviewerListItem { ...@@ -40,9 +42,11 @@ public class DepartmentReviewerListItem {
@ApiModelProperty(value = "自动审核金额") @ApiModelProperty(value = "自动审核金额")
private BigDecimal autoReviewAmount; private BigDecimal autoReviewAmount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "最近一次更新时间") @ApiModelProperty(value = "最近一次更新时间")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
...@@ -52,6 +56,10 @@ public class DepartmentReviewerListItem { ...@@ -52,6 +56,10 @@ public class DepartmentReviewerListItem {
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateUserName; private String updateUserName;
@TableField(exist = false)
@ApiModelProperty(value = "公司")
private String companyName;
private List<CostReviewer> costReviewerList; private List<CostReviewer> costReviewerList;
} }
...@@ -26,7 +26,7 @@ public class CostReviewer implements Serializable { ...@@ -26,7 +26,7 @@ public class CostReviewer implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final Integer departmentReviewer = 1; public static final Integer departmentReviewer = 5;
public static final Integer financialReviewer = 2; public static final Integer financialReviewer = 2;
public static final Integer finalReviewer = 3; public static final Integer finalReviewer = 3;
public static final Integer hrReviewer = 4; public static final Integer hrReviewer = 4;
...@@ -37,7 +37,7 @@ public class CostReviewer implements Serializable { ...@@ -37,7 +37,7 @@ public class CostReviewer implements Serializable {
@ApiModelProperty(value = "type=1:部门id ; type in (2,3,4):财务主体id;") @ApiModelProperty(value = "type=1:部门id ; type in (2,3,4):财务主体id;")
private Integer referId; private Integer referId;
@ApiModelProperty(value = "1-部门审核人 2-财务审核人 3-最终审核人 4-行政审核人") @ApiModelProperty(value = "1-部门审核人(作废) 2-财务审核人 3-最终审核人 4-行政审核人 5-新部门审核人")
private Integer type; private Integer type;
@ApiModelProperty(value = "审核人") @ApiModelProperty(value = "审核人")
......
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -45,9 +47,11 @@ public class SpecDepartmentCheckConfig implements Serializable { ...@@ -45,9 +47,11 @@ public class SpecDepartmentCheckConfig implements Serializable {
@ApiModelProperty(value = "特殊审核人") @ApiModelProperty(value = "特殊审核人")
private String reviewerUser; private String reviewerUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
......
...@@ -44,6 +44,8 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe ...@@ -44,6 +44,8 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe
@Override @Override
public IPage<DepartmentReviewerListItem> departmentReviewerList(DepartmentReviewerListReq req) { public IPage<DepartmentReviewerListItem> departmentReviewerList(DepartmentReviewerListReq req) {
IPage<DepartmentReviewerListItem> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<DepartmentReviewerListItem> page = new Page<>(req.getPageNum(), req.getPageSize());
page = baseMapper.departmentReviewerList(page, req);
if (ListUtil.isNotEmpty(page.getRecords())) {
Map<Integer, List<CostReviewer>> cMap = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>() Map<Integer, List<CostReviewer>> cMap = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.in(CostReviewer::getReferId, page.getRecords().stream().map(DepartmentReviewerListItem::getId).collect(Collectors.toList()))) .in(CostReviewer::getReferId, page.getRecords().stream().map(DepartmentReviewerListItem::getId).collect(Collectors.toList())))
.stream() .stream()
...@@ -51,7 +53,8 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe ...@@ -51,7 +53,8 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe
page.getRecords().forEach(departmentReviewerListItem -> departmentReviewerListItem.setCostReviewerList(cMap.get(departmentReviewerListItem.getId()))); page.getRecords().forEach(departmentReviewerListItem -> departmentReviewerListItem.setCostReviewerList(cMap.get(departmentReviewerListItem.getId())));
return baseMapper.departmentReviewerList(page, req); }
return page;
} }
@Override @Override
...@@ -84,6 +87,5 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe ...@@ -84,6 +87,5 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe
departmentReviewer.setAutoReviewAmount(req.getAutoReviewAmount()); departmentReviewer.setAutoReviewAmount(req.getAutoReviewAmount());
} }
} }
...@@ -168,7 +168,7 @@ public class SpecDepartmentCheckConfigServiceImpl extends ServiceImpl<SpecDepart ...@@ -168,7 +168,7 @@ public class SpecDepartmentCheckConfigServiceImpl extends ServiceImpl<SpecDepart
specDepartmentCheckConfig.setUpdateUserId(req.getUpdateUserId()); specDepartmentCheckConfig.setUpdateUserId(req.getUpdateUserId());
specDepartmentCheckConfig.setUpdateUserName(oaUserMapper.selectByOaUserId(req.getUpdateUserId()).getUserName()); specDepartmentCheckConfig.setUpdateUserName(oaUserMapper.selectByOaUserId(req.getUpdateUserId()).getUserName());
specDepartmentCheckConfig.setLastUpdateTime(LocalDateTime.now()); specDepartmentCheckConfig.setLastUpdateTime(LocalDateTime.now());
this.save(specDepartmentCheckConfig); this.updateById(specDepartmentCheckConfig);
} }
@Override @Override
......
...@@ -12,6 +12,10 @@ import com.blt.other.module.auth.service.IOaUserService; ...@@ -12,6 +12,10 @@ import com.blt.other.module.auth.service.IOaUserService;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.service.impl.costcheck.CostContext; import com.blt.other.module.cost.service.impl.costcheck.CostContext;
import com.blt.other.module.cost.service.impl.costcheck.DepartmentCheckState; import com.blt.other.module.cost.service.impl.costcheck.DepartmentCheckState;
import com.blt.other.module.sys.dao.CostReviewerMapper;
import com.blt.other.module.sys.dao.DepartmentReviewerMapper;
import com.blt.other.module.sys.model.CostReviewer;
import com.blt.other.module.sys.model.DepartmentReviewer;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,6 +24,7 @@ import org.springframework.test.context.ActiveProfiles; ...@@ -20,6 +24,7 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -27,7 +32,7 @@ import java.util.stream.Collectors; ...@@ -27,7 +32,7 @@ import java.util.stream.Collectors;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = OtherApplication.class) @SpringBootTest(classes = OtherApplication.class)
@ActiveProfiles("prod") @ActiveProfiles("test")
public class OtherApplicationTests { public class OtherApplicationTests {
@Autowired @Autowired
...@@ -39,7 +44,50 @@ public class OtherApplicationTests { ...@@ -39,7 +44,50 @@ public class OtherApplicationTests {
@Resource @Resource
OaDepartmentMapper oaDepartmentMapper; OaDepartmentMapper oaDepartmentMapper;
// @Transactional(rollbackFor = Exception.class) @Resource
CostReviewerMapper costReviewerMapper;
@Resource
DepartmentReviewerMapper departmentReviewerMapper;
@Test
public void syncDepartmentReviewer() {
departmentReviewerMapper.delete(new LambdaQueryWrapper<>());
costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.departmentReviewer));
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, 1));
costReviewerList.stream().collect(Collectors.groupingBy(CostReviewer::getReferId))
.forEach((departmentId, list) -> {
OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(departmentId);
DepartmentReviewer departmentReviewer = new DepartmentReviewer();
departmentReviewer.setPrimaryDepartmentId(oaDepartment.getDepartmentId());
departmentReviewer.setAutoReviewAmount(oaDepartment.getDepartmentMinimumReviewAmount());
departmentReviewer.setPrimaryDepartmentName(oaDepartment.getName());
departmentReviewer.setSecondDepartmentId(0);
departmentReviewer.setSecondDepartmentName("全部");
departmentReviewer.setCreateTime(LocalDateTime.now());
departmentReviewer.setLastUpdateTime(LocalDateTime.now());
departmentReviewerMapper.insert(departmentReviewer);
list.forEach(costReviewer -> {
costReviewer.setReferId(departmentReviewer.getId());
costReviewer.setType(CostReviewer.departmentReviewer);
costReviewer.setId(null);
costReviewerMapper.insert(costReviewer);
});
});
costReviewerList.forEach(costReviewer -> {
});
}
@Test @Test
public void syncOa() { public void syncOa() {
List<OaUserResp> oaUserRespList = oaApi.getAllUser(); List<OaUserResp> oaUserRespList = oaApi.getAllUser();
......
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