Commit a39eb5ec by huluobin

update

parent 8997cfc0
...@@ -82,7 +82,7 @@ public class CostReviewerController { ...@@ -82,7 +82,7 @@ public class CostReviewerController {
@RequestParam Integer oaDepartmentId, @RequestParam Integer oaDepartmentId,
@RequestParam String departmentReviewerUserIds) { @RequestParam String departmentReviewerUserIds) {
oaDepartmentService.modifyFinancialReviewer(userId, oaDepartmentId, Lists.newArrayList(departmentReviewerUserIds.split(",")) oaDepartmentService.modifyFinancialReviewer(userId, oaDepartmentId, Lists.newArrayList(departmentReviewerUserIds.split(","))
.stream().map(Integer::valueOf).collect(Collectors.toList()))); .stream().map(Integer::valueOf).collect(Collectors.toList()));
return CostResult.success(); return CostResult.success();
} }
......
...@@ -50,21 +50,6 @@ public interface CostTypeKindService { ...@@ -50,21 +50,6 @@ public interface CostTypeKindService {
CostTypeKindDomain getKindByKindNo(String kindNo); CostTypeKindDomain getKindByKindNo(String kindNo);
/** /**
* 根据费用小类名称和公司名称获取种类信息
* @param kindName
* @param companyName
* @return
*/
CostTypeKindDomain getKindByKindNameAndCompanyName(String kindName, String companyName);
/**
* 获取指定费用类型小类列表
* @param companyNo
* @return
*/
List<CostTypeKindDto> getListByCompanyNoAndCostForm(String companyNo,Integer costForm);
/**
* Excel 导入费用小类 * Excel 导入费用小类
* @param file * @param file
*/ */
......
...@@ -45,11 +45,19 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos ...@@ -45,11 +45,19 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
@Override @Override
public void edit(CostTemplate costTemplate) { public void edit(CostTemplate costTemplate) {
this.save(costTemplate);
List<CostTemplateCol> costTemplateColList = costTemplate.getCostTemplateColList();
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateId(costTemplate.getId()));
costTemplateColService.saveBatch(costTemplateColList);
} }
@Override @Override
public void delete(Integer id) { public void delete(Integer id) {
this.removeById(id); if (id != null) {
this.removeById(id);
costTemplateColService.remove(new LambdaQueryWrapper<CostTemplateCol>()
.eq(CostTemplateCol::getCostTemplateId, id));
}
} }
} }
package com.blt.other.cost.service.impl; package com.blt.other.cost.service.impl;
import com.bailuntec.cost.api.dto.CostTypeKindDto;
import com.blt.other.auth.dao.UserDao; import com.blt.other.auth.dao.UserDao;
import com.blt.other.cost.dao.CostCompanyDao; import com.blt.other.cost.dao.CostCompanyDao;
import com.blt.other.cost.dao.CostTypeDao; import com.blt.other.cost.dao.CostTypeDao;
import com.blt.other.cost.dao.CostTypeKindDao; import com.blt.other.cost.dao.CostTypeKindDao;
import com.blt.other.cost.dao.LogisticsSupplierBankDao; import com.blt.other.cost.dao.LogisticsSupplierBankDao;
import com.bailuntec.cost.api.dto.CostTypeKindDto;
import com.blt.other.cost.service.CostTypeKindService; import com.blt.other.cost.service.CostTypeKindService;
import com.blt.other.database.mapper.StatusMapper; import com.blt.other.database.mapper.StatusMapper;
import com.blt.other.database.model.*; import com.blt.other.database.model.*;
...@@ -57,20 +57,21 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -57,20 +57,21 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
/** /**
* 分页获取所有费用小类 * 分页获取所有费用小类
*
* @param pageSize * @param pageSize
* @param pageNum * @param pageNum
* @return * @return
*/ */
@Override @Override
public Map<String, Object> getAllKindWithPage(Integer pageNum, Integer pageSize) { public Map<String, Object> getAllKindWithPage(Integer pageNum, Integer pageSize) {
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum, pageSize);
List<CostTypeKindDomain> costTypeKindDomains = costTypeKindDao.selectAll(); List<CostTypeKindDomain> costTypeKindDomains = costTypeKindDao.selectAll();
PageInfo<CostTypeKindDomain> pageInfo = new PageInfo<>(costTypeKindDomains); PageInfo<CostTypeKindDomain> pageInfo = new PageInfo<>(costTypeKindDomains);
List<CostTypeKindDto> dtoList = getDtoList(costTypeKindDomains); List<CostTypeKindDto> dtoList = getDtoList(costTypeKindDomains);
result.put("kinds",dtoList); result.put("kinds", dtoList);
result.put("pageInfo",pageInfo); result.put("pageInfo", pageInfo);
return result; return result;
} }
...@@ -90,13 +91,14 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -90,13 +91,14 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
/** /**
* 保存费用种类记录 * 保存费用种类记录
*
* @return * @return
*/ */
@Override @Override
public Integer saveNewKind(CostTypeKindDomain costTypeKindDomain) { public Integer saveNewKind(CostTypeKindDomain costTypeKindDomain) {
// 是否已经存在相同 typeNo 、kindName 的记录 // 是否已经存在相同 typeNo 、kindName 的记录
CostTypeKindDomain costTypeDomain = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain); CostTypeKindDomain costTypeDomain = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain);
if (null != costTypeDomain && null != costTypeDomain.getTypeNo()){ if (null != costTypeDomain && null != costTypeDomain.getTypeNo()) {
return null; return null;
} }
// 执行 doInsert() // 执行 doInsert()
...@@ -106,6 +108,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -106,6 +108,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
/** /**
* 根据 kindNo 获取费用单详情 * 根据 kindNo 获取费用单详情
*
* @param kindNo * @param kindNo
* @return * @return
*/ */
...@@ -114,40 +117,17 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -114,40 +117,17 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return costTypeKindDao.selectByKindNo(kindNo); return costTypeKindDao.selectByKindNo(kindNo);
} }
/**
* 根据费用小类名称和公司名称获取种类信息
* @param kindName
* @param companyName
* @return
*/
@Override
public CostTypeKindDomain getKindByKindNameAndCompanyName(String kindName, String companyName) {
return costTypeKindDao.selectByKindNameAndCompanyName(kindName, companyName);
}
/** /**
* 获取指定费用类型小类列表 * Excel 导入费用小类
* @param companyNo *
* @return
*/
@Override
public List<CostTypeKindDto> getListByCompanyNoAndCostForm(String companyNo,Integer costForm) {
CostTypeKindDomain costTypeKindDomain = new CostTypeKindDomain();
costTypeKindDomain.setCompanyNo(companyNo);
costTypeKindDomain.setCostForm(costForm);
List<CostTypeKindDomain> domains = costTypeKindDao.selectByCompanyNoAndCostForm(costTypeKindDomain);
return getDtoList(domains);
}
/**
* Excel 导入费用小类
* @param file * @param file
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Transactional(readOnly = false,rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public Boolean importByExcel(MultipartFile file,String createUsercode) throws Exception{ public Boolean importByExcel(MultipartFile file, String createUsercode) throws Exception {
boolean notNull = false; boolean notNull = false;
boolean isExcel2003 = true; boolean isExcel2003 = true;
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
...@@ -161,70 +141,70 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -161,70 +141,70 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
} else { } else {
wb = new XSSFWorkbook(is); wb = new XSSFWorkbook(is);
} }
if (null != wb){ if (null != wb) {
List<CostTypeKindDomain> list = new ArrayList<>(); List<CostTypeKindDomain> list = new ArrayList<>();
for (int s =0 ;s < wb.getNumberOfSheets();s++){ for (int s = 0; s < wb.getNumberOfSheets(); s++) {
Sheet sheet = wb.getSheetAt(s); Sheet sheet = wb.getSheetAt(s);
if(sheet!=null){ if (sheet != null) {
notNull = true; notNull = true;
CostTypeKindDomain costTypeKindDomain; CostTypeKindDomain costTypeKindDomain;
String typeName = ""; String typeName = "";
for (int r = 1; r <= sheet.getLastRowNum(); r++) { for (int r = 1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
if (row == null){ if (row == null) {
continue; continue;
} }
if (null == row.getCell(0) || String.valueOf(row.getCell(0).getNumericCellValue()).isEmpty()){ if (null == row.getCell(0) || String.valueOf(row.getCell(0).getNumericCellValue()).isEmpty()) {
// 超出的多余行数,跳过 // 超出的多余行数,跳过
continue; continue;
// System.out.print("序号1 "); // 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 "); // System.out.print("序号2 ");
// 超出的多余行数,跳过 // 超出的多余行数,跳过
continue; continue;
}else { } else {
} }
costTypeKindDomain = new CostTypeKindDomain(); costTypeKindDomain = new CostTypeKindDomain();
CostCompanyDomain companyDomain = null; CostCompanyDomain companyDomain = null;
if (null == row.getCell(1) || row.getCell(1).getStringCellValue().isEmpty()) { if (null == row.getCell(1) || row.getCell(1).getStringCellValue().isEmpty()) {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 行公司主体不能为空"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不能为空");
}else { } else {
// 根据公司主体名称获取主体信息,不存在则抛出异常 // 根据公司主体名称获取主体信息,不存在则抛出异常
String companyName = row.getCell(1).getStringCellValue(); String companyName = row.getCell(1).getStringCellValue();
companyDomain = costCompanyDao.selectByName(companyName); companyDomain = costCompanyDao.selectByName(companyName);
if (null == companyDomain || null == companyDomain.getCompanyNo()){ if (null == companyDomain || null == companyDomain.getCompanyNo()) {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 行公司主体不存在或主体信息不全"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行公司主体不存在或主体信息不全");
} }
costTypeKindDomain.setCompanyNo(companyDomain.getCompanyNo()); costTypeKindDomain.setCompanyNo(companyDomain.getCompanyNo());
costTypeKindDomain.setCompanyName(companyDomain.getCompanyName()); costTypeKindDomain.setCompanyName(companyDomain.getCompanyName());
} }
// 科目编码 第 2 列 // 科目编码 第 2 列
if (null != row.getCell(2) ){ if (null != row.getCell(2)) {
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
if (!row.getCell(2).getStringCellValue().isEmpty()) { if (!row.getCell(2).getStringCellValue().isEmpty()) {
costTypeKindDomain.setSubjectCode(row.getCell(2).getStringCellValue()); costTypeKindDomain.setSubjectCode(row.getCell(2).getStringCellValue());
}else { } else {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 科目编码不明确"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 科目编码不明确");
} }
}else { } else {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 科目编码不明确"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 科目编码不明确");
} }
// 大类 第 5 列 // 大类 第 5 列
if ((null != row.getCell(5) && !row.getCell(5).getStringCellValue().isEmpty())){ if ((null != row.getCell(5) && !row.getCell(5).getStringCellValue().isEmpty())) {
typeName = row.getCell(5).getStringCellValue(); typeName = row.getCell(5).getStringCellValue();
// 11111111(companyDomain.getCompanyName()+" "+typeName); // 11111111(companyDomain.getCompanyName()+" "+typeName);
saveTypePIO(companyDomain,typeName,row,s,r); saveTypePIO(companyDomain, typeName, row, s, r);
} }
CostTypeDomain typeDomain = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(),typeName); CostTypeDomain typeDomain = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(), typeName);
if (null == typeDomain){ if (null == typeDomain) {
typeDomain = saveTypePIO(companyDomain, typeName, row, s, r); typeDomain = saveTypePIO(companyDomain, typeName, row, s, r);
// throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " null"); // throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " null");
}else { } else {
typeDomain = setCostForm(typeDomain, row,s,r); typeDomain = setCostForm(typeDomain, row, s, r);
} }
costTypeKindDomain.setTypeNo(typeDomain.getTypeNo()); costTypeKindDomain.setTypeNo(typeDomain.getTypeNo());
costTypeKindDomain.setTypeName(typeName); costTypeKindDomain.setTypeName(typeName);
...@@ -234,21 +214,21 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -234,21 +214,21 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
// 小类 第 6 列 // 小类 第 6 列
costTypeKindDomain.setKindName(row.getCell(6).getStringCellValue()); costTypeKindDomain.setKindName(row.getCell(6).getStringCellValue());
CostTypeKindDomain costTypeKind = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain); CostTypeKindDomain costTypeKind = costTypeKindDao.selectByTypeNoAndKindName(costTypeKindDomain);
if (null != costTypeKind && null != costTypeKind.getKindName()){ if (null != costTypeKind && null != costTypeKind.getKindName()) {
continue; continue;
} }
costTypeKindDomain.setKindNo(createKindNo()); costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomain.setId(r); costTypeKindDomain.setId(r);
costTypeKindDomain = setCreateUser(costTypeKindDomain,createUsercode); costTypeKindDomain = setCreateUser(costTypeKindDomain, createUsercode);
list.add(costTypeKindDomain); list.add(costTypeKindDomain);
} }
} }
} }
// 将导入的小类列表加入数据库 // 将导入的小类列表加入数据库
if(null != list && list.size() >= 1){ if (null != list && list.size() >= 1) {
for (CostTypeKindDomain costTypeKindDomain : list){ for (CostTypeKindDomain costTypeKindDomain : list) {
CostTypeKindDomain costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo()); CostTypeKindDomain costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
while (null != costTypeKindDomainGet){ while (null != costTypeKindDomainGet) {
costTypeKindDomain.setKindNo(createKindNo()); costTypeKindDomain.setKindNo(createKindNo());
costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo()); costTypeKindDomainGet = costTypeKindDao.selectByKindNo(costTypeKindDomain.getKindNo());
} }
...@@ -260,7 +240,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -260,7 +240,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return notNull; return notNull;
} }
private CostTypeKindDomain setCreateUser(CostTypeKindDomain costTypeKindDomain,String createUsercode){ private CostTypeKindDomain setCreateUser(CostTypeKindDomain costTypeKindDomain, String createUsercode) {
UserDomain select = userDao.select(createUsercode); UserDomain select = userDao.select(createUsercode);
costTypeKindDomain.setCreateUsercode(createUsercode); costTypeKindDomain.setCreateUsercode(createUsercode);
costTypeKindDomain.setCreateUsername(select.getUsername()); costTypeKindDomain.setCreateUsername(select.getUsername());
...@@ -284,48 +264,48 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -284,48 +264,48 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
return costTypeKindDao.delete(kindNo); return costTypeKindDao.delete(kindNo);
} }
private CostTypeDomain saveTypePIO (CostCompanyDomain companyDomain, private CostTypeDomain saveTypePIO(CostCompanyDomain companyDomain,
String typeName, String typeName,
Row row, Row row,
Integer s, Integer s,
Integer r){ Integer r) {
CostTypeDomain type = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(),typeName); CostTypeDomain type = costTypeDao.selectByCompanyNameAndTypeName(companyDomain.getCompanyName(), typeName);
CostTypeDomain typeDomain = new CostTypeDomain(); CostTypeDomain typeDomain = new CostTypeDomain();
if (null == type || null == type.getTypeNo()){ if (null == type || null == type.getTypeNo()) {
typeDomain.setTypeNo(createTypeNo()); typeDomain.setTypeNo(createTypeNo());
typeDomain.setTypeName(typeName); typeDomain.setTypeName(typeName);
typeDomain.setSubjectCode(row.getCell(2).getStringCellValue()); typeDomain.setSubjectCode(row.getCell(2).getStringCellValue());
typeDomain.setCompanyName(companyDomain.getCompanyName()); typeDomain.setCompanyName(companyDomain.getCompanyName());
typeDomain.setCompanyNo(companyDomain.getCompanyNo()); typeDomain.setCompanyNo(companyDomain.getCompanyNo());
typeDomain = setCostForm(typeDomain, row,s,r); typeDomain = setCostForm(typeDomain, row, s, r);
// TODO try 重复的 typeNo // TODO try 重复的 typeNo
Integer insert = costTypeDao.insert(typeDomain); Integer insert = costTypeDao.insert(typeDomain);
} }
return typeDomain; return typeDomain;
} }
private CostTypeDomain setCostForm(CostTypeDomain typeDomain,Row row,Integer s,Integer r){ private CostTypeDomain setCostForm(CostTypeDomain typeDomain, Row row, Integer s, Integer r) {
// 费用类型 第 4 列 // 费用类型 第 4 列
if (null != row.getCell(4) && !row.getCell(4).getStringCellValue().isEmpty()){ if (null != row.getCell(4) && !row.getCell(4).getStringCellValue().isEmpty()) {
String costFormStr = row.getCell(4).getStringCellValue(); String costFormStr = row.getCell(4).getStringCellValue();
if ("付款".equals(costFormStr)){ if ("付款".equals(costFormStr)) {
typeDomain.setCostForm(1); typeDomain.setCostForm(1);
}else if ("收款".equals(costFormStr)){ } else if ("收款".equals(costFormStr)) {
typeDomain.setCostForm(2); typeDomain.setCostForm(2);
}else { } else {
typeDomain.setCostForm(3); typeDomain.setCostForm(3);
if ("借支".equals(costFormStr)){ if ("借支".equals(costFormStr)) {
typeDomain.setIsLend(1); typeDomain.setIsLend(1);
}else if ("借还".equals(costFormStr)){ } else if ("借还".equals(costFormStr)) {
typeDomain.setIsLend(2); typeDomain.setIsLend(2);
}else { } else {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 行费用类型不明确"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行费用类型不明确");
} }
} }
}else { } else {
throw new RuntimeException("sheet"+(s+1)+" "+"第 "+(r)+ " 行费用类型不明确"); throw new RuntimeException("sheet" + (s + 1) + " " + "第 " + (r) + " 行费用类型不明确");
} }
return typeDomain; return typeDomain;
} }
...@@ -333,10 +313,10 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -333,10 +313,10 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
private String createTypeNo() { private String createTypeNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss");
Random random = new Random(); Random random = new Random();
String typeNo = "CTN"+sdf.format(new Date())+random.nextInt(9); String typeNo = "CTN" + sdf.format(new Date()) + random.nextInt(9);
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo); CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
while (null != costTypeDomain){ while (null != costTypeDomain) {
typeNo = "CTN"+sdf.format(new Date())+random.nextInt(9); typeNo = "CTN" + sdf.format(new Date()) + random.nextInt(9);
costTypeDomain = costTypeDao.selectByTypeNo(typeNo); costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
} }
return typeNo; return typeNo;
...@@ -345,7 +325,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -345,7 +325,7 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
private Integer doInsert(CostTypeKindDomain costTypeKindDomain) { private Integer doInsert(CostTypeKindDomain costTypeKindDomain) {
// 获取 type 信息 // 获取 type 信息
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costTypeKindDomain.getTypeNo()); CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costTypeKindDomain.getTypeNo());
BeanUtils.copyProperties(costTypeDomain,costTypeKindDomain); BeanUtils.copyProperties(costTypeDomain, costTypeKindDomain);
// 补充剩余属性,执行 insert // 补充剩余属性,执行 insert
costTypeKindDomain.setId(null); costTypeKindDomain.setId(null);
costTypeKindDomain.setKindNo(createKindNo()); costTypeKindDomain.setKindNo(createKindNo());
...@@ -354,37 +334,39 @@ public class CostTypeKindServiceImpl implements CostTypeKindService { ...@@ -354,37 +334,39 @@ public class CostTypeKindServiceImpl implements CostTypeKindService {
Integer result = costTypeKindDao.insert(costTypeKindDomain); Integer result = costTypeKindDao.insert(costTypeKindDomain);
return result; return result;
} }
/** /**
* 生成唯一的费用种类编号 * 生成唯一的费用种类编号
*
* @return * @return
*/ */
private String createKindNo(){ private String createKindNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
Random random = new Random(); Random random = new Random();
String costTypeKindNo = "CTK"+sdf.format(new Date())+random.nextInt(9); String costTypeKindNo = "CTK" + sdf.format(new Date()) + random.nextInt(9);
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(costTypeKindNo); CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(costTypeKindNo);
while (null != costTypeKindDomain && null != costTypeKindDomain.getKindName()){ while (null != costTypeKindDomain && null != costTypeKindDomain.getKindName()) {
costTypeKindNo = "CTK"+sdf.format(new Date())+random.nextInt(9); costTypeKindNo = "CTK" + sdf.format(new Date()) + random.nextInt(9);
costTypeKindDomain = costTypeKindDao.selectByKindNo(costTypeKindNo); costTypeKindDomain = costTypeKindDao.selectByKindNo(costTypeKindNo);
} }
return costTypeKindNo; return costTypeKindNo;
} }
private List<CostTypeKindDto> getDtoList(List<CostTypeKindDomain> list){ private List<CostTypeKindDto> getDtoList(List<CostTypeKindDomain> list) {
List<CostTypeKindDto> costTypeKindDtoList = new ArrayList<>(); List<CostTypeKindDto> costTypeKindDtoList = new ArrayList<>();
if (null != list && list.size() >= 1){ if (null != list && list.size() >= 1) {
CostTypeKindDto costTypeKindDto; CostTypeKindDto costTypeKindDto;
for (CostTypeKindDomain costTypeKindDomain : list){ for (CostTypeKindDomain costTypeKindDomain : list) {
costTypeKindDto = new CostTypeKindDto(); costTypeKindDto = new CostTypeKindDto();
BeanUtils.copyProperties(costTypeKindDomain,costTypeKindDto); BeanUtils.copyProperties(costTypeKindDomain, costTypeKindDto);
costTypeKindDto.setCostTypeStatusDto(getCostTypeStatus("cost_type_status",costTypeKindDto.getCostTypeStatus())); costTypeKindDto.setCostTypeStatusDto(getCostTypeStatus("cost_type_status", costTypeKindDto.getCostTypeStatus()));
costTypeKindDtoList.add(costTypeKindDto); costTypeKindDtoList.add(costTypeKindDto);
} }
} }
return costTypeKindDtoList; return costTypeKindDtoList;
} }
private String getCostTypeStatus(String statusname,Integer statuskey){ private String getCostTypeStatus(String statusname, Integer statuskey) {
String statusValue = statusMapper.getStatusValue(statusname, statuskey); String statusValue = statusMapper.getStatusValue(statusname, statuskey);
return statusValue; return statusValue;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
SELECT t1.*, t2.`name` company_name SELECT t1.*, t2.`name` company_name
from oa_department t1 from oa_department t1
LEFT JOIN oa_company t2 on t1.company_id = t2.oa_company_id LEFT JOIN oa_company t2 on t1.company_id = t2.oa_company_id
left join cost_reviewer t3 on t1.id = t3.refer_id and (t3.type = 1) left join cost_reviewer t3 on t1.department_id = t3.refer_id and (t3.type = 1)
where t1.parent_id = 0 where t1.parent_id = 0
/*审核人*/ /*审核人*/
<if test="req.reviewerUserId !=null"> <if test="req.reviewerUserId !=null">
......
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