From 42f05d2b835ed1ee41ca32cf76fe11849a890cb4 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 06 五月 2021 14:26:03 +0800
Subject: [PATCH] 金币完善

---
 service-goldcorn/src/main/java/com/ks/goldcorn/service/remote/GoldCornGetSourceServiceImpl.java |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/service-goldcorn/src/main/java/com/ks/goldcorn/service/remote/GoldCornGetSourceServiceImpl.java b/service-goldcorn/src/main/java/com/ks/goldcorn/service/remote/GoldCornGetSourceServiceImpl.java
index cde6903..d25f3b7 100644
--- a/service-goldcorn/src/main/java/com/ks/goldcorn/service/remote/GoldCornGetSourceServiceImpl.java
+++ b/service-goldcorn/src/main/java/com/ks/goldcorn/service/remote/GoldCornGetSourceServiceImpl.java
@@ -1,18 +1,20 @@
 package com.ks.goldcorn.service.remote;
 
+import com.ks.goldcorn.exception.GoldAppException;
 import com.ks.goldcorn.exception.GoldSourceException;
 import com.ks.goldcorn.mapper.GoldCornGetSourceMapper;
 import com.ks.goldcorn.pojo.DO.GoldCornGetSource;
 import com.ks.goldcorn.query.SourceQuery;
 import com.ks.goldcorn.service.GoldCornAppManager;
-import org.springframework.stereotype.Service;
+import io.seata.core.context.RootContext;
+import org.apache.dubbo.config.annotation.Service;
 import org.yeshi.utils.StringUtil;
 
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
 
-@Service
+@Service(version = "1.0")
 public class GoldCornGetSourceServiceImpl implements GoldCornGetSourceService {
     @Resource
     private GoldCornAppManager goldCornAppManager;
@@ -37,6 +39,15 @@
     }
 
     @Override
+    public GoldCornGetSource selectByAppAndCode(String appCode, String code) {
+        Long appId = goldCornAppManager.selectAppIdByAppCode(appCode);
+        if (appId == null) {
+            return null;
+        }
+        return goldCornGetSourceMapper.selectByAppIdAndSourceCode(appId, code);
+    }
+
+    @Override
     public long countByName(String appCode, String nameKey) {
         Long appId = goldCornAppManager.selectAppIdByAppCode(appCode);
         if (appId == null) {
@@ -50,6 +61,7 @@
 
     @Override
     public void addSource(GoldCornGetSource source) throws GoldSourceException {
+        System.out.println("寮�濮嬪叏灞�浜嬪姟锛孹ID = " + RootContext.getXID());
         if (source == null || source.getAppId() == null || source.getGoldCorn() == null || StringUtil.isNullOrEmpty(source.getSourceCode()) || StringUtil.isNullOrEmpty(source.getSourceName())) {
             throw new GoldSourceException(GoldSourceException.CODE_PARAMS_NOT_ENOUGH, "鍙傛暟涓嶅畬鏁�");
         }
@@ -81,4 +93,24 @@
         source.setUpdateTime(new Date());
         goldCornGetSourceMapper.updateByPrimaryKeySelective(source);
     }
+
+    @Override
+    public List<GoldCornGetSource> listShow(String appCode, int page, int pageSize) throws GoldAppException {
+        Long appId = goldCornAppManager.getAppId(appCode);
+        SourceQuery query = new SourceQuery();
+        query.setAppId(appId);
+        query.setStart((page - 1) * pageSize);
+        query.setCount(pageSize);
+        query.setState(GoldCornGetSource.STATE_NORMAL);
+        return goldCornGetSourceMapper.list(query);
+    }
+
+    @Override
+    public long countShow(String appCode) throws GoldAppException {
+        Long appId = goldCornAppManager.getAppId(appCode);
+        SourceQuery query = new SourceQuery();
+        query.setAppId(appId);
+        query.setState(GoldCornGetSource.STATE_NORMAL);
+        return goldCornGetSourceMapper.count(query);
+    }
 }

--
Gitblit v1.8.0