Browse Source

Merge branch 'master' of http://124.220.229.80:9093/root/cif

linxk 1 week ago
parent
commit
ef8d1a78f5

+ 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();

+ 2 - 3
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,12 +8,11 @@ import lombok.*;
 @Getter
 @Setter
 @NoArgsConstructor
-@AllArgsConstructor
+
 @Builder
 @ApiModel(value = "支付通道")
 public class PaymentChannelBO extends PaymentChannel {
 
-        private MidChannelMethod midChannelMethod;
 
 
 }

+ 32 - 16
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;
@@ -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);
+    }
 }

+ 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;

+ 19 - 0
cif-service/src/main/java/com/txz/cif/web/para/BasePageParam.java

@@ -0,0 +1,19 @@
+package com.txz.cif.web.para;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class BasePageParam {
+
+    @ApiModelProperty(value="page")
+    private Integer page;
+
+    @ApiModelProperty(value="size")
+    private Integer size;
+
+}