图片修改,必填的进行非空校验;非必填的可以更新为空
This commit is contained in:
@@ -56,10 +56,14 @@ public class SupplierController extends BaseController {
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setLicenseImg(null);
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setFoodLicenseImg(null);
|
||||
}
|
||||
return supplierService.saveVO(supplierVO);
|
||||
}
|
||||
@@ -78,10 +82,14 @@ public class SupplierController extends BaseController {
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setLicenseImg(null);
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setFoodLicenseImg(null);
|
||||
}
|
||||
return supplierService.updateVO(supplierVO);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ public class AccompanyMealController extends BaseController {
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}else{
|
||||
accompanyMealVO.setAccompanyImage(null);
|
||||
}
|
||||
return accompanyMealService.saveVO(accompanyMealVO);
|
||||
}
|
||||
@@ -75,6 +77,8 @@ public class AccompanyMealController extends BaseController {
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}else{
|
||||
accompanyMealVO.setAccompanyImage(null);
|
||||
}
|
||||
return accompanyMealService.updateVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,12 @@ public class CattenController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业执照,食品许可证图片不能为空
|
||||
* @param cattenVO
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
@@ -51,18 +57,29 @@ public class CattenController extends BaseController {
|
||||
return error("非学校账号无法添加食堂");
|
||||
}
|
||||
}
|
||||
// 图片校验不能为空
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("营业执照图片不能为空");
|
||||
}else{
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}else{
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.saveVO(cattenVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业执照,食品许可证图片不能为空
|
||||
* @param cattenVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
@@ -72,13 +89,19 @@ public class CattenController extends BaseController {
|
||||
return error("非学校账号无法修改食堂信息");
|
||||
}
|
||||
}
|
||||
// 图片校验不能为空
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("营业执照图片不能为空");
|
||||
}else{
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}else{
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.updateVO(cattenVO);
|
||||
|
||||
@@ -56,6 +56,8 @@ public class FoodSampleController extends BaseController {
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}else{
|
||||
return error("留样图片不能为空");
|
||||
}
|
||||
return foodSampleService.saveVO(foodSampleVO);
|
||||
}
|
||||
@@ -73,6 +75,8 @@ public class FoodSampleController extends BaseController {
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}else{
|
||||
return error("留样图片不能为空");
|
||||
}
|
||||
return foodSampleService.updateVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,8 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
morningInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
return morningInspectionDetailService.saveVO(morningInspectionDetailVO);
|
||||
}
|
||||
@@ -112,6 +114,8 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
morningInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
return morningInspectionDetailService.updateVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class RubbishDealController extends BaseController {
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}else{
|
||||
rubbishDealVO.setDealImg(null);
|
||||
}
|
||||
return rubbishDealService.saveVO(rubbishDealVO);
|
||||
}
|
||||
@@ -73,6 +75,8 @@ public class RubbishDealController extends BaseController {
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}else{
|
||||
rubbishDealVO.setDealImg(null);
|
||||
}
|
||||
return rubbishDealService.updateVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ public class SchoolStaffController extends BaseController {
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}else{
|
||||
return error("健康证图片不能为空");
|
||||
}
|
||||
return schoolStaffService.saveVO(schoolStaffVO);
|
||||
}
|
||||
@@ -78,6 +80,8 @@ public class SchoolStaffController extends BaseController {
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}else{
|
||||
return error("健康证图片不能为空");
|
||||
}
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
selfInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +84,8 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
selfInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public class SupplierDeliveryItemController extends BaseController {
|
||||
List<WxImg> images = supplierDeliveryItemUpdateVO.getWxCheckReportImage();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierDeliveryItemUpdateVO.setCheckReportImage(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierDeliveryItemUpdateVO.setCheckReportImage(null);
|
||||
}
|
||||
return supplierDeliveryItemService.updateVO(supplierDeliveryItemUpdateVO);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.HttpMessage;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -24,6 +25,8 @@ import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.html.EscapeUtil;
|
||||
|
||||
import java.sql.DataTruncation;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
@@ -34,6 +37,31 @@ public class GlobalExceptionHandler
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* JSON入参序列化异常HttpMessageNotReadableException
|
||||
*/
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',JSON入参序列化异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库异常处理:DataTruncation
|
||||
*/
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
public AjaxResult handleDataIntegrityViolationException(DataIntegrityViolationException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',数据库异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -85,8 +83,9 @@ public class AccompanyMeal implements Serializable {
|
||||
private String feedBack;
|
||||
|
||||
/**
|
||||
* 陪餐照片
|
||||
* 陪餐照片: 为空时也会进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String accompanyImage;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -56,8 +54,9 @@ public class MorningInspectionDetail implements Serializable {
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 问题照片
|
||||
* 问题照片:为null也修改
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String abnormalImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,8 +62,9 @@ public class RubbishDeal implements Serializable {
|
||||
private String recycleCompany;
|
||||
|
||||
/**
|
||||
* 回收图片
|
||||
* 回收图片,为空时也会更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String dealImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -53,8 +51,9 @@ public class SelfInspectionDetail implements Serializable {
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 问题图片
|
||||
* 问题图片:为null也更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String abnormalImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,13 +62,15 @@ public class Supplier implements Serializable {
|
||||
private String concatPhone;
|
||||
|
||||
/**
|
||||
* 营业执照照片
|
||||
* 营业执照照片:为null也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String licenseImg;
|
||||
|
||||
/**
|
||||
* 食品经营许可证照片
|
||||
* 食品经营许可证照片:为null也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String foodLicenseImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,8 +62,9 @@ public class SupplierDeliveryItem implements Serializable {
|
||||
private String inImage;
|
||||
|
||||
/**
|
||||
* 检测报告图片
|
||||
* 检测报告图片:为null时也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String checkReportImage;
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SupplierVO extends CommonVO implements Serializable {
|
||||
* 联系电话
|
||||
*/
|
||||
@NotBlank(message = "联系电话不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
@Phone(message = "联系电话格式不正确")
|
||||
@Phone(message = "联系电话格式不正确", groups = {UpdateGroup.class, AddGroup.class})
|
||||
private String concatPhone;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user