Showing
7 changed files
with
94 additions
and
2 deletions
1 | +package com.yoho.product.dal; | ||
2 | + | ||
3 | +import com.yoho.product.model.SecondhandInfo; | ||
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | + | ||
9 | +public interface SecondhandInfoMapper { | ||
10 | + | ||
11 | + List<SecondhandInfo> selectBySkups(@Param("skupList")List<Integer> skupList); | ||
12 | +} |
1 | +package com.yoho.product.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +@Data | ||
7 | +@ToString | ||
8 | +public class SecondhandInfo { | ||
9 | + private Integer id; | ||
10 | + | ||
11 | + private Integer skup; | ||
12 | + | ||
13 | + private String flawId; | ||
14 | + | ||
15 | + private String flawAttr; | ||
16 | + | ||
17 | + private String describeInfo; | ||
18 | + | ||
19 | + private String rejectReason; | ||
20 | +} |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yoho.product.dal.SecondhandInfoMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.product.model.SecondhandInfo" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="skup" property="skup" jdbcType="INTEGER" /> | ||
7 | + <result column="flaw_id" property="flawId" jdbcType="VARCHAR" /> | ||
8 | + <result column="flaw_attr" property="flawAttr" jdbcType="VARCHAR" /> | ||
9 | + <result column="describe_info" property="describe_info" jdbcType="VARCHAR" /> | ||
10 | + <result column="create_time" property="createTime" jdbcType="INTEGER" /> | ||
11 | + <result column="reject_reason" property="rejectReason" javaType="VARCHAR"/> | ||
12 | + </resultMap> | ||
13 | + <sql id="Base_Column_List" > | ||
14 | + id, skup, flaw_id, flaw_attr, describe_info, create_time, reject_reason | ||
15 | + </sql> | ||
16 | + | ||
17 | + <select id="selectBySkups" resultMap="BaseResultMap" > | ||
18 | + select <include refid="Base_Column_List" /> | ||
19 | + from secondhand_info where skup in | ||
20 | + <foreach item="item" index="index" collection="skupList" open="(" separator="," close=")"> | ||
21 | + #{item} | ||
22 | + </foreach> | ||
23 | + </select> | ||
24 | +</mapper> |
@@ -55,7 +55,7 @@ public class ProductAssistService { | @@ -55,7 +55,7 @@ public class ProductAssistService { | ||
55 | private UfoSizeMapper sizeMapper; | 55 | private UfoSizeMapper sizeMapper; |
56 | 56 | ||
57 | @Autowired | 57 | @Autowired |
58 | - private AuditRejectInfoService auditRejectInfoService; | 58 | + private SecondhandInfoService secondhandInfoService; |
59 | 59 | ||
60 | // 商品列表填充品牌名称 | 60 | // 商品列表填充品牌名称 |
61 | public ProductAssistService fillBrandName(List<ProductResponceBo> productResponceBos) { | 61 | public ProductAssistService fillBrandName(List<ProductResponceBo> productResponceBos) { |
@@ -199,7 +199,7 @@ public class ProductAssistService { | @@ -199,7 +199,7 @@ public class ProductAssistService { | ||
199 | List<Integer> skupList = productResponceBos.stream().filter(item -> ProductSkupStatusEnum.CHECK_REJEST.getStatus().equals(item.getStatus())) | 199 | List<Integer> skupList = productResponceBos.stream().filter(item -> ProductSkupStatusEnum.CHECK_REJEST.getStatus().equals(item.getStatus())) |
200 | .map(ProductResponceBo::getSkup).collect(Collectors.toList()); | 200 | .map(ProductResponceBo::getSkup).collect(Collectors.toList()); |
201 | 201 | ||
202 | - Map<Integer, String> auditRejectInfos = auditRejectInfoService.selectBySkupsEx(skupList); | 202 | + Map<Integer, String> auditRejectInfos = secondhandInfoService.selectBySkupsEx(skupList); |
203 | 203 | ||
204 | productResponceBos.stream().forEach(item -> item.setCheckRejustReason(auditRejectInfos.get(item.getSkup()))); | 204 | productResponceBos.stream().forEach(item -> item.setCheckRejustReason(auditRejectInfos.get(item.getSkup()))); |
205 | return this; | 205 | return this; |
1 | +package com.yoho.ufo.service.impl; | ||
2 | + | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yoho.product.dal.SecondhandInfoMapper; | ||
5 | +import com.yoho.product.model.AuditRejectInfo; | ||
6 | +import com.yoho.product.model.SecondhandInfo; | ||
7 | +import org.apache.commons.collections.CollectionUtils; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | +import java.util.Map; | ||
13 | +import java.util.stream.Collectors; | ||
14 | + | ||
15 | +/** | ||
16 | + * Created by li.ma on 2019/4/10. | ||
17 | + */ | ||
18 | +@Service | ||
19 | +public class SecondhandInfoService { | ||
20 | + @Autowired | ||
21 | + private SecondhandInfoMapper secondhandInfoMapper; | ||
22 | + | ||
23 | + public List<SecondhandInfo> selectBySkups(List<Integer> skupList) { | ||
24 | + if (CollectionUtils.isEmpty(skupList)) { | ||
25 | + return Lists.newArrayList(); | ||
26 | + } | ||
27 | + return secondhandInfoMapper.selectBySkups(skupList); | ||
28 | + } | ||
29 | + | ||
30 | + public Map<Integer, String> selectBySkupsEx(List<Integer> skupList) { | ||
31 | + List<SecondhandInfo> auditRejectInfos = selectBySkups(skupList); | ||
32 | + return auditRejectInfos.stream().collect(Collectors.toMap(SecondhandInfo::getSkup, SecondhandInfo::getRejectReason)); | ||
33 | + } | ||
34 | +} |
@@ -11,6 +11,7 @@ datasources: | @@ -11,6 +11,7 @@ datasources: | ||
11 | - com.yoho.product.dal.ProductSelfShelvesMapper | 11 | - com.yoho.product.dal.ProductSelfShelvesMapper |
12 | - com.yoho.product.dal.ProductSelfShelvesPicMapper | 12 | - com.yoho.product.dal.ProductSelfShelvesPicMapper |
13 | - com.yoho.product.dal.AuditRejectInfoMapper | 13 | - com.yoho.product.dal.AuditRejectInfoMapper |
14 | + - com.yoho.product.dal.SecondhandInfoMapper | ||
14 | 15 | ||
15 | ufo_order: | 16 | ufo_order: |
16 | servers: | 17 | servers: |
@@ -11,6 +11,7 @@ datasources: | @@ -11,6 +11,7 @@ datasources: | ||
11 | - com.yoho.product.dal.ProductSelfShelvesMapper | 11 | - com.yoho.product.dal.ProductSelfShelvesMapper |
12 | - com.yoho.product.dal.ProductSelfShelvesPicMapper | 12 | - com.yoho.product.dal.ProductSelfShelvesPicMapper |
13 | - com.yoho.product.dal.AuditRejectInfoMapper | 13 | - com.yoho.product.dal.AuditRejectInfoMapper |
14 | + - com.yoho.product.dal.SecondhandInfoMapper | ||
14 | 15 | ||
15 | ufo_order: | 16 | ufo_order: |
16 | servers: | 17 | servers: |
-
Please register or login to post a comment