小程序端图片校验,商品查询sql错误修正
This commit is contained in:
@@ -14,6 +14,7 @@ import com.zf.foodpurchase.fdsafe.service.ICattenService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.CattenVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -50,6 +51,13 @@ public class WxAppCattenController extends BaseController {
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
// 图片信息校验
|
||||
if(CollectionUtils.isEmpty(cattenVO.getWxLicenseImg()) && (cattenVO.getLicenseImg() == null || cattenVO.getLicenseImg().length == 0)){
|
||||
return error("营业执照图片不能为空");
|
||||
}
|
||||
if(CollectionUtils.isEmpty(cattenVO.getWxFoodLicenseImg()) && (cattenVO.getFoodLicenseImg() == null || cattenVO.getFoodLicenseImg().length == 0)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}
|
||||
cattenVO.setSchoolId(userVO.getSchoolId());
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
@@ -62,6 +70,13 @@ public class WxAppCattenController extends BaseController {
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
// 图片信息校验
|
||||
if(CollectionUtils.isEmpty(cattenVO.getWxLicenseImg()) && (cattenVO.getLicenseImg() == null || cattenVO.getLicenseImg().length == 0)){
|
||||
return error("营业执照图片不能为空");
|
||||
}
|
||||
if(CollectionUtils.isEmpty(cattenVO.getWxFoodLicenseImg()) && (cattenVO.getFoodLicenseImg() == null || cattenVO.getFoodLicenseImg().length == 0)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}
|
||||
cattenVO.setSchoolId(userVO.getSchoolId());
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.zf.foodpurchase.fdsafe.service.IFoodSampleService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSampleVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -50,6 +51,10 @@ public class WxAppFoodSampleController extends BaseController {
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
// 图片校验小程序与app使用图片字段不一样,不能同时为空
|
||||
if(CollectionUtils.isEmpty(foodSampleVO.getWxSaveImage()) && (foodSampleVO.getSaveImg() == null || foodSampleVO.getSaveImg().length == 0)){
|
||||
return error("留样照片不能为空");
|
||||
}
|
||||
foodSampleVO.setSchoolId(userVO.getSchoolId());
|
||||
// 图片处理
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(foodSampleVO.getWxSaveImage()));
|
||||
@@ -62,6 +67,10 @@ public class WxAppFoodSampleController extends BaseController {
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
// 图片校验小程序与app使用图片字段不一样,不能同时为空
|
||||
if(CollectionUtils.isEmpty(foodSampleVO.getWxSaveImage()) && (foodSampleVO.getSaveImg() == null || foodSampleVO.getSaveImg().length == 0)){
|
||||
return error("留样照片不能为空");
|
||||
}
|
||||
foodSampleVO.setSchoolId(userVO.getSchoolId());
|
||||
// 图片处理
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(foodSampleVO.getWxSaveImage()));
|
||||
|
||||
@@ -16,7 +16,9 @@ ruoyi:
|
||||
# imagePrefix: http://192.168.1.124:8080
|
||||
# 正常访问路径:
|
||||
# http://download.zhengfankeji.com/upload/foodPurchase/upload/2024/12/31/3_20241231182707A001.jpg
|
||||
imagePrefix: http://download.zhengfankeji.com/upload/schoolFood/upload/
|
||||
# imagePrefix: http://download.zhengfankeji.com/upload/schoolFood/upload/
|
||||
# 小程序组件要求图片必须为https,对应图片前缀
|
||||
imagePrefix: https://zfxc.zhengfankeji.com/upload/schoolFood/upload/
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
@@ -100,7 +102,8 @@ token:
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
# expireTime: 30
|
||||
expireTime: 7200
|
||||
|
||||
## MyBatis配置
|
||||
#mybatis:
|
||||
|
||||
@@ -68,19 +68,19 @@ public class CattenVO extends CommonVO implements Serializable {
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
@NotEmpty(message = "营业执照图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
@NotEmpty(message = "营业执照图片不能为空", groups = { AddGroup.class, UpdateGroup.class})
|
||||
private String[] licenseImg;
|
||||
private String licenseImgStr;
|
||||
@NotEmpty(message = "营业执照图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
// @NotEmpty(message = "营业执照图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
private List<WxImg> wxLicenseImg;
|
||||
|
||||
/**
|
||||
* 食品许可证
|
||||
*/
|
||||
@NotEmpty(message = "食品许可证图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
@NotEmpty(message = "食品许可证图片不能为空", groups = { AddGroup.class, UpdateGroup.class})
|
||||
private String[] foodLicenseImg;
|
||||
private String foodLicenseImgStr;
|
||||
@NotEmpty(message = "食品许可证图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
// @NotEmpty(message = "食品许可证图片不能为空", groups = { AddGroup.class, UpdateGroup.class, WxAddGroup.class, WxUpdateGroup.class})
|
||||
private List<WxImg> wxFoodLicenseImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,7 +74,7 @@ public class FoodSampleVO extends CommonVO implements Serializable {
|
||||
@NotEmpty(message = "留样照片不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
private String[] saveImg;
|
||||
private String saveImgStr;
|
||||
@NotEmpty(message = "留样照片不能为空", groups = {WxUpdateGroup.class, WxAddGroup.class})
|
||||
// @NotEmpty(message = "留样照片不能为空", groups = {WxUpdateGroup.class, WxAddGroup.class})
|
||||
private List<WxImg> wxSaveImage;
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<if test="foodName !=null and foodName !=''">
|
||||
and f.food_name like concat('%',#{foodName},'%')
|
||||
</if>
|
||||
<if test="delFlag">
|
||||
<if test="delFlag != null">
|
||||
and fp.del_flag = #{delFlag}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
Reference in New Issue
Block a user