|
@@ -1,12 +1,66 @@
|
|
|
package com.pig4cloud.pigx.qa.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.pig4cloud.pigx.qa.entity.SgTimeSheet;
|
|
|
import com.pig4cloud.pigx.qa.mapper.SgTimeSheetMapper;
|
|
|
import com.pig4cloud.pigx.qa.service.SgTimeSheetService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
public class SgTimeSheetServiceImpl extends ServiceImpl<SgTimeSheetMapper, SgTimeSheet> implements SgTimeSheetService {
|
|
|
|
|
|
-}
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public String uploadTimeExcel(List<List<Object>> readTimeDatas, String timemonth) {
|
|
|
+
|
|
|
+ // Integer userId = SecurityUtils.getUser().getId();
|
|
|
+ List<SgTimeSheet> sgTimeSheets = new ArrayList<>();
|
|
|
+ for (List<Object> data : readTimeDatas) {
|
|
|
+
|
|
|
+ String name = (String) data.get(0);
|
|
|
+ //code为空,继续循环
|
|
|
+ if (StrUtil.isBlank(name)) {continue;}
|
|
|
+ SgTimeSheet sgTimeSheet = new SgTimeSheet();
|
|
|
+
|
|
|
+ try {
|
|
|
+ sgTimeSheet.setECnname(data.get(0).toString().trim());
|
|
|
+ sgTimeSheet.setMonthOvertimeAdd(Convert.toBigDecimal(data.get(1)));
|
|
|
+ sgTimeSheet.setMonthOvertimeDecrease(Convert.toBigDecimal(data.get(2)));
|
|
|
+ sgTimeSheet.setMonthOvertimeSurplus(Convert.toBigDecimal(data.get(3)));
|
|
|
+ sgTimeSheet.setAnnualLeaveDecrease(Convert.toBigDecimal(data.get(4)));
|
|
|
+ sgTimeSheet.setAnnualLeaveSurplus(Convert.toBigDecimal(data.get(5)));
|
|
|
+ sgTimeSheet.setSilkLeaveAdd(Convert.toBigDecimal(data.get(6)));
|
|
|
+ sgTimeSheet.setSilkLeaveAll(Convert.toBigDecimal(data.get(7)));
|
|
|
+ sgTimeSheet.setLeaveAbsenceAdd(Convert.toBigDecimal(data.get(8)));
|
|
|
+ sgTimeSheet.setLeaveAbsenceAll(Convert.toBigDecimal(data.get(9)));
|
|
|
+ sgTimeSheet.setLateLess5(Convert.toLong(data.get(10)));
|
|
|
+ sgTimeSheet.setLateGreate6(Convert.toLong(data.get(11)));
|
|
|
+ sgTimeSheet.setLateAll(Convert.toLong(data.get(12)));
|
|
|
+ sgTimeSheet.setTimeMonth(Long.valueOf(timemonth));
|
|
|
+ sgTimeSheet.setEId(1L);
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ return " 错误";
|
|
|
+ }
|
|
|
+
|
|
|
+ sgTimeSheets.add(sgTimeSheet);
|
|
|
+ }
|
|
|
+
|
|
|
+ sgTimeSheets.forEach(k->saveOrUpdate(k));
|
|
|
+ //rocketMQTemplate.convertAndSend("CSPRODUCTION:supplierQuoted",sgNewQuotes.stream().map(k->k.getPCode()).collect(Collectors.toList())+" 供应商已报价,请尽快查看_"+SecurityUtils.getUser().getUsername());
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|