新版仿ok交易所-后端
zyy
2026-01-04 7295334ff00457c111484d2f021a9c33bbf4a5f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
package com.yami.trading.api.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.trading.bean.c2c.C2cAdvert;
import com.yami.trading.bean.c2c.C2cUser;
import com.yami.trading.bean.item.domain.Item;
import com.yami.trading.bean.model.C2cPaymentMethodConfig;
import com.yami.trading.bean.model.C2cTranslate;
import com.yami.trading.bean.model.User;
import com.yami.trading.bean.rate.domain.ExchangeRate;
import com.yami.trading.common.constants.Constants;
import com.yami.trading.common.domain.Result;
import com.yami.trading.common.exception.YamiShopBindException;
import com.yami.trading.common.util.DateUtils;
import com.yami.trading.common.util.StringUtils;
import com.yami.trading.security.common.util.SecurityUtils;
import com.yami.trading.service.AwsS3OSSFileService;
import com.yami.trading.service.c2c.C2cAdvertService;
import com.yami.trading.service.c2c.C2cPaymentMethodConfigService;
import com.yami.trading.service.c2c.C2cTranslateService;
import com.yami.trading.service.c2c.C2cUserService;
import com.yami.trading.service.item.ItemService;
import com.yami.trading.service.rate.ExchangeRateService;
import com.yami.trading.service.user.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.*;
 
/**
 * C2C广告
 */
@RestController
@Slf4j
public class ApiC2cAdvertController {
    @Autowired
    private C2cAdvertService c2cAdvertService;
    @Autowired
    private C2cUserService c2cUserService;
    @Autowired
    private UserService userService;
    @Autowired
    private ExchangeRateService exchangeRateService;
    @Autowired
    private ItemService itemService;
    @Autowired
    private C2cPaymentMethodConfigService c2cPaymentMethodConfigService;
//    @Autowired
//    private C2cPaymentMethodService c2cPaymentMethodService;
//    @Autowired
//    private SessionTokenService sessionTokenService;
//    @Autowired
//    private SecUserService secUserService;
//    @Autowired
//    private LogService logService;
//    @Autowired
//    private SysparaService sysparaService;
//    @Autowired
//    private C2cOrderService c2cOrderService;
//    @Autowired
//    private C2cAppealService c2cAppealService;
    @Autowired
    AwsS3OSSFileService awsS3OSSFileService;
    @Autowired
    private C2cTranslateService c2cTranslateService;
    private final String action = "/api/c2cAdvert!";
 
