dongdingding 10 months ago
commit 3c6d276bc9

@ -3,7 +3,6 @@ package com.ruoyi.tcZz.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tcZz.domain.TcYqzs;
import com.ruoyi.tcZz.service.ITcYqzsService;
@ -59,15 +58,21 @@ public class TcYqzsController extends BaseController {
/**
*
*/
//根据area_id + cy_name判断如果已存在则调修改
TcYqzs tcYqzs1 = new TcYqzs();
tcYqzs1.setAreaId(tcYqzs.getAreaId());
tcYqzs1.setDateTime(tcYqzs.getDateTime());
List<TcYqzs> list = tcYqzsService.selectTcYqzsList(tcYqzs1);
if (!list.isEmpty()) {
throw new BaseException("同一天内不得新增多条太仓数据");
for (TcYqzs a : list) {
tcYqzs.setId(a.getId());
tcYqzsService.updateTcYqzs(tcYqzs);
}
} else {
tcYqzsService.insertTcYqzs(tcYqzs);
}
return AjaxResult.success();
return toAjax(tcYqzsService.insertTcYqzs(tcYqzs));
}
/**

@ -100,7 +100,18 @@ public class TcYqzsServiceImpl implements ITcYqzsService
StringBuilder successMsg = new StringBuilder();
if (!tcYqzsList.isEmpty()) {
for (TcYqzs tcYqzs : tcYqzsList) {
tcYqzsMapper.insertTcYqzs(tcYqzs);
TcYqzs tcYqzs1 = new TcYqzs();
tcYqzs1.setAreaId(tcYqzs.getAreaId());
tcYqzs1.setDateTime(tcYqzs.getDateTime());
List<TcYqzs> list = tcYqzsMapper.selectTcYqzsList(tcYqzs1);
if (!list.isEmpty()) {
for (TcYqzs a : list) {
tcYqzs.setId(a.getId());
tcYqzsMapper.updateTcYqzs(tcYqzs);
}
} else {
tcYqzsMapper.insertTcYqzs(tcYqzs);
}
}
successMsg.append("导入成功");
}

Loading…
Cancel
Save