|
@@ -7,6 +7,7 @@ import com.caimei365.order.mapper.BaseMapper;
|
|
|
import com.caimei365.order.mapper.OrderCommonMapper;
|
|
|
import com.caimei365.order.mapper.ShipMapper;
|
|
|
import com.caimei365.order.model.ResponseJson;
|
|
|
+import com.caimei365.order.model.dto.JsonParamsDto;
|
|
|
import com.caimei365.order.model.dto.LogisticsBatchDto;
|
|
|
import com.caimei365.order.model.dto.LogisticsDto;
|
|
|
import com.caimei365.order.model.po.*;
|
|
@@ -845,14 +846,65 @@ public class ShipServiceImpl implements ShipService {
|
|
|
// 商品资质文件
|
|
|
List<QualificationPo> fileList = shipMapper.getQualificationFile(qualification.getRecordId());
|
|
|
qualification.setFileList(fileList);
|
|
|
- boolean isFile = (fileList == null || fileList.size() == 0);
|
|
|
- boolean isImage = (images == null || images.size() == 0);
|
|
|
- if (StringUtils.isBlank(qualification.getSn()) && isFile && isImage) {
|
|
|
+ if (StringUtils.isBlank(qualification.getSn()) && fileList.isEmpty() && images.isEmpty()) {
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
return ResponseJson.success(qualificationList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 保存商品资质
|
|
|
+ *
|
|
|
+ * @param jsonParamsDto params:[{
|
|
|
+ * recordId: 商品发货记录id,
|
|
|
+ * sn: sn码,
|
|
|
+ * files: [{fileName:"文件名称",ossName:"oss文件名称"},{fileName:"文件名称",ossName:"oss文件名称"}...]
|
|
|
+ * images: ["图片","图片",...]
|
|
|
+ * }, {}]
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Void> saveProductQualification(JsonParamsDto jsonParamsDto) {
|
|
|
+ try {
|
|
|
+ JSONArray paramsArray = parseArray(jsonParamsDto.getParams());
|
|
|
+ for (Object paramObj: paramsArray) {
|
|
|
+ JSONObject jsonObject = (JSONObject) paramObj;
|
|
|
+ Integer recordId = jsonObject.getInteger("recordId");
|
|
|
+ String sn = jsonObject.getString("sn");
|
|
|
+ JSONArray filesArray = jsonObject.getJSONArray("files");
|
|
|
+ // 删除旧的资质文件
|
|
|
+ shipMapper.deleteQualificationFile(recordId);
|
|
|
+ if (!filesArray.isEmpty()) {
|
|
|
+ QualificationPo qualificationFile = new QualificationPo();
|
|
|
+ qualificationFile.setRecordId(recordId);
|
|
|
+ for (Object fileObj: filesArray) {
|
|
|
+ JSONObject file = (JSONObject) fileObj;
|
|
|
+ qualificationFile.setFileName(file.getString("fileName"));
|
|
|
+ qualificationFile.setOssName(file.getString("ossName"));
|
|
|
+ // 保存资质文件
|
|
|
+ shipMapper.insertQualificationFile(qualificationFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JSONArray imagesArray = jsonObject.getJSONArray("images");
|
|
|
+ // 删除旧的资质图片
|
|
|
+ shipMapper.deleteQualificationImage(recordId);
|
|
|
+ if (!imagesArray.isEmpty()) {
|
|
|
+ for (Object imageObj: imagesArray) {
|
|
|
+ String image = String.valueOf(imageObj);
|
|
|
+ // 保存资质图片
|
|
|
+ shipMapper.insertQualificationImage(image, recordId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(sn)) {
|
|
|
+ // 更新商品发货记录SN码
|
|
|
+ shipMapper.updateLogisticsRecordSn(recordId, sn);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseJson.success(null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("保存商品资质参数:" + jsonParamsDto.toString());
|
|
|
+ log.error("【保存商品资质】>>>参数解析异常try-catch:", e);
|
|
|
+ return ResponseJson.error("保存商品资质参数解析异常!", null);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|