Authored by mali

Merge branch 'master' into test6.10.1

@@ -33,233 +33,234 @@ import java.util.stream.Collectors; @@ -33,233 +33,234 @@ import java.util.stream.Collectors;
33 public class MerchantServiceImpl { 33 public class MerchantServiceImpl {
34 34
35 private static final Logger LOGGER = LoggerFactory.getLogger(MerchantServiceImpl.class); 35 private static final Logger LOGGER = LoggerFactory.getLogger(MerchantServiceImpl.class);
36 -  
37 - private ThreadLocal<SimpleDateFormat> sdf = ThreadLocal.withInitial(()-> new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")); 36 +
  37 + private ThreadLocal<SimpleDateFormat> sdf = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"));
38 38
39 @Autowired 39 @Autowired
40 private SellerWalletDetailMapper mapper; 40 private SellerWalletDetailMapper mapper;
41 - @Autowired 41 + @Autowired
42 private SellerWalletMapper sellerWalletMapper; 42 private SellerWalletMapper sellerWalletMapper;
43 - @Autowired  
44 - private StoredSellerMapper storedSellerMapper;  
45 - @Autowired  
46 - private ProductMapper productMapper;  
47 - @Autowired  
48 - private GoodsMapper goodsMapper;  
49 - @Autowired  
50 - private StorageMapper storageMapper;  
51 - @Autowired  
52 - private UfoSizeMapper ufoSizeMapper;  
53 - @Autowired  
54 - private StoragePriceMapper storagePriceMapper; 43 + @Autowired
  44 + private StoredSellerMapper storedSellerMapper;
  45 + @Autowired
  46 + private ProductMapper productMapper;
  47 + @Autowired
  48 + private GoodsMapper goodsMapper;
  49 + @Autowired
  50 + private StorageMapper storageMapper;
  51 + @Autowired
  52 + private UfoSizeMapper ufoSizeMapper;
  53 + @Autowired
  54 + private StoragePriceMapper storagePriceMapper;
55 55
56 - public MerchantOrderAttachInfo earnestDetail(MerchantReq req) {  
57 - SellerWalletDetail sellerWalletDetail = mapper.selectById(req.getId());  
58 - MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();  
59 - if(StringUtils.isNotBlank(sellerWalletDetail.getAttachValue())) {  
60 - info = JSON.parseObject(sellerWalletDetail.getAttachValue(), MerchantOrderAttachInfo.class);  
61 - }  
62 - info.setId(sellerWalletDetail.getId());  
63 - info.setUid(sellerWalletDetail.getUid());  
64 - info.setType(sellerWalletDetail.getType());  
65 - info.setTime(sdf.get().format(new Date(sellerWalletDetail.getCreateTime() * 1000L)));  
66 - SellerWalletDetail.TypeSearch curType = null;  
67 - //如果类型不存在,则不进行处理  
68 - if(info.getType()==null || (curType = SellerWalletDetail.TypeSearch.of(new int[]{info.getType().intValue()}))==null){  
69 - return info;  
70 - }  
71 - if(curType.equals(SellerWalletDetail.TypeSearch.RE_CHARGE)){  
72 - return dealReCharge(info,sellerWalletDetail);//保证金充值  
73 - }  
74 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ONSHELF)){  
75 - return dealSellerOnShelf(info,sellerWalletDetail);//卖家上架商品  
76 - }  
77 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_OFFSHELF)){  
78 - return dealSellerOffShelf(info,sellerWalletDetail);//卖家下架商品  
79 - }  
80 - if(curType.equals(SellerWalletDetail.TypeSearch.TRADE_COMPLETE)){  
81 - return dealTradeComplete(info,sellerWalletDetail);//商品交易完成  
82 - }  
83 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_TRADEFAILED)){  
84 - return dealSellerTradeFailed(info,sellerWalletDetail);//卖家原因交易失败  
85 - }  
86 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ADDPRICE)){  
87 - return dealSellerAddPrice(info,sellerWalletDetail);//卖家上调价格  
88 - }  
89 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_REDUCEPRICE)){  
90 - return dealSellerReducePrice(info,sellerWalletDetail);//卖家下调价格  
91 - }  
92 - if(curType.equals(SellerWalletDetail.TypeSearch.BUYER_CANCEL)){  
93 - return dealBuyerCancel(info,sellerWalletDetail);//买家付款后取消订单  
94 - }  
95 - if(curType.equals(SellerWalletDetail.TypeSearch.SYSTEM_OFFSHELF)){  
96 - return dealSystemOffShelf(info,sellerWalletDetail);//系统下架商品  
97 - }  
98 - if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_QUIT)){  
99 - return dealSellerQuit(info,sellerWalletDetail);//卖家退出入驻  
100 - }  
101 - return info;  
102 - } 56 + public MerchantOrderAttachInfo earnestDetail(MerchantReq req) {
  57 + SellerWalletDetail sellerWalletDetail = mapper.selectById(req.getId());
  58 + MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();
  59 + if (StringUtils.isNotBlank(sellerWalletDetail.getAttachValue())) {
  60 + info = JSON.parseObject(sellerWalletDetail.getAttachValue(), MerchantOrderAttachInfo.class);
  61 + }
  62 + info.setId(sellerWalletDetail.getId());
  63 + info.setUid(sellerWalletDetail.getUid());
  64 + info.setType(sellerWalletDetail.getType());
  65 + info.setTime(sdf.get().format(new Date(sellerWalletDetail.getCreateTime() * 1000L)));
  66 + SellerWalletDetail.TypeSearch curType = null;
  67 + //如果类型不存在,则不进行处理
  68 + if (info.getType() == null || (curType = SellerWalletDetail.TypeSearch.of(new int[]{info.getType().intValue()})) == null) {
  69 + return info;
  70 + }
  71 + if (curType.equals(SellerWalletDetail.TypeSearch.RE_CHARGE)) {
  72 + return dealReCharge(info, sellerWalletDetail);//保证金充值
  73 + }
  74 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_ONSHELF)) {
  75 + return dealSellerOnShelf(info, sellerWalletDetail);//卖家上架商品
  76 + }
  77 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_OFFSHELF)) {
  78 + return dealSellerOffShelf(info, sellerWalletDetail);//卖家下架商品
  79 + }
  80 + if (curType.equals(SellerWalletDetail.TypeSearch.TRADE_COMPLETE)) {
  81 + return dealTradeComplete(info, sellerWalletDetail);//商品交易完成
  82 + }
  83 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_TRADEFAILED)) {
  84 + return dealSellerTradeFailed(info, sellerWalletDetail);//卖家原因交易失败
  85 + }
  86 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_ADDPRICE)) {
  87 + return dealSellerAddPrice(info, sellerWalletDetail);//卖家上调价格
  88 + }
  89 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_REDUCEPRICE)) {
  90 + return dealSellerReducePrice(info, sellerWalletDetail);//卖家下调价格
  91 + }
  92 + if (curType.equals(SellerWalletDetail.TypeSearch.BUYER_CANCEL)) {
  93 + return dealBuyerCancel(info, sellerWalletDetail);//买家付款后取消订单
  94 + }
  95 + if (curType.equals(SellerWalletDetail.TypeSearch.SYSTEM_OFFSHELF)) {
  96 + return dealSystemOffShelf(info, sellerWalletDetail);//系统下架商品
  97 + }
  98 + if (curType.equals(SellerWalletDetail.TypeSearch.SELLER_QUIT)) {
  99 + return dealSellerQuit(info, sellerWalletDetail);//卖家退出入驻
  100 + }
  101 + return info;
  102 + }