    /**
     * 获取 支付币种(法币) 列表
     */
    @RequestMapping(action + "currency.action")
    public Result currency(HttpServletRequest request) {
        Map<String, String> pmtMap = c2cAdvertService.getC2cSyspara("c2c_advert_currency");
        List<Map<String, Object>> data = new ArrayList<>();
        List<ExchangeRate> exchangeRateList =exchangeRateService.findBy(Constants.OUT_OR_IN_DEFAULT);
        for (ExchangeRate er : exchangeRateList) {
            if (pmtMap.keySet().contains(er.getCurrency())) {
                Map<String, Object> erMap = new HashMap<String, Object>();
                erMap.put("out_or_in", er.getOutOrIn());
                erMap.put("rate", er.getRata());
                erMap.put("currency", er.getCurrency());
                erMap.put("name", er.getName());
                erMap.put("currency_symbol", er.getCurrencySymbol());
                data.add(erMap);
            }
        }
        return Result.succeed(data);
    }
//
    /**
     * 获取 上架币种 列表
     */
    @RequestMapping(action + "symbol.action")
    public Result symbol(HttpServletRequest request) {
        Map<String, String> asMap =c2cAdvertService.getC2cSyspara("c2c_advert_symbol");
        Map<String, String> data = new HashMap<>();
        List<Item> itemList = itemService.cacheGetAll();
        data.put("usdt", "USDT");
        for (Item item : itemList) {
            if (asMap.keySet().contains(item.getSymbol().toUpperCase())) {
                data.put(item.getSymbol(), item.getSymbol().toUpperCase());
            }
        }
        return Result.succeed(data);
    }
////    /**
////     * 获取 广告支付时效 列表
////     */
////    @RequestMapping(action + "expire_time.action")
////    public Object expire_time(HttpServletRequest request) {
////
////        ResultObject resultObject = new ResultObject();
////
////        try {
////
////            Map<String, String> data = this.c2cAdvertService.getC2cSyspara("c2c_advert_expire_time");
////
////            resultObject.setData(data);
////
////        } catch (BusinessException e) {
////            resultObject.setCode("1");
////            resultObject.setMsg(e.getMessage());
////        } catch (Throwable t) {
////            resultObject.setCode("1");
////            resultObject.setMsg("程序错误");
////            logger.error("error:", t);
////        }
////
////        return resultObject;
////    }
//
    /**
     * 获取 广告 列表
     * <p>
     * direction 买卖方式:buy买/sell卖
     * currency 支付币种(大写CNY、USD、CAD等)
     * symbol 上架币种(大写USDT、BTC、ETH)
     * method_type 支付方式类型:0其它/1银行卡/2虚拟货币/3微信/4支付宝/5PayPal/6西联汇款/7SWIFT国际汇款
     * amount 支付金额:必须小于剩余派单金额
     */
    @RequestMapping(action + "list.action")
    public Result list(HttpServletRequest request) {
        String page_no = request.getParameter("page_no");
        String direction = request.getParameter("direction");
        String currency = request.getParameter("currency");
        String symbol = request.getParameter("symbol");
        String method_type = request.getParameter("method_type");
        String amount = request.getParameter("amount");
        String language = request.getParameter("language");
 
            String error = this.verif(direction, currency, symbol, method_type, amount);
            if (!StringUtils.isNullOrEmpty(error)) {
                throw new YamiShopBindException(error);
            }
            if (StringUtils.isNullOrEmpty(page_no)) {
                page_no = "1";
            }
            if (!StringUtils.isInteger(page_no)) {
                throw new YamiShopBindException("页码不是整数");
            }
            if (Integer.valueOf(page_no).intValue() <= 0) {
                throw new YamiShopBindException("页码不能小于等于0");
            }
            int page_no_int = Integer.valueOf(page_no).intValue();
            String partyId = SecurityUtils.getUser().getUserId();
             String c2cUserId = "";
            User party = userService.getById(partyId);
            if (null == party) {
                throw new YamiShopBindException("用户不存在");
            }
            if (Arrays.asList(1, 2).contains(party.getC2cUserType())) {
                C2cUser c2cUser = c2cUserService.getByPartyId(partyId);
                if (null != c2cUser) {
                    c2cUserId = c2cUser.getUuid().toString();
                }
            }
            Page page = c2cAdvertService.pagedQuery(page_no_int, 20, c2cUserId, direction, currency, symbol, amount, 1, 0, false);
 
            if (null == page) {
                return Result.succeed(new ArrayList<Map<String, Object>>());
            } else {
                List<Map<String, Object>> dataResult = new ArrayList<Map<String, Object>>();
                if (!StringUtils.isEmptyString(method_type)) {
                    List<Map<String, Object>> data = (List<Map<String, Object>>) page.getRecords();
                    for (int i = 0; i < data.size(); i++) {
                        Map<String, Object> map = data.get(i);
                        Object pay_type = map.get("pay_type");
                        if (null == pay_type) {
                            continue;
                        }
                        // 获取 Map<支付方式模板ID,支付方式模板类型>
                        Map<String, String> methodConfigIdTypeMap =c2cPaymentMethodConfigService.getMethodConfigIdTypeMap();
                        String[] payTypes = pay_type.toString().split(",");
                        for (String type : payTypes) {
                            if (method_type.equals(methodConfigIdTypeMap.get(type))) {
                                dataResult.add(map);
                                break;
                            }
                        }
                    }
                } else {
                    dataResult = (List<Map<String, Object>>) page.getRecords();
                }
                for (int i = 0; i < dataResult.size(); i++) {
                    Map<String, Object> mso = dataResult.get(i);
                    if (null != mso) {
                        int thirtyDaysOrder = 0;
                        int thirtyDaysOrderBase = 0;
                        double thirtyDaysOrderRatio = 0D;
                        double thirtyDaysOrderRatioBase = 0D;
                        if (null != mso.get("thirty_days_order") && StringUtils.isNotEmpty(mso.get("thirty_days_order").toString())) {
                            thirtyDaysOrder = Integer.valueOf(mso.get("thirty_days_order").toString()).intValue();
                        }
                        if (null != mso.get("thirty_days_order_base") && StringUtils.isNotEmpty(mso.get("thirty_days_order_base").toString())) {
                            thirtyDaysOrderBase = Integer.valueOf(mso.get("thirty_days_order_base").toString()).intValue();
                        }
                        if (null != mso.get("thirty_days_order_ratio") && StringUtils.isNotEmpty(mso.get("thirty_days_order_ratio").toString())) {
                            thirtyDaysOrderRatio = Double.valueOf(mso.get("thirty_days_order_ratio").toString()).doubleValue();
                        }
                        if (null != mso.get("thirty_days_order_ratio_base") && StringUtils.isNotEmpty(mso.get("thirty_days_order_ratio_base").toString())) {
                            thirtyDaysOrderRatioBase = Double.valueOf(mso.get("thirty_days_order_ratio_base").toString()).doubleValue();
                        }
                        mso.put("thirty_days_order", thirtyDaysOrderBase + thirtyDaysOrder);
                        mso.put("thirty_days_order_ratio", 0 != thirtyDaysOrderRatioBase ? thirtyDaysOrderRatioBase : thirtyDaysOrderRatio);
                        if (null != mso.get("head_img") && StringUtils.isNotEmpty(mso.get("head_img").toString())) {
                            String path = Constants.IMAGES_HTTP+mso.get("head_img").toString();
                            mso.put("head_img", path);
                        }
                        if (mso.get("pay_type") != null && StringUtils.isNotEmpty(mso.get("pay_type").toString())) {
                            List<String> pay_type = new LinkedList<String>();
                            String[] types = mso.get("pay_type").toString().split(",");
                            for (String type : types) {
                                C2cPaymentMethodConfig method =c2cPaymentMethodConfigService.get(type.trim());
                                if (null != method) {
                                    C2cTranslate trans = c2cTranslateService.get(method.getMethodName(), language);
                                    if (null != trans) {
                                        pay_type.add(trans.getTranslate());
                                    } else {
                                        pay_type.add(method.getMethodName());
                                    }
                                }
                            }
                            mso.put("pay_type_name", String.join(",", pay_type));
                        }
                    }
                }
                return  Result.succeed(dataResult);
            }
    }
////    /**
////     * 获取 承兑商广告 列表
////     *
////     * direction 买卖方式:buy买/sell卖
////     * currency 支付币种(大写CNY、USD、CAD等)
////     * symbol 上架币种(大写USDT、BTC、ETH)
////     * on_sale 是否上架:0下架/1上架
////     */
////    @RequestMapping(action + "list_c2c_user.action")
////    public Object list_c2c_user(HttpServletRequest request) {
////        String page_no = request.getParameter("page_no");
////        String direction = request.getParameter("direction");
////        String currency = request.getParameter("currency");
////        String symbol = request.getParameter("symbol");
////        String on_sale = request.getParameter("on_sale");
////        String language = request.getParameter("language");
////
////        ResultObject resultObject = new ResultObject();
////        resultObject = this.readSecurityContextFromSession(resultObject);
////        if (!"0".equals(resultObject.getCode())) {
////            return resultObject;
////        }
////
////        try {
////
////            String error = this.verif_c2c_user(direction, currency, symbol, on_sale);
////            if (!StringUtils.isNullOrEmpty(error)) {
////                throw new BusinessException(error);
////            }
////
////            if (StringUtils.isNullOrEmpty(page_no)) {
////                page_no = "1";
////            }
////            if (!StringUtils.isInteger(page_no)) {
////                throw new BusinessException("页码不是整数");
////            }
////            if (Integer.valueOf(page_no).intValue() <= 0) {
////                throw new BusinessException("页码不能小于等于0");
////            }
////
////            int page_no_int = Integer.valueOf(page_no).intValue();
////
////            String partyId = this.getLoginPartyId();
////            if (null == partyId) {
////                throw new BusinessException("请重新登录");
////            }
////
////            C2cUser c2cUser = this.c2cUserService.getByPartyId(partyId);
////            if (null == c2cUser) {
////                throw new BusinessException("承兑商不存在");
////            }
////
////            Integer on_sale_int = null;
////            if (StringUtils.isNotEmpty(on_sale)) {
////                on_sale_int = Integer.valueOf(on_sale);
////            }
////
////            Page page = this.c2cAdvertService.pagedQuery(page_no_int, 20, c2cUser.getId().toString(), direction, currency, symbol, "", on_sale_int, 0, true);
////            if (null == page) {
////                resultObject.setData(new ArrayList<Map<String, Object>>());
////            } else {
////                List<Map<String, Object>> dataResult = (List<Map<String, Object>>) page.getElements();
////
////                for (int i = 0; i < dataResult.size(); i++) {
////                    Map<String, Object> mso = dataResult.get(i);
////                    if (null != mso) {
////
////                        if (mso.get("pay_type") != null && StringUtils.isNotEmpty(mso.get("pay_type").toString())) {
////                            List<String> pay_type = new LinkedList<String>();
////                            String[] types = mso.get("pay_type").toString().split(",");
////                            for (String type : types) {
////                                C2cPaymentMethodConfig method = this.c2cPaymentMethodConfigService.get(type.trim());
////                                if (null != method) {
////                                    C2cTranslate trans = this.c2cTranslateService.get(method.getMethodName(), language);
////                                    if (null != trans) {
////                                        pay_type.add(trans.getTranslate());
////                                    } else {
////                                        pay_type.add(method.getMethodName());
////                                    }
////                                }
////                            }
////                            mso.put("pay_type_name", String.join(",", pay_type));
////                        }
////                    }
////                }
////
////                resultObject.setData(dataResult);
////            }
////
////        } catch (BusinessException e) {
////            resultObject.setCode("1");
////            resultObject.setMsg(e.getMessage());
////        } catch (Throwable t) {
////            resultObject.setCode("1");
////            resultObject.setMsg("程序错误");
////            logger.error("error:", t);
////        }
////
////        return resultObject;
////    }
////    /**
////     * 获取 承兑商广告 历史列表
////     *
////     * direction 买卖方式:buy买/sell卖
////     */
////    @RequestMapping(action + "list_history.action")
////    public Object list_history(HttpServletRequest request) {
////        String page_no = request.getParameter("page_no");
////        String direction = request.getParameter("direction");
////        String language = request.getParameter("language");
////
////        ResultObject resultObject = new ResultObject();
////        resultObject = this.readSecurityContextFromSession(resultObject);
////        if (!"0".equals(resultObject.getCode())) {
////            return resultObject;
////        }
////
////        try {
////
////            if (!StringUtils.isEmptyString(direction) && !Arrays.asList("buy", "sell").contains(direction)) {
////                throw new BusinessException("买卖方式不正确");
////            }
////
////            if (StringUtils.isNullOrEmpty(page_no)) {
////                page_no = "1";
////            }
////            if (!StringUtils.isInteger(page_no)) {
////                throw new BusinessException("页码不是整数");
////            }
////            if (Integer.valueOf(page_no).intValue() <= 0) {
////                throw new BusinessException("页码不能小于等于0");
////            }
////
////            int page_no_int = Integer.valueOf(page_no).intValue();
////
////            String partyId = this.getLoginPartyId();
////            if (null == partyId) {
////                throw new BusinessException("请重新登录");
////            }
////
////            C2cUser c2cUser = this.c2cUserService.getByPartyId(partyId);
////            if (null == c2cUser) {
////                throw new BusinessException("承兑商不存在");
////            }
////
////            Page page = this.c2cAdvertService.pagedQuery(page_no_int, 20, c2cUser.getId().toString(), direction, "", "", "", null, 1, true);
////            if (null == page) {
////                resultObject.setData(new ArrayList<Map<String, Object>>());
////            } else {
////                List<Map<String, Object>> dataResult = (List<Map<String, Object>>) page.getElements();
////
////                for (int i = 0; i < dataResult.size(); i++) {
////                    Map<String, Object> mso = dataResult.get(i);
////                    if (null != mso) {
////
////                        if (mso.get("pay_type") != null && StringUtils.isNotEmpty(mso.get("pay_type").toString())) {
////                            List<String> pay_type = new LinkedList<String>();
////                            String[] types = mso.get("pay_type").toString().split(",");
////                            for (String type : types) {
////                                C2cPaymentMethodConfig method = this.c2cPaymentMethodConfigService.get(type.trim());
////                                if (null != method) {
////                                    C2cTranslate trans = this.c2cTranslateService.get(method.getMethodName(), language);
////                                    if (null != trans) {
////                                        pay_type.add(trans.getTranslate());
////                                    } else {
////                                        pay_type.add(method.getMethodName());
////                                    }
////                                }
////                            }
////                            mso.put("pay_type_name", String.join(",", pay_type));
////                        }
////                    }
////                }
////
////                resultObject.setData(dataResult);
////            }
////
////        } catch (BusinessException e) {
////            resultObject.setCode("1");
////            resultObject.setMsg(e.getMessage());
////        } catch (Throwable t) {
////            resultObject.setCode("1");
////            resultObject.setMsg("程序错误");
////            logger.error("error:", t);
////        }
////
////        return resultObject;
////    }
//
 
