|
@@ -1,17 +1,30 @@
|
|
|
package com.platform.service.workflow.viewStrategy.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.platform.common.util.JsonUtils;
|
|
|
+import com.platform.common.util.ListUtils;
|
|
|
import com.platform.dao.entity.custom.CustomFormData;
|
|
|
+import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.enums.CategoryTypeEnum;
|
|
|
import com.platform.dao.enums.SbFormTypeEnum;
|
|
|
+import com.platform.dao.enums.SbInfoStatusEnum;
|
|
|
+import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
import com.platform.service.workflow.viewStrategy.EffectiveComposer;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
@Service("sbScrapEffectiveComposer")
|
|
|
public class SbScrapEffectiveComposer implements EffectiveComposer {
|
|
|
+ @Resource
|
|
|
+ private SbInfoMapper sbInfoMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public String getType() {
|
|
|
return CategoryTypeEnum.SB_FORM.getValue() + SbFormTypeEnum.SB_ABOLISH.getValue();
|
|
@@ -20,6 +33,22 @@ public class SbScrapEffectiveComposer implements EffectiveComposer {
|
|
|
@Override
|
|
|
public void effectiveComposer(CustomFormData data) {
|
|
|
log.info("------------------报废的后置处理------------------");
|
|
|
+ List<String> sbIds = ListUtils.newArrayList();
|
|
|
+ parseJson(data.getJsonString(),sbIds);
|
|
|
+ sbIds.forEach(item->{
|
|
|
+ SbInfo sbInfo = new SbInfo();
|
|
|
+ sbInfo.setId(item);
|
|
|
+ sbInfo.setStatus(SbInfoStatusEnum.SCRAPED.getValue());
|
|
|
+ sbInfoMapper.updateByPrimaryKeySelective(sbInfo);
|
|
|
+ });
|
|
|
log.info(JsonUtils.objectToJson(data));
|
|
|
}
|
|
|
+
|
|
|
+ private void parseJson(String jsonString,List<String> sbIds) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(jsonString);
|
|
|
+ JSONArray sbList = jsonObject.getJSONArray("sbList");
|
|
|
+ for (int i = 0; i < sbList.size(); i++) {
|
|
|
+ sbIds.add(sbList.getJSONObject(i).getString("id"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|