Compare commits

..

No commits in common. "cbd2c424dc0b6ea5cb501ddfc46ee7f94bf6b48c" and "415bfd3086333ab02973f95d085d91c019d93b4e" have entirely different histories.

2 changed files with 5 additions and 4 deletions

View File

@ -1,11 +1,13 @@
package com.zcloud.controller.accident; package com.zcloud.controller.accident;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.entity.accident.AccidentRecords;
import com.zcloud.service.accident.AccidentRecordsService; import com.zcloud.service.accident.AccidentRecordsService;
import com.zcloud.util.ObjectExcelView; import com.zcloud.util.ObjectExcelView;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -93,7 +95,7 @@ public class AccidentRecordsController extends BaseController {
if (CollUtil.isEmpty(pageData)){ if (CollUtil.isEmpty(pageData)){
throw new RuntimeException("参数不能为空"); throw new RuntimeException("参数不能为空");
} }
if (pageData.get("id") == null) { if (pageData.get("id") != null) {
throw new RuntimeException("id不能为空"); throw new RuntimeException("id不能为空");
} }
accidentRecordsService.update(pageData); accidentRecordsService.update(pageData);

View File

@ -97,12 +97,11 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
public void update(PageData pageData) { public void update(PageData pageData) {
AccidentRecords accidentRecords = new AccidentRecords(); AccidentRecords accidentRecords = new AccidentRecords();
accidentRecords.setIncidentNumber(pageData.getString("incidentNumber")); accidentRecords.setIncidentNumber(pageData.getString("incidentNumber"));
accidentRecords.setId(pageData.getString("id"));
accidentRecords.setIncidentName(pageData.getString("incidentName")); accidentRecords.setIncidentName(pageData.getString("incidentName"));
accidentRecords.setIncidentType(pageData.getString("incidentType")); accidentRecords.setIncidentType(pageData.getString("incidentType"));
accidentRecords.setIncidentLevel(pageData.getString("incidentLevel")); accidentRecords.setIncidentLevel(pageData.getString("incidentLevel"));
accidentRecords.setLocation(pageData.getString("location")); accidentRecords.setLocation(pageData.getString("location"));
accidentRecords.setIncidentDate(DateUtil.parse(pageData.getString("incidentDate"), "YYYY-MM-DD HH:mm:ss")); accidentRecords.setIncidentDate(DateUtil.parse(pageData.getString("incidentDate"), DatePattern.UTC_MS_PATTERN));
accidentRecords.setDirectLoss(Convert.toInt(pageData.get("directLoss"))); accidentRecords.setDirectLoss(Convert.toInt(pageData.get("directLoss")));
accidentRecords.setInjured(Convert.toInt(pageData.get("injured"))); accidentRecords.setInjured(Convert.toInt(pageData.get("injured")));
accidentRecords.setSeriouslyInjured(Convert.toInt(pageData.get("seriouslyInjured"))); accidentRecords.setSeriouslyInjured(Convert.toInt(pageData.get("seriouslyInjured")));
@ -112,7 +111,7 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
accidentRecords.setSuggestions(pageData.getString("suggestions")); accidentRecords.setSuggestions(pageData.getString("suggestions"));
accidentRecords.setMeasures(pageData.getString("measures")); accidentRecords.setMeasures(pageData.getString("measures"));
accidentRecords.setCreator(pageData.getString("creator")); accidentRecords.setCreator(pageData.getString("creator"));
accidentRecords.setReportDate(DateUtil.parse(pageData.getString("reportDate"), "YYYY-MM-DD HH:mm:ss")); accidentRecords.setReportDate(DateUtil.parse(pageData.getString("reportDate"), DatePattern.UTC_MS_PATTERN));
accidentRecords.setUpdatedBy(Jurisdiction.getUsername()); accidentRecords.setUpdatedBy(Jurisdiction.getUsername());
accidentRecords.setUpdatedTime(new Date()); accidentRecords.setUpdatedTime(new Date());
String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId(); String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId();