|
@@ -26,10 +26,10 @@ public class TargetdataFristController {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
@PostMapping(value = "/save")
|
|
|
@ApiOperation(value = "增", notes = "增")
|
|
|
public R save(@RequestBody ProEconTargetdataFrist data) {
|
|
|
+ data.setOperationTime(new Date());
|
|
|
boolean b = targetdataFristService.save(data);
|
|
|
if (b) {
|
|
|
return R.data(ResultMsg.ok(b));
|
|
@@ -42,6 +42,7 @@ public class TargetdataFristController {
|
|
|
@PutMapping(value = "/update")
|
|
|
@ApiOperation(value = "改", notes = "改")
|
|
|
public R update(@RequestBody ProEconTargetdataFrist data) {
|
|
|
+ data.setOperationTime(new Date());
|
|
|
boolean b = targetdataFristService.update(data);
|
|
|
if (b) {
|
|
|
return R.data(ResultMsg.ok(b));
|
|
@@ -64,7 +65,7 @@ public class TargetdataFristController {
|
|
|
@GetMapping(value = "/get")
|
|
|
@ApiOperation(value = "查", notes = "查")
|
|
|
public R get(
|
|
|
- @RequestParam(value = "date", required = true) String date) {
|
|
|
+ @RequestParam(value = "date", required = true) String date) {
|
|
|
List<ProEconTargetdataFrist> resultList = targetdataFristService.get(date);
|
|
|
if (StringUtils.isNotNull(resultList)) {
|
|
|
return R.data(ResultMsg.ok(resultList));
|
|
@@ -82,7 +83,7 @@ public class TargetdataFristController {
|
|
|
|
|
|
ProEconTargetdataFrist.builder().id("").name("光伏").type("GF").rfdl(1.0).yfdl(2.0).nfdl(3.0).recordDate(DateUtils.truncate(new Date())).build()
|
|
|
|
|
|
- );
|
|
|
+ );
|
|
|
|
|
|
// 输出
|
|
|
ExcelUtils.write(response, "导入模板.xls", "导入模板", ProEconTargetdataFrist.class, list);
|
|
@@ -93,13 +94,19 @@ public class TargetdataFristController {
|
|
|
public R importExcel(@RequestParam("file") MultipartFile file) throws Exception {
|
|
|
List<ProEconTargetdataFrist> list = ExcelUtils.read(file, ProEconTargetdataFrist.class);
|
|
|
|
|
|
- if(StringUtils.notEmp(list) && list.isEmpty())
|
|
|
+ if(StringUtils.notEmp(list) && !list.isEmpty())
|
|
|
{
|
|
|
for(ProEconTargetdataFrist vo:list)
|
|
|
{
|
|
|
vo.setId(StringUtils.getUUID());
|
|
|
vo.setOperationTime(new Date());
|
|
|
- targetdataFristService.save(vo);
|
|
|
+
|
|
|
+ List<ProEconTargetdataFrist > ls=targetdataFristService.getByDateAndName(vo.getName(),vo.getRecordDate());
|
|
|
+ if(ls.isEmpty())
|
|
|
+ {
|
|
|
+ targetdataFristService.save(vo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotNull(list)) {
|