|
@@ -152,8 +152,9 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
|
return kuaishouItemCollectSamplesMapper.deleteKuaishouItemCollectSamplesById(id);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- public JSONObject preview(Long userId, String nickName, JSONArray itemIds, JSONArray promoterIds) {
|
|
|
+ public JSONObject preview(Long userId, String nickName, JSONArray itemIds, JSONArray ids) {
|
|
|
JSONObject previewJson = new JSONObject();
|
|
|
List<JSONObject> itemList = kuaishouItemCollectSamplesMapper.getItemList(itemIds);
|
|
|
Map<Long, JSONObject> itemMap = new HashMap<>();
|
|
@@ -162,18 +163,23 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
|
itemMap.put(itemJson.getLong("itemId"), itemJson);
|
|
|
}
|
|
|
Map<Long, JSONObject> promoterMap = new HashMap<>();
|
|
|
- List<JSONObject> promoterList = kuaishouItemCollectSamplesMapper.promoterList(promoterIds);
|
|
|
+ List<JSONObject> promoterList = kuaishouItemCollectSamplesMapper.promoterList(ids);
|
|
|
for (int i = 0; i < promoterList.size(); i++) {
|
|
|
JSONObject promoterJson = promoterList.get(i);
|
|
|
- promoterMap.put(promoterJson.getLong("promoterId"), promoterJson);
|
|
|
+ promoterMap.put(promoterJson.getLong("id"), promoterJson);
|
|
|
}
|
|
|
Integer sampleReceivedCount = 0;
|
|
|
List<JSONObject> samples = new ArrayList<>();
|
|
|
for (int i = 0; i < itemIds.size(); i++) {
|
|
|
Long itemId = itemIds.getLong(i);
|
|
|
JSONObject itemJson = itemMap.get(itemId);
|
|
|
- for (int j = 0; j < promoterIds.size(); j++) {
|
|
|
- Long promoterId = promoterIds.getLong(j);
|
|
|
+ for (int j = 0; j < ids.size(); j++) {
|
|
|
+ Long id = ids.getLong(j);
|
|
|
+ JSONObject promoterJson = promoterMap.get(id);
|
|
|
+ if(Check.isNull(promoterJson)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Long promoterId = promoterJson.getLong("promoterId");
|
|
|
Integer count = kuaishouItemCollectSamplesMapper.check(itemId, promoterId);
|
|
|
if (count > 0) {
|
|
|
sampleReceivedCount++;
|
|
@@ -190,8 +196,8 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
|
sampleJson.put("itemCreateName", itemJson.getString("userName"));
|
|
|
sampleJson.put("collectSampleId", userId);
|
|
|
sampleJson.put("collectSampleName", nickName);
|
|
|
- JSONObject promoterJson = promoterMap.get(promoterId);
|
|
|
- sampleJson.put("promoterId", promoterJson.getLong("promoterId"));
|
|
|
+
|
|
|
+ sampleJson.put("promoterId", promoterId);
|
|
|
sampleJson.put("promoterNickName", promoterJson.getString("promoterNickName"));
|
|
|
sampleJson.put("promoterPhone", promoterJson.getString("promoterPhone"));
|
|
|
sampleJson.put("promoterAddress", promoterJson.getString("promoterAddress"));
|