Showing
6 changed files
with
146 additions
and
151 deletions
1 | -package com.yohobuy.platform.grass.restapi; | ||
2 | - | ||
3 | -import com.yohobuy.platform.grass.service.IGrassGoodsCommentService; | ||
4 | -import com.yohobuy.platform.model.common.ApiResponse; | ||
5 | -import com.yohobuy.platform.model.common.PageResponseVO; | ||
6 | -import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
7 | -import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
8 | -import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
9 | -import org.slf4j.Logger; | ||
10 | -import org.slf4j.LoggerFactory; | ||
11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
12 | -import org.springframework.web.bind.annotation.RequestBody; | ||
13 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
14 | -import org.springframework.web.bind.annotation.ResponseBody; | ||
15 | -import org.springframework.web.bind.annotation.RestController; | ||
16 | - | ||
17 | -/** | ||
18 | - * Created by shengguo.cai on 2019/1/21. | ||
19 | - */ | ||
20 | -@RestController | ||
21 | -@RequestMapping("/grassGoodsComment") | ||
22 | -public class GrassGoodsCommentController { | ||
23 | - private static final Logger logger = LoggerFactory.getLogger(GrassGoodsCommentController.class); | ||
24 | - @Autowired | ||
25 | - private IGrassGoodsCommentService grassGoodsCommentService; | ||
26 | - | ||
27 | - @RequestMapping("/queryGrassGoodsComment") | ||
28 | - @ResponseBody | ||
29 | - public ApiResponse queryGrassGoodsComment(GoodsCommentQueryReq req){ | ||
30 | - logger.info("enter queryGrassGoodsComment.param is {}",req); | ||
31 | - PageResponseVO<GoodsCommentQueryRsp> result = grassGoodsCommentService.queryComment(req); | ||
32 | - return new ApiResponse.ApiResponseBuilder().data(result).build(); | ||
33 | - } | ||
34 | - | ||
35 | - @RequestMapping("/modifyGrassGoodsCommentStatus") | ||
36 | - @ResponseBody | ||
37 | - public ApiResponse modifyGrassGoodsCommentStatus(@RequestBody GoodsCommentModifyStatusReq req){ | ||
38 | - logger.info("enter modifyGrassGoodsCommentStatus.param is {}",req); | ||
39 | - grassGoodsCommentService.modifyStatus(req); | ||
40 | - return new ApiResponse.ApiResponseBuilder().message("审核完成").build(); | ||
41 | - } | ||
42 | -} | 1 | +//package com.yohobuy.platform.grass.restapi; |
2 | +// | ||
3 | +//import com.yohobuy.platform.grass.service.IGrassGoodsCommentService; | ||
4 | +//import com.yohobuy.platform.model.common.ApiResponse; | ||
5 | +//import com.yohobuy.platform.model.common.PageResponseVO; | ||
6 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
7 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
8 | +//import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
9 | +//import org.slf4j.Logger; | ||
10 | +//import org.slf4j.LoggerFactory; | ||
11 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +//import org.springframework.web.bind.annotation.RequestBody; | ||
13 | +//import org.springframework.web.bind.annotation.RequestMapping; | ||
14 | +//import org.springframework.web.bind.annotation.ResponseBody; | ||
15 | +//import org.springframework.web.bind.annotation.RestController; | ||
16 | +// | ||
17 | +///** | ||
18 | +// * Created by shengguo.cai on 2019/1/21. | ||
19 | +// */ | ||
20 | +//@RestController | ||
21 | +//@RequestMapping("/grassGoodsComment") | ||
22 | +//public class GrassGoodsCommentController { | ||
23 | +// private static final Logger logger = LoggerFactory.getLogger(GrassGoodsCommentController.class); | ||
24 | +// @Autowired | ||
25 | +// private IGrassGoodsCommentService grassGoodsCommentService; | ||
26 | +// | ||
27 | +// @RequestMapping("/queryGrassGoodsComment") | ||
28 | +// @ResponseBody | ||
29 | +// public ApiResponse queryGrassGoodsComment(GoodsCommentQueryReq req){ | ||
30 | +// logger.info("enter queryGrassGoodsComment.param is {}",req); | ||
31 | +// PageResponseVO<GoodsCommentQueryRsp> result = grassGoodsCommentService.queryComment(req); | ||
32 | +// return new ApiResponse.ApiResponseBuilder().data(result).build(); | ||
33 | +// } | ||
34 | +// | ||
35 | +// @RequestMapping("/modifyGrassGoodsCommentStatus") | ||
36 | +// @ResponseBody | ||
37 | +// public ApiResponse modifyGrassGoodsCommentStatus(@RequestBody GoodsCommentModifyStatusReq req){ | ||
38 | +// logger.info("enter modifyGrassGoodsCommentStatus.param is {}",req); | ||
39 | +// grassGoodsCommentService.modifyStatus(req); | ||
40 | +// return new ApiResponse.ApiResponseBuilder().message("审核完成").build(); | ||
41 | +// } | ||
42 | +//} |
1 | -package com.yohobuy.platform.grass.service; | ||
2 | - | ||
3 | -import com.yohobuy.platform.model.common.PageResponseVO; | ||
4 | -import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
5 | -import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
6 | -import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
7 | - | ||
8 | -/** | ||
9 | - * Created by shengguo.cai on 2019/1/21. | ||
10 | - */ | ||
11 | -public interface IGrassGoodsCommentService { | ||
12 | - PageResponseVO<GoodsCommentQueryRsp> queryComment(GoodsCommentQueryReq req); | ||
13 | - | ||
14 | - void modifyStatus(GoodsCommentModifyStatusReq req); | ||
15 | -} | 1 | +//package com.yohobuy.platform.grass.service; |
2 | +// | ||
3 | +//import com.yohobuy.platform.model.common.PageResponseVO; | ||
4 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
5 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
6 | +//import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
7 | +// | ||
8 | +///** | ||
9 | +// * Created by shengguo.cai on 2019/1/21. | ||
10 | +// */ | ||
11 | +//public interface IGrassGoodsCommentService { | ||
12 | +// PageResponseVO<GoodsCommentQueryRsp> queryComment(GoodsCommentQueryReq req); | ||
13 | +// | ||
14 | +// void modifyStatus(GoodsCommentModifyStatusReq req); | ||
15 | +//} |
@@ -4,6 +4,7 @@ import com.yoho.core.common.utils.DateUtil; | @@ -4,6 +4,7 @@ import com.yoho.core.common.utils.DateUtil; | ||
4 | import com.yohobuy.platform.common.helper.UserHelper; | 4 | import com.yohobuy.platform.common.helper.UserHelper; |
5 | import com.yohobuy.platform.dal.common.BeanConvertUtil; | 5 | import com.yohobuy.platform.dal.common.BeanConvertUtil; |
6 | import com.yohobuy.platform.dal.grass.IGrassArticleCommentDao; | 6 | import com.yohobuy.platform.dal.grass.IGrassArticleCommentDao; |
7 | +import com.yohobuy.platform.dal.grass.model.GrassArticleCommentQueryDo; | ||
7 | import com.yohobuy.platform.grass.service.IGrassArticleCommentService; | 8 | import com.yohobuy.platform.grass.service.IGrassArticleCommentService; |
8 | import com.yohobuy.platform.model.common.PageResponseVO; | 9 | import com.yohobuy.platform.model.common.PageResponseVO; |
9 | import com.yohobuy.platform.model.grass.ChildCommentTotalBo; | 10 | import com.yohobuy.platform.model.grass.ChildCommentTotalBo; |
@@ -33,14 +34,17 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi | @@ -33,14 +34,17 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi | ||
33 | public PageResponseVO<ArticleCommentQueryRsp> queryComment(ArticleCommentQueryReq req) { | 34 | public PageResponseVO<ArticleCommentQueryRsp> queryComment(ArticleCommentQueryReq req) { |
34 | PageResponseVO<ArticleCommentQueryRsp> result = new PageResponseVO<>(); | 35 | PageResponseVO<ArticleCommentQueryRsp> result = new PageResponseVO<>(); |
35 | logger.info("queryComment:before selectTotalByCommentQueryReq,param is {}",req); | 36 | logger.info("queryComment:before selectTotalByCommentQueryReq,param is {}",req); |
36 | - int total = grassArticleCommentDao.selectTotalByCommentQueryReq(req); | 37 | + int total = grassArticleCommentDao.selectTotalByCommentQueryReq(req.getStatus(),req.getUid(),req.getDestId(),req.getBeginTime(),req.getEndTime(), |
38 | + GrassArticleCommentQueryDo.ColumnType.ARTICLE.getValue()); | ||
37 | result.setTotal(total); | 39 | result.setTotal(total); |
38 | result.setSize(req.getSize()); | 40 | result.setSize(req.getSize()); |
39 | result.setPage(req.getPage()); | 41 | result.setPage(req.getPage()); |
40 | if(total == 0){ | 42 | if(total == 0){ |
41 | return result; | 43 | return result; |
42 | } | 44 | } |
43 | - List<ArticleCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassArticleCommentDao.selectByCommentQueryReq(req),ArticleCommentQueryRsp.class); | 45 | + |
46 | + List<ArticleCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassArticleCommentDao.selectByCommentQueryReq(req.getStatus(),req.getUid(),req.getDestId(), | ||
47 | + req.getBeginTime(),req.getEndTime(),GrassArticleCommentQueryDo.ColumnType.ARTICLE.getValue(),req.getStart(),req.getSize()),ArticleCommentQueryRsp.class); | ||
44 | if(CollectionUtils.isEmpty(commentQueryRspList)){ | 48 | if(CollectionUtils.isEmpty(commentQueryRspList)){ |
45 | return result; | 49 | return result; |
46 | } | 50 | } |
1 | -package com.yohobuy.platform.grass.service.impl; | ||
2 | - | ||
3 | -import com.yoho.core.common.utils.DateUtil; | ||
4 | -import com.yohobuy.platform.common.helper.UserHelper; | ||
5 | -import com.yohobuy.platform.dal.common.BeanConvertUtil; | ||
6 | -import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao; | ||
7 | -import com.yohobuy.platform.grass.service.IGrassGoodsCommentService; | ||
8 | -import com.yohobuy.platform.model.common.PageResponseVO; | ||
9 | -import com.yohobuy.platform.model.grass.ChildCommentTotalBo; | ||
10 | -import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
11 | -import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
12 | -import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
13 | -import org.apache.commons.collections.CollectionUtils; | ||
14 | -import org.slf4j.Logger; | ||
15 | -import org.slf4j.LoggerFactory; | ||
16 | -import org.springframework.beans.factory.annotation.Autowired; | ||
17 | -import org.springframework.stereotype.Service; | ||
18 | - | ||
19 | -import java.util.List; | ||
20 | -import java.util.Map; | ||
21 | -import java.util.stream.Collectors; | ||
22 | - | ||
23 | -/** | ||
24 | - * Created by shengguo.cai on 2019/1/21. | ||
25 | - */ | ||
26 | -@Service | ||
27 | -public class GrassGoodsCommentServiceImpl implements IGrassGoodsCommentService { | ||
28 | - private static final Logger logger = LoggerFactory.getLogger(GrassGoodsCommentServiceImpl.class); | ||
29 | - @Autowired | ||
30 | - private IGrassGoodsCommentDao grassGoodsCommentDao; | ||
31 | - @Override | ||
32 | - public PageResponseVO<GoodsCommentQueryRsp> queryComment(GoodsCommentQueryReq req) { | ||
33 | - PageResponseVO<GoodsCommentQueryRsp> result = new PageResponseVO<>(); | ||
34 | - logger.info("queryComment:before selectTotalByCommentQueryReq,param is {}",req); | ||
35 | - int total = grassGoodsCommentDao.selectTotalByCommentQueryReq(req); | ||
36 | - result.setTotal(total); | ||
37 | - result.setSize(req.getSize()); | ||
38 | - result.setPage(req.getPage()); | ||
39 | - if(total == 0){ | ||
40 | - return result; | ||
41 | - } | ||
42 | - List<GoodsCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassGoodsCommentDao.selectByCommentQueryReq(req),GoodsCommentQueryRsp.class); | ||
43 | - if(CollectionUtils.isEmpty(commentQueryRspList)){ | ||
44 | - return result; | ||
45 | - } | ||
46 | - List<Integer> ids = commentQueryRspList.stream().map(com->com.getId()).collect(Collectors.toList()); | ||
47 | - Map<Integer,ChildCommentTotalBo> childMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectChildTotalMapByIds(ids),ChildCommentTotalBo.class); | ||
48 | - commentQueryRspList.forEach(com->{ | ||
49 | - ChildCommentTotalBo bo = childMap.get(com.getId()); | ||
50 | - if(bo != null){ | ||
51 | - com.setChildTotal(bo.getTotal()); | ||
52 | - } | ||
53 | - }); | ||
54 | - result.setList(commentQueryRspList); | ||
55 | - return result; | ||
56 | - } | ||
57 | - | ||
58 | - @Override | ||
59 | - public void modifyStatus(GoodsCommentModifyStatusReq req) { | ||
60 | - Integer reviewerId = new UserHelper().getUserId(); | ||
61 | - grassGoodsCommentDao.updateStatus(req.getIds(),req.getStatus(),reviewerId, DateUtil.currentTimeSeconds()); | ||
62 | - } | ||
63 | -} | 1 | +//package com.yohobuy.platform.grass.service.impl; |
2 | +// | ||
3 | +//import com.yoho.core.common.utils.DateUtil; | ||
4 | +//import com.yohobuy.platform.common.helper.UserHelper; | ||
5 | +//import com.yohobuy.platform.dal.common.BeanConvertUtil; | ||
6 | +//import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao; | ||
7 | +//import com.yohobuy.platform.grass.service.IGrassGoodsCommentService; | ||
8 | +//import com.yohobuy.platform.model.common.PageResponseVO; | ||
9 | +//import com.yohobuy.platform.model.grass.ChildCommentTotalBo; | ||
10 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq; | ||
11 | +//import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq; | ||
12 | +//import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp; | ||
13 | +//import org.apache.commons.collections.CollectionUtils; | ||
14 | +//import org.slf4j.Logger; | ||
15 | +//import org.slf4j.LoggerFactory; | ||
16 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
17 | +//import org.springframework.stereotype.Service; | ||
18 | +// | ||
19 | +//import java.util.List; | ||
20 | +//import java.util.Map; | ||
21 | +//import java.util.stream.Collectors; | ||
22 | +// | ||
23 | +///** | ||
24 | +// * Created by shengguo.cai on 2019/1/21. | ||
25 | +// */ | ||
26 | +//@Service | ||
27 | +//public class GrassGoodsCommentServiceImpl implements IGrassGoodsCommentService { | ||
28 | +// private static final Logger logger = LoggerFactory.getLogger(GrassGoodsCommentServiceImpl.class); | ||
29 | +// @Autowired | ||
30 | +// private IGrassGoodsCommentDao grassGoodsCommentDao; | ||
31 | +// @Override | ||
32 | +// public PageResponseVO<GoodsCommentQueryRsp> queryComment(GoodsCommentQueryReq req) { | ||
33 | +// PageResponseVO<GoodsCommentQueryRsp> result = new PageResponseVO<>(); | ||
34 | +// logger.info("queryComment:before selectTotalByCommentQueryReq,param is {}",req); | ||
35 | +// int total = grassGoodsCommentDao.selectTotalByCommentQueryReq(req); | ||
36 | +// result.setTotal(total); | ||
37 | +// result.setSize(req.getSize()); | ||
38 | +// result.setPage(req.getPage()); | ||
39 | +// if(total == 0){ | ||
40 | +// return result; | ||
41 | +// } | ||
42 | +// List<GoodsCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassGoodsCommentDao.selectByCommentQueryReq(req),GoodsCommentQueryRsp.class); | ||
43 | +// if(CollectionUtils.isEmpty(commentQueryRspList)){ | ||
44 | +// return result; | ||
45 | +// } | ||
46 | +// List<Integer> ids = commentQueryRspList.stream().map(com->com.getId()).collect(Collectors.toList()); | ||
47 | +// Map<Integer,ChildCommentTotalBo> childMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectChildTotalMapByIds(ids),ChildCommentTotalBo.class); | ||
48 | +// commentQueryRspList.forEach(com->{ | ||
49 | +// ChildCommentTotalBo bo = childMap.get(com.getId()); | ||
50 | +// if(bo != null){ | ||
51 | +// com.setChildTotal(bo.getTotal()); | ||
52 | +// } | ||
53 | +// }); | ||
54 | +// result.setList(commentQueryRspList); | ||
55 | +// return result; | ||
56 | +// } | ||
57 | +// | ||
58 | +// @Override | ||
59 | +// public void modifyStatus(GoodsCommentModifyStatusReq req) { | ||
60 | +// Integer reviewerId = new UserHelper().getUserId(); | ||
61 | +// grassGoodsCommentDao.updateStatus(req.getIds(),req.getStatus(),reviewerId, DateUtil.currentTimeSeconds()); | ||
62 | +// } | ||
63 | +//} |
@@ -6,6 +6,7 @@ import com.yoho.core.common.helpers.ImagesHelper; | @@ -6,6 +6,7 @@ import com.yoho.core.common.helpers.ImagesHelper; | ||
6 | import com.yoho.core.common.utils.DateUtil; | 6 | import com.yoho.core.common.utils.DateUtil; |
7 | import com.yoho.core.rest.client.ServiceCaller; | 7 | import com.yoho.core.rest.client.ServiceCaller; |
8 | import com.yoho.error.exception.ServiceException; | 8 | import com.yoho.error.exception.ServiceException; |
9 | +import com.yohobuy.platform.common.convert.BeanConvert; | ||
9 | import com.yohobuy.platform.dal.common.BeanConvertUtil; | 10 | import com.yohobuy.platform.dal.common.BeanConvertUtil; |
10 | import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao; | 11 | import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao; |
11 | import com.yohobuy.platform.dal.grass.IGrassGoodsDao; | 12 | import com.yohobuy.platform.dal.grass.IGrassGoodsDao; |
@@ -58,21 +59,22 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | @@ -58,21 +59,22 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | ||
58 | PageResponseVO<GoodsQueryRsp> result = new PageResponseVO<>(); | 59 | PageResponseVO<GoodsQueryRsp> result = new PageResponseVO<>(); |
59 | result.setPage(req.getPage()); | 60 | result.setPage(req.getPage()); |
60 | result.setSize(req.getSize()); | 61 | result.setSize(req.getSize()); |
61 | - int total = grassGoodsDao.selectTotalByGoodsQueryReq(req); | 62 | + int total = grassGoodsDao.selectTotalByGoodsQueryReq(req.getSkn()); |
62 | result.setTotal(total); | 63 | result.setTotal(total); |
63 | if(total == 0){ | 64 | if(total == 0){ |
64 | logger.info("queryGoods#selectTotalByGoodsQueryReq total is 0.param is {}",req); | 65 | logger.info("queryGoods#selectTotalByGoodsQueryReq total is 0.param is {}",req); |
65 | return result; | 66 | return result; |
66 | } | 67 | } |
67 | - List<GoodsQueryRsp> goodsBoList = BeanConvertUtil.convertList(grassGoodsDao.selectByGoodsQueryReq(req),GoodsQueryRsp.class); | 68 | + List<GoodsQueryRsp> goodsBoList = BeanConvertUtil.convertList(grassGoodsDao.selectByGoodsQueryReq(req.getSkn(),req.getStart(),req.getSize()),GoodsQueryRsp.class); |
68 | if(CollectionUtils.isEmpty(goodsBoList)){ | 69 | if(CollectionUtils.isEmpty(goodsBoList)){ |
69 | logger.info("queryGoods#selectByGoodsQueryReq goodsBoList is empty.param is {}",req); | 70 | logger.info("queryGoods#selectByGoodsQueryReq goodsBoList is empty.param is {}",req); |
70 | return result; | 71 | return result; |
71 | } | 72 | } |
72 | // 查询评论总数 | 73 | // 查询评论总数 |
73 | List<Integer> goodsIds = goodsBoList.stream().map(goods->goods.getId()).collect(Collectors.toList()); | 74 | List<Integer> goodsIds = goodsBoList.stream().map(goods->goods.getId()).collect(Collectors.toList()); |
74 | - Map<Integer,GoodsCommentTotalBo> commentMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectTotalMapByGoodsIds(goodsIds),GoodsCommentTotalBo.class); | ||
75 | - // 查询商品信息 | 75 | + //TODO 查询评论合并了 Map<Integer,GoodsCommentTotalBo> commentMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectTotalMapByGoodsIds(goodsIds),GoodsCommentTotalBo.class); |
76 | + Map<Integer,GoodsCommentTotalBo> commentMap = null;//TODO 查询评论后期实现 | ||
77 | + // 查询商品信息 | ||
76 | String skns = goodsBoList.stream().filter(goods-> StringUtils.isNotBlank(goods.getProductSkn())).map(goods->goods.getProductSkn()).collect(Collectors.joining(",")); | 78 | String skns = goodsBoList.stream().filter(goods-> StringUtils.isNotBlank(goods.getProductSkn())).map(goods->goods.getProductSkn()).collect(Collectors.joining(",")); |
77 | Map<String,JSONObject> productMap = buildProductMap(skns,1); | 79 | Map<String,JSONObject> productMap = buildProductMap(skns,1); |
78 | // 组装返回 | 80 | // 组装返回 |
@@ -116,9 +118,9 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | @@ -116,9 +118,9 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | ||
116 | if(CollectionUtils.isEmpty(reqList)){ | 118 | if(CollectionUtils.isEmpty(reqList)){ |
117 | throw new ServiceException(400,"param is empty!"); | 119 | throw new ServiceException(400,"param is empty!"); |
118 | } | 120 | } |
119 | - initAddGoodsContent(reqList); | ||
120 | - int createTime = DateUtil.getCurrentTimeSecond(); | ||
121 | - grassGoodsDao.insertByBatchAddGoodsReq(reqList,createTime); | 121 | + List<GrassGoods> goodsList = BeanConvertUtil.convertList(reqList,GrassGoods.class); |
122 | + initAddGoodsContent(goodsList); | ||
123 | + grassGoodsDao.insertByBatchAddGoodsReq(goodsList); | ||
122 | } | 124 | } |
123 | 125 | ||
124 | @Override | 126 | @Override |
@@ -134,7 +136,8 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | @@ -134,7 +136,8 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | ||
134 | throw new ServiceException(400,"some params are null!"); | 136 | throw new ServiceException(400,"some params are null!"); |
135 | } | 137 | } |
136 | req.setUpdateTime(DateUtil.getCurrentTimeSecond()); | 138 | req.setUpdateTime(DateUtil.getCurrentTimeSecond()); |
137 | - grassGoodsDao.updateByGoodsModifyReq(req); | 139 | + GrassGoods grassGoods = BeanConvert.copyBeans(GrassGoods.class,req); |
140 | + grassGoodsDao.updateByGoodsModifyReq(grassGoods); | ||
138 | } | 141 | } |
139 | 142 | ||
140 | @Override | 143 | @Override |
@@ -142,8 +145,9 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | @@ -142,8 +145,9 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | ||
142 | grassGoodsDao.updateStatus(status,id,DateUtil.getCurrentTimeSecond()); | 145 | grassGoodsDao.updateStatus(status,id,DateUtil.getCurrentTimeSecond()); |
143 | } | 146 | } |
144 | 147 | ||
145 | - private void initAddGoodsContent(List<BatchAddGoodsReq> reqList) { | ||
146 | - List<Integer> skns = reqList.stream().map(req->req.getSkn()).collect(Collectors.toList()); | 148 | + private void initAddGoodsContent(List<GrassGoods> reqList) { |
149 | + int createTime = DateUtil.getCurrentTimeSecond(); | ||
150 | + List<Integer> skns = reqList.stream().map(req->Integer.valueOf(req.getProductSkn())).collect(Collectors.toList()); | ||
147 | logger.info("initAddGoodsContent#before selectProductBySkns,skns is {}",skns); | 151 | logger.info("initAddGoodsContent#before selectProductBySkns,skns is {}",skns); |
148 | List<Product> productList = productMapper.selectProductBySkns(skns); | 152 | List<Product> productList = productMapper.selectProductBySkns(skns); |
149 | if(CollectionUtils.isEmpty(productList)){ | 153 | if(CollectionUtils.isEmpty(productList)){ |
@@ -153,7 +157,8 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | @@ -153,7 +157,8 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{ | ||
153 | Map<Integer,String> productContentMap = new HashMap<>(); | 157 | Map<Integer,String> productContentMap = new HashMap<>(); |
154 | productList.stream().forEach(product -> {productContentMap.put(product.getErpProductId(),product.getPhrase());}); | 158 | productList.stream().forEach(product -> {productContentMap.put(product.getErpProductId(),product.getPhrase());}); |
155 | reqList.stream().forEach(req->{ | 159 | reqList.stream().forEach(req->{ |
156 | - req.setContent(productContentMap.get(req.getSkn())); | 160 | + req.setContent(productContentMap.get(req.getProductSkn())); |
161 | + req.setCreateTime(createTime); | ||
157 | }); | 162 | }); |
158 | } | 163 | } |
159 | 164 |
@@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
75 | }); | 75 | }); |
76 | $("#iptArticleId").numberbox({ | 76 | $("#iptArticleId").numberbox({ |
77 | required:false, | 77 | required:false, |
78 | - prompt: "原内容ID" | 78 | + prompt: "文章ID" |
79 | }); | 79 | }); |
80 | 80 | ||
81 | $("#allBtn").linkbutton({ | 81 | $("#allBtn").linkbutton({ |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | $("#labelGroupListTable").datagrid("load", { | 120 | $("#labelGroupListTable").datagrid("load", { |
121 | status: status, | 121 | status: status, |
122 | uid: $("#iptUid").textbox("getValue"), | 122 | uid: $("#iptUid").textbox("getValue"), |
123 | - articleId: $("#iptArticleId").textbox("getValue"), | 123 | + destId: $("#iptArticleId").textbox("getValue"), |
124 | beginTime: startTime, | 124 | beginTime: startTime, |
125 | endTime: endTime | 125 | endTime: endTime |
126 | }); | 126 | }); |
@@ -158,22 +158,8 @@ | @@ -158,22 +158,8 @@ | ||
158 | align: "left" | 158 | align: "left" |
159 | }, | 159 | }, |
160 | { | 160 | { |
161 | - title: "原文类型", | ||
162 | - field: "columnType", | ||
163 | - width: 15, | ||
164 | - align: "center", | ||
165 | - formatter: function (value, rowData, rowIndex) { | ||
166 | - if(value == '1000'){ | ||
167 | - return "文章"; | ||
168 | - } | ||
169 | - if(value == '1001'){ | ||
170 | - return "晒单"; | ||
171 | - } | ||
172 | - } | ||
173 | - }, | ||
174 | - { | ||
175 | - title: "晒单ID", | ||
176 | - field: "shareOrderId", | 161 | + title: "文章ID", |
162 | + field: "destId", | ||
177 | width: 20, | 163 | width: 20, |
178 | align: "labelAmount" | 164 | align: "labelAmount" |
179 | }, | 165 | }, |
-
Please register or login to post a comment