103 103
104 - private MerchantOrderAttachInfo dealReCharge(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
105 - if(info.getPayment()!=null){  
106 - info.setRechargeType(1==info.getPayment().intValue()?"支付宝":"微信");//充值方式  
107 - }  
108 - info.setSeriNo(info.getOrderCode()==null?null:info.getOrderCode().toString());//充值流水  
109 - info.setRechargeTime(info.getTime());//充值时间  
110 - info.setRechargeMoney(sellerWalletDetail.getAmount());//充值金额  
111 - return info;  
112 - } 104 + private MerchantOrderAttachInfo dealReCharge(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  105 + if (info.getPayment() != null) {
  106 + info.setRechargeType(1 == info.getPayment().intValue() ? "支付宝" : "微信");//充值方式
  107 + }
  108 + info.setSeriNo(info.getOrderCode() == null ? null : info.getOrderCode().toString());//充值流水
  109 + info.setRechargeTime(info.getTime());//充值时间
  110 + info.setRechargeMoney(sellerWalletDetail.getAmount());//充值金额
  111 + return info;
  112 + }
113 113
114 - private MerchantOrderAttachInfo dealSellerOnShelf(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
115 - info.setOnShelfTime(info.getTime());  
116 - info.setLockEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().abs().toString());  
117 - initProductInfo(info);  
118 - return info;  
119 - } 114 + private MerchantOrderAttachInfo dealSellerOnShelf(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  115 + info.setOnShelfTime(info.getTime());
  116 + info.setLockEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().abs().toString());
  117 + initProductInfo(info);
  118 + return info;
  119 + }
