记得上下班打卡 | git大法好,push需谨慎

Commit 8def0dee authored by 张国柄's avatar 张国柄

+API:服务保障列表;

parent 8b7542d5
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.goblin.dto.vo.GoblinServiceSupportVo;
import java.util.List;
public interface IGoblinMgtServiceSupportService {
/**
* 服务支持列表
* 不存在则创建
*
* @return List<GoblinServiceSupportVo>
*/
List<GoblinServiceSupportVo> list();
}
...@@ -4,6 +4,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; ...@@ -4,6 +4,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinServiceSupportVo; import com.liquidnet.service.goblin.dto.vo.GoblinServiceSupportVo;
import com.liquidnet.service.goblin.service.manage.IGoblinMgtServiceSupportService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,12 +25,12 @@ import java.util.List; ...@@ -24,12 +25,12 @@ import java.util.List;
@RequestMapping("mgt/sevs") @RequestMapping("mgt/sevs")
public class GoblinMgtServiceSupportController { public class GoblinMgtServiceSupportController {
@Autowired @Autowired
GoblinMongoUtils goblinMongoUtils; IGoblinMgtServiceSupportService goblinMgtServiceSupportService;
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "服务支持列表") @ApiOperation(value = "服务支持列表")
@PostMapping("list") @PostMapping("list")
public ResponseDto<List<GoblinServiceSupportVo>> list() { public ResponseDto<List<GoblinServiceSupportVo>> list() {
return ResponseDto.success(goblinMongoUtils.getMgtServiceSupportVo()); return ResponseDto.success(goblinMgtServiceSupportService.list());
} }
} }
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.service.goblin.dto.vo.GoblinServiceSupportVo;
import com.liquidnet.service.goblin.service.manage.IGoblinMgtServiceSupportService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Service
public class GoblinMgtServiceSupportServiceImpl implements IGoblinMgtServiceSupportService {
@Autowired
private GoblinMongoUtils goblinMongoUtils;
@Override
public List<GoblinServiceSupportVo> list() {
List<GoblinServiceSupportVo> serviceSupportVos = goblinMongoUtils.getMgtServiceSupportVos();
if (CollectionUtils.isEmpty(serviceSupportVos)) {
serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("正品保证").setDesc("商品为正版行货").setSsid("101"));
serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("极速发货").setDesc("24小时内发送货物").setSsid("102"));
serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("无忧退货").setDesc("支持7天无理由退款").setSsid("103"));
List<GoblinServiceSupportVo> serviceSupportVoList = goblinMongoUtils.insertMgtServiceSupportVos(serviceSupportVos);
// TODO: 2022/1/4 zhanggb + queue.sql
}
return serviceSupportVos;
}
}
...@@ -89,7 +89,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -89,7 +89,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
} }
// 服务保障处理 // 服务保障处理
vo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVo(storeMgtGoodsAddParam.getSsidList())); vo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVos(storeMgtGoodsAddParam.getSsidList()));
goblinMongoUtils.setGoodsInfoVo(vo); goblinMongoUtils.setGoodsInfoVo(vo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList); goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
......
...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component; ...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -55,21 +56,18 @@ public class GoblinMongoUtils { ...@@ -55,21 +56,18 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 服务保障数据源 ---------------------------------------- */ /* ---------------------------------------- 服务保障数据源 ---------------------------------------- */
public List<GoblinServiceSupportVo> getServiceSupportVo(List<String> ssids) { public List<GoblinServiceSupportVo> getServiceSupportVos(List<String> ssids) {
if (CollectionUtils.isEmpty(ssids)) return ObjectUtil.getGoblinServiceSupportVoArrayList(); if (CollectionUtils.isEmpty(ssids)) return ObjectUtil.getGoblinServiceSupportVoArrayList();
return mongoTemplate.find(Query.query(Criteria.where("ssid").in(ssids)), return mongoTemplate.find(Query.query(Criteria.where("ssid").in(ssids)),
GoblinServiceSupportVo.class,GoblinServiceSupportVo.class.getSimpleName()); GoblinServiceSupportVo.class,GoblinServiceSupportVo.class.getSimpleName());
} }
public List<GoblinServiceSupportVo> getMgtServiceSupportVo() { public List<GoblinServiceSupportVo> getMgtServiceSupportVos() {
List<GoblinServiceSupportVo> serviceSupportVoList = mongoTemplate.findAll(GoblinServiceSupportVo.class, GoblinServiceSupportVo.class.getSimpleName()); return mongoTemplate.findAll(GoblinServiceSupportVo.class, GoblinServiceSupportVo.class.getSimpleName());
if (CollectionUtils.isEmpty(serviceSupportVoList)) { }
serviceSupportVoList.add(GoblinServiceSupportVo.getNew().setName("正品保证").setDesc("商品为正版行货").setSsid("101"));
serviceSupportVoList.add(GoblinServiceSupportVo.getNew().setName("极速发货").setDesc("24小时内发送货物").setSsid("102")); public List<GoblinServiceSupportVo> insertMgtServiceSupportVos(List<GoblinServiceSupportVo> vos) {
serviceSupportVoList.add(GoblinServiceSupportVo.getNew().setName("无忧退货").setDesc("支持7天无理由退款").setSsid("103")); return (List<GoblinServiceSupportVo>) mongoTemplate.insert(vos, GoblinServiceSupportVo.class.getSimpleName());
mongoTemplate.insert(serviceSupportVoList, GoblinServiceSupportVo.class.getSimpleName());
}
return serviceSupportVoList;
} }
/* ---------------------------------------- 店铺数据源 ---------------------------------------- */ /* ---------------------------------------- 店铺数据源 ---------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment