|
|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.chuanghai.attendance.common.exception.BizCodeEnume;
|
|
|
import com.chuanghai.attendance.common.exception.RRException;
|
|
|
+import com.chuanghai.attendance.common.utils.CommonResult;
|
|
|
import com.chuanghai.attendance.dao.MonthlySummaryDao;
|
|
|
import com.chuanghai.attendance.dto.MonthlyDto;
|
|
|
import com.chuanghai.attendance.entity.*;
|
|
|
@@ -57,7 +58,7 @@ public class MonthlySummaryServiceImpl extends ServiceImpl<MonthlySummaryDao, Mo
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Override
|
|
|
- public Boolean importMonthDataExcel(MultipartFile file) throws Exception {
|
|
|
+ public CommonResult importMonthDataExcel(MultipartFile file) throws Exception {
|
|
|
|
|
|
List<MonthlySummary> monthlySummaryList = new ArrayList<>();
|
|
|
List<DayDetails> dayDetailsList = new ArrayList<>();
|
|
|
@@ -65,11 +66,13 @@ public class MonthlySummaryServiceImpl extends ServiceImpl<MonthlySummaryDao, Mo
|
|
|
Boolean aBoolean = dayDetailsService.removeDayDetails();
|
|
|
//删除导入的月度汇总数据
|
|
|
Boolean mBoolean = removeMonthlySummary();
|
|
|
- Boolean statu = Boolean.FALSE;
|
|
|
if (aBoolean && mBoolean) {
|
|
|
List<String[]> list = null;
|
|
|
try {
|
|
|
list = ExcelImportXLSXUtil.readerExcel(file.getInputStream(), "月度汇总", 59);
|
|
|
+ if(list == null){
|
|
|
+ return CommonResult.fail("-1","缺少月度汇总页数据!");
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
throw new RRException(BizCodeEnume.FILE_IMPORT_ERROR);
|
|
|
@@ -196,10 +199,9 @@ public class MonthlySummaryServiceImpl extends ServiceImpl<MonthlySummaryDao, Mo
|
|
|
boolean d = dayDetailsService.saveBatch(dayDetailsList, dayDetailsList.size());
|
|
|
boolean m = this.saveBatch(monthlySummaryList, monthlySummaryList.size());
|
|
|
if (m & d) {
|
|
|
- statu = Boolean.TRUE;
|
|
|
+ return CommonResult.ok();
|
|
|
}
|
|
|
- return statu;
|
|
|
-
|
|
|
+ return CommonResult.fail("-1","缺少月度汇总页数据!");
|
|
|
}
|
|
|
|
|
|
|