|
@@ -1,6 +1,7 @@
|
|
|
package com.pig4cloud.pigx.qa.controller;
|
|
|
|
|
|
import cn.hutool.core.codec.Base64;
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -47,7 +48,7 @@ public class InspectionApplyController {
|
|
|
@RequestParam(required = false) String areaCode, Response response) {
|
|
|
|
|
|
Page results = inspectionApplyService.getByParm(scCode,poCode,sId,eId,dateStart,dateEnd,null,areaCode,page) ;
|
|
|
- List<InspectionApply> inspectionApplys = results.getRecords();
|
|
|
+/* List<InspectionApply> inspectionApplys = results.getRecords();
|
|
|
for (InspectionApply inspectionApply :inspectionApplys ){
|
|
|
if (!StrUtil.isBlank( inspectionApply.getInspector())){
|
|
|
inspectionApply.setInspector(Base64.encode(inspectionApply.getInspector()));
|
|
@@ -69,14 +70,14 @@ public class InspectionApplyController {
|
|
|
List<String> strings=new ArrayList<>();
|
|
|
inspectionApplys.forEach(k->strings.add(JSONObject.toJSONString(k)));
|
|
|
|
|
|
- results.setRecords(strings);
|
|
|
+ results.setRecords(strings);*/
|
|
|
|
|
|
return R.ok(results);
|
|
|
}
|
|
|
|
|
|
@PostMapping("mobile/picture" )
|
|
|
@ApiOperation(value = "陪验员上传图片")
|
|
|
- public R addSampleDocumentBySdId(@RequestParam("scId" ) Integer scId,
|
|
|
+ public R addSampleDocumentBySdId(@RequestParam("ids" ) String ids,
|
|
|
@RequestParam(value = "file",required = false) MultipartFile file) throws IOException {
|
|
|
List<String> urls=new ArrayList<>();
|
|
|
String filename = file.getOriginalFilename();
|
|
@@ -84,38 +85,18 @@ public class InspectionApplyController {
|
|
|
String url = FastDFSClient.upload(file.getBytes(), fileExt);
|
|
|
urls.add(url);
|
|
|
|
|
|
+ for (String id : StrUtil.split(ids, StrUtil.DASHED)) {
|
|
|
+ InspectionApply inspectionApply= inspectionApplyService.getbyScIdBetweenThisWeek(Convert.toInt(id));
|
|
|
|
|
|
- //StringBuffer string=new StringBuffer();
|
|
|
- //for (String file:files){
|
|
|
- //if (StrUtil.startWith(file,"http://")){
|
|
|
- // string.append(file).append(",");
|
|
|
- // }else {
|
|
|
- // byte[] decode = Base64.decode(file);
|
|
|
- // String picture = FastDFSClient.upload(decode, "png");
|
|
|
- // string.append(picture).append(",");
|
|
|
- //}
|
|
|
- //}
|
|
|
- List<InspectionApply> inspectionApplies = inspectionApplyService.getbyScIdBetweenThisWeek(scId);
|
|
|
-
|
|
|
- if (!inspectionApplies.isEmpty()){
|
|
|
- inspectionApplies.forEach(k->{
|
|
|
- if (!StrUtil.isBlank(k.getPicture())){
|
|
|
- List<String> oldUrls = Arrays.asList(k.getPicture().split(","));
|
|
|
- urls.addAll(oldUrls);
|
|
|
- }
|
|
|
- k.setPicture(String.join(",",urls));
|
|
|
- inspectionApplyService.updateById(k);
|
|
|
- });
|
|
|
- }else {
|
|
|
- InspectionApply inspectionApply = new InspectionApply();
|
|
|
- inspectionApply.setScId(scId);
|
|
|
- inspectionApply.setPicture(String.join(",",urls));
|
|
|
-
|
|
|
- inspectionApplyService.save(inspectionApply);
|
|
|
- }
|
|
|
- return R.ok();
|
|
|
-
|
|
|
+ if (!StrUtil.isBlank(inspectionApply.getPicture())){
|
|
|
+ List<String> oldUrls = Arrays.asList(inspectionApply.getPicture().split(","));
|
|
|
+ urls.addAll(oldUrls);
|
|
|
+ }
|
|
|
+ inspectionApply.setPicture(String.join(",",urls));
|
|
|
+ inspectionApplyService.updateById(inspectionApply);
|
|
|
|
|
|
+ }
|
|
|
+ return R.ok(String.join(",",urls));
|
|
|
|
|
|
}
|
|
|
|