|
@@ -1,9 +1,11 @@
|
|
|
package com.boman.web.core.controller;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
|
+import com.boman.common.core.utils.StringUtils;
|
|
|
import com.boman.common.core.utils.poi.ExcelUtil;
|
|
|
import com.boman.common.core.web.controller.BaseController;
|
|
|
import com.boman.common.core.web.page.TableDataInfo;
|
|
@@ -78,6 +80,10 @@ public class VaccineInfoController extends BaseController {
|
|
|
@Log(title = "疫苗信息", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody VaccineInfoOperation vaccineInfo) {
|
|
|
+ String msg = this.validate(vaccineInfo);
|
|
|
+ if(StringUtils.isNotEmpty(msg)) {
|
|
|
+ return AjaxResult.error(msg);
|
|
|
+ }
|
|
|
vaccineInfo.setCreateBy(SecurityUtils.getUsername());
|
|
|
return toAjax(vaccineInfoService.insertVaccineInfo(vaccineInfo));
|
|
|
}
|
|
@@ -89,8 +95,14 @@ public class VaccineInfoController extends BaseController {
|
|
|
@Log(title = "疫苗信息", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody VaccineInfoOperation vaccineInfo) {
|
|
|
+ /* vaccineInfo.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ return toAjax(vaccineInfoService.updateVaccineInfo(vaccineInfo));*/
|
|
|
+ String msg = this.validate(vaccineInfo);
|
|
|
+ if(StringUtils.isNotEmpty(msg)) {
|
|
|
+ return AjaxResult.error(msg);
|
|
|
+ }
|
|
|
vaccineInfo.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- return toAjax(vaccineInfoService.updateVaccineInfo(vaccineInfo));
|
|
|
+ return vaccineInfoService.updateVaccineInfo(vaccineInfo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -140,4 +152,32 @@ public class VaccineInfoController extends BaseController {
|
|
|
vaccineInfoUserService.syncData();
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
+
|
|
|
+ private String validate(VaccineInfoOperation vaccineInfo) {
|
|
|
+ List<VaccineInfoUser> vaccineInfoUserList = vaccineInfo.getVaccineInfoUserList();
|
|
|
+ String msg = "";
|
|
|
+ for (VaccineInfoUser vaccineInfoUser : vaccineInfoUserList) {
|
|
|
+ String vaccineName = vaccineInfoUser.getVaccineName();
|
|
|
+ Date vaccinationTime = vaccineInfoUser.getVaccinationTime();
|
|
|
+ String vaccinationPlace = vaccineInfoUser.getVaccinationPlace();
|
|
|
+ String jici = vaccineInfoUser.getJici();
|
|
|
+ String progress = vaccineInfoUser.getProgress();
|
|
|
+ if(StringUtils.isEmpty(vaccineName) &&
|
|
|
+ vaccinationTime == null &&
|
|
|
+ StringUtils.isEmpty(vaccinationPlace) &&
|
|
|
+ StringUtils.isEmpty(jici) &&
|
|
|
+ StringUtils.isEmpty(progress)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(vaccineName) ||
|
|
|
+ vaccinationTime == null ||
|
|
|
+ StringUtils.isEmpty(vaccinationPlace) ||
|
|
|
+ StringUtils.isEmpty(jici) ||
|
|
|
+ StringUtils.isEmpty(progress)) {
|
|
|
+ msg = "请确认疫苗接种信息是否填写完整!";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|