1
0

2 Commit-ok a66d5d7b8d ... 4936b659b1

Szerző SHA1 Üzenet Dátum
  yubin 4936b659b1 支付通道列表 1 hete
  yubin b766c68bf2 支付通道列表 1 hete

+ 1 - 1
cif-service/src/main/java/com/txz/cif/service/PaymentChannelService.java

@@ -9,5 +9,5 @@ import com.txz.cif.core.Service;
 public interface PaymentChannelService extends Service<PaymentChannel> {
     int add(PaymentChannel model);
 
-
+    int modify(PaymentChannel model);
 }

+ 34 - 1
cif-service/src/main/java/com/txz/cif/service/impl/PaymentChannelServiceImpl.java

@@ -2,6 +2,7 @@ package com.txz.cif.service.impl;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import com.txz.cif.dao.MidChannelMethodMapper;
 import com.txz.cif.dao.PaymentChannelMapper;
 import com.txz.cif.model.MidChannelMethod;
 import com.txz.cif.model.PaymentChannel;
@@ -12,6 +13,9 @@ import com.txz.cif.core.AbstractService;
 import com.txz.cif.service.PaymentMethodService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
+import tk.mybatis.mapper.entity.Condition;
+import tk.mybatis.mapper.entity.Example;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -27,12 +31,16 @@ public class PaymentChannelServiceImpl extends AbstractService<PaymentChannel> i
     @Resource
     private PaymentChannelMapper cPaymentChannelMapper;
 
-
+    @Resource
+    private MidChannelMethodMapper midChannelMethodMapper;
     @Resource
     private PaymentMethodService paymentMethodService;
 
     @Resource
     private MidChannelMethodService midChannelMethodService;
+
+
+
     @Override
     public int add(PaymentChannel model) {
 
@@ -50,6 +58,31 @@ public class PaymentChannelServiceImpl extends AbstractService<PaymentChannel> i
         return midChannelMethodService.save(midChannelMethodList);
     }
 
+    @Override
+    public int modify(PaymentChannel model) {
+
+
+
+        model.setCreateUser("opt");
+
+
+
+       //联动删除
+        if(!ObjectUtils.isEmpty(model.getIsValid())) {
+
+            Example example = new Example(MidChannelMethod.class);
+            example.createCriteria().andEqualTo("channelId",model.getId());
+            MidChannelMethod midChannelMethod = new MidChannelMethod();
+            midChannelMethod.setIsValid(model.getIsValid());
+            midChannelMethodMapper.updateByConditionSelective(midChannelMethod,example);
+        }
+
+
+        return cPaymentChannelMapper.updateByPrimaryKeySelective(model);
+    }
+
+
+
   private  List<MidChannelMethod> createMidChannelMethodList(Long paymentChannelId,DateTime date){
       List<MidChannelMethod>  midChannelMethodList = new ArrayList<>();
       MidChannelMethod midChannelMethod = new MidChannelMethod();

+ 1 - 1
cif-service/src/main/java/com/txz/cif/web/bo/PaymentChannelBO.java

@@ -1,6 +1,6 @@
 package com.txz.cif.web.bo;
 
-import com.txz.cif.model.MidChannelMethod;
+
 import com.txz.cif.model.PaymentChannel;
 import io.swagger.annotations.ApiModel;
 import lombok.*;

+ 8 - 1
cif-service/src/main/java/com/txz/cif/web/mng/PaymentChannelController.java

@@ -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;
@@ -74,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);
@@ -114,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);
@@ -122,6 +126,9 @@ public class PaymentChannelController {
         return ResultGenerator.genSuccessResult();
     }
 
+
+
+
 //    @GetMapping("/detail")
 //	@ApiOperation(value = "paymentChannel获取详情",httpMethod = "GET")
 //    public Result<PaymentChannel> detail(@RequestParam Integer id) {

+ 5 - 1
cif-service/src/main/java/com/txz/cif/web/mng/PaymentMethodController.java

@@ -147,9 +147,13 @@ public class PaymentMethodController {
 
             List<MidChannelMethod> midChannelMethodList = midChannelMethodService.findAll();
 
+            Byte b = (byte)1;
             Map<Long, List<MidChannelMethodBO>> midChannelMethodBOGroupMap;
             if (!CollectionUtils.isEmpty(midChannelMethodList)) {
-                midChannelMethodBOGroupMap = midChannelMethodList.stream().filter(a -> a.getAgencyService().equals(paymentMethodParam.getAgencyService())).map(a -> {
+                midChannelMethodBOGroupMap = midChannelMethodList.stream().filter(a -> (
+                        b.equals(a.getIsValid()) &&
+                        a.getAgencyService().equals(paymentMethodParam.getAgencyService()))
+                ).map(a -> {
                     MidChannelMethodBO bean = BeanUtil.toBean(a, MidChannelMethodBO.class);
                     bean.setPaymentChannel(paymentChannelMap.get(bean.getChannelId()));
                     return bean;