120 120
121 - private void initProductInfo(MerchantOrderAttachInfo info){  
122 - //根据orderCode查商品信息  
123 - info.setProductCount(info.getProductCount()==null?1:info.getProductCount());  
124 - StorageProductBo bo = initStorageProduct(info);  
125 - if(null == bo || bo.getProduct()==null || bo.getStorage() == null){  
126 - LOGGER.info("dealSellerOnShelf StorageProductBo is null!StorageProductBo is {},MerchantOrderAttachInfo is {}",bo,info);  
127 - return ;  
128 - }  
129 - info.setProductName(bo.getProduct().getProductName());  
130 - info.setSkup(bo.getProduct().getSkup());  
131 - List<Goods> goodsList = goodsMapper.selectByProductId(Arrays.asList(bo.getProduct().getId()));  
132 - if(!CollectionUtils.isEmpty(goodsList)){  
133 - info.setProductColor(goodsList.get(0).getGoodsName());  
134 - }  
135 - Size size = null;  
136 - if(bo.getStorage().getSizeId()!=null &&(size = ufoSizeMapper.selectOneById(bo.getStorage().getSizeId()))!=null){  
137 - info.setProductSize(size.getSizeName());  
138 - }  
139 - } 121 + private void initProductInfo(MerchantOrderAttachInfo info) {
  122 + //根据orderCode查商品信息
  123 + info.setProductCount(info.getProductCount() == null ? 1 : info.getProductCount());
  124 + StorageProductBo bo = initStorageProduct(info);
  125 + if (null == bo || bo.getProduct() == null || bo.getStorage() == null) {
  126 + LOGGER.info("dealSellerOnShelf StorageProductBo is null!StorageProductBo is {},MerchantOrderAttachInfo is {}", bo, info);
  127 + return;
  128 + }
  129 + info.setProductName(bo.getProduct().getProductName());
  130 + info.setSkup(bo.getProduct().getSkup());
  131 + List<Goods> goodsList = goodsMapper.selectByProductId(Arrays.asList(bo.getProduct().getId()));
  132 + if (!CollectionUtils.isEmpty(goodsList)) {
  133 + info.setProductColor(goodsList.get(0).getGoodsName());
  134 + }
  135 + Size size = null;
  136 + if (bo.getStorage().getSizeId() != null && (size = ufoSizeMapper.selectOneById(bo.getStorage().getSizeId())) != null) {
  137 + info.setProductSize(size.getSizeName());
  138 + }
  139 + }
140 140
141 - private StorageProductBo initStorageProduct(MerchantOrderAttachInfo info){  
142 - if(null != info.getStorageId()){  
143 - Storage storage = storageMapper.selectByPrimaryKey(info.getStorageId());  
144 - if(storage!=null){  
145 - Product product = null != storage.getProductId()?productMapper.selectByPrimaryKey(storage.getProductId()):null;  
146 - return new StorageProductBo(storage,product);  
147 - }  
148 - }  
149 - if(info.getSkup()!=null){  
150 - StoragePrice storagePrice = storagePriceMapper.selectBySkup(info.getSkup());  
151 - Storage storage = storageMapper.selectByPrimaryKey(storagePrice.getStorageId());  
152 - Product product = productMapper.selectByPrimaryKey(storagePrice.getProductId());  
153 - return new StorageProductBo(storage,product);  
154 - }  
155 - return null;  
156 - }  
157 - private MerchantOrderAttachInfo dealSellerOffShelf(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
158 - info.setUnShelfTime(info.getTime());  
159 - info.setReleaseEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().abs().toString());  
160 - initProductInfo(info);  
161 - return info;  
162 - } 141 + private StorageProductBo initStorageProduct(MerchantOrderAttachInfo info) {
  142 + if (null != info.getStorageId()) {
  143 + Storage storage = storageMapper.selectByPrimaryKey(info.getStorageId());
  144 + if (storage != null) {
  145 + Product product = null != storage.getProductId() ? productMapper.selectByPrimaryKey(storage.getProductId()) : null;
  146 + return new StorageProductBo(storage, product);
  147 + }
  148 + }
  149 + if (info.getSkup() != null) {
  150 + StoragePrice storagePrice = storagePriceMapper.selectBySkup(info.getSkup());
  151 + Storage storage = storageMapper.selectByPrimaryKey(storagePrice.getStorageId());
  152 + Product product = productMapper.selectByPrimaryKey(storagePrice.getProductId());
  153 + return new StorageProductBo(storage, product);
  154 + }
  155 + return null;
  156 + }
  157 +
  158 + private MerchantOrderAttachInfo dealSellerOffShelf(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  159 + info.setUnShelfTime(info.getTime());
  160 + info.setReleaseEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().abs().toString());
  161 + initProductInfo(info);
  162 + return info;
  163 + }
163 164
164 - private MerchantOrderAttachInfo dealTradeComplete(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
165 - info.setTradeCompleteTime(info.getTime());  
166 - info.setReleaseEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().abs().toString());  
167 - initProductInfo(info);  
168 - return info;  
169 - } 165 + private MerchantOrderAttachInfo dealTradeComplete(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  166 + info.setTradeCompleteTime(info.getTime());
  167 + info.setReleaseEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().abs().toString());
  168 + initProductInfo(info);
  169 + return info;
  170 + }
