Commit bac604e6 by huluobin

state update

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