| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yami.trading.admin.controller.c2c.model.*; |
| | | import com.yami.trading.bean.c2c.C2cAdvert; |
| | | import com.yami.trading.bean.c2c.C2cOrder; |
| | | import com.yami.trading.bean.model.C2cPaymentMethod; |
| | | import com.yami.trading.bean.model.C2cPaymentMethodConfig; |
| | | import com.yami.trading.bean.model.Log; |
| | | import com.yami.trading.bean.model.User; |
| | | 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.C2cOrderLock; |
| | | import com.yami.trading.common.util.IPHelper; |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.common.util.ThreadUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.c2c.C2cAdvertService; |
| | | import com.yami.trading.service.c2c.C2cOrderService; |
| | | import com.yami.trading.service.c2c.C2cPaymentMethodConfigService; |
| | | import com.yami.trading.service.chat.otc.OtcOnlineChatMessageService; |
| | | import com.yami.trading.service.item.ItemService; |
| | | import com.yami.trading.service.rate.ExchangeRateService; |
| | | import com.yami.trading.service.user.UserService; |
| | | import com.yami.trading.sys.model.SysUser; |
| | | import com.yami.trading.sys.service.SysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.text.MessageFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | UserService userService; |
| | | |
| | | @Autowired |
| | | C2cPaymentMethodConfigService c2cPaymentMethodConfigService; |
| | | // |
| | | // private final String action = "normal/adminC2cOrderAction!"; |
| | | // |
| | |
| | | return Result.succeed(detail_map); |
| | | } |
| | | |
| | | public String verifAdd(String orderNo, String method_config_id, String real_name, String param_value1, String login_safeword) { |
| | | if (StringUtils.isNullOrEmpty(orderNo)) { |
| | | return "请传入订单号"; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(method_config_id)) { |
| | | return "支付方式模板不正确"; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(real_name)) { |
| | | return "真实姓名必填"; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(param_value1)) { |
| | | return "参数值1必填"; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(login_safeword)) { |
| | | return "资金密码错误"; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | @PostMapping("setC2cOrderPayMethod") |
| | | @ApiOperation("设置C2C订单支付方式") |
| | | public Result setC2cOrderPayMethod(@RequestBody @Valid PaymentMethodAddModel model) { |
| | | |
| | | try { |
| | | String error = verifAdd(model.getOrderNo(), model.getMethodConfigId(), |
| | | model.getRealName(), model.getParamValue1(), model.getLoginSafeword()); |
| | | if (!StringUtils.isNullOrEmpty(error)) { |
| | | throw new YamiShopBindException(error); |
| | | } |
| | | |
| | | sysUserService.checkSafeWord(model.getLoginSafeword()); |
| | | |
| | | C2cOrder c2cOrder = this.c2cOrderService.get(model.getOrderNo()); |
| | | if (null == c2cOrder) { |
| | | throw new YamiShopBindException("订单不存在"); |
| | | } |
| | | |
| | | C2cPaymentMethodConfig method = c2cPaymentMethodConfigService.getById(model.getMethodConfigId()); |
| | | if (null == method) { |
| | | throw new YamiShopBindException("支付方式模板不存在"); |
| | | } |
| | | c2cOrder.setMethodType(method.getMethodType()); |
| | | c2cOrder.setMethodName(method.getMethodName()); |
| | | c2cOrder.setMethodImg(method.getMethodImg()); |
| | | c2cOrder.setRealName(model.getRealName()); |
| | | c2cOrder.setParamName1(method.getParamName1()); |
| | | c2cOrder.setParamValue1(model.getParamValue1()); |
| | | c2cOrder.setParamName2(method.getParamName2()); |
| | | c2cOrder.setParamValue2(model.getParamValue2()); |
| | | c2cOrder.setParamName3(method.getParamName3()); |
| | | c2cOrder.setParamValue3(model.getParamValue3()); |
| | | c2cOrder.setParamName4(method.getParamName4()); |
| | | c2cOrder.setParamValue4(model.getParamValue4()); |
| | | c2cOrder.setParamName5(method.getParamName5()); |
| | | c2cOrder.setParamValue5(model.getParamValue5()); |
| | | c2cOrder.setParamName6(method.getParamName6()); |
| | | c2cOrder.setParamValue6(model.getParamValue6()); |
| | | c2cOrder.setParamName7(method.getParamName7()); |
| | | c2cOrder.setParamValue7(model.getParamValue7()); |
| | | c2cOrder.setParamName8(method.getParamName8()); |
| | | c2cOrder.setParamValue8(model.getParamValue8()); |
| | | c2cOrder.setParamName9(method.getParamName9()); |
| | | c2cOrder.setParamValue9(model.getParamValue9()); |
| | | c2cOrder.setParamName10(method.getParamName10()); |
| | | c2cOrder.setParamValue10(model.getParamValue10()); |
| | | c2cOrder.setParamName11(method.getParamName11()); |
| | | c2cOrder.setParamValue11(model.getParamValue11()); |
| | | c2cOrder.setParamName12(method.getParamName12()); |
| | | c2cOrder.setParamValue12(model.getParamValue12()); |
| | | c2cOrder.setParamName13(method.getParamName13()); |
| | | c2cOrder.setParamValue13(model.getParamValue13()); |
| | | c2cOrder.setParamName14(method.getParamName14()); |
| | | c2cOrder.setParamValue14(model.getParamValue14()); |
| | | c2cOrder.setParamName15(method.getParamName15()); |
| | | c2cOrder.setParamValue15(model.getParamValue15()); |
| | | c2cOrder.setQrcode(model.getQrcode()); |
| | | |
| | | this.c2cOrderService.updateById(c2cOrder); |
| | | return Result.ok(null); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Result.failed("设置失败"); |
| | | } |
| | | |
| | | } |