170 171
171 - private MerchantOrderAttachInfo dealSellerTradeFailed(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
172 - info.setCancelOrderTime(info.getTime());  
173 - info.setReleaseEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().abs().toString());  
174 - initProductInfo(info);  
175 - return info;  
176 - } 172 + private MerchantOrderAttachInfo dealSellerTradeFailed(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  173 + info.setCancelOrderTime(info.getTime());
  174 + info.setReleaseEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().abs().toString());
  175 + initProductInfo(info);
  176 + return info;
  177 + }
177 178
178 - private MerchantOrderAttachInfo dealSellerAddPrice(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
179 - info.setAdjustPriceTime(info.getTime());  
180 - info.setBeforeAdjustPrice(info.getBeforeProductPrice()==null?null:info.getBeforeProductPrice().toString());  
181 - info.setBeforeAdjustLockMoney(info.getBeforeEarnestMoney());  
182 - info.setAfterAdjustPrice(info.getAfterProductPrice()==null?null:info.getAfterProductPrice().toString());  
183 - info.setAfterAdjustLockMoney((info.getAfterEarnestMoney()));  
184 - if(info.getAfterAdjustLockMoney()!=null && info.getBeforeAdjustLockMoney()!=null){  
185 - BigDecimal afterLockMoney = new BigDecimal(info.getAfterAdjustLockMoney());  
186 - info.setAddLockEarnestMoney(afterLockMoney.subtract(new BigDecimal(info.getBeforeAdjustLockMoney())).abs().toString());  
187 - }  
188 - initProductInfo(info);  
189 - return info;  
190 - } 179 + private MerchantOrderAttachInfo dealSellerAddPrice(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  180 + info.setAdjustPriceTime(info.getTime());
  181 + info.setBeforeAdjustPrice(info.getBeforeProductPrice() == null ? null : info.getBeforeProductPrice().toString());
  182 + info.setBeforeAdjustLockMoney(info.getBeforeEarnestMoney());
  183 + info.setAfterAdjustPrice(info.getAfterProductPrice() == null ? null : info.getAfterProductPrice().toString());
  184 + info.setAfterAdjustLockMoney((info.getAfterEarnestMoney()));
  185 + if (info.getAfterAdjustLockMoney() != null && info.getBeforeAdjustLockMoney() != null) {
  186 + BigDecimal afterLockMoney = new BigDecimal(info.getAfterAdjustLockMoney());
  187 + info.setAddLockEarnestMoney(afterLockMoney.subtract(new BigDecimal(info.getBeforeAdjustLockMoney())).abs().toString());
  188 + }
  189 + initProductInfo(info);
  190 + return info;
  191 + }
191 192
192 - private MerchantOrderAttachInfo dealSellerReducePrice(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
193 - info.setAdjustPriceTime(info.getTime());  
194 - info.setBeforeAdjustPrice(info.getBeforeProductPrice()==null?null:info.getBeforeProductPrice().toString());  
195 - info.setBeforeAdjustLockMoney(info.getBeforeEarnestMoney());  
196 - info.setAfterAdjustPrice(info.getAfterProductPrice()==null?null:info.getAfterProductPrice().toString());  
197 - info.setAfterAdjustLockMoney((info.getAfterEarnestMoney()));  
198 - if(info.getAfterAdjustLockMoney()!=null && info.getBeforeAdjustLockMoney()!=null){  
199 - BigDecimal afterLockMoney = new BigDecimal(info.getAfterAdjustLockMoney());  
200 - info.setReduceLockEarnestMoney(afterLockMoney.subtract(new BigDecimal(info.getBeforeAdjustLockMoney())).abs().toString());  
201 - }  
202 - initProductInfo(info);  
203 - return info;  
204 - } 193 + private MerchantOrderAttachInfo dealSellerReducePrice(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  194 + info.setAdjustPriceTime(info.getTime());
  195 + info.setBeforeAdjustPrice(info.getBeforeProductPrice() == null ? null : info.getBeforeProductPrice().toString());
  196 + info.setBeforeAdjustLockMoney(info.getBeforeEarnestMoney());
  197 + info.setAfterAdjustPrice(info.getAfterProductPrice() == null ? null : info.getAfterProductPrice().toString());
  198 + info.setAfterAdjustLockMoney((info.getAfterEarnestMoney()));
  199 + if (info.getAfterAdjustLockMoney() != null && info.getBeforeAdjustLockMoney() != null) {
  200 + BigDecimal afterLockMoney = new BigDecimal(info.getAfterAdjustLockMoney());
  201 + info.setReduceLockEarnestMoney(afterLockMoney.subtract(new BigDecimal(info.getBeforeAdjustLockMoney())).abs().toString());
  202 + }
  203 + initProductInfo(info);
  204 + return info;
  205 + }
