Commit 6fb07a96 by huluobin

财务审核状态过滤

parent 24cdb1fb
package com.blt.other.module.auth.service;
import com.blt.other.module.auth.vo.UserGetByBLUserAcct;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.UserDomain;
import org.springframework.lang.NonNull;
......@@ -51,4 +52,5 @@ public interface UserService {
* @return 费用系统用户列表
*/
List<UserDomain> getByCompanyId(@NonNull Integer companyId);
}
......@@ -3,6 +3,7 @@ package com.blt.other.module.auth.service.impl;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.auth.vo.UserGetByBLUserAcct;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.UserDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -113,4 +114,6 @@ public class UserServiceImpl implements UserService {
public List<UserDomain> getByCompanyId(@NonNull Integer companyId) {
return userDao.getByCompanyId(companyId);
}
}
......@@ -3,12 +3,14 @@ package com.blt.other.module.cost.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.blt.other.module.database.model.CostDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.time.LocalDateTime;
/**
......@@ -54,4 +56,15 @@ public class CostTemplateCol implements Serializable {
private CostTemplateBaseCol costTemplateBaseCol;
public Boolean RuleCheck(CostDomain costDomain) throws NoSuchFieldException, IllegalAccessException {
Class<CostDomain> clazz = CostDomain.class;
Field field = clazz.getDeclaredField(this.costTemplateBaseCol.getColName());
field.setAccessible(true);
Object fieldVar = field.get(costDomain);
return false;
}
}
package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.ListUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostTemplateBaseColMapper;
import com.blt.other.module.cost.dto.CostTemplateColReq;
......@@ -57,10 +58,13 @@ public class CostTemplateBaseColServiceImpl extends ServiceImpl<CostTemplateBase
@Override
public void setCostTemplateBaseCol(List<CostTemplateCol> costTemplateColList) {
List<Integer> costTemplateBaseColIds = costTemplateColList.stream().map(CostTemplateCol::getCostTemplateBaseColId).collect(Collectors.toList());
List<CostTemplateBaseCol> costTemplateBaseColList = this.listByIds(costTemplateBaseColIds);
if (ListUtil.isNotEmpty(costTemplateBaseColIds)) {
List<CostTemplateBaseCol> costTemplateBaseColList = this.listByIds(costTemplateBaseColIds);
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1));
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1));
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId())));
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId())));
}
}
}
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostTemplateColMapper;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.service.ICostTemplateBaseColService;
import com.blt.other.module.cost.service.ICostTemplateColService;
......@@ -54,11 +53,19 @@ public class CostTemplateColServiceImpl extends ServiceImpl<CostTemplateColMappe
.in(CostTemplateCol::getCostTemplateId, costTemplateIds));
costTemplateBaseColService.setCostTemplateBaseCol(costTemplateColList);
Map<Integer, List<CostTemplateCol>> map = costTemplateColList.stream().collect(Collectors.groupingBy(CostTemplateCol::getCostTemplateId));
costTemplateList.forEach(costTemplate -> {
costTemplate.setCostTemplateColList(map.get(costTemplate.getId()));
});
}
}
@Override
public void setCostTemplateCol(CostTemplate costTemplate) {
List<CostTemplateCol> costTemplateColList = this.list(new LambdaQueryWrapper<CostTemplateCol>()
.eq(CostTemplateCol::getCostTemplateId, costTemplate.getId()));
costTemplateBaseColService.setCostTemplateBaseCol(costTemplateColList);
costTemplate.setCostTemplateColList(costTemplateColList);
}
}
package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.ListUtil;
import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.cost.dao.CostTemplateMapper;
import com.blt.other.module.cost.dto.CostTemplateApiDto;
import com.blt.other.module.cost.model.CostTemplate;
......@@ -12,13 +12,13 @@ import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.service.ICostTemplateBaseColService;
import com.blt.other.module.cost.service.ICostTemplateColService;
import com.blt.other.module.cost.service.ICostTemplateService;
import com.blt.other.module.database.model.UserDomain;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -38,9 +38,16 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
ICostTemplateColService costTemplateColService;
@Resource
ICostTemplateBaseColService costTemplateBaseColService;
@Resource
UserService userService;
@Override
public void add(CostTemplate costTemplate) {
UserDomain userDomain = userService.findByUserid(costTemplate.getCreateUserId());
costTemplate.setCreateUserName(userDomain.getUsername());
costTemplate.setUpdateUserId(userDomain.getUseridsso());
costTemplate.setUpdateUserName(userDomain.getUsername());
this.save(costTemplate);
List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.defaultBaseColList(costTemplate.getCostType());
......@@ -62,27 +69,17 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
@Override
public CostTemplate queryDetail(Integer id) {
CostTemplate costTemplate = this.getById(id);
List<CostTemplateCol> costTemplateColList = costTemplateColService.list(new LambdaQueryWrapper<CostTemplateCol>()
.eq(CostTemplateCol::getCostTemplateId, id));
List<Integer> costTemplateBaseColIds = costTemplateColList.stream().map(CostTemplateCol::getCostTemplateBaseColId).collect(Collectors.toList());
if (ListUtil.isNotEmpty(costTemplateBaseColIds)) {
List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.listByIds(costTemplateBaseColIds);
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1));
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId())));
}
costTemplate.setCostTemplateColList(costTemplateColList);
costTemplateColService.setCostTemplateCol(costTemplate);
return costTemplate;
}
@Override
public void edit(CostTemplate costTemplate) {
this.save(costTemplate);
List<CostTemplateCol> costTemplateColList = costTemplate.getCostTemplateColList();
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateId(costTemplate.getId()));
costTemplateColService.saveBatch(costTemplateColList);
UserDomain userDomain = userService.findByUserid(costTemplate.getUpdateUserId());
costTemplate.setUpdateUserId(userDomain.getUseridsso());
costTemplate.setUpdateUserName(userDomain.getUsername());
this.updateById(costTemplate);
}
@Override
......@@ -103,7 +100,7 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview());
}
if (StringUtils.isNotEmpty(req.getTemplateName())) {
wrapper.eq(CostTemplate::getTemplateName, req.getTemplateName());
wrapper.like(CostTemplate::getTemplateName, req.getTemplateName());
}
if (req.getCreateUserId() != null) {
wrapper.eq(CostTemplate::getCreateUserId, req.getCreateUserId());
......@@ -128,7 +125,6 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
}
List<CostTemplate> costTemplateList = this.list(wrapper);
costTemplateColService.setCostTemplateCol(costTemplateList);
return list();
return costTemplateList;
}
}
......@@ -3,6 +3,9 @@ package com.blt.other.module.database.model;
import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.cost.api.dto.CostDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.common.util.CurUtils;
import com.blt.other.module.database.mapper.StatusMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -12,6 +15,7 @@ import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Date;
@TableName("cost")
@Data
public class CostDomain {
......@@ -22,6 +26,7 @@ public class CostDomain {
//借支/借还
public final static Integer COST_FROM_3 = 2;
// 费用单编号
@TableId(type = IdType.AUTO)
private Integer id;
// 费用单编号
private String costNo;
......
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