Authored by csgyoho

Merge branch 'dev-margin-20181207' into test6.8.3

@@ -31,8 +31,54 @@ public class SellerWalletDetail { @@ -31,8 +31,54 @@ public class SellerWalletDetail {
31 private BigDecimal lockAmount; 31 private BigDecimal lockAmount;
32 private Integer isSet; 32 private Integer isSet;
33 33
34 -  
35 - public enum Type { 34 + public enum Type{
  35 + RE_CHARGE("充值保证金", 1),
  36 + SELLER_ONSHELF("卖家上架商品", 11),
  37 + SELLER_ADDPRICE("卖家上调价格", 12),
  38 + TRADE_COMPLETE("商品交易完成", 51),
  39 + SELLER_REDUCEPRICE("卖家下调价格", 13),
  40 + SELLER_OFFSHELF("卖家下架商品", 21),
  41 + SYSTEM_OFFSHELF("系统下架商品", 22),
  42 + SELLER_UNSELL("卖家不卖",31),
  43 + SELLER_SELLOUTTIME("卖家超时发货",32),
  44 + SELLER_CHECKFAILED("鉴定不通过", 33),
  45 + BUYER_CANCEL_NOLOG("买家取消(无物流)", 41),
  46 + BUYER_CANCEL_LOG("买家取消(有物流)", 42),
  47 + SELLER_QUIT("卖家退出入驻", 61);
  48 + private String name;
  49 + private int value;
  50 +
  51 + public String getName() {
  52 + return name;
  53 + }
  54 +
  55 + public void setName(String name) {
  56 + this.name = name;
  57 + }
  58 +
  59 + public int getValue() {
  60 + return value;
  61 + }
  62 +
  63 + public void setValue(int value) {
  64 + this.value = value;
  65 + }
  66 +
  67 + private Type(String name, int value) {
  68 + this.name = name;
  69 + this.value = value;
  70 + }
  71 + public static Type of(int value) {
  72 + for (Type t : values()) {
  73 + if(t.value == value){
  74 + return t;
  75 + }
  76 + }
  77 + return null;
  78 + }
  79 + }
  80 +
  81 + public enum TypeSearch {
36 // 1:充值,11:发布上架,12:加价,13:减价, 82 // 1:充值,11:发布上架,12:加价,13:减价,
37 // 21卖家下架,22系统下架,31卖家不卖,32卖家超时发货,33鉴定不通过, 83 // 21卖家下架,22系统下架,31卖家不卖,32卖家超时发货,33鉴定不通过,
38 // 41买家取消(无物流), 42买家取消(有物流), 84 // 41买家取消(无物流), 42买家取消(有物流),
@@ -52,7 +98,7 @@ public class SellerWalletDetail { @@ -52,7 +98,7 @@ public class SellerWalletDetail {
52 private String name; 98 private String name;
53 private int[] value; 99 private int[] value;
54 100
55 - private Type(String name, int[] value) { 101 + private TypeSearch(String name, int[] value) {
56 this.name = name; 102 this.name = name;
57 this.value = value; 103 this.value = value;
58 } 104 }
@@ -68,11 +114,11 @@ public class SellerWalletDetail { @@ -68,11 +114,11 @@ public class SellerWalletDetail {
68 * @param value 114 * @param value
69 * @return 115 * @return
70 */ 116 */
71 - public static Type of(int[] value) { 117 + public static TypeSearch of(int[] value) {
72 if(value == null || value.length == 0){ 118 if(value == null || value.length == 0){
73 return null; 119 return null;
74 } 120 }
75 - for (Type t : values()) { 121 + for (TypeSearch t : values()) {
76 boolean isFind=true; 122 boolean isFind=true;
77 if(t.value.length<value.length){ 123 if(t.value.length<value.length){
78 continue; 124 continue;
@@ -63,39 +63,39 @@ public class MerchantServiceImpl { @@ -63,39 +63,39 @@ public class MerchantServiceImpl {
63 info.setUid(sellerWalletDetail.getUid()); 63 info.setUid(sellerWalletDetail.getUid());
64 info.setType(sellerWalletDetail.getType()); 64 info.setType(sellerWalletDetail.getType());
65 info.setTime(sdf.get().format(new Date(sellerWalletDetail.getCreateTime() * 1000L))); 65 info.setTime(sdf.get().format(new Date(sellerWalletDetail.getCreateTime() * 1000L)));
66 - SellerWalletDetail.Type curType = null; 66 + SellerWalletDetail.TypeSearch curType = null;
67 //如果类型不存在,则不进行处理 67 //如果类型不存在,则不进行处理
68 - if(info.getType()==null || (curType = SellerWalletDetail.Type.of(new int[]{info.getType().intValue()}))==null){ 68 + if(info.getType()==null || (curType = SellerWalletDetail.TypeSearch.of(new int[]{info.getType().intValue()}))==null){
69 return info; 69 return info;
70 } 70 }
71 - if(curType.equals(SellerWalletDetail.Type.RE_CHARGE)){ 71 + if(curType.equals(SellerWalletDetail.TypeSearch.RE_CHARGE)){
72 return dealReCharge(info,sellerWalletDetail);//保证金充值 72 return dealReCharge(info,sellerWalletDetail);//保证金充值
73 } 73 }
74 - if(curType.equals(SellerWalletDetail.Type.SELLER_ONSHELF)){ 74 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ONSHELF)){
75 return dealSellerOnShelf(info,sellerWalletDetail);//卖家上架商品 75 return dealSellerOnShelf(info,sellerWalletDetail);//卖家上架商品
76 } 76 }
77 - if(curType.equals(SellerWalletDetail.Type.SELLER_OFFSHELF)){ 77 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_OFFSHELF)){
78 return dealSellerOffShelf(info,sellerWalletDetail);//卖家下架商品 78 return dealSellerOffShelf(info,sellerWalletDetail);//卖家下架商品
79 } 79 }
80 - if(curType.equals(SellerWalletDetail.Type.TRADE_COMPLETE)){ 80 + if(curType.equals(SellerWalletDetail.TypeSearch.TRADE_COMPLETE)){
81 return dealTradeComplete(info,sellerWalletDetail);//商品交易完成 81 return dealTradeComplete(info,sellerWalletDetail);//商品交易完成
82 } 82 }
83 - if(curType.equals(SellerWalletDetail.Type.SELLER_TRADEFAILED)){ 83 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_TRADEFAILED)){
84 return dealSellerTradeFailed(info,sellerWalletDetail);//卖家原因交易失败 84 return dealSellerTradeFailed(info,sellerWalletDetail);//卖家原因交易失败
85 } 85 }
86 - if(curType.equals(SellerWalletDetail.Type.SELLER_ADDPRICE)){ 86 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_ADDPRICE)){
87 return dealSellerAddPrice(info,sellerWalletDetail);//卖家上调价格 87 return dealSellerAddPrice(info,sellerWalletDetail);//卖家上调价格
88 } 88 }
89 - if(curType.equals(SellerWalletDetail.Type.SELLER_REDUCEPRICE)){ 89 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_REDUCEPRICE)){
90 return dealSellerReducePrice(info,sellerWalletDetail);//卖家下调价格 90 return dealSellerReducePrice(info,sellerWalletDetail);//卖家下调价格
91 } 91 }
92 - if(curType.equals(SellerWalletDetail.Type.BUYER_CANCEL)){ 92 + if(curType.equals(SellerWalletDetail.TypeSearch.BUYER_CANCEL)){
93 return dealBuyerCancel(info,sellerWalletDetail);//买家付款后取消订单 93 return dealBuyerCancel(info,sellerWalletDetail);//买家付款后取消订单
94 } 94 }
95 - if(curType.equals(SellerWalletDetail.Type.SYSTEM_OFFSHELF)){ 95 + if(curType.equals(SellerWalletDetail.TypeSearch.SYSTEM_OFFSHELF)){
96 return dealSystemOffShelf(info,sellerWalletDetail);//系统下架商品 96 return dealSystemOffShelf(info,sellerWalletDetail);//系统下架商品
97 } 97 }
98 - if(curType.equals(SellerWalletDetail.Type.SELLER_QUIT)){ 98 + if(curType.equals(SellerWalletDetail.TypeSearch.SELLER_QUIT)){
99 return dealSellerQuit(info,sellerWalletDetail);//卖家退出入驻 99 return dealSellerQuit(info,sellerWalletDetail);//卖家退出入驻
100 } 100 }
101 return info; 101 return info;
@@ -230,7 +230,7 @@ public class MerchantServiceImpl { @@ -230,7 +230,7 @@ public class MerchantServiceImpl {
230 Integer stratTime = parse(req.getStartTime()); 230 Integer stratTime = parse(req.getStartTime());
231 Integer endTime = parse(req.getEndTime()); 231 Integer endTime = parse(req.getEndTime());
232 List<Integer> uids = null; 232 List<Integer> uids = null;
233 - if(StringUtils.isNotBlank(req.getMerchantName()) || req.getUid() !=null){ 233 + if(StringUtils.isNotBlank(req.getMerchantName()) || StringUtils.isNotBlank(req.getUid())){
234 uids = storedSellerMapper.selectUidByCertNameAndUid(req.getMerchantName(),req.getUid()); 234 uids = storedSellerMapper.selectUidByCertNameAndUid(req.getMerchantName(),req.getUid());
235 if(CollectionUtils.isEmpty(uids)){ 235 if(CollectionUtils.isEmpty(uids)){
236 return new PageResponseBO<>(); 236 return new PageResponseBO<>();
@@ -241,15 +241,19 @@ public class MerchantServiceImpl { @@ -241,15 +241,19 @@ public class MerchantServiceImpl {
241 return new PageResponseBO<>(); 241 return new PageResponseBO<>();
242 } 242 }
243 List<SellerWalletDetail> beanList = mapper.selectMerchantInfo(CollectionUtils.isEmpty(uids)?null:uids, stratTime, endTime, req.getStateList(),req.getOrderCode(), req.getStart(), req.getRows()); 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 + }
244 Map<Integer,Map<String,Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(beanList.stream().map(cell->cell.getUid()).collect(Collectors.toList())); 251 Map<Integer,Map<String,Object>> storedSellerMap = this.storedSellerMapper.selectNameByUids(beanList.stream().map(cell->cell.getUid()).collect(Collectors.toList()));
245 List<MerchantOrderAttachInfo> boList = new ArrayList<>(); 252 List<MerchantOrderAttachInfo> boList = new ArrayList<>();
246 for(SellerWalletDetail detail : beanList) { 253 for(SellerWalletDetail detail : beanList) {
247 - MerchantOrderAttachInfo info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);  
248 - info=info == null?new MerchantOrderAttachInfo():info; 254 + MerchantOrderAttachInfo info = exchange(detail);
249 info.setOrderCode(detail.getOrderCode()); 255 info.setOrderCode(detail.getOrderCode());
250 - info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));  
251 info.setMerchantName((String)storedSellerMap.get(detail.getUid()).get("cert_name")); 256 info.setMerchantName((String)storedSellerMap.get(detail.getUid()).get("cert_name"));
252 - info.setUid(detail.getUid());  
253 boList.add(info); 257 boList.add(info);
254 } 258 }
255 PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>(); 259 PageResponseBO<MerchantOrderAttachInfo> result=new PageResponseBO<>();
@@ -265,24 +269,30 @@ public class MerchantServiceImpl { @@ -265,24 +269,30 @@ public class MerchantServiceImpl {
265 MerchantOrderAttachInfo info = new MerchantOrderAttachInfo(); 269 MerchantOrderAttachInfo info = new MerchantOrderAttachInfo();
266 if(StringUtils.isNotBlank(detail.getAttachValue())) { 270 if(StringUtils.isNotBlank(detail.getAttachValue())) {
267 info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class); 271 info = JSON.parseObject(detail.getAttachValue(), MerchantOrderAttachInfo.class);
  272 + info=info == null?new MerchantOrderAttachInfo():info;
268 } 273 }
269 info.setId(detail.getId()); 274 info.setId(detail.getId());
270 info.setUid(detail.getUid()); 275 info.setUid(detail.getUid());
271 info.setType(detail.getType()); 276 info.setType(detail.getType());
272 - info.setUserName(""); 277 + if(null != info.getType()){
  278 + info.setTypeName(SellerWalletDetail.Type.of(detail.getType()).getName());
  279 + }
273 info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L))); 280 info.setTime(sdf.get().format(new Date(detail.getCreateTime() * 1000L)));
274 if (info.getType() / 10 == 3 || info.getType()==61) { 281 if (info.getType() / 10 == 3 || info.getType()==61) {
275 - info.setAccountAmount(detail.getAmount().toString());  
276 - info.setLockEarnestMoney(detail.getAmount().toString()); 282 + info.setAccountAmount(detail.getAmount()==null?null:detail.getAmount().toString());
  283 + info.setLockEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());
277 info.setAvailEarnestMoney("/"); 284 info.setAvailEarnestMoney("/");
278 } else { 285 } else {
279 info.setAccountAmount("/"); 286 info.setAccountAmount("/");
280 info.setLockEarnestMoney("/"); 287 info.setLockEarnestMoney("/");
281 - info.setAvailEarnestMoney(detail.getAmount().toString()); 288 + info.setAvailEarnestMoney(detail.getAmount()==null?null:detail.getAmount().toString());
  289 + }
  290 + if(detail.getAvailAmount()!=null){
  291 + info.setAccountAllAmount(detail.getLockAmount()==null?
  292 + detail.getAvailAmount().toString():detail.getAvailAmount().add(detail.getLockAmount()).toString());
  293 + info.setAvailAllEarnestMoney(detail.getAvailAmount().toString());
282 } 294 }
283 - info.setAccountAllAmount(detail.getAvailAmount().add(detail.getLockAmount()).toString());  
284 - info.setLockAllEarnestMoney(detail.getLockAmount().toString());  
285 - info.setAvailAllEarnestMoney(detail.getAvailAmount().toString()); 295 + info.setLockAllEarnestMoney(detail.getLockAmount()==null?null:detail.getLockAmount().toString());
286 return info; 296 return info;
287 } 297 }
288 298
@@ -311,6 +321,13 @@ public class MerchantServiceImpl { @@ -311,6 +321,13 @@ public class MerchantServiceImpl {
311 return new PageResponseBO<>(); 321 return new PageResponseBO<>();
312 } 322 }
313 List<SellerWallet> sellerWallets = this.sellerWalletMapper.selectByUidAndMerchantUids(req.getUid(),uids,req.getStart(),req.getSize()); 323 List<SellerWallet> sellerWallets = this.sellerWalletMapper.selectByUidAndMerchantUids(req.getUid(),uids,req.getStart(),req.getSize());
  324 + if(CollectionUtils.isEmpty(sellerWallets)){
  325 + PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
  326 + result.setTotal(total);
  327 + result.setPage(req.getPage());
  328 + result.setSize(req.getSize());
  329 + return result;
  330 + }
314 List<MerchantOrderAttachInfo> infos = initMerchantOrderAttachInfos(sellerWallets); 331 List<MerchantOrderAttachInfo> infos = initMerchantOrderAttachInfos(sellerWallets);
315 PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>(); 332 PageResponseBO<MerchantOrderAttachInfo> result = new PageResponseBO<>();
316 result.setTotal(total); 333 result.setTotal(total);
@@ -183,6 +183,7 @@ @@ -183,6 +183,7 @@
183 width: 80, 183 width: 80,
184 align: "center", 184 align: "center",
185 rowspan:2, 185 rowspan:2,
  186 + hidden:'true',//暂时隐藏
186 formatter: function (value, rowData) { 187 formatter: function (value, rowData) {
187 return "<a role='view' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #5bc0de'>查看</a>"; 188 return "<a role='view' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #5bc0de'>查看</a>";
188 } 189 }
@@ -103,6 +103,7 @@ @@ -103,6 +103,7 @@
103 // 搜索 103 // 搜索
104 $("#searchLinkButton").linkbutton({ 104 $("#searchLinkButton").linkbutton({
105 onClick: function () { 105 onClick: function () {
  106 + $("#marginTable").myDatagrid('loadData', []);
106 loadData(); 107 loadData();
107 } 108 }
108 }); 109 });
@@ -114,6 +115,7 @@ @@ -114,6 +115,7 @@
114 $("#merchantName").textbox("clear"); 115 $("#merchantName").textbox("clear");
115 $("#orderCode").textbox("clear"); 116 $("#orderCode").textbox("clear");
116 $("#violationType").textbox("clear"); 117 $("#violationType").textbox("clear");
  118 + $("#marginTable").myDatagrid('loadData', []);
117 loadData(); 119 loadData();
118 } 120 }
119 }); 121 });