205 206
206 - private MerchantOrderAttachInfo dealBuyerCancel(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
207 - info.setBuyerCancelTime(info.getTime());  
208 - info.setReleaseEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().toString());  
209 - initProductInfo(info);  
210 - return info;  
211 - } 207 + private MerchantOrderAttachInfo dealBuyerCancel(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  208 + info.setBuyerCancelTime(info.getTime());
  209 + info.setReleaseEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().toString());
  210 + initProductInfo(info);
  211 + return info;
  212 + }
212 213
213 - private MerchantOrderAttachInfo dealSystemOffShelf(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
214 - info.setUnShelfTime(info.getTime());  
215 - info.setReleaseEarnestMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().toString());  
216 - initProductInfo(info);  
217 - return info;  
218 - } 214 + private MerchantOrderAttachInfo dealSystemOffShelf(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  215 + info.setUnShelfTime(info.getTime());
  216 + info.setReleaseEarnestMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().toString());
  217 + initProductInfo(info);
  218 + return info;
  219 + }
219 220
220 - private MerchantOrderAttachInfo dealSellerQuit(MerchantOrderAttachInfo info,SellerWalletDetail sellerWalletDetail) {  
221 - info.setRefundSeriNo(null == info.getOrderCode()?null:info.getOrderCode().toString());  
222 - info.setRefundTime(info.getTime());  
223 - info.setRefundType(1==info.getPayment().intValue()?"支付宝":"微信");  
224 - info.setRefundMoney(sellerWalletDetail.getAmount()==null?null:sellerWalletDetail.getAmount().toString());  
225 - return info;  
226 - } 221 + private MerchantOrderAttachInfo dealSellerQuit(MerchantOrderAttachInfo info, SellerWalletDetail sellerWalletDetail) {
  222 + info.setRefundSeriNo(null == info.getOrderCode() ? null : info.getOrderCode().toString());
  223 + info.setRefundTime(info.getTime());
  224 + info.setRefundType(1 == info.getPayment().intValue() ? "支付宝" : "微信");
  225 + info.setRefundMoney(sellerWalletDetail.getAmount() == null ? null : sellerWalletDetail.getAmount().toString());
  226 + return info;
  227 + }