    /**
     * 获取 广告 详情
     * <p>
     * id C2C广告ID
     */
    @RequestMapping(action + "get.action")
    public Result get(HttpServletRequest request) {
 
        String id = request.getParameter("id");
        String language = request.getParameter("language");
        if (StringUtils.isEmptyString(id)) {
            throw new YamiShopBindException("C2C广告id不正确");
        }
        C2cAdvert c2cAdvert = c2cAdvertService.getById(id);
        if (null == c2cAdvert) {
            throw new YamiShopBindException("广告不存在");
        }
        C2cUser c2cUser = this.c2cUserService.getById(c2cAdvert.getC2cUserId());
        if (null == c2cUser) {
            throw new YamiShopBindException("承兑商不存在");
        }
        User c2cParty = userService.getById(c2cUser.getC2cUserPartyId());
        if (null == c2cParty) {
            throw new YamiShopBindException("承兑商的用户信息不存在");
        }
        Map<String, String> data = new HashMap<String, String>();
        data.put("id", c2cAdvert.getUuid().toString());
        data.put("direction", c2cAdvert.getDirection());
        data.put("currency", c2cAdvert.getCurrency());
        data.put("symbol", c2cAdvert.getSymbol());
        data.put("pay_rate", String.valueOf(c2cAdvert.getPayRate()));
        data.put("pay_type", c2cAdvert.getPayType());
        data.put("symbol_value", String.valueOf(c2cAdvert.getSymbolValue()));
        data.put("coin_amount", String.valueOf(c2cAdvert.getCoinAmount()));
        data.put("investment_min", String.valueOf(c2cAdvert.getInvestmentMin()));
        data.put("investment_max", String.valueOf(c2cAdvert.getInvestmentMax()));
        data.put("deposit", String.valueOf(c2cAdvert.getDeposit()));
        data.put("deposit_open", String.valueOf(c2cAdvert.getDepositOpen()));
        data.put("on_sale", String.valueOf(c2cAdvert.getOnSale()));
        data.put("sort_index", String.valueOf(c2cAdvert.getSortIndex()));
        data.put("expire_time", String.valueOf(c2cAdvert.getExpireTime()));
        data.put("transaction_terms", c2cAdvert.getTransactionTerms());
        data.put("order_msg", c2cAdvert.getOrderMsg());
        data.put("remark", c2cAdvert.getRemark());
        data.put("create_time", DateUtils.format(c2cAdvert.getCreateTime(), DateUtils.DF_yyyyMMddHHmmss));
        data.put("update_time", DateUtils.format(c2cAdvert.getUpdateTime(), DateUtils.DF_yyyyMMddHHmmss));
        data.put("c2c_user_id", c2cUser.getUuid().toString());
        data.put("nick_name", c2cUser.getNickName());
        data.put("c2c_user_type", String.valueOf(c2cUser.getC2cUserType()));
        data.put("c2c_user_code", c2cUser.getC2cUserCode());
        data.put("party_id", c2cParty.getUserId().toString());
        data.put("user_code", c2cParty.getUserCode());
        data.put("user_name", c2cParty.getUserName());
        if (StringUtils.isNotEmpty(c2cUser.getHeadImg())) {
            String path = Constants.IMAGES_HTTP+c2cUser.getHeadImg();
            data.put("head_img", path);
        } else {
            data.put("head_img", "");
        }
        if (data.get("pay_type") != null && StringUtils.isNotEmpty(data.get("pay_type").toString())) {
            List<String> pay_type = new LinkedList<String>();
            String[] types = data.get("pay_type").toString().split(",");
            for (String type : types) {
                C2cPaymentMethodConfig method = this.c2cPaymentMethodConfigService.get(type.trim());
                if (null != method) {
                    C2cTranslate trans = this.c2cTranslateService.get(method.getMethodName(), language);
                    if (null != trans) {
                        pay_type.add(trans.getTranslate());
                    } else {
                        pay_type.add(method.getMethodName());
                    }
                }
            }
            data.put("pay_type_name", String.join(",", pay_type));
        }
        return Result.succeed(data);
    }
 
 
//
//    private String verif_add(String coin_amount, String direction, String pay_type, String currency,
//                             String symbol, String symbol_value, String investment_min, String investment_max, String on_sale, String expire_time, String safeword) {
//        if (StringUtils.isEmptyString(coin_amount) || !StringUtils.isDouble(coin_amount) || Double.valueOf(coin_amount).doubleValue() <= 0) {
//            return "交易数量不正确";
//        }
//        if (StringUtils.isEmptyString(direction) || !Arrays.asList("buy", "sell").contains(direction)) {
//            return "买卖方式不正确";
//        }
//        if (StringUtils.isEmptyString(pay_type)) {
//            return "支付方式不正确";
//        }
//        Map<String, String> currencyMap = this.c2cAdvertService.getCurrencyMap();
//        Map<String, String> symbolMap = this.c2cAdvertService.getSymbolMap();
//        if (StringUtils.isEmptyString(currency) || null == currencyMap || (null != currencyMap && !currencyMap.containsKey(currency))) {
//            return "支付币种不正确";
//        }
//        if (StringUtils.isEmptyString(symbol) || null == symbolMap || (null != symbolMap && !symbolMap.containsKey(symbol))) {
//            return "上架币种不正确";
//        }
//        if (StringUtils.isEmptyString(symbol_value) || !StringUtils.isDouble(symbol_value) || Double.valueOf(symbol_value).doubleValue() <= 0) {
//            return "币种单价不正确";
//        }
//        if (StringUtils.isEmptyString(investment_min) || !StringUtils.isDouble(investment_min) || Double.valueOf(investment_min).doubleValue() <= 0) {
//            return "单笔订单最低限额未填或格式不正确";
//        }
//        if (StringUtils.isEmptyString(investment_max) || !StringUtils.isDouble(investment_max) || Double.valueOf(investment_max).doubleValue() <= 0) {
//            return "单笔订单最高限额未填或格式不正确";
//        }
//        if (StringUtils.isEmptyString(on_sale) || !Arrays.asList("0", "1").contains(on_sale)) {
//            return "是否上架未填或格式不正确";
//        }
//        Map<String, String> aetMap = this.c2cAdvertService.getC2cSyspara("c2c_advert_expire_time");
//        if (StringUtils.isEmptyString(expire_time) || !aetMap.keySet().contains(expire_time)) {
//            return "支付时效未填或格式不正确";
//        }
//        if (StringUtils.isEmptyString(safeword)) {
//            return "资金密码错误";
//        }
//        return null;
//    }
//
    private String verif(String direction, String currency, String symbol, String method_type, String amount) {
        if (!StringUtils.isEmptyString(direction) && !Arrays.asList("buy", "sell").contains(direction)) {
            return "买卖方式不正确";
        }
        Map<String, String> currencyMap = this.c2cAdvertService.getCurrencyMap();
        Map<String, String> symbolMap = this.c2cAdvertService.getSymbolMap();
        if (!StringUtils.isEmptyString(currency) && null != currencyMap && !currencyMap.containsKey(currency)) {
            return "支付币种不正确";
        }
        if (!StringUtils.isEmptyString(symbol) && null != symbolMap && !symbolMap.containsKey(symbol)) {
            return "上架币种不正确";
        }
        Map<String, String> pmtMap = this.c2cAdvertService.getC2cSyspara("c2c_payment_method_type");
        if (!StringUtils.isEmptyString(method_type) && !pmtMap.keySet().contains(method_type)) {
            return "支付方式类型不正确";
        }
        if (!StringUtils.isEmptyString(amount) && (!StringUtils.isDouble(amount) || Double.valueOf(amount).doubleValue() < 0)) {
            return "支付金额不正确";
        }
        return null;
    }
//
//    private String verif_c2c_user(String direction, String currency, String symbol, String on_sale) {
//        if (!StringUtils.isEmptyString(direction) && !Arrays.asList("buy", "sell").contains(direction)) {
//            return "买卖方式不正确";
//        }
//        Map<String, String> currencyMap = this.c2cAdvertService.getCurrencyMap();
//        Map<String, String> symbolMap = this.c2cAdvertService.getSymbolMap();
//        if (!StringUtils.isEmptyString(currency) && null != currencyMap && !currencyMap.containsKey(currency)) {
//            return "支付币种不正确";
//        }
//        if (!StringUtils.isEmptyString(symbol) && null != symbolMap && !symbolMap.containsKey(symbol)) {
//            return "上架币种不正确";
//        }
//        if (!StringUtils.isEmptyString(on_sale) && !Arrays.asList("0", "1").contains(on_sale)) {
//            return "是否上架不正确";
//        }
//        return null;
//    }
//
//    public void saveLog(SecUser secUser, String operator, String context, String category) {
//        project.log.Log log = new project.log.Log();
//        log.setCategory(category);
//        log.setOperator(operator);
//        log.setUsername(secUser.getUsername());
//        log.setPartyId(secUser.getPartyId());
//        log.setLog(context);
//        log.setCreateTime(new Date());
//        this.logService.saveSync(log);
//    }
}