|
@@ -1,5 +1,6 @@
|
|
|
package com.txz.cif.web.mng;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.txz.cif.core.AuthService;
|
|
|
import com.txz.cif.core.Result;
|
|
|
import com.txz.cif.core.ResultGenerator;
|
|
@@ -16,8 +17,10 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.txz.cif.service.PaymentMethodService;
|
|
|
import com.txz.cif.service.UserService;
|
|
|
+import com.txz.cif.web.bo.PaymentChannelBO;
|
|
|
import com.txz.cif.web.para.PaymentChannelParam;
|
|
|
import com.txz.cif.web.para.updateparam.PaymentChannelUpdateParam;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -31,7 +34,9 @@ import tk.mybatis.mapper.entity.Example.Criteria;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -70,6 +75,9 @@ public class PaymentChannelController {
|
|
|
// paymentChannel.setCreateTime(new Date());
|
|
|
// paymentChannel.setCreateUserId(userId);
|
|
|
PaymentChannel bean = BeanUtil.toBean(paymentChannelParam, PaymentChannel.class);
|
|
|
+ bean.setUpdateTime(DateUtil.date());
|
|
|
+ bean.setIsValid((byte)1);
|
|
|
+ bean.setVersion(1);
|
|
|
bean.setCreateUser("lala");
|
|
|
bean.setUpdateUser("lala");
|
|
|
paymentChannelService.add(bean);
|
|
@@ -110,7 +118,7 @@ public class PaymentChannelController {
|
|
|
try {
|
|
|
// paymentChannel.setUpdateTime(new Date());
|
|
|
// paymentChannel.setUpdateUserId(userId);
|
|
|
- paymentChannelService.update(bean);
|
|
|
+ paymentChannelService.modify(bean);
|
|
|
} catch (Exception e) {
|
|
|
log.error("更新对象操作异常e:{}",e);
|
|
|
return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
@@ -118,6 +126,9 @@ public class PaymentChannelController {
|
|
|
return ResultGenerator.genSuccessResult();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// @GetMapping("/detail")
|
|
|
// @ApiOperation(value = "paymentChannel获取详情",httpMethod = "GET")
|
|
|
// public Result<PaymentChannel> detail(@RequestParam Integer id) {
|
|
@@ -136,23 +147,28 @@ public class PaymentChannelController {
|
|
|
// return ResultGenerator.genSuccessResult(paymentChannel);
|
|
|
// }
|
|
|
|
|
|
-// @PostMapping("/list")
|
|
|
-// @ApiOperation(value = "paymentChannel获取列表",httpMethod = "POST")
|
|
|
-// public Result<List<PaymentChannel>> list(@RequestBody PaymentChannel paymentChannel, @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
|
|
|
-//
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "paymentChannel获取列表",httpMethod = "POST")
|
|
|
+ public Result<List<PaymentChannelBO>> list() {
|
|
|
+
|
|
|
// PageHelper.startPage(page, size);
|
|
|
//
|
|
|
// Condition condition = new Condition(paymentChannel.getClass());
|
|
|
// Criteria criteria = condition.createCriteria();
|
|
|
-//// criteria.andEqualTo("name", city.getName());
|
|
|
-// PageInfo pageInfo = null;
|
|
|
-// try {
|
|
|
-// List<PaymentChannel> list = paymentChannelService.findByCondition(condition);
|
|
|
-// pageInfo = new PageInfo(list);
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error("查询对象操作异常e:{}",e);
|
|
|
-// return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
-// }
|
|
|
-// return ResultGenerator.genSuccessResult(pageInfo);
|
|
|
-// }
|
|
|
+// criteria.andEqualTo("name", city.getName());
|
|
|
+ // PageInfo pageInfo = null;
|
|
|
+ List<PaymentChannelBO> resultList = new ArrayList<>();
|
|
|
+ Byte b = (byte) 1;
|
|
|
+ try {
|
|
|
+ List<PaymentChannel> list = paymentChannelService.findAll();
|
|
|
+ if(!CollectionUtils.isEmpty(list)) {
|
|
|
+ resultList = list.stream().filter(a -> b.equals(a.getIsValid())).map(a -> BeanUtil.toBean(a, PaymentChannelBO.class)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult(resultList);
|
|
|
+ }
|
|
|
}
|