227 228
228 229
229 - public PageResponseBO<MerchantOrderAttachInfo> earnestList(MerchantReq req) {  
230 - Integer stratTime = parse(req.getStartTime());  
231 - Integer endTime = parse(req.getEndTime());  
232 - List<Integer> uids = null;  
233 - if(StringUtils.isNotBlank(req.getMerchantName()) || StringUtils.isNotBlank(req.getUid())){  
234 - uids = storedSellerMapper.selectUidByCertNameAndUid(req.getMerchantName(),req.getUid());  
235 - if(CollectionUtils.isEmpty(uids)){  
236 - return new PageResponseBO<>();  
237 - }  
238 - }  
239 - int total = mapper.selectMerchantInfoCount(CollectionUtils.isEmpty(uids)?null:uids, stratTime, endTime, req.getStateList(),req.getOrderCode());  
240 - if(total == 0) {  
241 - return new PageResponseBO<>();  
242 - }  
243 - List<SellerWalletDetail> beanList = mapper.selectMerchantInfo(CollectionUtils.isEmpty(uids)?null:uids, stratTime, endTime, req.getStateList(),req.getOrderCode(), req.getStart(), req.getRows());  
244 - if(CollectionUtils.isEmpty(beanList)){  
245 - PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>();  
246 - result.setPage(req.getPage());  
247 - result.setSize(req.getSize());  
248 - result.setTotal(total);  
249 - return result;  
250 - }  
251 - Map<Integer,Map<String,Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(beanList.stream().map(cell->cell.getUid()).collect(Collectors.toList()));  
252 - List<MerchantOrderAttachInfo> boList = new ArrayList<>();  
253 - for(SellerWalletDetail detail : beanList) {  
254 - MerchantOrderAttachInfo info = exchange(detail);  
255 - info.setOrderCode(detail.getOrderCode());  
256 - Map<String,Object> storedSellerDataMap = storedSellerMap.get(detail.getUid());  
257 - if(null != storedSellerDataMap){  
258 - info.setMerchantName((String)storedSellerDataMap.get("cert_name"));  
259 - }  
260 - boList.add(info);  
261 - }  
262 - PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>(); 230 + public PageResponseBO<MerchantOrderAttachInfo> earnestList(MerchantReq req) {
  231 + Integer stratTime = parse(req.getStartTime());
  232 + Integer endTime = parse(req.getEndTime());
  233 + List<Integer> uids = null;
  234 + if (StringUtils.isNotBlank(req.getMerchantName()) || StringUtils.isNotBlank(req.getUid())) {
  235 + uids = storedSellerMapper.selectUidByCertNameAndUid(req.getMerchantName(), req.getUid());
  236 + if (CollectionUtils.isEmpty(uids)) {
  237 + return new PageResponseBO<>();
  238 + }
  239 + }
  240 + int total = mapper.selectMerchantInfoCount(CollectionUtils.isEmpty(uids) ? null : uids, stratTime, endTime, req.getStateList(), req.getOrderCode());
  241 + if (total == 0) {
  242 + return new PageResponseBO<>();
  243 + }
  244 + List<SellerWalletDetail> beanList = mapper.selectMerchantInfo(CollectionUtils.isEmpty(uids) ? null : uids, stratTime, endTime, req.getStateList(), req.getOrderCode(), req.getStart(), req.getRows());
  245 + if (CollectionUtils.isEmpty(beanList)) {
  246 + PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
  247 + result.setPage(req.getPage());
  248 + result.setSize(req.getSize());
  249 + result.setTotal(total);
  250 + return result;
  251 + }
  252 + Map<Integer, Map<String, Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(beanList.stream().map(cell -> cell.getUid()).collect(Collectors.toList()));
  253 + List<MerchantOrderAttachInfo> boList = new ArrayList<>();
  254 + for (SellerWalletDetail detail : beanList) {
  255 + MerchantOrderAttachInfo info = exchange(detail);
  256 + info.setOrderCode(detail.getOrderCode());
  257 + Map<String, Object> storedSellerDataMap = storedSellerMap.get(detail.getUid());
  258 + if (null != storedSellerDataMap) {
  259 + info.setMerchantName((String) storedSellerDataMap.get("cert_name"));
  260 + }
  261 + boList.add(info);
  262 + }
  263 + PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
263 result.setList(boList); 264 result.setList(boList);
264 result.setPage(req.getPage()); 265 result.setPage(req.getPage());
265 result.setSize(req.getSize()); 266 result.setSize(req.getSize());
@@ -268,92 +269,96 @@ public class MerchantServiceImpl { @@ -268,92 +269,96 @@ public class MerchantServiceImpl {
268 } 269 }
269 270
270 271
271 - private MerchantOrderAttachInfo exchange(SellerWalletDetail detail) {  
272 - MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();  
273 - if(StringUtils.isNotBlank(detail.getAttachValue())) {  
274 - info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);  
275 - info=info == null?new MerchantOrderAttachInfo():info;  
276 - }  
277 - info.setId(detail.getId());  
278 - info.setUid(detail.getUid());  
279 - info.setType(detail.getType());  
280 - if(null != info.getType()){  
281 - info.setTypeName(SellerWalletDetail.Type.of(detail.getType()).getName());  
282 - }  
283 - info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));  
284 - if (info.getType() / 10 == 3 || info.getType()==61) {  
285 - info.setAccountAmount(detail.getAmount()==null?null:detail.getAmount().toString());  
286 - info.setLockEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());  
287 - info.setAvailEarnestMoney("/");  
288 - } else {  
289 - info.setAccountAmount("/");  
290 - info.setLockEarnestMoney("/");  
291 - info.setAvailEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());  
292 - }  
293 - info.setAccountAllAmount(detail.getAvailAmount() == null?detail.getLockAmount()==null?  
294 - null:detail.getLockAmount().toString():detail.getAvailAmount().add(detail.getLockAmount()).toString());  
295 - info.setAvailAllEarnestMoney(detail.getAvailAmount() == null?null:detail.getAvailAmount().toString());  
296 - info.setLockAllEarnestMoney(detail.getLockAmount()==null?null:detail.getLockAmount().toString());  
297 - return info;  
298 - } 272 + private MerchantOrderAttachInfo exchange(SellerWalletDetail detail) {
  273 + MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();
  274 + if (StringUtils.isNotBlank(detail.getAttachValue())) {
  275 + try {
  276 + info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);
  277 + } catch (Exception e) {
  278 + // ignore exception
  279 + }
  280 + info = info == null ? new MerchantOrderAttachInfo() : info;
  281 + }
  282 + info.setId(detail.getId());
  283 + info.setUid(detail.getUid());
  284 + info.setType(detail.getType());
  285 + if (null != info.getType()) {
  286 + info.setTypeName(SellerWalletDetail.Type.of(detail.getType()).getName());
  287 + }
  288 + info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));
  289 + if (info.getType() / 10 == 3 || info.getType() == 61) {
  290 + info.setAccountAmount(detail.getAmount() == null ? null : detail.getAmount().toString());
  291 + info.setLockEarnestMoney(detail.getAmount() == null ? null : detail.getAmount().toString());
  292 + info.setAvailEarnestMoney("/");
  293 + } else {
  294 + info.setAccountAmount("/");
  295 + info.setLockEarnestMoney("/");
  296 + info.setAvailEarnestMoney(detail.getAmount() == null ? null : detail.getAmount().toString());
  297 + }
  298 + info.setAccountAllAmount(detail.getAvailAmount() == null ? detail.getLockAmount() == null ?
  299 + null : detail.getLockAmount().toString() : detail.getAvailAmount().add(detail.getLockAmount()).toString());
  300 + info.setAvailAllEarnestMoney(detail.getAvailAmount() == null ? null : detail.getAvailAmount().toString());
  301 + info.setLockAllEarnestMoney(detail.getLockAmount() == null ? null : detail.getLockAmount().toString());
  302 + return info;
  303 + }
