|
@@ -0,0 +1,163 @@
|
|
|
+package com.txz.cif.web.mng.appcontroller;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.txz.cif.core.Result;
|
|
|
+import com.txz.cif.core.ResultCode;
|
|
|
+import com.txz.cif.core.ResultGenerator;
|
|
|
+import com.txz.cif.model.MidChannelMethod;
|
|
|
+import com.txz.cif.model.PaymentChannel;
|
|
|
+import com.txz.cif.model.PaymentMethod;
|
|
|
+import com.txz.cif.service.MidChannelMethodService;
|
|
|
+import com.txz.cif.service.PaymentChannelService;
|
|
|
+import com.txz.cif.service.PaymentMethodService;
|
|
|
+import com.txz.cif.web.bo.MidChannelMethodBO;
|
|
|
+import com.txz.cif.web.bo.PaymentMethodBO;
|
|
|
+import com.txz.cif.web.para.PaymentMethodParam;
|
|
|
+import com.txz.cif.web.para.updateparam.PaymentMethodUpdateParam;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by CodeGenerator on 2025/08/04.
|
|
|
+ */
|
|
|
+@Api(tags = "[App]paymentMethod管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/payment/method")
|
|
|
+public class PaymentMethodAppController {
|
|
|
+
|
|
|
+ private static Logger log = LoggerFactory.getLogger(PaymentMethodAppController.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private PaymentMethodService paymentMethodService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private PaymentChannelService paymentChannelService;
|
|
|
+
|
|
|
+// @PostMapping("/add")
|
|
|
+// @ApiOperation(value = "paymentMethod新增", httpMethod = "POST")
|
|
|
+// public Result add(@RequestBody PaymentMethod paymentMethod) {
|
|
|
+// if (paymentMethod == null) {
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.OBJECT_IS_NULL);
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// // paymentMethod.setCreateTime(new Date());
|
|
|
+// // paymentMethod.setCreateUserId(userId);
|
|
|
+// paymentMethodService.save(paymentMethod);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("新增对象操作异常e:{}", e);
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+// }
|
|
|
+//
|
|
|
+// return ResultGenerator.genSuccessResult(paymentMethod);
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping("/delete")
|
|
|
+// @ApiOperation(value = "paymentMethod删除", httpMethod = "GET")
|
|
|
+// public Result delete(@RequestParam Integer id) {
|
|
|
+// if (id == null) {
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// paymentMethodService.deleteById(id);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("删除对象操作异常e:{}", e);
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+// }
|
|
|
+// return ResultGenerator.genSuccessResult();
|
|
|
+// }
|
|
|
+
|
|
|
+// @PostMapping("/update")
|
|
|
+// @ApiOperation(value = "支付方式启用/关停", httpMethod = "POST")
|
|
|
+// public Result update(@RequestBody PaymentMethodUpdateParam paymentMethodUpdateParam) {
|
|
|
+// if (paymentMethodUpdateParam == null) {
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.OBJECT_IS_NULL);
|
|
|
+// }
|
|
|
+// if (paymentMethodUpdateParam.getId() == null) {
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+// }
|
|
|
+//
|
|
|
+// PaymentMethod bean = BeanUtil.toBean(paymentMethodUpdateParam, PaymentMethod.class);
|
|
|
+// try {
|
|
|
+//
|
|
|
+// bean.setUpdateUser("lala");
|
|
|
+//
|
|
|
+// paymentMethodService.update(bean);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("更新对象操作异常e:{}", e);
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+// }
|
|
|
+// return ResultGenerator.genSuccessResult();
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping("/detail")
|
|
|
+// @ApiOperation(value = "paymentMethod获取详情", httpMethod = "GET")
|
|
|
+// public Result<PaymentMethod> detail(@RequestParam Integer id) {
|
|
|
+// if (id == null) {
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+// }
|
|
|
+//
|
|
|
+// PaymentMethod paymentMethod = null;
|
|
|
+// try {
|
|
|
+// paymentMethod = paymentMethodService.findById(id);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("查询对象操作异常e:{}", e);
|
|
|
+// return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+// }
|
|
|
+//
|
|
|
+// return ResultGenerator.genSuccessResult(paymentMethod);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/getpaymentchannel")
|
|
|
+ @ApiOperation(value = "app端getpaymentchannel", httpMethod = "GET")
|
|
|
+ public Result getpaymentchannel(@RequestParam("id") Long id) {
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(id)){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.OBJECT_IS_NULL);
|
|
|
+ }
|
|
|
+ PaymentChannel paymentChannel;
|
|
|
+ try {
|
|
|
+ paymentChannel = paymentChannelService.paymentChannelReturnsByWeight(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}", e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult(paymentChannel);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "app端paymentMethod获取列表", httpMethod = "POST")
|
|
|
+ public Result<List<PaymentMethodBO>> list(@RequestBody PaymentMethodParam paymentMethodParam) {
|
|
|
+
|
|
|
+ List<PaymentMethodBO> paymentMethodListBO = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ List<PaymentMethod> paymentMethodList = paymentMethodService.findAll();
|
|
|
+ if (!CollectionUtils.isEmpty(paymentMethodList)) {
|
|
|
+ Byte status = 1;
|
|
|
+ paymentMethodListBO = paymentMethodList.stream().filter(a -> status.equals(a.getIsValid())).map(a -> {
|
|
|
+ return BeanUtil.toBean(a, PaymentMethodBO.class);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}", e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult(paymentMethodListBO);
|
|
|
+ }
|
|
|
+}
|