yz_08
2021-05-13 e83cdbeae135043cbf1b316660c32bc4c8ffdb83
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpLaborTroubleServiceImpl.java
@@ -2,8 +2,10 @@
import cc.mrbird.febs.common.core.constant.DicCode;
import cc.mrbird.febs.common.core.constant.ModuleCode;
import cc.mrbird.febs.common.core.entity.constant.FebsConstant;
import cc.mrbird.febs.common.core.entity.system.DicItem;
import cc.mrbird.febs.common.core.exception.FebsException;
import cc.mrbird.febs.common.core.utils.SortUtil;
import cc.mrbird.febs.server.hr.constant.MyConstant;
import cc.mrbird.febs.server.hr.entity.*;
import cc.mrbird.febs.server.hr.entity.EmpLaborTrouble;
@@ -71,7 +73,7 @@
         queryWrapper.like("a.CertificateNumb", empLabortrouble.getCertificateNumb());
      }
      if (StringUtils.isNotBlank(empLabortrouble.getDeptName())) {
         queryWrapper.like("a.DeptName", empLabortrouble.getDeptName());
         queryWrapper.like("b.allDeptName", empLabortrouble.getDeptName());
      }
      if (StringUtils.isNotBlank(empLabortrouble.getArbitrationDateStr())) {
         queryWrapper.between("a.ArbitrationDate", empLabortrouble.getArbitrationDateStr().split(",")[0],
@@ -88,13 +90,14 @@
         queryWrapper.eq("a.ArbitrationStatus", empLabortrouble.getArbitrationStatus());
      }
      if (StringUtils.isNotBlank(empLabortrouble.getEmpStatus())) {
         queryWrapper.eq("a.EmpStatus", empLabortrouble.getEmpStatus());
         queryWrapper.in("a.EmpStatus", empLabortrouble.getEmpStatus().split(","));
      }
      if (StringUtils.isNotBlank(empLabortrouble.getArbitrationReason())) {
         queryWrapper.like("a.ArbitrationReason", empLabortrouble.getArbitrationReason());
      }
      queryWrapper.in("c.dept_Id", remoteDeptService.userRightDepts().split(StringConstant.COMMA));
        Page<EmpLaborTrouble> page = new Page<>(request.getPageNum(), request.getPageSize());
        SortUtil.handlePageSort(request, page, "arbitrationDate", FebsConstant.ORDER_ASC, true);
        IPage<EmpLaborTrouble> iPage = empLabortroubleMapper.selectPageVo(page, queryWrapper);
        iPage.setRecords(this.convertDicItemName(iPage.getRecords()));
        return iPage;
@@ -177,15 +180,18 @@
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void importEmpLaborTrouble(List<List<Object>> listObject,List<String>  returnList) {
   public void importEmpLaborTrouble(List<List<Object>> listObject,List<String>  returnList,List<DicItem> dicItems ) {
      for (List<Object> list : listObject) {
         if (list.size()==0){
         if (list.size()==0||StrUtil.isBlank(list.get(0).toString())){
            continue;
         }
         EmpLaborTrouble empLabortrouble = new EmpLaborTrouble();
         empLabortrouble.setArbitrationId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE));
         empLabortrouble.setEmpNumb(list.get(0).toString());
         List<Dept> depts = CastUtil.castList(redisService.get("depts"), Dept.class);
         if(null == depts){
            depts =remoteDeptService.setDeptRedis();
         }
         Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(1).toString())).findFirst().orElse(null);
         if (null == dept) {
            returnList.add(StrUtil.format("导入员工劳资案件异常: 出现位置第{}行, 原因:{}部门不存在",listObject.indexOf(list)+1,list.get(1).toString()));
@@ -196,7 +202,7 @@
            returnList.add(StrUtil.format("导入员工劳资案件异常: 出现位置第{}行, 原因:{}员工编号不存在",listObject.indexOf(list)+1,list.get(0).toString()));
            continue;
         }
         empLabortrouble.setDelFlag(2);
         empLabortrouble.setDelFlag(0);
         empLabortrouble.setEmpId(empBaseInfo.getEmpId());
         empLabortrouble.setDeptName(list.get(1).toString());
         empLabortrouble.setDeptId(dept.getDeptId());
@@ -206,7 +212,14 @@
         if (StringUtils.isNotBlank(list.get(5).toString())) {
            empLabortrouble.setArbitrationDate(DateUtil.parseDateTime(list.get(5).toString()));
         }
         empLabortrouble.setArbitrationType(list.get(6).toString());
         //仲裁类型
         DicItem  dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"zctype")&&StrUtil.equals(j.getDicItemName(),list.get(6).toString())).findFirst().orElse(null);
         if (null!=dicItem){
            empLabortrouble.setArbitrationType(dicItem.getDicItemCode());
         }
         empLabortrouble.setArbitrationReason(list.get(7).toString());
         empLabortrouble.setReporter(list.get(8).toString());
         empLabortrouble.setRemark(list.get(9).toString());
@@ -229,10 +242,10 @@
        list.forEach(p -> {
            //仲裁类型
            p.setArbitrationTypeName(dicItems.stream()
                    .filter(k -> DicCode.ARBITRATIONTYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getArbitrationType()))
                    .filter(k -> DicCode.ZCTYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getArbitrationType()))
                    .findFirst()
                    .map(DicItem::getDicItemName)
                    .orElse("劳资纠纷"));
                    .orElse(""));
        });
        return  list;