Commit bac604e6 by huluobin

state update

parent b480e5fc
...@@ -53,7 +53,6 @@ public class CostReviewerController { ...@@ -53,7 +53,6 @@ public class CostReviewerController {
public CostResult<Void> modifyFinalReviewer(@RequestParam Integer userId, public CostResult<Void> modifyFinalReviewer(@RequestParam Integer userId,
@RequestParam @ApiParam("财务公司主体 逗号分隔") List<String> companyNoList, @RequestParam @ApiParam("财务公司主体 逗号分隔") List<String> companyNoList,
@RequestParam @ApiParam("oa用户id 逗号分隔") Integer finalReviewerUserId) { @RequestParam @ApiParam("oa用户id 逗号分隔") Integer finalReviewerUserId) {
// List<String> companyNoList = Lists.newArrayList(companyNos.split(","));
costCompanyService.modifyFinalReviewer(userId, companyNoList, finalReviewerUserId); costCompanyService.modifyFinalReviewer(userId, companyNoList, finalReviewerUserId);
return CostResult.success(); return CostResult.success();
} }
......
...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.model; ...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
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;
...@@ -37,7 +38,9 @@ public class OaCompany implements Serializable { ...@@ -37,7 +38,9 @@ public class OaCompany implements Serializable {
private Integer createUserId; private Integer createUserId;
private String createUserName; private String createUserName;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
@ApiModelProperty("更新用户id") @ApiModelProperty("更新用户id")
......
...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.model; ...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
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;
...@@ -60,7 +61,10 @@ public class OaDepartment implements Serializable { ...@@ -60,7 +61,10 @@ public class OaDepartment implements Serializable {
@ApiModelProperty(value = "创建人姓名") @ApiModelProperty(value = "创建人姓名")
private String createUserName; private String createUserName;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
@ApiModelProperty("更新用户id") @ApiModelProperty("更新用户id")
......
...@@ -50,7 +50,6 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD ...@@ -50,7 +50,6 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD
page = baseMapper.reviewerList(page, req); page = baseMapper.reviewerList(page, req);
if (ListUtil.isNotEmpty(page.getRecords())) { if (ListUtil.isNotEmpty(page.getRecords())) {
List<Integer> oaDepartmentIds = page.getRecords().stream().map(OaDepartment::getDepartmentId).collect(Collectors.toList()); List<Integer> oaDepartmentIds = page.getRecords().stream().map(OaDepartment::getDepartmentId).collect(Collectors.toList());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>() List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
......
...@@ -218,13 +218,14 @@ public class CostController { ...@@ -218,13 +218,14 @@ public class CostController {
@ApiOperation("审核费用单列表") @ApiOperation("审核费用单列表")
@GetMapping("/checkCostList") @GetMapping("/checkCostList")
public IPage<CostDto> financialCheckCostList(@RequestParam Integer userid, public CostResult<IPage<CostDto>> financialCheckCostList(@RequestParam Integer userid,
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type, @RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type,
@RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) { @RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) {
costService = CostServiceFactory.getCostService(); costService = CostServiceFactory.getCostService();
return costService.checkCostList(userid, pageNum, pageSize, type, status); IPage<CostDto> page = costService.checkCostList(userid, pageNum, pageSize, type, status);
return CostResult.success(page);
} }
@ApiOperation("部门审核通过") @ApiOperation("部门审核通过")
......
...@@ -112,12 +112,10 @@ public interface CostDao extends BaseMapper<CostDomain> { ...@@ -112,12 +112,10 @@ public interface CostDao extends BaseMapper<CostDomain> {
* @param type type * @param type type
* @param status status * @param status status
* @param userid userid * @param userid userid
* @param isManage ismange
* @return * @return
*/ */
IPage<CostDomain> checkCostList(@Param("page") IPage<CostDomain> page, IPage<CostDomain> checkCostList(@Param("page") IPage<CostDomain> page,
@Param("type") Integer type, @Param("type") Integer type,
@Param("status") Integer status, @Param("status") Integer status,
@Param("userid") Integer userid, @Param("userid") Integer userid);
@Param("isManage") Boolean isManage);
} }
...@@ -251,6 +251,9 @@ public class CostDomain implements Serializable { ...@@ -251,6 +251,9 @@ public class CostDomain implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Boolean canAudit; private Boolean canAudit;
@TableField(exist = false)
private String checkUrl;
public CostDto castToDto() { public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class); StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
...@@ -10,7 +10,6 @@ public interface CostLogService { ...@@ -10,7 +10,6 @@ public interface CostLogService {
Integer save(String costNo, Integer updateUserid, String updateMainNote,Integer type); Integer save(String costNo, Integer updateUserid, String updateMainNote,Integer type);
List<CostLogDomain> getListByCostNo(String costNo); List<CostLogDomain> getListByCostNo(String costNo);
List<String> getListLogs(List<CostLogDomain> logs); List<String> getListLogs(List<CostLogDomain> logs);
......
package com.blt.other.module.cost.service.impl; package com.blt.other.module.cost.service.impl;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.dao.UserDao; import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.dao.CostLogDao; import com.blt.other.module.cost.dao.CostLogDao;
import com.blt.other.module.cost.service.CostLogService; import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
...@@ -8,6 +10,7 @@ import com.blt.other.module.database.model.UserDomain; ...@@ -8,6 +10,7 @@ import com.blt.other.module.database.model.UserDomain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -26,6 +29,9 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -26,6 +29,9 @@ public class CostLogServiceImpl implements CostLogService {
return this.save(costNo, updateUserid, updateMainNote, null); return this.save(costNo, updateUserid, updateMainNote, null);
} }
@Resource
OaUserMapper oaUserMapper;
@Override @Override
public Integer save(String costNo, Integer updateUserid, String updateMainNote, Integer type) { public Integer save(String costNo, Integer updateUserid, String updateMainNote, Integer type) {
CostLogDomain costLog = new CostLogDomain(); CostLogDomain costLog = new CostLogDomain();
...@@ -33,9 +39,18 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -33,9 +39,18 @@ public class CostLogServiceImpl implements CostLogService {
costLog.setUpdateTime(new Date()); costLog.setUpdateTime(new Date());
UserDomain user = userDao.selectByuserid(updateUserid); UserDomain user = userDao.selectByuserid(updateUserid);
if (user == null) {
user = new UserDomain();
OaUser oaUser = oaUserMapper.selectByOaUserId(updateUserid);
user.setUsercode(oaUser.getUserCode());
user.setUsername(oaUser.getUserName());
}
costLog.setUpdateUsercode(user.getUsercode()); costLog.setUpdateUsercode(user.getUsercode());
costLog.setUpdateUserid(updateUserid);
costLog.setUpdateUsername(user.getUsername()); costLog.setUpdateUsername(user.getUsername());
costLog.setUpdateUserid(updateUserid);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + user.getUsername()); costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + user.getUsername());
costLog.setType(type); costLog.setType(type);
......
...@@ -15,6 +15,7 @@ import com.blt.other.common.util.MoneyUtil; ...@@ -15,6 +15,7 @@ import com.blt.other.common.util.MoneyUtil;
import com.blt.other.common.util.SessionUtils; import com.blt.other.common.util.SessionUtils;
import com.blt.other.module.auth.dao.CostReviewerMapper; import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.auth.service.UserService; import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.cost.dao.*; import com.blt.other.module.cost.dao.*;
...@@ -127,19 +128,19 @@ public abstract class AbstractCostService implements CostService { ...@@ -127,19 +128,19 @@ public abstract class AbstractCostService implements CostService {
Integer currentUserId = SessionUtils.getCurrentUserId(); Integer currentUserId = SessionUtils.getCurrentUserId();
OaUser costUser = oaUserMapper.selectByOaUserId(currentUserId); OaUser costUser = oaUserMapper.selectByOaUserId(currentUserId);
// if (currentUserId == null) { if (currentUserId == null) {
// costDomain.setCanAudit(false); costDomain.setCanAudit(false);
// } else if (costDomain.getCostStatus().equals(CostDomain.STATUS_DEPARTMENT_CHECK)) { } else if (costDomain.getCostStatus().equals(CostDomain.STATUS_DEPARTMENT_CHECK)) {
// costDomain.setCanAudit(costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null); costDomain.setCanAudit(costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null);
// } else if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) { } else if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) {
// costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null); costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null);
// } else if (costDomain.getCostStatus().equals(CostDomain.STATUS_FINAL_CHECK)) { } else if (costDomain.getCostStatus().equals(CostDomain.STATUS_FINAL_CHECK)) {
// costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null); costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null);
// } else { } else {
// costDomain.setCanAudit(false); costDomain.setCanAudit(false);
// } }
//todo // //todo
costDomain.setCanAudit(true); // costDomain.setCanAudit(true);
return costDomain; return costDomain;
} }
...@@ -243,10 +244,7 @@ public abstract class AbstractCostService implements CostService { ...@@ -243,10 +244,7 @@ public abstract class AbstractCostService implements CostService {
public IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type, Integer status) { public IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type, Integer status) {
IPage<CostDomain> page = new Page<>(pageNum, pageSize); IPage<CostDomain> page = new Page<>(pageNum, pageSize);
UserDomain userDomain = userService.findByUserid(userid); UserDomain userDomain = userService.findByUserid(userid);
//财务或者管理员 return costDao.checkCostList(page, type, status, userid).convert(CostDomain::castToDto);
Boolean isManage = userDomain.getIsadmin() != 0 || userDomain.getIsfinansys() != 0;
return costDao.checkCostList(page, type, status, userid, isManage).convert(CostDomain::castToDto);
} }
@Resource @Resource
......
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
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;
...@@ -9,6 +11,8 @@ import com.blt.other.module.database.model.CostLogDomain; ...@@ -9,6 +11,8 @@ import com.blt.other.module.database.model.CostLogDomain;
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 javax.annotation.Resource;
/** /**
* <p> * <p>
* *
...@@ -24,6 +28,9 @@ public class DepartmentCheckState extends CostState { ...@@ -24,6 +28,9 @@ public class DepartmentCheckState extends CostState {
FinancialCheckState financialCheckState; FinancialCheckState financialCheckState;
@Resource
OaDepartmentMapper oaDepartmentMapper;
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -37,9 +44,22 @@ public class DepartmentCheckState extends CostState { ...@@ -37,9 +44,22 @@ public class DepartmentCheckState extends CostState {
//如果是默认模版 不需要部门审核 //如果是默认模版 不需要部门审核
if (costTemplate.getIsDefault()) { if (costTemplate.getIsDefault()) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain);
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
OaDepartment oaDepartment = oaDepartmentMapper.selectById(costUser.getPrimaryDepartmentId());
String manageUserName = oaDepartment.getManageUser1();
OaUser oaUser = oaUserMapper.selectByUserName(manageUserName);
//流转状态 //流转状态
nextState(financialCheckState); nextState(financialCheckState);
costSubscribe.subscribe(costContext); costSubscribe.subscribe(costContext);
costLogService.save(costDomain.getCostNo(), oaUser.getOaUserId(), "基础模版无需部门审核", CostLogDomain.DEPARTMENT_AUTO_PASS);
return;
} }
//需要自动审核 //需要自动审核
......
...@@ -55,6 +55,7 @@ public class FinancialCheckState extends CostState { ...@@ -55,6 +55,7 @@ public class FinancialCheckState extends CostState {
} }
} }
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo()); CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
//人工审核通过 //人工审核通过
......
...@@ -19,7 +19,7 @@ public class PayedState extends CostState { ...@@ -19,7 +19,7 @@ public class PayedState extends CostState {
} }
@Override @Override
public void refuse(String rejectReason { public void refuse(String rejectReason) {
} }
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.module.auth.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -27,7 +28,9 @@ public class CostCompanyDomain { ...@@ -27,7 +28,9 @@ public class CostCompanyDomain {
private Integer value; private Integer value;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
private Integer createUserId; private Integer createUserId;
......
...@@ -414,14 +414,20 @@ ...@@ -414,14 +414,20 @@
<select id="checkCostList" resultMap="cost"> <select id="checkCostList" resultMap="cost">
select t1.* select t1.*
from cost t1 from cost t1
left join cost_log cl on t1.cost_no = cl.cost_no left join cost_log t2 on t1.cost_no = t2.cost_no
left join cost_company t3 on t1.company_no = t3.company_no
-- 最终审核人
LEFT JOIN cost_reviewer t4 on t3.id = t4.refer_id and t4.type = 3
-- 财务审核人
LEFT JOIN cost_reviewer t5 on t3.id = t5.refer_id and t5.type = 2
LEFT JOIN oa_user t6 on t1.create_userid = t6.oa_user_id
-- 部门审核人
LEFT JOIN cost_reviewer t7 on t6.primary_department_id = t7.refer_id and t7.type = 1
where true where true
/*财务 或者 最终审核*/ /*财务 或者 最终审核 只显示待审核的*/
<if test="type==1"> <if test="type==1">
/*待审核*/ and (t1.cost_status = 7 or t1.cost_status = 8)
<if test=" status == 2 "> and (t4.reviewer_user_id = #{userid} or t5.reviewer_user_id = #{userid})
and (t1.cost_status = 7 or t1.cost_status = 8)
</if>
</if> </if>
/*部门审核*/ /*部门审核*/
<if test="type==2"> <if test="type==2">
...@@ -431,12 +437,13 @@ ...@@ -431,12 +437,13 @@
</if> </if>
/*已手动审核*/ /*已手动审核*/
<if test=" status == 3 "> <if test=" status == 3 ">
and cl.type = 5 and t2.type = 5
</if> </if>
/*已自动审核*/ /*已自动审核*/
<if test=" status == 4 "> <if test=" status == 4 ">
and cl.type = 4 and t2.type = 4
</if> </if>
and (t7.reviewer_user_id = #{userid} )
</if> </if>
group by group by
t1.id t1.id
......
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