Commit 80032e4c by huluobin

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

parent e81c22f5
......@@ -14,88 +14,159 @@ import java.util.List;
@Data
public class CostDto {
private Integer id; // 费用单表 id
private String costNo; // 费用单编号
private String costPlanNo; // 费用计划编号
private String companyNo; // 主体编号
private String companyName; // 主体名称
private String typeNo; // 大类编号
private String typeName; // 大类标题
private String kindNo; // 小类编号
private String kindName; // 小类标题
private Integer createUserid; // 创建人 id
private String createUsercode; // 创建人编号
private String createUsername; // 创建人名称
private String costRemark; // 费用单备注
// 费用单编号
private Integer id;
@ApiModelProperty("费用单编号")
private String costNo;
@ApiModelProperty("费用计划编号")
private String costPlanNo;
@ApiModelProperty("主体编号")
private String companyNo;
@ApiModelProperty("主体名称")
private String companyName;
@ApiModelProperty("类型编号")
private String typeNo;
@ApiModelProperty("类型标题")
private String typeName;
@ApiModelProperty("科目编号")
private String subjectCode;
@ApiModelProperty("小类编号")
private String kindNo;
@ApiModelProperty("小类标题")
private String kindName;
@ApiModelProperty("创建人id")
private Integer createUserid;
@ApiModelProperty("创建人编号")
private String createUsercode;
@ApiModelProperty("创建人名称")
private String createUsername;
@ApiModelProperty("费用单备注")
private String costRemark;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; // 创建时间
private String sonCostNo; // 关联子单
private String supCostNo; // 关联父单
private Integer costStatus; // 费用单状态 0 未提交 1待审核 2待出纳付款 3已支付
private String costStatusDto; // 费用单状态 0 未提交 1待审核 2待出纳付款 3已支付
private String filePath; // 文件地址
private String fileName; // 文件名
private String morFilePath; // 补充材料地址
private String morFileName; // 补充材料文件名
private BigDecimal amount; // 费用总金额
private String amountDto;
private Integer subLogisticsSupplierId; // 二级物流供应商ID
private Integer logisticsSupplierId; // 一级物流供应商ID
private String bankName; // 收款银行(平台)
private String bankCard; // 收款账户
private String bankCardUser; // 收款用户名
private String bankCompany; // 收款/付款单位
private String morRemark; // 补充信息
private Integer isLend; // 0 普通费用 1 借支 2 借还
private String isLendDto;// 0 普通费用 1 借支 2 借还
private Integer costForm; // 费用类型
private String costFormDto; // 费用类型
private String costReason; // 付款理由
private BigDecimal hadPay; // 借支单已还金额
private Integer lendStatus; // 借支单状态 1 未还 2 部分还款 3 结清
private String lendStatusDto;
private BigDecimal compensate; // 借支单补偿金额
private BigDecimal counteract; // 冲销金额
private BigDecimal lendBalance; // 借还单余额
private String rejectReason; // 驳回原因
private String dic; // 币种
private String dicDto; // 币种
private BigDecimal payCounteract; // 借还单冲销金额 ( 支付币种 )
private BigDecimal payLendBalance; // 借还单余额 ( 支付币种 )
private BigDecimal payPlanAmount; // 计划金额 ( 支付币种 )
private String payPlanAmountDto;
private String payDic; // 支付币种
private String payDicDto; // 支付币种
private BigDecimal payCur; // 汇率
private Integer isTax; // 0 不抵扣个税 1 抵扣个税
private String isTaxStr; // 0 不抵扣个税 1 抵扣个税
private String detailKey; // 出纳系统 detailKey
private Date createTime;
// @ApiModelProperty("关联子单")puh
// @Deprecated
// private String sonCostNo;
@ApiModelProperty("关联父单")
private String supCostNo;
@ApiModelProperty("费用单状态 0 待提交 1- 待财务审核 2待出纳付款 3被驳回 4已支付 5已作废 6-待部门审核 7-待财务审核 8-待最终审核人审核")
private Integer costStatus;
@ApiModelProperty("文件地址")
private String filePath;
@ApiModelProperty("补充材料地址")
private String morFilePath;
@ApiModelProperty("补充信息")
private String morRemark;
@ApiModelProperty("费用总金额")
private BigDecimal amount;
@ApiModelProperty("二级物流供应商ID")
private Integer subLogisticsSupplierId;
@ApiModelProperty("一级物流供应商ID")
private Integer logisticsSupplierId;
@ApiModelProperty("收款银行(平台)")
private String bankName;
@ApiModelProperty("收款账户")
private String bankCard;
@ApiModelProperty("收款用户名")
private String bankCardUser;
@ApiModelProperty("收款/付款单位")
private String bankCompany;
@ApiModelProperty("1 付款费用 2 收款费用 3 借支/借还")
private Integer costForm;
@ApiModelProperty("1 借支 2 借还")
private Integer isLend;
@ApiModelProperty("1 未还 2 部分还款 3 待补差额 4 结清")
private Integer lendStatus;
@ApiModelProperty("付款理由")
private String costReason;
@ApiModelProperty("驳回原因")
private String rejectReason;
@ApiModelProperty("借支单已还金额")
private BigDecimal hadPay;
@ApiModelProperty("借支单补偿金额")
private BigDecimal compensate;
@ApiModelProperty("冲销金额 (借支单币种)")
private BigDecimal counteract;
@ApiModelProperty("借还单余额 (借支单币种)")
private BigDecimal lendBalance;
@ApiModelProperty("对应借支单币种)")
private String dic;
@ApiModelProperty("借还单冲销金额 ( 支付币种 )")
private BigDecimal payCounteract;
@ApiModelProperty("借还单余额 ( 支付币种 )")
private BigDecimal payLendBalance;
@ApiModelProperty("计划金额 ( 支付币种 )")
private BigDecimal payPlanAmount;
@ApiModelProperty("支付币种")
private String payDic;
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal payCur;
@ApiModelProperty("0 不抵扣个税 1 抵扣个税")
private Integer isTax;
@ApiModelProperty("出纳系统 detailKey")
private String detailKey;
@ApiModelProperty("支付者用户ID")
private Integer payUserId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date payTime; // 付款时间
@ApiModelProperty("支付时间")
private Date payTime;
@ApiModelProperty("转人民币汇率")
private BigDecimal toRmbRate;
@ApiModelProperty("费用单人民币总金额")
private BigDecimal amountRmb;
@ApiModelProperty("公司主体value")
private Integer companyValue;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("财务审核时间")
private Date auditTime;
@ApiModelProperty("费用单发票状态编号")
private Integer hasInvoice;
@ApiModelProperty("驳回类型")
private Integer rejectType;
private Integer rejectTime;
@ApiModelProperty("财务驳回时间")
private Date rejectTime;
@ApiModelProperty("")
private String cashierFilePath;
@ApiModelProperty("")
private String cashierDownloadPath;
//费用来源 1-默认 2-WMS 3-调拨系统
@ApiModelProperty("费用来源 1-默认 2-WMS 3-调拨系统")
private String sourceFrom;
//项目
@ApiModelProperty("项目")
private String projectType;
//客户编号
private String customerNum;
@TableField(exist = false)
private Integer primaryDepartmentId;
@TableField(exist = false)
private String primaryDepartmentName;
@ApiModelProperty("能否审核")
@TableField(exist = false)
private Boolean canAudit;
@ApiModelProperty("客户编号")
private String customerNum;
@TableField(typeHandler = JacksonTypeHandler.class)
@ApiModelProperty("附加字段")
......@@ -104,35 +175,43 @@ public class CostDto {
@ApiModelProperty("费用模版id")
private Integer costTemplateId;
@TableField(exist = false)
private CostTemplateDto costTemplate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime lastModifyDate;
///-------------
@ApiModelProperty("科目编号")
private String subjectCode;
@ApiModelProperty("支付者用户ID")
private Integer payUserId;
@ApiModelProperty("能否审核")
@TableField(exist = false)
private Boolean canAudit;
@ApiModelProperty("转人民币汇率")
private BigDecimal toRmbRate;
@ApiModelProperty("借支单,还款申请金额,包括已还的和申请中 ,借支单币种。")
private BigDecimal repaymentAppliedAmount;
@ApiModelProperty("费用单人民币总金额")
private BigDecimal amountRmb;
@TableField(exist = false)
private Integer primaryDepartmentId;
@TableField(exist = false)
private String primaryDepartmentName;
@ApiModelProperty("公司主体value")
private Integer companyValue;
@ApiModelProperty("最终审核人")
private String finalReviewerUserName;
@ApiModelProperty("财务审核人")
private String financialFinalReviewerUserName;
@ApiModelProperty("部门审核人")
private String departmentReviewerUserName;
@ApiModelProperty("行政审核人")
private String hrReviewerUserName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("财务审核时间")
private Date auditTime;
private String costStatusDto; // 费用单状态 0 未提交 1待审核 2待出纳付款 3已支付
private String fileName; // 文件名
private String morFileName; // 补充材料文件名
private String amountDto;
private String isLendDto;// 0 普通费用 1 借支 2 借还
private String costFormDto; // 费用类型
private String lendStatusDto;
private String dicDto; // 币种
private String payPlanAmountDto;
private String payDicDto; // 支付币种
private String isTaxStr; // 0 不抵扣个税 1 抵扣个税
@ApiModelProperty("借支单,还款申请金额,包括已还的和申请中 ,借支单币种。")
private BigDecimal repaymentAppliedAmount;
@TableField(exist = false)
private CostTemplateDto costTemplate;
}
......@@ -13,4 +13,7 @@ public interface CostLogDao {
Integer insert(CostLogDomain log);
List<CostLogDomain> selectByCostNo(String costNo);
//查询部门审核日志
CostLogDomain selectDepartmentCheckLog(String costNo);
}
......@@ -10,9 +10,10 @@ public interface CostLogService {
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<String> getListLogs(List<CostLogDomain> logs);
}
......@@ -67,7 +67,7 @@ public class CostLogServiceImpl implements CostLogService {
CostCompanyDao costCompanyDao;
@Override
public Integer saveByManage(String costNo, String updateMainNote, Integer type) {
public void saveByManage(String costNo, String updateMainNote, Integer type) {
CostLogDomain costLog = new CostLogDomain();
costLog.setCostNo(costNo);
costLog.setUpdateTime(new Date());
......@@ -115,7 +115,7 @@ public class CostLogServiceImpl implements CostLogService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + reviewer.getUserName());
costLog.setType(type);
return costLogDao.insert(costLog);
costLogDao.insert(costLog);
}
@Override
......
......@@ -12,13 +12,11 @@ import com.blt.other.module.database.model.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,7 +29,6 @@ import java.util.*;
@Service
public class CostTypeKindServiceImpl implements CostTypeKindService {
private static Logger logger = LoggerFactory.getLogger(CostTypeKindServiceImpl.class);
@Autowired
private CostTypeKindDao costTypeKindDao;
@Autowired
......@@ -52,13 +49,6 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return getDtoList(costTypeKindDomains);
}
/**
* 分页获取所有费用小类
*
* @param pageSize
* @param pageNum
* @return
*/
@Override
public Map<String, Object> getAllKindWithPage(Integer pageNum, Integer pageSize) {
Map<String, Object> result = new HashMap<>();
......@@ -76,8 +66,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
@Override
public List<CostTypeKindDto> getListByTypeNo(String typeNo) {
List<CostTypeKindDomain> costTypeKindDomains = costTypeKindDao.selectByTypeNo(typeNo);
List<CostTypeKindDto> dtoList = getDtoList(costTypeKindDomains);
return dtoList;
return getDtoList(costTypeKindDomains);
}
@Override
......@@ -86,11 +75,6 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return getDtoList(costTypeKindDomains);
}
/**
* 保存费用种类记录
*
* @return
*/
@Override
public Integer saveNewKind(CostTypeKindDomain costTypeKindDomain) {
// 是否已经存在相同 typeNo 、kindName 的记录
......@@ -99,139 +83,124 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return null;
}
// 执行 doInsert()
Integer integer = doInsert(costTypeKindDomain);
return integer;
return doInsert(costTypeKindDomain);
}
/**
* 根据 kindNo 获取费用单详情
*
* @param kindNo
* @return
*/
@Override
public CostTypeKindDomain getKindByKindNo(String kindNo) {
return costTypeKindDao.selectByKindNo(kindNo);
}
/**
* Excel 导入费用小类
*
* @param file
* @return
* @throws Exception
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean importByExcel(MultipartFile file, String createUsercode) throws Exception {
boolean notNull = false;
boolean isExcel2003 = true;
String fileName = file.getOriginalFilename();
assert fileName != null;
if (fileName.matches("^.+\\.(?i)(xlsx)$")) {
isExcel2003 = false;
}
InputStream is = file.getInputStream();
Workbook wb = null;
Workbook wb;
if (isExcel2003) {
wb = new HSSFWorkbook(is);
} else {
wb = new XSSFWorkbook(is);
}
if (null != wb) {
List<CostTypeKindDomain> list = new ArrayList<>();
for (int s = 0; s < wb.getNumberOfSheets(); s++) {
Sheet sheet = wb.getSheetAt(s);
if (sheet != null) {
notNull = true;
CostTypeKindDomain costTypeKindDomain;
String typeName = "";
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
if (row == null) {
continue;
}
if (null == row.getCell(0) || String.valueOf(row.getCell(0).getNumericCellValue()).isEmpty()) {
List<CostTypeKindDomain> list = new ArrayList<>();
for (int s = 0; s < wb.getNumberOfSheets(); s++) {
Sheet sheet = wb.getSheetAt(s);
if (sheet != null) {
notNull = true;
CostTypeKindDomain costTypeKindDomain;
String typeName = "";
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
if (row == null) {
continue;
}
if (null == row.getCell(0) || String.valueOf(row.getCell(0).getNumericCellValue()).isEmpty()) {
// 超出的多余行数,跳过
continue;
continue;
// System.out.print("序号1 ");
} else if (null == row.getCell(0) || row.getCell(0).getNumericCellValue() == 0) {
} else if (null == row.getCell(0) || row.getCell(0).getNumericCellValue() == 0) {
// System.out.print("序号2 ");
// 超出的多余行数,跳过
continue;
} else {
}
continue;
}
costTypeKindDomain = new CostTypeKindDomain();
CostCompanyDomain companyDomain = null;
if (null == row.getCell(1) || row.getCell(1).getStringCellValue().isEmpty()) {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不能为空");
} else {
// 根据公司主体名称获取主体信息,不存在则抛出异常
String companyName = row.getCell(1).getStringCellValue();
companyDomain = costCompanyDao.selectByName(companyName);
if (null == companyDomain || null == companyDomain.getCompanyNo()) {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不存在或主体信息不全");
}
costTypeKindDomain.setCompanyNo(companyDomain.getCompanyNo());
costTypeKindDomain.setCompanyName(companyDomain.getCompanyName());
costTypeKindDomain = new CostTypeKindDomain();
CostCompanyDomain companyDomain;
if (null == row.getCell(1) || row.getCell(1).getStringCellValue().isEmpty()) {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不能为空");
} else {
// 根据公司主体名称获取主体信息,不存在则抛出异常
String companyName = row.getCell(1).getStringCellValue();
companyDomain = costCompanyDao.selectByName(companyName);
if (null == companyDomain || null == companyDomain.getCompanyNo()) {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不存在或主体信息不全");
}
costTypeKindDomain.setCompanyNo(companyDomain.getCompanyNo());
costTypeKindDomain.setCompanyName(companyDomain.getCompanyName());
}
// 科目编码 第 2 列
if (null != row.getCell(2)) {
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
if (!row.getCell(2).getStringCellValue().isEmpty()) {
costTypeKindDomain.setSubjectCode(row.getCell(2).getStringCellValue());
} else {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 科目编码不明确");
}
// 科目编码 第 2 列
if (null != row.getCell(2)) {
// row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
row.getCell(2).setCellType(CellType.STRING);
if (!row.getCell(2).getStringCellValue().isEmpty()) {
costTypeKindDomain.setSubjectCode(row.getCell(2).getStringCellValue());
} else {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 科目编码不明确");
}
} else {
throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 科目编码不明确");
}
// 大类 第 5 列
if ((null != row.getCell(5) && !row.getCell(5).getStringCellValue().isEmpty())) {
typeName = row.getCell(5).getStringCellValue();
// 大类 第 5 列
if ((null != row.getCell(5) && !row.getCell(5).getStringCellValue().isEmpty())) {
typeName = row.getCell(5).getStringCellValue();
// 11111111(companyDomain.getCompanyName()+" "+typeName);
saveTypePIO(companyDomain, typeName, row, s, r);
}
CostTypeDomain typeDomain = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(), typeName);
if (null == typeDomain) {
typeDomain = saveTypePIO(companyDomain, typeName, row, s, r);
saveTypePIO(companyDomain, typeName, row, s, r);
}
CostTypeDomain typeDomain = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(), typeName);
if (null == typeDomain) {
typeDomain = saveTypePIO(companyDomain, typeName, row, s, r);
// throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " null");
} else {
typeDomain = setCostForm(typeDomain, row, s, r);
}
costTypeKindDomain.setTypeNo(typeDomain.getTypeNo());
costTypeKindDomain.setTypeName(typeName);
costTypeKindDomain.setCostForm(typeDomain.getCostForm());
costTypeKindDomain.setIsLend(typeDomain.getIsLend());
// 小类 第 6 列
costTypeKindDomain.setKindName(row.getCell(6).getStringCellValue());
CostTypeKindDomain costTypeKind = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain);
if (null != costTypeKind && null != costTypeKind.getKindName()) {
continue;
}
costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomain.setId(r);
costTypeKindDomain = setCreateUser(costTypeKindDomain, createUsercode);
list.add(costTypeKindDomain);
} else {
typeDomain = setCostForm(typeDomain, row, s, r);
}
costTypeKindDomain.setTypeNo(typeDomain.getTypeNo());
costTypeKindDomain.setTypeName(typeName);
costTypeKindDomain.setCostForm(typeDomain.getCostForm());
costTypeKindDomain.setIsLend(typeDomain.getIsLend());
// 小类 第 6 列
costTypeKindDomain.setKindName(row.getCell(6).getStringCellValue());
CostTypeKindDomain costTypeKind = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain);
if (null != costTypeKind && null != costTypeKind.getKindName()) {
continue;
}
costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomain.setId(r);
costTypeKindDomain = setCreateUser(costTypeKindDomain, createUsercode);
list.add(costTypeKindDomain);
}
}
// 将导入的小类列表加入数据库
if (null != list && list.size() >= 1) {
for (CostTypeKindDomain costTypeKindDomain : list) {
CostTypeKindDomain costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
while (null != costTypeKindDomainGet) {
costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
}
// TODO try 重复的 kindNo
costTypeKindDao.insert(costTypeKindDomain);
}
// 将导入的小类列表加入数据库
if (null != list && list.size() >= 1) {
for (CostTypeKindDomain costTypeKindDomain : list) {
CostTypeKindDomain costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
while (null != costTypeKindDomainGet) {
costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
}
// TODO try 重复的 kindNo
costTypeKindDao.insert(costTypeKindDomain);
}
}
return notNull;
......@@ -252,8 +221,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
costTypeKindDomain.setCompanyNo(costTypeDomain.getCompanyNo());
costTypeKindDomain.setCompanyName(costTypeDomain.getCompanyName());
}
Integer i = costTypeKindDao.update(costTypeKindDomain);
return i;
return costTypeKindDao.update(costTypeKindDomain);
}
@Override
......@@ -275,9 +243,9 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
typeDomain.setCompanyName(companyDomain.getCompanyName());
typeDomain.setCompanyNo(companyDomain.getCompanyNo());
typeDomain = setCostForm(typeDomain, row, s, r);
setCostForm(typeDomain, row, s, r);
// TODO try 重复的 typeNo
Integer insert = costTypeDao.insert(typeDomain);
costTypeDao.insert(typeDomain);
}
return typeDomain;
}
......@@ -328,14 +296,13 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomain.setCostTypeStatus(1);
costTypeKindDomain.setSubjectCode(costTypeDomain.getSubjectCode());
Integer result = costTypeKindDao.insert(costTypeKindDomain);
return result;
return costTypeKindDao.insert(costTypeKindDomain);
}
/**
* 生成唯一的费用种类编号
*
* @return
* @return 唯一的费用种类编号
*/
private String createKindNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
......@@ -356,15 +323,15 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
for (CostTypeKindDomain costTypeKindDomain : list) {
costTypeKindDto = new CostTypeKindDto();
BeanUtils.copyProperties(costTypeKindDomain, costTypeKindDto);
costTypeKindDto.setCostTypeStatusDto(getCostTypeStatus("cost_type_status", costTypeKindDto.getCostTypeStatus()));
costTypeKindDto.setCostTypeStatusDto(getCostTypeStatus(costTypeKindDto.getCostTypeStatus()));
costTypeKindDtoList.add(costTypeKindDto);
}
}
return costTypeKindDtoList;
}
private String getCostTypeStatus(String statusname, Integer statuskey) {
return statusMapper.getStatusValue(statusname, statuskey);
private String getCostTypeStatus(Integer statusKey) {
return statusMapper.getStatusValue("cost_type_status", statusKey);
}
@Override
......
......@@ -3,10 +3,12 @@ package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.model.CostReviewer;
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.CostTemplate;
import com.blt.other.module.database.model.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -21,6 +23,7 @@ import java.time.LocalDateTime;
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
@Slf4j
@Component
public class FinalCheckState extends CostState {
......@@ -28,7 +31,22 @@ public class FinalCheckState extends CostState {
UnPayState unPayState;
@Resource
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)
@Override
......@@ -44,15 +62,18 @@ public class FinalCheckState extends CostState {
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)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//通知财务系统
costContext.costService.toFinancial(costDomain);
log.info("费用单:{}不需要最终审核审核,并且主体不是工会。最终审核人自动通过", costDomain.getCostNo());
this.autoPass();
return;
}
......@@ -60,15 +81,8 @@ public class FinalCheckState extends CostState {
if (costTemplate.shouldFinalAutoCheck(costDomain)) {
//自动审核通过
if (this.autoCheck(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);
log.info("费用单:{}需要自动审核并且自动审核规则校验通过.最终审核人自动通过", costDomain.getCostNo());
this.autoPass();
return;
}
}
......@@ -80,6 +94,7 @@ public class FinalCheckState extends CostState {
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
log.info("费用单:{}最终审核人工审核通过", costDomain.getCostNo());
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS);
//流转状态
......@@ -114,6 +129,7 @@ public class FinalCheckState extends CostState {
costContext.costService.reject(costDomain.getCostNo());
log.info("费用单:{}最终审核拒绝,理由:{}", costDomain.getCostNo(), rejectReason);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE);
}
......
......@@ -6,9 +6,9 @@ import com.bailuntec.common.exception.BizException;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.blt.other.common.util.PathUtil;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
......@@ -98,10 +98,10 @@ public class CostFileUtil {
return qiniuUpload(localFile);
}
@SuppressWarnings("all")
public String qiniuUpload(File localFilePath) {
//1、构造一个带指定Zone对象的配置类
Configuration cfg = new Configuration(Zone.zone2());
// Configuration cfg = new Configuration(Zone.zone2());
Configuration cfg = new Configuration(Region.region2());
//2、其他参数参考类注释
UploadManager uploadManager = new UploadManager(cfg);
//3、生成上传凭证,然后准备上传
......
......@@ -32,7 +32,7 @@
<AsyncLogger name="io.lettuce" level="ERROR" includeLocation="true"/>
<AsyncRoot level="INFO" includeLocation="true">
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
<!-- <appender-ref ref="CONSOLE"/>-->
</AsyncRoot>
</Loggers>
......
......@@ -419,24 +419,14 @@
group_concat(distinct t8.reviewer_user_name) as hr_reviewer_user_name
from cost t1
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_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
<!--# </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>-->
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
left join cost_reviewer t8 on t3.id = t8.refer_id and t5.type = 4
where true
/*财务 或者 最终审核 只显示待审核的*/
<if test="req.type == 1">
and (t1.cost_status = 7 or t1.cost_status = 8)
......@@ -486,7 +476,6 @@
order by t1.create_time desc
</select>
<select id="appCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
......
......@@ -33,6 +33,11 @@
or company_name LIKE CONCAT('%',#{key},'%')
</if>
</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 id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
......
......@@ -4,24 +4,25 @@
<mapper namespace="com.blt.other.module.cost.dao.CostLogDao">
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO
cost_log(
cost_no,update_usercode,update_username,update_time,update_note,update_userid
)
VALUE
(
#{costNo},#{updateUsercode},#{updateUsername},#{updateTime},#{updateNote},#{updateUserid}
)
INSERT INTO cost_log(cost_no, update_usercode, update_username, update_time, update_note, update_userid)
VALUE
(
#{costNo}, #{updateUsercode}, #{updateUsername}, #{updateTime}, #{updateNote}, #{updateUserid}
)
</insert>
<select id="selectByCostNo" resultType="com.blt.other.module.database.model.CostLogDomain">
SELECT
*
FROM
cost_log
WHERE
cost_no = #{costNo}
ORDER BY
id DESC
SELECT *
FROM cost_log
WHERE cost_no = #{costNo}
ORDER BY id DESC
</select>
<select id="selectDepartmentCheckLog" resultType="com.blt.other.module.database.model.CostLogDomain">
select *
from cost_log
where cost_no = #{costNo}
and type in (2, 3)
order by update_time desc
limit 1;
</select>
</mapper>
......@@ -64,7 +64,7 @@ public class CodeGenerator {
PackageConfig pc = new PackageConfig();
String s = scanner("模块名");
String ss = "." + s;
pc.setParent("com.blt.other" + ss);
pc.setParent("com.blt.other.module" + ss);
pc.setEntity("model");
pc.setService("service");
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