web端图片上传格式修订为对象数组,与小程序共用wxXXX字段,对象字段为uid与url
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.zf.foodpurchase.fdsafe.common;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.redis.RedisCache;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.wx.entity.Area;
|
||||
import com.zf.foodpurchase.wx.service.IAreaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 全国省市县三级行政区域信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-14
|
||||
*/
|
||||
@Api(tags = "三级区划查询")
|
||||
@RestController
|
||||
@RequestMapping("/wx/area")
|
||||
public class AreaController {
|
||||
@Autowired
|
||||
private IAreaService areaService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询所有区划数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询所有区划数据")
|
||||
@GetMapping("listAll")
|
||||
public AjaxResult listAll() {
|
||||
List<Area> provinceList = areaService.queryAllArea();
|
||||
return AjaxResult.success("查询成功", provinceList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询省/市/县级区划")
|
||||
@GetMapping("queryByLevel")
|
||||
public AjaxResult queryByLevel(Integer level) {
|
||||
if (level == null) {
|
||||
return AjaxResult.error("level不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Area::getLevel, level);
|
||||
return AjaxResult.success("查询成功", areaService.list(queryWrapper));
|
||||
}
|
||||
|
||||
@ApiOperation("根据区划编码查询区划信息")
|
||||
@GetMapping("getArea")
|
||||
public AjaxResult getArea(String areaCode) {
|
||||
if (StringUtils.isBlank(areaCode)) {
|
||||
return AjaxResult.error("areaCode不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Area::getAreaCode, areaCode);
|
||||
Area area = areaService.getOne(queryWrapper);
|
||||
return AjaxResult.success("查询成功", area);
|
||||
}
|
||||
|
||||
@ApiOperation("根据区划编码查询本级以及上下级区划信息")
|
||||
@GetMapping("getAreaDetail")
|
||||
public AjaxResult getAreaDetail(String areaCode) {
|
||||
if (StringUtils.isBlank(areaCode)) {
|
||||
return AjaxResult.error("areaCode不能为空");
|
||||
}
|
||||
Area area = areaService.getAreaDetail(areaCode);
|
||||
|
||||
return AjaxResult.success("查询成功", area);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,13 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -36,12 +39,30 @@ public class SupplierController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SupplierVO supplierVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
return supplierService.saveVO(supplierVO);
|
||||
}
|
||||
|
||||
// 接口需要划分:上架,信息编辑.
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SupplierVO supplierVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
return supplierService.updateVO(supplierVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@ import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.AccompanyMeal;
|
||||
import com.zf.foodpurchase.fdsafe.service.IAccompanyMealService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.AccompanyMealVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -40,11 +43,21 @@ public class AccompanyMealController extends BaseController {
|
||||
|
||||
@RequestMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}
|
||||
return accompanyMealService.saveVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}
|
||||
return accompanyMealService.updateVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,11 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ICattenService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.CattenVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -16,7 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
@@ -37,17 +40,35 @@ public class CattenController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.saveVO(cattenVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.updateVO(cattenVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer cattenId) {
|
||||
if(cattenId == null){
|
||||
if (cattenId == null) {
|
||||
return error("请选择要删除的食堂");
|
||||
}
|
||||
return cattenService.removeById(cattenId) ? success("删除成功") : error("删除失败");
|
||||
|
||||
@@ -7,8 +7,11 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodSampleService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSampleVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -38,11 +41,21 @@ public class FoodSampleController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodSampleVO foodSampleVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}
|
||||
return foodSampleService.saveVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodSampleVO foodSampleVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}
|
||||
return foodSampleService.updateVO(foodSampleVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,13 @@ import com.zf.foodpurchase.fdsafe.mapper.MorningCheckInMapper;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionContentService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionDetailService;
|
||||
import com.zf.foodpurchase.fdsafe.service.impl.MorningInspectionContentServiceImpl;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningTableHeaderVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.apache.commons.math3.analysis.function.Add;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -75,11 +78,21 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated({AddGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
// wxImage形式
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
return morningInspectionDetailService.saveVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated({UpdateGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
// wxImage形式
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
return morningInspectionDetailService.updateVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,11 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IRubbishDealService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RubbishDealVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -38,11 +41,21 @@ public class RubbishDealController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}
|
||||
return rubbishDealService.saveVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}
|
||||
return rubbishDealService.updateVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolStaffService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolStaffVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -24,7 +25,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
@@ -40,27 +41,32 @@ public class SchoolStaffController extends BaseController {
|
||||
public TableDataInfo pageList(SchoolStaffVO schoolStaffVO) {
|
||||
startPage();
|
||||
List<SchoolStaffVO> list = schoolStaffService.querySchoolStaffVO(schoolStaffVO);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
list.forEach(item->{
|
||||
item.setHealthCertImg(ArrayStringUtils.stringToArray(item.getHealthCertImgStr()));
|
||||
});
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}
|
||||
return schoolStaffService.saveVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer staffId) {
|
||||
if(staffId == null){
|
||||
if (staffId == null) {
|
||||
return error("请选择要删除的学校人员");
|
||||
}
|
||||
boolean flag = schoolStaffService.removeById(staffId);
|
||||
|
||||
@@ -7,9 +7,12 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISelfInspectionRecordService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -39,11 +42,31 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
// wxImage形式
|
||||
List<SelfInspectionDetailVO> selfInspectionDetailVOList = selfInspectionRecordVO.getSelfInspectionDetailVOList();
|
||||
if(!CollectionUtils.isEmpty(selfInspectionDetailVOList)){
|
||||
for (SelfInspectionDetailVO selfInspectionDetailVO : selfInspectionDetailVOList) {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
}
|
||||
}
|
||||
return selfInspectionRecordService.saveVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
// wxImage形式
|
||||
List<SelfInspectionDetailVO> selfInspectionDetailVOList = selfInspectionRecordVO.getSelfInspectionDetailVOList();
|
||||
if(!CollectionUtils.isEmpty(selfInspectionDetailVOList)){
|
||||
for (SelfInspectionDetailVO selfInspectionDetailVO : selfInspectionDetailVOList) {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
}
|
||||
}
|
||||
return selfInspectionRecordService.updateVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,13 @@ import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierDeliveryService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryAddUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -49,6 +52,11 @@ public class SupplierDeliveryController extends BaseController {
|
||||
|
||||
@PostMapping("/schoolSignDelivery")
|
||||
public AjaxResult schoolUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SchoolDeliveryVO schoolDeliveryVO){
|
||||
// wxImage形式
|
||||
List<WxImg> images = schoolDeliveryVO.getWxSignImage();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
schoolDeliveryVO.setSignImage(ArrayStringUtils.wxImgToArray(images));
|
||||
}
|
||||
return supplierDeliveryService.schoolUpdateDelivery(schoolDeliveryVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
|
||||
list.forEach(item -> {
|
||||
item.setLicenseImg(ArrayStringUtils.stringToArray(item.getLicenseImgStr()));
|
||||
item.setFoodLicenseImg(ArrayStringUtils.stringToArray(item.getFoodLicenseImgStr()));
|
||||
item.setWxLicenseImg(ArrayStringUtils.arrayToWxImgList(item.getLicenseImg()));
|
||||
item.setWxFoodLicenseImg(ArrayStringUtils.arrayToWxImgList(item.getFoodLicenseImg()));
|
||||
|
||||
String areaCodeStr = item.getAreaCodeStr();
|
||||
if(StringUtils.isNotBlank(areaCodeStr)){
|
||||
|
||||
@@ -5,7 +5,9 @@ package com.zf.foodpurchase.fdsafe.utils;
|
||||
* @date:2025/5/9
|
||||
*/
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ImageVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -71,4 +73,61 @@ public class ArrayStringUtils {
|
||||
}
|
||||
return wxImgList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转ImageVO数组
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static List<ImageVO> stringToImageVOArray(String str) {
|
||||
List<ImageVO> imageVOList = new ArrayList<>();
|
||||
if(StringUtils.isBlank(str)){
|
||||
return imageVOList;
|
||||
}
|
||||
|
||||
if(!str.contains(",")){
|
||||
ImageVO imageVO = new ImageVO();
|
||||
imageVO.setUrl(str);
|
||||
imageVOList.add(imageVO);
|
||||
return imageVOList;
|
||||
}
|
||||
String[] strArray = str.trim().split(",");
|
||||
for (int i = 0; i < strArray.length; i++){
|
||||
ImageVO imageVO = new ImageVO();
|
||||
imageVO.setUrl(strArray[i].trim());
|
||||
imageVOList.add(imageVO);
|
||||
}
|
||||
return imageVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageVO数组转字符串
|
||||
* @param imageVOList
|
||||
* @return
|
||||
*/
|
||||
public static String imageVOArrayToString(List<ImageVO> imageVOList) {
|
||||
if(imageVOList == null || imageVOList.size() == 0){
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int size = imageVOList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ImageVO imageVO = imageVOList.get(i);
|
||||
if(imageVO != null && StringUtils.isNotBlank(imageVO.getUrl())){
|
||||
String url = imageVO.getUrl();
|
||||
sb.append(url.trim());
|
||||
if(i != size - 1){
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String urls = "http://1,http://2";
|
||||
List<ImageVO> imageVOList = stringToImageVOArray(urls);
|
||||
System.out.println(JSONObject.toJSONString(imageVOList));
|
||||
System.out.println(imageVOArrayToString(imageVOList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class CattenVO extends CommonVO implements Serializable {
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
@NotEmpty(message = "营业执照图片不能为空", groups = { AddGroup.class, UpdateGroup.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})
|
||||
@@ -77,7 +77,7 @@ public class CattenVO extends CommonVO implements Serializable {
|
||||
/**
|
||||
* 食品许可证
|
||||
*/
|
||||
@NotEmpty(message = "食品许可证图片不能为空", groups = { AddGroup.class, UpdateGroup.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})
|
||||
|
||||
@@ -71,7 +71,7 @@ public class FoodSampleVO extends CommonVO implements Serializable {
|
||||
/**
|
||||
* 留样照片
|
||||
*/
|
||||
@NotEmpty(message = "留样照片不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
// @NotEmpty(message = "留样照片不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
private String[] saveImg;
|
||||
private String saveImgStr;
|
||||
// @NotEmpty(message = "留样照片不能为空", groups = {WxUpdateGroup.class, WxAddGroup.class})
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zf.foodpurchase.fdsafe.vo;
|
||||
|
||||
import com.zf.foodpurchase.common.utils.uuid.UUID;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/7/21
|
||||
*/
|
||||
@Data
|
||||
public class ImageVO {
|
||||
private String uid=UUID.fastUUID().toString();
|
||||
private String url;
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
@@ -82,12 +83,15 @@ public class SupplierVO extends CommonVO implements Serializable {
|
||||
*/
|
||||
private String[] licenseImg;
|
||||
private String licenseImgStr;
|
||||
private List<WxImg> wxLicenseImg;
|
||||
|
||||
/**
|
||||
* 食品经营许可证照片
|
||||
*/
|
||||
private String[] foodLicenseImg;
|
||||
private String foodLicenseImgStr;
|
||||
private List<WxImg> wxFoodLicenseImg;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zf.foodpurchase.fdsafe.vo;
|
||||
|
||||
import com.zf.foodpurchase.common.utils.uuid.UUID;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -9,4 +10,5 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WxImg {
|
||||
private String url;
|
||||
private String uid= UUID.fastUUID().toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user