Commit 0be62102 by huluobin

update

parent 16e8cc93
...@@ -2,11 +2,11 @@ package com.blt.other.module.auth.model; ...@@ -2,11 +2,11 @@ package com.blt.other.module.auth.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
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.*;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/** /**
* <p> * <p>
...@@ -18,9 +18,13 @@ import lombok.EqualsAndHashCode; ...@@ -18,9 +18,13 @@ import lombok.EqualsAndHashCode;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="OaUser对象", description="") @ApiModel(value = "OaUser对象", description = "")
@AllArgsConstructor
@NoArgsConstructor
public class OaUser implements Serializable { public class OaUser implements Serializable {
public static final OaUser DEFAULT = new OaUser(-1, -1, "default", "default", "default", -1, -1, -1);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
......
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.UserDao; import com.blt.other.module.auth.dao.UserDao;
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.IOaUserService; import com.blt.other.module.auth.service.IOaUserService;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostDao; import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostLogDao; import com.blt.other.module.cost.dao.CostLogDao;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostLogService; import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.database.model.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import com.blt.other.module.database.model.UserDomain; import com.blt.other.module.database.model.UserDomain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -56,6 +61,10 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -56,6 +61,10 @@ public class CostLogServiceImpl implements CostLogService {
IOaUserService oaUserService; IOaUserService oaUserService;
@Resource @Resource
CostDao costDao; CostDao costDao;
@Resource
CostReviewerMapper costReviewerMapper;
@Resource
CostCompanyDao costCompanyDao;
@Override @Override
public Integer saveByManage(String costNo, String updateMainNote, Integer type) { public Integer saveByManage(String costNo, String updateMainNote, Integer type) {
...@@ -66,10 +75,39 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -66,10 +75,39 @@ public class CostLogServiceImpl implements CostLogService {
CostDomain costDomain = costDao.selectByCostNo(costNo); CostDomain costDomain = costDao.selectByCostNo(costNo);
OaUser oaUser = oaUserService.selectManage(costDomain.getCreateUserid()); OaUser oaUser = oaUserService.selectManage(costDomain.getCreateUserid());
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
OaUser reviewer;
if (type.equals(CostLogDomain.DEPARTMENT_AUTO_PASS)) {
reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.departmentReviewer)
.eq(CostReviewer::getReferId, oaUser.getPrimaryDepartmentId()))
.stream()
.findAny()
.map(costReviewer -> oaUserService.selectManage(costReviewer.getReviewerUserId()))
.orElse(OaUser.DEFAULT);
} else if (type.equals(CostLogDomain.FINANCIAL_AUTO_PASS)) {
reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.financialReviewer)
.eq(CostReviewer::getReferId, costCompany.getId()))
.stream()
.findAny()
.map(costReviewer -> oaUserService.selectManage(costReviewer.getReviewerUserId()))
.orElse(OaUser.DEFAULT);
} else if (type.equals(CostLogDomain.FINAL_AUTO_PASS)) {
reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.finalReviewer)
.eq(CostReviewer::getReferId, costCompany.getId()))
.stream()
.findAny()
.map(costReviewer -> oaUserService.selectManage(costReviewer.getReviewerUserId()))
.orElse(OaUser.DEFAULT);
} else {
throw new BizRuntimeException("invalid param");
}
costLog.setUpdateUsercode(oaUser.getUserCode()); costLog.setUpdateUsercode(reviewer.getUserCode());
costLog.setUpdateUsername(oaUser.getUserName()); costLog.setUpdateUsername(reviewer.getUserName());
costLog.setUpdateUserid(oaUser.getOaUserId()); costLog.setUpdateUserid(reviewer.getOaUserId());
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 + " 更新人:" + oaUser.getUserName()); costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + oaUser.getUserName());
......
...@@ -10,7 +10,6 @@ import com.blt.other.module.auth.model.OaUser; ...@@ -10,7 +10,6 @@ import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.auth.service.IOaDepartmentService; import com.blt.other.module.auth.service.IOaDepartmentService;
import com.blt.other.module.auth.service.IOaUserService; 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.database.model.CostCompanyDomain;
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;
......
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