299 304
300 305
301 - private Integer parse(String startTime) {  
302 - if(StringUtils.isBlank(startTime)) {  
303 - return null;  
304 - }  
305 - try {  
306 - return (int) (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime).getTime()/1000);  
307 - } catch (ParseException e) {  
308 - return null;  
309 - }  
310 - } 306 + private Integer parse(String startTime) {
  307 + if (StringUtils.isBlank(startTime)) {
  308 + return null;
  309 + }
  310 + try {
  311 + return (int) (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime).getTime() / 1000);
  312 + } catch (ParseException e) {
  313 + return null;
  314 + }
  315 + }
311 316
312 - public PageResponseBO<MerchantOrderAttachInfo> listSellerWallets(MerchantReq req) {  
313 - List<Integer> uids = null;  
314 - if(StringUtils.isNotBlank(req.getMerchantName())){  
315 - uids = storedSellerMapper.selectUidByCertName(req.getMerchantName());  
316 - if(CollectionUtils.isEmpty(uids)){  
317 - return new PageResponseBO<>();  
318 - }  
319 - }  
320 - int total = this.sellerWalletMapper.selectTotalByUidAndMerchantUids(req.getUid(),uids);  
321 - if(total == 0){  
322 - return new PageResponseBO<>();  
323 - }  
324 - List<SellerWallet> sellerWallets = this.sellerWalletMapper.selectByUidAndMerchantUids(req.getUid(),uids,req.getStart(),req.getSize());  
325 - if(CollectionUtils.isEmpty(sellerWallets)){  
326 - PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();  
327 - result.setTotal(total);  
328 - result.setPage(req.getPage());  
329 - result.setSize(req.getSize());  
330 - return result;  
331 - }  
332 - List<MerchantOrderAttachInfo> infos = initMerchantOrderAttachInfos(sellerWallets);  
333 - PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();  
334 - result.setTotal(total);  
335 - result.setList(infos);  
336 - result.setPage(req.getPage());  
337 - result.setSize(req.getSize());  
338 - return result;  
339 - } 317 + public PageResponseBO<MerchantOrderAttachInfo> listSellerWallets(MerchantReq req) {
  318 + List<Integer> uids = null;
  319 + if (StringUtils.isNotBlank(req.getMerchantName())) {
  320 + uids = storedSellerMapper.selectUidByCertName(req.getMerchantName());
  321 + if (CollectionUtils.isEmpty(uids)) {
  322 + return new PageResponseBO<>();
  323 + }
  324 + }
  325 + int total = this.sellerWalletMapper.selectTotalByUidAndMerchantUids(req.getUid(), uids);
  326 + if (total == 0) {
  327 + return new PageResponseBO<>();
  328 + }
  329 + List<SellerWallet> sellerWallets = this.sellerWalletMapper.selectByUidAndMerchantUids(req.getUid(), uids, req.getStart(), req.getSize());
  330 + if (CollectionUtils.isEmpty(sellerWallets)) {
  331 + PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
  332 + result.setTotal(total);
  333 + result.setPage(req.getPage());
  334 + result.setSize(req.getSize());
  335 + return result;
  336 + }
  337 + List<MerchantOrderAttachInfo> infos = initMerchantOrderAttachInfos(sellerWallets);
  338 + PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
  339 + result.setTotal(total);
  340 + result.setList(infos);
  341 + result.setPage(req.getPage());
  342 + result.setSize(req.getSize());
  343 + return result;
  344 + }
