|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
package org.sky.scientific.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
|
import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
@@ -36,6 +37,7 @@ import java.io.BufferedInputStream;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -63,8 +65,7 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
if (Func.notNull(vo.getTechnician())) {
|
|
|
vo.getTechnician().setForeign(!"在职".equals(vo.getTechnician().getNature()));
|
|
|
}
|
|
|
-// vo.setPjrgfy(vo.getPjrgfy() / 10000);
|
|
|
- }
|
|
|
+ }
|
|
|
return page.setRecords(dataList);
|
|
|
}
|
|
|
|
|
|
@@ -107,9 +108,6 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
excel.setIdCard(Func.isBlank(excel.getIdCard()) ? null : excel.getIdCard().trim());
|
|
|
|
|
|
Long technicianId = technicianMapper.getIdByNumberAndIdentityCard(excel.getNumber(), excel.getIdCard(), DateUtil.format(xmVO.getXmkssj(), DateUtil.PATTERN_YYYYMM));
|
|
|
-// List<Long> list = dbTechnicianList.stream()
|
|
|
-// .filter(technician -> Func.equals(technician.getNumber(), excel.getNumber()) || Func.equals(technician.getIdCard(), excel.getIdCard()))
|
|
|
-// .map(TechnicianEntity::getId).toList();
|
|
|
if (technicianId == null) {
|
|
|
throw new ServiceException("[" + excel.getName() + "]不存在");
|
|
|
}
|
|
|
@@ -117,9 +115,8 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
if (dbYsList.stream().anyMatch(ys -> Func.equals(ys.getTechnicianId(), technicianId))) {
|
|
|
throw new ServiceException("[" + excel.getName() + "]已在预算表中");
|
|
|
}
|
|
|
+ BeanUtil.copyProperties(excel, entity);
|
|
|
entity.setTechnicianId(technicianId);
|
|
|
- entity.setZzsc(excel.getZzsc());
|
|
|
- entity.setPjrgfy(excel.getPjrgfy() * 10000);
|
|
|
entity.setXmId(xmId);
|
|
|
insertList.add(entity);
|
|
|
|
|
|
@@ -149,9 +146,9 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
obj.put("number", Func.notNull(technician) ? technician.getNumber() : "");
|
|
|
obj.put("idCard", Func.notNull(technician) ? technician.getIdCard() : "");
|
|
|
obj.put("zzsc", temp.getZzsc());
|
|
|
- temp.setPjrgfy(temp.getPjrgfy() / 10000);
|
|
|
+ temp.setPjrgfy(temp.getPjrgfy().divide(BigDecimal.valueOf(10000L), 4 , RoundingMode.UP));
|
|
|
obj.put("pjrgfy", temp.getPjrgfy());
|
|
|
- obj.put("total", BigDecimal.valueOf(temp.getZzsc() * temp.getPjrgfy()));
|
|
|
+ obj.put("total", temp.getPjrgfy().multiply(BigDecimal.valueOf(temp.getZzsc())));
|
|
|
obj.put("foreignStr", Func.notNull(temp.getTechnician()) ? (temp.getTechnician().isForeign() ? "是" : "否") : "");
|
|
|
results.add(obj);
|
|
|
}
|
|
|
@@ -185,7 +182,7 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
if (dbTechnicianIdList.contains(ysRyrgfy.getTechnicianId())) {
|
|
|
throw new ServiceException("人员已在预算表中");
|
|
|
}
|
|
|
- ysRyrgfy.setPjrgfy(ysRyrgfy.getPjrgfy() * 10000);
|
|
|
+ ysRyrgfy.setPjrgfy(ysRyrgfy.getPjrgfy().multiply(BigDecimal.valueOf(10000)));
|
|
|
return this.save(ysRyrgfy);
|
|
|
}
|
|
|
|
|
|
@@ -202,7 +199,7 @@ public class YsRyrgfyServiceImpl extends BaseServiceImpl<YsRyrgfyMapper, YsRyrgf
|
|
|
throw new ServiceException("人员已在预算表中");
|
|
|
}
|
|
|
}
|
|
|
- ysRyrgfy.setPjrgfy(ysRyrgfy.getPjrgfy() * 10000);
|
|
|
+ ysRyrgfy.setPjrgfy(ysRyrgfy.getPjrgfy().multiply(BigDecimal.valueOf(10000)));
|
|
|
return this.updateById(ysRyrgfy);
|
|
|
}
|
|
|
}
|