|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.huaxu.dict.DictUtil;
|
|
|
import com.huaxu.evaluation.dao.EvaluationItemMapper;
|
|
|
import com.huaxu.evaluation.entity.EvaluationCycleEntity;
|
|
|
import com.huaxu.evaluation.entity.EvaluationGradeEntity;
|
|
@@ -38,6 +39,8 @@ public class EvaluationItemServiceImpl extends ServiceImpl<EvaluationItemMapper,
|
|
|
private EvaluationItemValueService evaluationItemValueService;
|
|
|
@Autowired
|
|
|
private OrgInfoUtil orgInfoUtil;
|
|
|
+ @Autowired
|
|
|
+ private DictUtil dictUtil;
|
|
|
/**
|
|
|
* 自定义分页查询,含关联实体对像
|
|
|
*/
|
|
@@ -50,10 +53,24 @@ public class EvaluationItemServiceImpl extends ServiceImpl<EvaluationItemMapper,
|
|
|
//1是公司,2是公司及以下,3部门,4部门及以下,5自定义
|
|
|
evaluationItemEntity.setPermissonType(currentUser.getPermissonType());
|
|
|
}
|
|
|
+ if(evaluationItemEntity.getDeptOrgId()!=null) {
|
|
|
+ Integer tempCompanyId = orgInfoUtil.getOrgCompanyId(evaluationItemEntity.getDeptOrgId());
|
|
|
+ if (tempCompanyId != null) {
|
|
|
+ evaluationItemEntity.setCompanyOrgId(tempCompanyId);
|
|
|
+ } else {
|
|
|
+ evaluationItemEntity.setCompanyOrgId(evaluationItemEntity.getDeptOrgId());
|
|
|
+ evaluationItemEntity.setDeptOrgId(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
Page<EvaluationItemEntity> iPage = evaluationItemMapper.findPage(page, evaluationItemEntity);
|
|
|
for (EvaluationItemEntity item : iPage.getRecords()) {
|
|
|
item.setCompanyOrgName(orgInfoUtil.getOrgName(item.getCompanyOrgId()));
|
|
|
item.setDeptOrgName(orgInfoUtil.getOrgName(item.getDeptOrgId()));
|
|
|
+ //考评周期
|
|
|
+ String[] cycles = item.getCycle().split(",");
|
|
|
+ for (String cycle : cycles) {
|
|
|
+ item.setCycleName(item.getCycleName() == null ? dictUtil.getDictName("SC_EVALUATION_CYCLE ", Integer.valueOf(cycle)) : item.getCycleName() + "," + dictUtil.getDictName("SC_EVALUATION_CYCLE ", Integer.valueOf(cycle)));
|
|
|
+ }
|
|
|
//查询考评项分支
|
|
|
EvaluationItemValueEntity entity = new EvaluationItemValueEntity();
|
|
|
entity.setEvaluationItemId(item.getId());
|
|
@@ -101,23 +118,31 @@ public class EvaluationItemServiceImpl extends ServiceImpl<EvaluationItemMapper,
|
|
|
*/
|
|
|
public boolean addEvaluationItem(EvaluationItemEntity evaluationItem) {
|
|
|
LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
- if (this.save(evaluationItem)) {
|
|
|
- Long id = evaluationItem.getId();
|
|
|
- for (EvaluationItemValueEntity item : evaluationItem.getItemValues()) {
|
|
|
- if (currentUser != null) {
|
|
|
- item.setTenantId(currentUser.getTenantId());
|
|
|
- item.setCreateBy(currentUser.getUsername());
|
|
|
- item.setUpdateBy(currentUser.getUsername());
|
|
|
+ for (Integer itemCompanyId : evaluationItem.getDeptOrgIds()) {
|
|
|
+ Integer companyId = orgInfoUtil.getOrgCompanyId(itemCompanyId);
|
|
|
+ if (companyId != null) {
|
|
|
+ evaluationItem.setCompanyOrgId(companyId);
|
|
|
+ evaluationItem.setDeptOrgId(itemCompanyId);
|
|
|
+ } else {
|
|
|
+ evaluationItem.setCompanyOrgId(itemCompanyId);
|
|
|
+ }
|
|
|
+ if (this.save(evaluationItem)) {
|
|
|
+ Long id = evaluationItem.getId();
|
|
|
+ for (EvaluationItemValueEntity item : evaluationItem.getItemValues()) {
|
|
|
+ if (currentUser != null) {
|
|
|
+ item.setTenantId(currentUser.getTenantId());
|
|
|
+ item.setCreateBy(currentUser.getUsername());
|
|
|
+ item.setUpdateBy(currentUser.getUsername());
|
|
|
+ }
|
|
|
+ item.setEvaluationItemId(id);
|
|
|
+ item.setStatus(1);
|
|
|
+ item.setDateUpdate(new Date());
|
|
|
+ item.setDateCreate(new Date());
|
|
|
+ evaluationItemValueService.addEvaluationItemValue(item);
|
|
|
}
|
|
|
- item.setEvaluationItemId(id);
|
|
|
- item.setStatus(1);
|
|
|
- item.setDateUpdate(new Date());
|
|
|
- item.setDateCreate(new Date());
|
|
|
- evaluationItemValueService.addEvaluationItemValue(item);
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|