340 345
341 - private List<MerchantOrderAttachInfo> initMerchantOrderAttachInfos(List<SellerWallet> sellerWallets) {  
342 - List<MerchantOrderAttachInfo> infos = new ArrayList<>();  
343 - Map<Integer,Map<String,Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(sellerWallets.stream().map(cell->cell.getUid()).collect(Collectors.toList()));  
344 - for (SellerWallet sellerWallet : sellerWallets) {  
345 - MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();  
346 - BigDecimal amount = sellerWallet.getAmount();  
347 - BigDecimal lockMoney = sellerWallet.getLockAmount();  
348 - info.setId(sellerWallet.getId());  
349 - info.setAccountAmount(null == amount?null == lockMoney?null:lockMoney.toString():amount.add(sellerWallet.getLockAmount()).toString());  
350 - info.setLockEarnestMoney(null == lockMoney?null:lockMoney.toString());  
351 - info.setAvailEarnestMoney(null == amount?null:amount.toString());  
352 - info.setUid(sellerWallet.getUid());  
353 - Map<String,Object> certInfo = storedSellerMap.get(sellerWallet.getUid());  
354 - info.setMerchantName(certInfo==null?"":(String)certInfo.get("cert_name"));  
355 - infos.add(info);  
356 - }  
357 - return infos;  
358 - } 346 + private List<MerchantOrderAttachInfo> initMerchantOrderAttachInfos(List<SellerWallet> sellerWallets) {
  347 + List<MerchantOrderAttachInfo> infos = new ArrayList<>();
  348 + Map<Integer, Map<String, Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(sellerWallets.stream().map(cell -> cell.getUid()).collect(Collectors.toList()));
  349 + for (SellerWallet sellerWallet : sellerWallets) {
  350 + MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();
  351 + BigDecimal amount = sellerWallet.getAmount();
  352 + BigDecimal lockMoney = sellerWallet.getLockAmount();
  353 + info.setId(sellerWallet.getId());
  354 + info.setAccountAmount(null == amount ? null == lockMoney ? null : lockMoney.toString() : amount.add(sellerWallet.getLockAmount()).toString());
  355 + info.setLockEarnestMoney(null == lockMoney ? null : lockMoney.toString());
  356 + info.setAvailEarnestMoney(null == amount ? null : amount.toString());
  357 + info.setUid(sellerWallet.getUid());
  358 + Map<String, Object> certInfo = storedSellerMap.get(sellerWallet.getUid());
  359 + info.setMerchantName(certInfo == null ? "" : (String) certInfo.get("cert_name"));
  360 + infos.add(info);
  361 + }
  362 + return infos;
  363 + }
359 } 364 }
@@ -44,11 +44,12 @@ @@ -44,11 +44,12 @@
44 width: 150, 44 width: 150,
45 editable : false, 45 editable : false,
46 data: [ 46 data: [
47 - {"text" : "违规类型", "value" : "31,32,33,34", "selected": true}, 47 + {"text" : "违规类型", "value" : "31,32,33,34,35", "selected": true},
48 {"text" : "卖家不卖", "value" : 31}, 48 {"text" : "卖家不卖", "value" : 31},
49 {"text" : "超时未发货", "value" : 32}, 49 {"text" : "超时未发货", "value" : 32},
50 {"text" : "鉴定不通过", "value" : 33}, 50 {"text" : "鉴定不通过", "value" : 33},
51 {"text" : "卖家虚假发货", "value" : 34}, 51 {"text" : "卖家虚假发货", "value" : 34},
  52 + {"text" : "瑕疵确认不接受", "value" : 35}
52 ] 53 ]
53 }); 54 });
54 $("#marginTable").myDatagrid({ 55 $("#marginTable").myDatagrid({
@@ -119,7 +120,7 @@ @@ -119,7 +120,7 @@
119 $("#uid").textbox("clear"); 120 $("#uid").textbox("clear");
120 $("#merchantName").textbox("clear"); 121 $("#merchantName").textbox("clear");
121 $("#orderCode").textbox("clear"); 122 $("#orderCode").textbox("clear");
122 - $("#violationType").combobox('setValue',"31,32,33"); 123 + $("#violationType").combobox('setValue',"31,32,33,34,35");
123 $("#marginTable").myDatagrid('loadData', []); 124 $("#marginTable").myDatagrid('loadData', []);
124 loadData(); 125 loadData();
125 } 126 }
@@ -133,7 +134,7 @@ @@ -133,7 +134,7 @@
133 param.merchantName = $('#merchantName').textbox('getText'); 134 param.merchantName = $('#merchantName').textbox('getText');
134 param.orderCode = $('#orderCode').textbox('getValue'); 135 param.orderCode = $('#orderCode').textbox('getValue');
135 var stateList = $('#violationType').combobox('getValue').split(","); 136 var stateList = $('#violationType').combobox('getValue').split(",");
136 - param.stateList = stateList[0] == ""?[31,32,33]:stateList; 137 + param.stateList = stateList[0] == ""?[31,32,33,34,35]:stateList;
137 if(pageNumber){ 138 if(pageNumber){
138 param.page=pageNumber; 139 param.page=pageNumber;
139 } 140 }