Commit 6a1533ee by huluobin

update

parent 0df22e75
......@@ -20,5 +20,28 @@ public class CostAttach {
@ApiModelProperty("附加字段值")
private String value;
private String type;
private Integer costTemplateBaseColId;
@ApiModelProperty(value = "对应cost表字段名")
private String costCol;
@ApiModelProperty(value = "对应cost表字段数据库类型")
private String costColType;
@ApiModelProperty("字段类目")
private String colCategory;
@ApiModelProperty("提示")
private String prompt;
@ApiModelProperty(value = "表单字段名")
private String colName;
@ApiModelProperty(value = "1-单行文本 2-多行文本 3-下拉框 4-多选 5-日期 6-附件")
private Integer colType;
@ApiModelProperty(value = "表单字段数据来源 ")
private String colDataSource;
}
......@@ -152,7 +152,7 @@ public class CostController {
@ApiOperation("修改费用单信息")
@PostMapping({"reset/resetFile", "reset/resetNoFile"})
public CostApiDto.UpdateCostResp resetFile(CostDomain costDomain) {
public CostApiDto.UpdateCostResp resetFile(@RequestBody CostDomain costDomain) {
costService = CostServiceFactory.getCostService(costDomain);
CostApiDto.UpdateCostResp resp = costService.updateCost(costDomain);
......@@ -224,9 +224,10 @@ public class CostController {
public IPage<CostDto> financialCheckCostList(@RequestParam Integer userid,
@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type) {
@RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type,
@RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) {
costService = CostServiceFactory.getCostService();
return costService.checkCostList(userid, pageNum, pageSize, type);
return costService.checkCostList(userid, pageNum, pageSize, type, status);
}
@ApiOperation("部门审核通过")
......
......@@ -3,6 +3,7 @@ package com.blt.other.module.cost.dao;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CostExportVo;
import org.apache.ibatis.annotations.Param;
......@@ -155,4 +156,10 @@ public interface CostDao extends BaseMapper<CostDomain> {
Integer updateCashierAnnex(@Param("costNo") String costNo, @Param("filePath") String filePath, @Param("downloadUrl") String downloadUrl);
List<CostDto> getCostList(@Param("startDate") String startDate, @Param("endDate") String endDate);
IPage<CostDomain> checkCostList(@Param("page") IPage<CostDomain> page,
@Param("type") Integer type,
@Param("status") Integer status,
@Param("userid") Integer userid,
@Param("isManage") Boolean isManage);
}
......@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.blt.other.common.util.CurUtils;
import com.blt.other.module.database.mapper.StatusMapper;
......@@ -43,7 +42,7 @@ public class CostDomain implements Serializable {
public final static int STATUS_FINAL_CHECK = 8;
public final static int STATUS_UN_PAY = 2;
public final static int STATUS_PAYED = 3;
public final static int STATUS_PAYED = 4;
// 费用单编号
@TableId(type = IdType.AUTO)
......
......@@ -46,8 +46,8 @@ public class CostTemplateBaseCol implements Serializable {
@ApiModelProperty(value = "1-单行文本 2-多行文本 3-下拉框 4-多选 5-日期 6-附件")
private Integer colType;
@ApiModelProperty(value = "表单字段数据来源 1. input 人工输入 2. api 网络请求 3. enum 枚举")
private Integer colDataSource;
@ApiModelProperty(value = "表单字段数据来源 ")
private String colDataSource;
@ApiModelProperty("是否扩展字段")
private Boolean isExtension;
......
......@@ -108,7 +108,7 @@ public interface CostService {
* @param type 1-财务+最终审核 2-部门审核
* @return 费用单列表
*/
IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type);
IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type, Integer status);
/**
* <p>
......
......@@ -124,7 +124,8 @@ public abstract class AbstractCostService implements CostService {
CostApiDto.UpdateCostResp resp = new CostApiDto.UpdateCostResp();
setCostDomain(costDomain);
Integer update = costDao.updateByNo(costDomain);
Integer update = costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo()));
resp.setMsg("success");
......@@ -198,27 +199,13 @@ public abstract class AbstractCostService implements CostService {
@Transactional
@Override
public IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type) {
public IPage<CostDto> checkCostList(Integer userid, Integer pageNum, Integer pageSize, Integer type, Integer status) {
IPage<CostDomain> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<CostDomain> wrapper = new LambdaQueryWrapper<>();
UserDomain userDomain = userService.findByUserid(userid);
//财务或者管理员
if (userDomain.getIsadmin() != 0 || userDomain.getIsfinansys() != 0) {
wrapper.in(CostDomain::getCompanyValue, Lists.newArrayList(userDomain.getAuthority().split(",")));
} else {
wrapper.eq(CostDomain::getCreateUserid, userid);
}
//财务 最终审核
if (type == 1) {
wrapper.in(CostDomain::getCostStatus, CostDomain.STATUS_FINAL_CHECK, CostDomain.STATUS_DEPARTMENT_CHECK);
}
//部门审核
else if (type == 2) {
wrapper.in(CostDomain::getCostStatus, CostDomain.STATUS_DEPARTMENT_CHECK);
} else {
log.warn("invalid type");
}
return costDao.selectPage(page, wrapper).convert(CostDomain::castToDto);
Boolean isManage = userDomain.getIsadmin() != 0 || userDomain.getIsfinansys() != 0;
return costDao.checkCostList(page, type, status, userid, isManage).convert(CostDomain::castToDto);
}
@Resource
......
......@@ -40,7 +40,7 @@ public class DepartmentCheckState extends CostState {
if (autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门自动审核通过", CostLogDomain.AUTO_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门自动审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态
nextState(financialCheckState);
......@@ -56,7 +56,7 @@ public class DepartmentCheckState extends CostState {
if (costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门审核通过", CostLogDomain.MANUAL_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
nextState(financialCheckState);
//发布到总线尝试下个环节的自动审核
......
......@@ -54,7 +54,7 @@ public class FinalCheckState extends CostState {
if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核自动通过", CostLogDomain.AUTO_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//流转状态
nextState(unPayState);
......@@ -71,7 +71,7 @@ public class FinalCheckState extends CostState {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.MANUAL_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS);
//流转状态
nextState(unPayState);
......
......@@ -45,7 +45,7 @@ public class FinancialCheckState extends CostState {
if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务自动审核通过", CostLogDomain.AUTO_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务自动审核通过", CostLogDomain.FINANCIAL_AUTO_PASS);
//流转状态
nextState(finalCheckState);
......@@ -62,7 +62,7 @@ public class FinancialCheckState extends CostState {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.MANUAL_CHECK);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.FINANCIAL_MANUAL_PASS);
//流转状态
nextState(finalCheckState);
......
......@@ -36,12 +36,10 @@ public class UnSubmitState extends CostState {
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "提交费用单");
//清空审核上下文的审核人
costContext.currentUserId = null;
//并且流转到下一个状态
costContext.setCostState(departmentCheckState);
//尝试审核(由于清空了审核人,这里只会走自动审核)
costContext.handle();
nextState(departmentCheckState);
//发布到总线尝试下个环节的自动审核
costSubscribe.subscribe(costContext);
}
@Override
......
......@@ -6,6 +6,7 @@ import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.dto.CostPlanApiDto;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.service.*;
import com.blt.other.module.cost.utils.CostUtils;
import com.blt.other.module.database.model.*;
......@@ -15,6 +16,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
......@@ -73,6 +75,9 @@ public abstract class AbstractCostPlanService implements CostPlanService {
userCostFinansysService.saveFinansysRecord(finansyRecordByCostDomain);
}
@Resource
CostTemplateBaseColMapper costTemplateBaseColMapper;
/**
* <p>
* 补全费用计划参数
......@@ -91,6 +96,11 @@ public abstract class AbstractCostPlanService implements CostPlanService {
costPlanDomain.setCreateTime(new Date());
costPlanDomain.setPayCur(costPlanDomain.getCur());
costPlanDomain.getAttach().forEach(costAttach -> {
CostTemplateBaseCol costTemplateBaseCol = costTemplateBaseColMapper.selectById(costAttach.getCostTemplateBaseColId());
BeanUtils.copyProperties(costTemplateBaseCol, costAttach, "id");
});
}
......
......@@ -7,10 +7,15 @@ import java.util.Date;
@Data
public class CostLogDomain {
//更新
public static final int TYPE_UPDATE = 1;
public static final int MANUAL_CHECK = 2;
public static final int AUTO_CHECK = 3;
public static final int DEPARTMENT_AUTO_PASS = 2;
public static final int DEPARTMENT_MANUAL_PASS = 3;
public static final int FINANCIAL_AUTO_PASS = 4;
public static final int FINANCIAL_MANUAL_PASS = 5;
public static final int FINAL_AUTO_PASS = 6;
public static final int FINAL_MANUAL_PASS = 7;
private Integer id; // 费用单日志
private String costNo; // 费用单号
private String updateUsercode; // 更新人编号
......@@ -22,6 +27,9 @@ public class CostLogDomain {
private Integer updateUserid; // 更新人 ID
//1-更新费用单 2-审核费用单 3-自动审核费用单
//1-普通日志 2-部门审核费用单 3-部门审核费用单
//4 -财务部门自动通过审核 5-财务部门手动审核
//6-最终审核自动通过 7-最终审核手动通过
//
private Integer type;
}
......@@ -553,6 +553,37 @@
and last_modify_date &lt;= #{endDate}
</select>
<select id="checkCostList" resultMap="cost">
select t1.*
from cost t1
left join cost_log cl on t1.cost_no = cl.cost_no
where true
/*财务 或者 最终审核*/
<if test="type==1">
/*待审核*/
<if test=" status == 2 ">
and (t1.cost_status = 7 or t1.cost_status = 8)
</if>
</if>
/*部门审核*/
<if test="type==2">
/*待审核*/
<if test=" status == 2 ">
and t1.cost_status = 6
</if>
/*已手动审核*/
<if test=" status == 3 ">
and cl.type = 5
</if>
/*已自动审核*/
<if test=" status == 4 ">
and cl.type = 4
</if>
</if>
group by
t1.id
</select>
<update id="updateCashierAnnex">
update cost
set cashier_file_path = #{filePath},
......
......@@ -9,4 +9,4 @@ mvn clean package -U -Dmaven.test.skip=true -Dmaven.compile.fork=true
# shellcheck disable=SC2009
ps -ef | grep cost-core | grep -v grep | grep prod | awk '{print $2}' | xargs kill -9
# 运行
nohup java -Xms512m -Xmx512m -Xss1M -jar -Dspring.profiles.active=prod /home/ubuntu/data/other/dc-cost-system/bailuntec-cost-core/target/bailuntec-cost-core-1.0-SNAPSHOT.jar &
nohup java -Xms512m -Xmx1024m -Xss1M -jar -Dspring.profiles.active=prod /home/ubuntu/data/other/dc-cost-system/bailuntec-cost-core/target/bailuntec-cost-core-1.0-SNAPSHOT.jar &
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