From 81da61b828e29b7745e1382dfbbaeb685dc083ef Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 23 一月 2024 17:17:55 +0800
Subject: [PATCH] 抖音转链修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/ShamUserServiceImpl.java |  436 +++++++++++++++++++++++++++---------------------------
 1 files changed, 218 insertions(+), 218 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ShamUserServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ShamUserServiceImpl.java
index 0e2b888..2d415ec 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ShamUserServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ShamUserServiceImpl.java
@@ -1,218 +1,218 @@
-package com.yeshi.fanli.service.impl.user;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import com.yeshi.fanli.entity.SystemEnum;
-import com.yeshi.fanli.service.inter.common.CommonConfigService;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.yeshi.fanli.dao.mybatis.user.ShamUserMapper;
-import com.yeshi.fanli.entity.bus.user.ShamUser;
-import com.yeshi.fanli.entity.system.ConfigKeyEnum;
-import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.user.ShamUserService;
-import com.yeshi.fanli.util.StringUtil;
-
-import net.sf.json.JSONArray;
-
-@Service
-public class ShamUserServiceImpl implements ShamUserService {
-
-    @Resource
-    private ShamUserMapper shamUserMapper;
-
-    @Resource
-    private ConfigService configService;
-    @Resource
-    private CommonConfigService commonConfigService;
-
-    @Transactional
-    public void addShamUser(ShamUser shamUser) {
-        shamUserMapper.insertSelective(shamUser);
-    }
-
-    public List<ShamUser> getAll() {
-        return shamUserMapper.listAll();
-    }
-
-    public List<ShamUser> findShamUserList(int sum) {
-        return shamUserMapper.listShamUserByKey(0, sum, null);
-    }
-
-    @Override
-    public int deleteByPrimaryKey(Long id) {
-        return shamUserMapper.deleteByPrimaryKey(id);
-    }
-
-    @Override
-    public int insert(ShamUser record) {
-        return shamUserMapper.insert(record);
-    }
-
-    @Override
-    public int insertSelective(ShamUser record) {
-        return shamUserMapper.insertSelective(record);
-    }
-
-    @Override
-    public ShamUser selectByPrimaryKey(Long id) {
-        return shamUserMapper.selectByPrimaryKey(id);
-    }
-
-    @Override
-    public int updateByPrimaryKeySelective(ShamUser record) {
-        return shamUserMapper.updateByPrimaryKeySelective(record);
-    }
-
-    @Override
-    public int updateByPrimaryKey(ShamUser record) {
-        return shamUserMapper.updateByPrimaryKey(record);
-    }
-
-    @Override
-    public List<ShamUser> listDistinctPicUrl(long start, int count) {
-        return shamUserMapper.listByDistinctPicUrl(start, count);
-    }
-
-    @Override
-    public int insertBatch(List<ShamUser> list) {
-        return shamUserMapper.insertBatch(list);
-    }
-
-    @Override
-    public int updateBatchSelective(List<ShamUser> list) {
-        return shamUserMapper.updateBatchSelective(list);
-    }
-
-    @Override
-    public List<ShamUser> listRandCouponUser(int count, int smallTime, int largeTime) {
-        List<Integer> listTime = new ArrayList<Integer>();
-
-        while (listTime.size() < count) {
-            int time = smallTime + (int) (Math.random() * (largeTime - smallTime + 1));
-            if (!listTime.contains(Integer.valueOf(time))) {
-                listTime.add(Integer.valueOf(time));
-            }
-        }
-
-        Collections.sort(listTime);
-
-        List<ShamUser> listRand = shamUserMapper.listRand(count);
-
-        for (int i = 1; i <= count; i++) {
-            ShamUser shamUser = (ShamUser) listRand.get(i - 1);
-
-            transformId(shamUser);
-
-            shamUser.setMsg(listTime.get(listTime.size() - i) + "绉掑墠璐拱浜嗘鍟嗗搧");
-        }
-
-        return listRand;
-    }
-
-    @Override
-    public List<ShamUser> listRandShareUser(int count, BigDecimal shareMoney, int small, int large) {
-
-        List<Integer> listMultiple = new ArrayList<Integer>();
-
-        while (listMultiple.size() < count) {
-            int Multiple = small + (int) (Math.random() * (large - small + 1));
-            listMultiple.add(Integer.valueOf(Multiple));
-        }
-
-        List<String> imgList = new ArrayList<String>();
-        String value = commonConfigService.getValue(ConfigKeyEnum.shareBonusPicture.getKey());
-
-        if (!StringUtil.isNullOrEmpty(value)) {
-            JSONArray array = JSONArray.fromObject(value);
-            if (array != null) {
-                for (int n = 0; n < array.size(); n++) {
-                    imgList.add(array.optString(n));
-                }
-            }
-
-        }
-
-        List<ShamUser> listRand = shamUserMapper.listRand(count);
-
-        for (int i = 0; i < count; i++) {
-            ShamUser shamUser = (ShamUser) listRand.get(i);
-
-            transformId(shamUser);
-
-            if (imgList.size() > 0) {
-                int randBonusPic = (int) (Math.random() * imgList.size());
-                shamUser.setShareBonusPic((String) imgList.get(randBonusPic));
-            }
-
-            BigDecimal money = shareMoney.multiply(new BigDecimal(((Integer) listMultiple.get(i)).intValue()))
-                    .setScale(2, 1);
-            // 蹇呴』鍖呭惈 銆愬閲懧ャ�� 杩�3涓鍙凤紝 鐢ㄤ簬鍓嶇棰滆壊鍖哄垎
-            shamUser.setMsg("鍒嗕韩浜嗚繖涓晢鍝�,绱鑾峰緱濂栭噾楼" + money);
-        }
-
-        return listRand;
-    }
-
-    public void transformId(ShamUser shamUser) {
-        String id = shamUser.getId() + "";
-        if (id.length() == 1) {
-            shamUser.setShowId("2****" + id);
-        } else {
-            shamUser.setShowId(id.substring(0, 1) + "****" + id.substring(id.length() - 2, id.length() - 1));
-        }
-
-        String name = shamUser.getName();
-        if (StringUtil.isNullOrEmpty(name)) {
-            // 鍚嶅瓧涓虹┖鏃�
-            String start = randomName();
-            String end = randomName();
-            shamUser.setName(start + "**" + end);
-        } else if (name.length() == 1) {
-            // 涓�涓瓧
-            String start = name;
-            if (start.trim().length() == 0 || start.equals("*")) {
-                start = randomName();
-            }
-            String end = randomName();
-            shamUser.setName(start + "**" + end);
-        } else {
-            // 涓や釜瀛楀強鍏朵互涓�
-            String start = name.substring(0, 1);
-            String end = name.substring(name.length() - 2, name.length() - 1);
-            if (start.trim().length() == 0 || start.equals("*")) {
-                start = randomName();
-            }
-            if (end.trim().length() == 0 || end.equals("*")) {
-                end = randomName();
-            }
-            shamUser.setName(start + "**" + end);
-        }
-    }
-
-    /**
-     * 闅忔満鍚嶇О
-     *
-     * @return
-     */
-    public String randomName() {
-        String[] array = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
-                "鎴�", "鍗�", "澹�", "鎬�", "涓�", "鎴�", "鍩�", "缃�", "钀�", "鑺�", "鍖�", "澶�", "绂�", "鎵�", "娴�", "鐢�", "鑻�", "姊�", "浣�", "绻�", "鍗�", "涓�", "璧�", "涓�", "鏄�", "宸�", "鎰�", "琛�",
-                "涓�", "鍚�", "椋�", "宄�", "鏋�", "闊�", "鍚�", "缁�", "鍊�", "绌�", "绂�", "涓�", "鍘�", "鐣�", "鍏�", "娴�", "鐦�", "闄�", "閺�", "闄�", "绱�", "瑾�", "鐐�", "缇�", "闄�", "濉�", "杌�", "鏅�",
-                "鍏�", "闆�", "楸�", "钘�", "闆�", "鍙�", "浜�", "閰�", "鑸�", "鍌�", "璩�", "娈�", "姗�", "宸�", "鍠�", "鎰�", "鍟�", "鍡�", "璀�", "璜�", "璨�", "閵�", "姹�", "鑸�", "瀛�", "鍚�", "鏄�", "鏄�", "闂�"
-                , "閾�", "楦�", "鍐�", "椋�", "璐�", "闈�", "搴�", "杈�", "鍘�", "鏇�", "娓�", "灏�", "绗�", "鏅�", "娑�", "鏍�", "瑗�", "濡�", "濞�", "鐮�", "鐪�", "鍑�", "寰�", "鍏�", "銇�", "瓒�", "榛�", "鑸�", "绱�",
-                "鎲�", "鏃�", "銇�", "銇�", "鐑�", "鏉�", "鐑�", "寮�", "缁�", "闆�", "鏈�", "鑸�"};
-        return array[(int) (Math.random() * array.length - 1)];
-    }
-
-    @Override
-    public List<ShamUser> listRandUser(int count) {
-        return shamUserMapper.listRand(count);
-    }
-}
+package com.yeshi.fanli.service.impl.user;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import com.yeshi.fanli.entity.SystemEnum;
+import com.yeshi.fanli.service.inter.common.CommonConfigService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.yeshi.fanli.dao.mybatis.user.ShamUserMapper;
+import com.yeshi.fanli.entity.bus.user.ShamUser;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.service.inter.config.ConfigService;
+import com.yeshi.fanli.service.inter.user.ShamUserService;
+import com.yeshi.fanli.util.StringUtil;
+
+import net.sf.json.JSONArray;
+
+@Service
+public class ShamUserServiceImpl implements ShamUserService {
+
+    @Resource
+    private ShamUserMapper shamUserMapper;
+
+    @Resource
+    private ConfigService configService;
+    @Resource
+    private CommonConfigService commonConfigService;
+
+    @Transactional
+    public void addShamUser(ShamUser shamUser) {
+        shamUserMapper.insertSelective(shamUser);
+    }
+
+    public List<ShamUser> getAll() {
+        return shamUserMapper.listAll();
+    }
+
+    public List<ShamUser> findShamUserList(int sum) {
+        return shamUserMapper.listShamUserByKey(0, sum, null);
+    }
+
+    @Override
+    public int deleteByPrimaryKey(Long id) {
+        return shamUserMapper.deleteByPrimaryKey(id);
+    }
+
+    @Override
+    public int insert(ShamUser record) {
+        return shamUserMapper.insert(record);
+    }
+
+    @Override
+    public int insertSelective(ShamUser record) {
+        return shamUserMapper.insertSelective(record);
+    }
+
+    @Override
+    public ShamUser selectByPrimaryKey(Long id) {
+        return shamUserMapper.selectByPrimaryKey(id);
+    }
+
+    @Override
+    public int updateByPrimaryKeySelective(ShamUser record) {
+        return shamUserMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int updateByPrimaryKey(ShamUser record) {
+        return shamUserMapper.updateByPrimaryKey(record);
+    }
+
+    @Override
+    public List<ShamUser> listDistinctPicUrl(long start, int count) {
+        return shamUserMapper.listByDistinctPicUrl(start, count);
+    }
+
+    @Override
+    public int insertBatch(List<ShamUser> list) {
+        return shamUserMapper.insertBatch(list);
+    }
+
+    @Override
+    public int updateBatchSelective(List<ShamUser> list) {
+        return shamUserMapper.updateBatchSelective(list);
+    }
+
+    @Override
+    public List<ShamUser> listRandCouponUser(int count, int smallTime, int largeTime) {
+        List<Integer> listTime = new ArrayList<Integer>();
+
+        while (listTime.size() < count) {
+            int time = smallTime + (int) (Math.random() * (largeTime - smallTime + 1));
+            if (!listTime.contains(Integer.valueOf(time))) {
+                listTime.add(Integer.valueOf(time));
+            }
+        }
+
+        Collections.sort(listTime);
+
+        List<ShamUser> listRand = shamUserMapper.listRand(count);
+
+        for (int i = 1; i <= count; i++) {
+            ShamUser shamUser = (ShamUser) listRand.get(i - 1);
+
+            transformId(shamUser);
+
+            shamUser.setMsg(listTime.get(listTime.size() - i) + "绉掑墠璐拱浜嗘鍟嗗搧");
+        }
+
+        return listRand;
+    }
+
+    @Override
+    public List<ShamUser> listRandShareUser(int count, BigDecimal shareMoney, int small, int large) {
+
+        List<Integer> listMultiple = new ArrayList<Integer>();
+
+        while (listMultiple.size() < count) {
+            int Multiple = small + (int) (Math.random() * (large - small + 1));
+            listMultiple.add(Integer.valueOf(Multiple));
+        }
+
+        List<String> imgList = new ArrayList<String>();
+        String value = commonConfigService.getValue(ConfigKeyEnum.shareBonusPicture.getKey());
+
+        if (!StringUtil.isNullOrEmpty(value)) {
+            JSONArray array = JSONArray.fromObject(value);
+            if (array != null) {
+                for (int n = 0; n < array.size(); n++) {
+                    imgList.add(array.optString(n));
+                }
+            }
+
+        }
+
+        List<ShamUser> listRand = shamUserMapper.listRand(count);
+
+        for (int i = 0; i < count; i++) {
+            ShamUser shamUser = (ShamUser) listRand.get(i);
+
+            transformId(shamUser);
+
+            if (imgList.size() > 0) {
+                int randBonusPic = (int) (Math.random() * imgList.size());
+                shamUser.setShareBonusPic((String) imgList.get(randBonusPic));
+            }
+
+            BigDecimal money = shareMoney.multiply(new BigDecimal(((Integer) listMultiple.get(i)).intValue()))
+                    .setScale(2, 1);
+            // 蹇呴』鍖呭惈 銆愬閲懧ャ�� 杩�3涓鍙凤紝 鐢ㄤ簬鍓嶇棰滆壊鍖哄垎
+            shamUser.setMsg("鍒嗕韩浜嗚繖涓晢鍝�,绱鑾峰緱濂栭噾楼" + money);
+        }
+
+        return listRand;
+    }
+
+    public void transformId(ShamUser shamUser) {
+        String id = shamUser.getId() + "";
+        if (id.length() == 1) {
+            shamUser.setShowId("2****" + id);
+        } else {
+            shamUser.setShowId(id.substring(0, 1) + "****" + id.substring(id.length() - 2, id.length() - 1));
+        }
+
+        String name = shamUser.getName();
+        if (StringUtil.isNullOrEmpty(name)) {
+            // 鍚嶅瓧涓虹┖鏃�
+            String start = randomName();
+            String end = randomName();
+            shamUser.setName(start + "**" + end);
+        } else if (name.length() == 1) {
+            // 涓�涓瓧
+            String start = name;
+            if (start.trim().length() == 0 || start.equals("*")) {
+                start = randomName();
+            }
+            String end = randomName();
+            shamUser.setName(start + "**" + end);
+        } else {
+            // 涓や釜瀛楀強鍏朵互涓�
+            String start = name.substring(0, 1);
+            String end = name.substring(name.length() - 2, name.length() - 1);
+            if (start.trim().length() == 0 || start.equals("*")) {
+                start = randomName();
+            }
+            if (end.trim().length() == 0 || end.equals("*")) {
+                end = randomName();
+            }
+            shamUser.setName(start + "**" + end);
+        }
+    }
+
+    /**
+     * 闅忔満鍚嶇О
+     *
+     * @return
+     */
+    public String randomName() {
+        String[] array = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
+                "鎴�", "鍗�", "澹�", "鎬�", "涓�", "鎴�", "鍩�", "缃�", "钀�", "鑺�", "鍖�", "澶�", "绂�", "鎵�", "娴�", "鐢�", "鑻�", "姊�", "浣�", "绻�", "鍗�", "涓�", "璧�", "涓�", "鏄�", "宸�", "鎰�", "琛�",
+                "涓�", "鍚�", "椋�", "宄�", "鏋�", "闊�", "鍚�", "缁�", "鍊�", "绌�", "绂�", "涓�", "鍘�", "鐣�", "鍏�", "娴�", "鐦�", "闄�", "閺�", "闄�", "绱�", "瑾�", "鐐�", "缇�", "闄�", "濉�", "杌�", "鏅�",
+                "鍏�", "闆�", "楸�", "钘�", "闆�", "鍙�", "浜�", "閰�", "鑸�", "鍌�", "璩�", "娈�", "姗�", "宸�", "鍠�", "鎰�", "鍟�", "鍡�", "璀�", "璜�", "璨�", "閵�", "姹�", "鑸�", "瀛�", "鍚�", "鏄�", "鏄�", "闂�"
+                , "閾�", "楦�", "鍐�", "椋�", "璐�", "闈�", "搴�", "杈�", "鍘�", "鏇�", "娓�", "灏�", "绗�", "鏅�", "娑�", "鏍�", "瑗�", "濡�", "濞�", "鐮�", "鐪�", "鍑�", "寰�", "鍏�", "銇�", "瓒�", "榛�", "鑸�", "绱�",
+                "鎲�", "鏃�", "銇�", "銇�", "鐑�", "鏉�", "鐑�", "寮�", "缁�", "闆�", "鏈�", "鑸�"};
+        return array[(int) (Math.random() * array.length - 1)];
+    }
+
+    @Override
+    public List<ShamUser> listRandUser(int count) {
+        return shamUserMapper.listRand(count);
+    }
+}

--
Gitblit v1.8.0