Commit 80032e4c by huluobin

审批流涉及到的人要展示出来,比如待部门审核,需要审批人

parent e81c22f5
...@@ -13,4 +13,7 @@ public interface CostLogDao { ...@@ -13,4 +13,7 @@ public interface CostLogDao {
Integer insert(CostLogDomain log); Integer insert(CostLogDomain log);
List<CostLogDomain> selectByCostNo(String costNo); List<CostLogDomain> selectByCostNo(String costNo);
//查询部门审核日志
CostLogDomain selectDepartmentCheckLog(String costNo);
} }
...@@ -10,9 +10,10 @@ public interface CostLogService { ...@@ -10,9 +10,10 @@ public interface CostLogService {
Integer save(String costNo, Integer updateUserid, String updateMainNote, Integer type); Integer save(String costNo, Integer updateUserid, String updateMainNote, Integer type);
Integer saveByManage(String costNo, String updateMainNote, Integer type); void saveByManage(String costNo, 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);
} }
...@@ -67,7 +67,7 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -67,7 +67,7 @@ public class CostLogServiceImpl implements CostLogService {
CostCompanyDao costCompanyDao; CostCompanyDao costCompanyDao;
@Override @Override
public Integer saveByManage(String costNo, String updateMainNote, Integer type) { public void saveByManage(String costNo, String updateMainNote, Integer type) {
CostLogDomain costLog = new CostLogDomain(); CostLogDomain costLog = new CostLogDomain();
costLog.setCostNo(costNo); costLog.setCostNo(costNo);
costLog.setUpdateTime(new Date()); costLog.setUpdateTime(new Date());
...@@ -115,7 +115,7 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -115,7 +115,7 @@ public class CostLogServiceImpl implements CostLogService {
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 + " 更新人:" + reviewer.getUserName()); costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + reviewer.getUserName());
costLog.setType(type); costLog.setType(type);
return costLogDao.insert(costLog); costLogDao.insert(costLog);
} }
@Override @Override
......
...@@ -3,10 +3,12 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -3,10 +3,12 @@ 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.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
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.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.CostCompanyDomain; 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 lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -21,6 +23,7 @@ import java.time.LocalDateTime; ...@@ -21,6 +23,7 @@ import java.time.LocalDateTime;
* @author robbendev * @author robbendev
* @since 2020/10/30 2:57 下午 * @since 2020/10/30 2:57 下午
*/ */
@Slf4j
@Component @Component
public class FinalCheckState extends CostState { public class FinalCheckState extends CostState {
...@@ -28,7 +31,22 @@ public class FinalCheckState extends CostState { ...@@ -28,7 +31,22 @@ public class FinalCheckState extends CostState {
UnPayState unPayState; UnPayState unPayState;
@Resource @Resource
CostCompanyDao costCompanyDao; CostCompanyDao costCompanyDao;
@Resource
CostLogDao costLogDao;
private void autoPass() {
CostDomain costDomain = costContext.costDomain;
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//流转状态
nextState(unPayState);
//通知财务系统
costContext.costService.toFinancial(costDomain);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
...@@ -44,15 +62,18 @@ public class FinalCheckState extends CostState { ...@@ -44,15 +62,18 @@ public class FinalCheckState extends CostState {
throw new BizRuntimeException("invalid status"); throw new BizRuntimeException("invalid status");
} }
//部门审核人和最终审核人是同一个人,最终审核人自动通过。
CostLogDomain costLogDomain = costLogDao.selectDepartmentCheckLog(costDomain.getCostNo());
if (costLogDomain != null && costLogDomain.getUpdateUserid().equals(currentUserId)) {
log.info("费用单:{}部门审核人和最终审核人是同一个人,最终审核人自动通过。", costDomain.getCostNo());
this.autoPass();
return;
}
//如果不需要审核 并且主体不是工会 直接通过 //如果不需要审核 并且主体不是工会 直接通过
if (!costTemplate.shouldFinalCheck(costDomain)) { if (!costTemplate.shouldFinalCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); log.info("费用单:{}不需要最终审核审核,并且主体不是工会。最终审核人自动通过", costDomain.getCostNo());
costDomain.setLastModifyDate(LocalDateTime.now()); this.autoPass();
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//通知财务系统
costContext.costService.toFinancial(costDomain);
return; return;
} }
...@@ -60,15 +81,8 @@ public class FinalCheckState extends CostState { ...@@ -60,15 +81,8 @@ public class FinalCheckState extends CostState {
if (costTemplate.shouldFinalAutoCheck(costDomain)) { if (costTemplate.shouldFinalAutoCheck(costDomain)) {
//自动审核通过 //自动审核通过
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); log.info("费用单:{}需要自动审核并且自动审核规则校验通过.最终审核人自动通过", costDomain.getCostNo());
costDomain.setLastModifyDate(LocalDateTime.now()); this.autoPass();
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//流转状态
nextState(unPayState);
//通知财务系统
costContext.costService.toFinancial(costDomain);
return; return;
} }
} }
...@@ -80,6 +94,7 @@ public class FinalCheckState extends CostState { ...@@ -80,6 +94,7 @@ public class FinalCheckState extends CostState {
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
log.info("费用单:{}最终审核人工审核通过", costDomain.getCostNo());
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS); costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS);
//流转状态 //流转状态
...@@ -114,6 +129,7 @@ public class FinalCheckState extends CostState { ...@@ -114,6 +129,7 @@ public class FinalCheckState extends CostState {
costContext.costService.reject(costDomain.getCostNo()); costContext.costService.reject(costDomain.getCostNo());
log.info("费用单:{}最终审核拒绝,理由:{}", costDomain.getCostNo(), rejectReason);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE); costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE);
} }
......
...@@ -6,9 +6,9 @@ import com.bailuntec.common.exception.BizException; ...@@ -6,9 +6,9 @@ import com.bailuntec.common.exception.BizException;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.blt.other.common.util.PathUtil; import com.blt.other.common.util.PathUtil;
import com.qiniu.common.QiniuException; import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response; import com.qiniu.http.Response;
import com.qiniu.storage.Configuration; import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager; import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet; import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth; import com.qiniu.util.Auth;
...@@ -98,10 +98,10 @@ public class CostFileUtil { ...@@ -98,10 +98,10 @@ public class CostFileUtil {
return qiniuUpload(localFile); return qiniuUpload(localFile);
} }
@SuppressWarnings("all")
public String qiniuUpload(File localFilePath) { public String qiniuUpload(File localFilePath) {
//1、构造一个带指定Zone对象的配置类 //1、构造一个带指定Zone对象的配置类
Configuration cfg = new Configuration(Zone.zone2()); // Configuration cfg = new Configuration(Zone.zone2());
Configuration cfg = new Configuration(Region.region2());
//2、其他参数参考类注释 //2、其他参数参考类注释
UploadManager uploadManager = new UploadManager(cfg); UploadManager uploadManager = new UploadManager(cfg);
//3、生成上传凭证,然后准备上传 //3、生成上传凭证,然后准备上传
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<AsyncLogger name="io.lettuce" level="ERROR" includeLocation="true"/> <AsyncLogger name="io.lettuce" level="ERROR" includeLocation="true"/>
<AsyncRoot level="INFO" includeLocation="true"> <AsyncRoot level="INFO" includeLocation="true">
<appender-ref ref="FILE"/> <appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/> <!-- <appender-ref ref="CONSOLE"/>-->
</AsyncRoot> </AsyncRoot>
</Loggers> </Loggers>
......
...@@ -419,24 +419,14 @@ ...@@ -419,24 +419,14 @@
group_concat(distinct t8.reviewer_user_name) as hr_reviewer_user_name group_concat(distinct t8.reviewer_user_name) as hr_reviewer_user_name
from cost t1 from cost t1
left join cost_log t2 on t1.cost_no = t2.cost_no left join cost_log t2 on t1.cost_no = t2.cost_no
<!--# <if test="req.type == 1">--> left join cost_company t3 on t1.company_no = t3.company_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 cost_reviewer t4 on t3.id = t4.refer_id and t4.type = 3 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
left join cost_reviewer t5 on t3.id = t5.refer_id and t5.type = 2 left join cost_reviewer t8 on t3.id = t8.refer_id and t5.type = 4
<!--# </if>-->
-- 部门审核人
<!--# <if test="req.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
<!--# </if>-->
-- 行政审核
<!--# <if test="req.type == 3">-->
left join cost_company t3 on t1.company_no = t3.company_no
left join cost_reviewer t8 on t3.id = t8.refer_id and t5.type = 4
<!--# </if>-->
where true where true
/*财务 或者 最终审核 只显示待审核的*/ /*财务 或者 最终审核 只显示待审核的*/
<if test="req.type == 1"> <if test="req.type == 1">
and (t1.cost_status = 7 or t1.cost_status = 8) and (t1.cost_status = 7 or t1.cost_status = 8)
...@@ -486,7 +476,6 @@ ...@@ -486,7 +476,6 @@
order by t1.create_time desc order by t1.create_time desc
</select> </select>
<select id="appCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="appCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.* select t1.*
from cost t1 from cost t1
......
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
or company_name LIKE CONCAT('%',#{key},'%') or company_name LIKE CONCAT('%',#{key},'%')
</if> </if>
</foreach> </foreach>
<foreach collection="keys" item="key" index="index">
<if test="key != null and key != '' ">
or bank_card_user LIKE CONCAT('%',#{key},'%')
</if>
</foreach>
</select> </select>
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
......
...@@ -4,24 +4,25 @@ ...@@ -4,24 +4,25 @@
<mapper namespace="com.blt.other.module.cost.dao.CostLogDao"> <mapper namespace="com.blt.other.module.cost.dao.CostLogDao">
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO INSERT INTO cost_log(cost_no, update_usercode, update_username, update_time, update_note, update_userid)
cost_log( VALUE
cost_no,update_usercode,update_username,update_time,update_note,update_userid (
) #{costNo}, #{updateUsercode}, #{updateUsername}, #{updateTime}, #{updateNote}, #{updateUserid}
VALUE )
(
#{costNo},#{updateUsercode},#{updateUsername},#{updateTime},#{updateNote},#{updateUserid}
)
</insert> </insert>
<select id="selectByCostNo" resultType="com.blt.other.module.database.model.CostLogDomain"> <select id="selectByCostNo" resultType="com.blt.other.module.database.model.CostLogDomain">
SELECT SELECT *
* FROM cost_log
FROM WHERE cost_no = #{costNo}
cost_log ORDER BY id DESC
WHERE </select>
cost_no = #{costNo} <select id="selectDepartmentCheckLog" resultType="com.blt.other.module.database.model.CostLogDomain">
ORDER BY select *
id DESC from cost_log
where cost_no = #{costNo}
and type in (2, 3)
order by update_time desc
limit 1;
</select> </select>
</mapper> </mapper>
...@@ -64,7 +64,7 @@ public class CodeGenerator { ...@@ -64,7 +64,7 @@ public class CodeGenerator {
PackageConfig pc = new PackageConfig(); PackageConfig pc = new PackageConfig();
String s = scanner("模块名"); String s = scanner("模块名");
String ss = "." + s; String ss = "." + s;
pc.setParent("com.blt.other" + ss); pc.setParent("com.blt.other.module" + ss);
pc.setEntity("model"); pc.setEntity("model");
pc.setService("service"); pc.setService("service");
pc.setServiceImpl("service" + ".impl"); pc.setServiceImpl("service" + ".impl");
......
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