Browse Source

创客版块代码大概写完,待完善

lichunlei 1 year ago
parent
commit
f79ac36c75

+ 5 - 0
pom.xml

@@ -75,6 +75,11 @@
 			<artifactId>reactor-test</artifactId>
 			<scope>test</scope>
 		</dependency>
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+			<version>2.0.34</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 30 - 0
src/main/java/com/kxs/adminap/AdminapApplication.java

@@ -1,10 +1,17 @@
 package com.kxs.adminap;
 
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
 import java.util.TimeZone;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import com.kxs.adminap.config.Base;
+import com.kxs.adminap.service.DbConn;
+
 import jakarta.annotation.PostConstruct;
 
 @SpringBootApplication
@@ -13,10 +20,33 @@ public class AdminapApplication {
 	@PostConstruct
 	void started() {
 		TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
+		initMainServer();
 	}
 
 	public static void main(String[] args) {
 		SpringApplication.run(AdminapApplication.class, args);
 	}
 
+
+	//获取数据库模型
+	private void initMainServer() {
+		Dictionary<String, Map<String, String>> tables = new Hashtable<>();
+		List<Dictionary<String, Object>> tablecollection = DbConn.Query("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'", Base.main_url, Base.main_username, Base.main_password);
+		for (Dictionary<String, Object> subtable : tablecollection)
+		{
+			Map<String, String> Columns = new Hashtable<>();
+			List<Dictionary<String, Object>> columncollection = DbConn.Query("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer' and TABLE_NAME='" + subtable.get("TABLE_NAME").toString() + "'", Base.main_url, Base.main_username, Base.main_password);
+			for (Dictionary<String, Object> column : columncollection)
+			{
+				String datatype = column.get("DATA_TYPE").toString();
+				if (datatype == "decimal")
+				{
+					datatype = "numeric";
+				}
+				Columns.put(column.get("COLUMN_NAME").toString(), datatype);
+			}
+			tables.put(subtable.get("TABLE_NAME").toString(), Columns);
+		}
+		Base.main_tables = tables;
+	}
 }

+ 13 - 0
src/main/java/com/kxs/adminap/config/Base.java

@@ -0,0 +1,13 @@
+package com.kxs.adminap.config;
+
+import java.util.Dictionary;
+import java.util.Map;
+
+public class Base {
+
+	public static String main_url = "jdbc:mysql://localhost:3306/GGSJ?useUnicode=true&characterEncoding=utf8";
+    public static String main_username = "root";
+    public static String main_password = "123456";
+
+	public static Dictionary<String, Map<String, String>> main_tables;
+}

+ 9 - 2
src/main/java/com/kxs/adminap/controller/TestController.java

@@ -2,14 +2,18 @@ package com.kxs.adminap.controller;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.kxs.adminap.config.Base;
 import com.kxs.adminap.dao.TestTablerepository;
 import com.kxs.adminap.enity.TestTable;
 import com.kxs.adminap.service.DbConn;
@@ -123,12 +127,15 @@ public class TestController {
 
 	@RequestMapping("/sql")
 	public List<Dictionary<String, Object>> sql() {
-		return DbConn.Query("select * from ApiVersion");
+		List<Object> params = new ArrayList<>();
+		params.add(2);
+		params.add(6);
+		return DbConn.Query("select * from ApiVersion limit ?,?", params, Base.main_url, Base.main_username, Base.main_password);
 	}
 
 	@RequestMapping("/sqlop")
 	public String sqlop(Integer id) {
-		DbConn.Op("delete from ApiVersion where Id=" + id);
+		DbConn.Op("delete from ApiVersion where Id=" + id, Base.main_url, Base.main_username, Base.main_password);
 		return "ok";
 	}
 

+ 1036 - 0
src/main/java/com/kxs/adminap/controller/UsersController.java

@@ -0,0 +1,1036 @@
+package com.kxs.adminap.controller;
+
+import org.springframework.web.bind.annotation.*;
+
+import com.alibaba.fastjson.JSONObject;
+import com.kxs.adminap.enity.AppResultJson;
+import com.kxs.adminap.enity.RelationData;
+import com.kxs.adminap.model.Users;
+import com.kxs.adminap.service.main.UsersService;
+import com.kxs.adminap.util.RedisUtils;
+import com.kxs.adminap.util.UsersUtil;
+import com.kxs.adminap.util.Util;
+
+import jakarta.annotation.Resource;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class UsersController
+{
+    @Resource
+	RedisUtils redisUtils;
+
+    //根据条件查询创客列表
+
+    /// <summary>
+    /// 创客列表
+    /// </summary>
+    /// <returns></returns>
+    @PostMapping("/main/users/all")
+    public @ResponseBody AppResultJson List(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer page = Integer.parseInt(data.getString("PageNum").toString());
+        Integer limit = Integer.parseInt(data.getString("PageSize").toString());
+        String condition = " and Status>-1"; //查询条件
+        // String CreateDate = data.getString("CreateDate").toString(); //昵称
+        String RealName = data.getString("RealName").toString(); //真实姓名
+        String CertId = data.getString("CertId").toString(); //身份证号
+        String Mobile = data.getString("Mobile").toString(); //手机号
+        String MakerCode = data.getString("MakerCode").toString(); //创客编号
+        Integer CheckParent = Integer.parseInt(Util.CheckInt(data.getString("CheckParent").toString())); //是否查询上级创客(默认为0或空 否 当前选中数据的UserId)
+        Integer CheckChild = Integer.parseInt(Util.CheckInt(data.getString("CheckChild").toString())); //是否查询直属创客(默认为0或空 否 当前选中数据的UserId)
+        // String SettleAmount = data.getString("SettleAmount").toString(); //最低结算金额
+        // String CashFreezeAmt = data.getString("CashFreezeAmt").toString(); //提现冻结金额
+        // String DeviceType = data.getString("DeviceType").toString(); //设备类型
+
+        // if (!Util.IsNullOrEmpty(CreateDate))
+        // {
+        //     string[] dates = CreateDate.Split(new string[] { " - " }, StringSplitOptions.None);
+        //     condition += " and CreateDate>='" + dates[0] + "' and CreateDate<='" + dates[1] + "'";
+        // }
+        if (CheckParent > 0)
+        {
+            var self = UsersService.Query(CheckParent, "*");
+            if (self != null)
+            {
+                String ParentNav = Util.CheckNull(self.ParentNav);
+                if (!ParentNav.isEmpty())
+                {
+                    condition += " and Id in (" + ParentNav.substring(1, ParentNav.length() - 2).replaceAll(",,", ",") + ")";
+                }
+                else
+                {
+                    condition += " and Id=0";
+                }
+            }
+        }
+        else if (CheckChild > 0)
+        {
+            condition += " and ParentUserId=" + CheckChild;
+        }
+        else
+        {
+            if (!Util.IsNullOrEmpty(RealName))
+            {
+                condition += " and RealName like '%" + RealName + "%'";
+            }
+            if (!Util.IsNullOrEmpty(CertId))
+            {
+                condition += " and CertId like '%" + CertId + "%'";
+            }
+            if (!Util.IsNullOrEmpty(Mobile))
+            {
+                condition += " and Mobile='" + Mobile + "'";
+            }
+            if (!Util.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and MakerCode like '%" + MakerCode + "%'";
+            }
+        }
+
+        //关联表数据
+        List<RelationData> relationData = new ArrayList<>();
+        RelationData RelationDataItem = new RelationData();
+        RelationDataItem.Field = "ParentUserId";
+        RelationDataItem.Table = "Users";
+        List<String> ReturnField = new ArrayList<>();
+        ReturnField.add("MakerCode");
+        ReturnField.add("RealName");
+        RelationDataItem.ReturnField = ReturnField;
+        relationData.add(RelationDataItem);
+
+        Integer count = 0;
+        List<Dictionary<String, Object>> list = UsersService.List(relationData, condition, count, page, limit, "Sort desc,Id desc");
+        for (Dictionary<String, Object> dic : list)
+        {
+            if (!Util.IsNullOrEmpty(dic.get("ParentNav").toString()))
+            {
+                String ParentNav = dic.get("ParentNav").toString();
+                String[] ParentNavList = ParentNav.substring(1, ParentNav.length() - 2).replaceAll(",,", ",").split(",");
+                var topUserInfo = new Users();
+                if (ParentNavList.length > 1)
+                {
+                    topUserInfo = UsersUtil.GetTopUserInfo(dic.get("ParentNav").toString(), 1);
+                }
+                else
+                {
+                    topUserInfo = UsersUtil.GetTopUserInfo(dic.get("ParentNav").toString(), 0);
+                }
+                dic.put("TopMakerCode", topUserInfo.MakerCode);
+                dic.put("TopRealName", topUserInfo.RealName);
+            }
+            else
+            {
+                dic.put("TopMakerCode", "");
+                dic.put("TopRealName", "");
+            }
+        }
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = list;
+        result.Other = count;
+        return result;
+    }
+
+
+    //根据条件查询上级创客列表
+
+    /// <summary>
+    /// 根据条件查询上级创客列表
+    /// </summary>
+    /// <returns></returns>
+    @PostMapping("/main/users/parentlist")
+    public @ResponseBody AppResultJson ParentList(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer page = Integer.parseInt(data.getString("PageNum").toString());
+        Integer limit = Integer.parseInt(data.getString("PageSize").toString());
+        String RealName = data.getString("RealName").toString(); //真实姓名
+        String CertId = data.getString("CertId").toString(); //身份证号
+        String Mobile = data.getString("Mobile").toString(); //手机号
+        String MakerCode = data.getString("MakerCode").toString(); //创客编号
+        Integer ParentUserId = Integer.parseInt(data.getString("ParentUserId").toString()); //上级创客Id
+        String condition = " and Status>-1 and ParentUserId=" + ParentUserId; //查询条件
+        if (!Util.IsNullOrEmpty(RealName))
+        {
+            condition += " and RealName like '%" + RealName + "%'";
+        }
+        if (!Util.IsNullOrEmpty(CertId))
+        {
+            condition += " and CertId like '%" + CertId + "%'";
+        }
+        if (!Util.IsNullOrEmpty(Mobile))
+        {
+            condition += " and Mobile='" + Mobile + "'";
+        }
+        if (!Util.IsNullOrEmpty(MakerCode))
+        {
+            condition += " and MakerCode like '%" + MakerCode + "%'";
+        }
+        //关联表数据
+        List<RelationData> relationData = new ArrayList<>();
+        RelationData RelationDataItem = new RelationData();
+        RelationDataItem.Field = "ParentUserId";
+        RelationDataItem.Table = "Users";
+        List<String> ReturnField = new ArrayList<>();
+        ReturnField.add("MakerCode");
+        ReturnField.add("RealName");
+        RelationDataItem.ReturnField = ReturnField;
+        relationData.add(RelationDataItem);
+
+        Integer count = 0;
+        List<Dictionary<String, Object>> list = UsersService.List(relationData, condition, count, page, limit, "Sort desc,Id desc");
+        for (Dictionary<String, Object> dic : list)
+        {
+            // dic["LevelName"] = UserLevelSetService.Query(Integer.parseInt(dic["UserLevel"].toString())).Name;
+
+            // //实名状态
+            // dic["AuthFlagName"] = dic["AuthFlag"].toString() == "1" ? "已实名" : "未实名";
+
+            // //风控状态
+            // dic["RiskFlagName"] = dic["RiskFlag"].toString() == "1" ? "已风控" : "未风控";
+
+            // //商户创客
+            // dic["MerchantTypeName"] = Func.GetMerchantTypeInfo(Integer.parseInt(dic["MerchantType"].toString()));
+
+
+        }
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = list;
+        result.Other = count;
+        return result;
+    }
+
+
+    //根据条件查询直属创客列表
+
+    /// <summary>
+    /// 根据条件查询直属创客列表
+    /// </summary>
+    /// <returns></returns>
+    @RequestMapping("/main/users/childlist")
+    public @ResponseBody AppResultJson ChildList(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer page = Integer.parseInt(data.getString("PageNum").toString());
+        Integer limit = Integer.parseInt(data.getString("PageSize").toString());
+        String RealName = data.getString("RealName").toString(); //真实姓名
+        String CertId = data.getString("CertId").toString(); //身份证号
+        String Mobile = data.getString("Mobile").toString(); //手机号
+        String MakerCode = data.getString("MakerCode").toString(); //创客编号
+        Integer UserId = Integer.parseInt(data.getString("ParentUserId").toString()); //创客Id
+        String condition = " and Status>-1 and ParentUserId=" + UserId; //查询条件
+        if (!Util.IsNullOrEmpty(RealName))
+        {
+            condition += " and RealName like '%" + RealName + "%'";
+        }
+        if (!Util.IsNullOrEmpty(CertId))
+        {
+            condition += " and CertId like '%" + CertId + "%'";
+        }
+        if (!Util.IsNullOrEmpty(Mobile))
+        {
+            condition += " and Mobile='" + Mobile + "'";
+        }
+        if (!Util.IsNullOrEmpty(MakerCode))
+        {
+            condition += " and MakerCode like '%" + MakerCode + "%'";
+        }
+        //关联表数据
+        List<RelationData> relationData = new ArrayList<>();
+        RelationData RelationDataItem = new RelationData();
+        RelationDataItem.Field = "ParentUserId";
+        RelationDataItem.Table = "Users";
+        List<String> ReturnField = new ArrayList<>();
+        ReturnField.add("MakerCode");
+        ReturnField.add("RealName");
+        RelationDataItem.ReturnField = ReturnField;
+        relationData.add(RelationDataItem);
+
+        Integer count = 0;
+        List<Dictionary<String, Object>> list = UsersService.List(relationData, condition, count, page, limit, "Sort desc,Id desc");
+        for (Dictionary<String, Object> dic : list)
+        {
+            // //创客等级
+            // dic["LevelName"] = UserLevelSetService.Query(Integer.parseInt(dic["UserLevel"].toString())).Name;
+
+            // //实名状态
+            // dic["AuthFlagName"] = dic["AuthFlag"].toString() == "1" ? "已实名" : "未实名";
+
+            // //风控状态
+            // dic["RiskFlagName"] = dic["RiskFlag"].toString() == "1" ? "已风控" : "未风控";
+
+            // //商户创客
+            // dic["MerchantTypeName"] = Func.GetMerchantTypeInfo(Integer.parseInt(dic["MerchantType"].toString()));
+
+
+        }
+        // 返回字段:
+        // MakerCode //创客编号
+        // RealName //真实姓名
+        // LevelName //创客等级
+        // Mobile //手机号
+        // CertId //身份证号
+        // AgentAreas //展业区域
+        // MerchantTypeName //商户创客类型
+        // MerchantDate //成为商户型创客时间
+        // AuthFlagName //实名状态
+        // CreateDate //注册时间
+        // AuthDate //实名时间
+        // ParentUserIdMakerCode //直属创客编号
+        // ParentUserIdRealName //直属创客名称
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = list;
+        result.Other = count;
+        return result;
+    }
+
+
+    //根据条件查询直属创客交易额列表
+
+    /// <summary>
+    /// 根据条件查询直属创客交易额列表
+    /// </summary>
+    /// <returns></returns>
+    @RequestMapping("/main/users/childamountrecordlist")
+    public @ResponseBody AppResultJson ChildAmountRecordList(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer page = Integer.parseInt(data.getString("PageNum").toString());
+        Integer limit = Integer.parseInt(data.getString("PageSize").toString());
+        Integer UserId = Integer.parseInt(Util.CheckInt(data.getString("UserId").toString())); // 创客Id
+        Integer BrandId = Integer.parseInt(Util.CheckInt(data.getString("BrandId").toString())); //品牌
+        String MakerCode = data.getString("MakerCode").toString(); //创客编号
+        String CreateDateData = data.getString("CreateDateData").toString(); //交易时间
+
+        String start = "";
+        String end = "";
+
+        String condition = " and Status>-1 and AuthFlag >0 and ParentUserId=" + UserId;
+        String con = " and Status>-1";
+        String cons = " and Status>=-1";
+        //创客编号
+        if (!Util.IsNullOrEmpty(MakerCode))
+        {
+            condition += " and MakerCode like '%" + MakerCode + "%'";
+        }
+        //时间不为空
+        if (!Util.IsNullOrEmpty(CreateDateData))
+        {
+            String[] datelist = CreateDateData.split(" - ");
+            start = datelist[0].replaceAll("-", "");
+            end = datelist[1].replaceAll("-", "");
+            con += " and TradeDate>='" + start + "' and TradeDate<='" + end + "'";
+            cons += " and SeoKeyword >=" + start + " and SeoKeyword <=" + end;
+
+        }
+        //时间为空
+        else
+        {
+            start = Util.DateFormat(new Date(), "yyyyMM") + "01";
+            end = Util.DateFormat(Util.AddMonth(new Date(), 1), "yyyyMM") + "01";
+            con += " and TradeDate>='" + start + "' and TradeDate<'" + end + "'";
+            cons += " and SeoKeyword >=" + start + " and SeoKeyword <" + end;
+        }
+        if (!Util.IsNullOrEmpty(BrandId.toString()) && BrandId > 0)
+        {
+            con += " and BrandId='" + BrandId + "'";
+            cons += " and BrandId='" + BrandId + "'";
+        }
+        //关联表数据
+        List<RelationData> relationData = new ArrayList<>();
+
+        Integer count = 0;
+        List<Dictionary<String, Object>> list = UsersService.List(relationData, condition, count, page, limit, "Sort desc, Id desc");
+        for (Dictionary<String, Object> dic : list)
+        {
+            Integer UId = Integer.parseInt(dic.get("Id").toString());
+            // var Info = TradeDaySummaryService.GetMonthTradeForBrand(UId, start, end, BrandId);
+
+            // dic["TotalAmtfc"] = Convert.ToDecimal(Info["TotalAmtfc"].toString()) + Convert.ToDecimal(Info["YAmtfc"].toString());
+            // dic["DAmtfc"] = Convert.ToDecimal(Info["DAmtfc"].toString());
+            // dic["JAmtfc"] = Convert.ToDecimal(Info["JAmtfc"].toString());
+            // dic["JfAmtfc"] = Convert.ToDecimal(Info["JfAmtfc"].toString());
+            // dic["JCountfc"] = Convert.ToInt32(Info["JCountfc"].toString());
+            // dic["YAmtfc"] = Convert.ToDecimal(Info["YAmtfc"].toString());
+
+            // dic["TotalAmtwd"] = Convert.ToDecimal(Info["TotalAmtwd"].toString()) + Convert.ToDecimal(Info["YAmtwd"].toString());
+            // dic["DAmtwd"] = Convert.ToDecimal(Info["DAmtwd"].toString());
+            // dic["JAmtwd"] = Convert.ToDecimal(Info["JAmtwd"].toString());
+            // dic["JfAmtwd"] = Convert.ToDecimal(Info["JfAmtwd"].toString());
+            // dic["JCountwd"] = Convert.ToInt32(Info["JCountwd"].toString());
+            // dic["YAmtwd"] = Convert.ToDecimal(Info["YAmtwd"].toString());
+
+            // dic["TotalAmtyl"] = Convert.ToDecimal(Info["TotalAmtyl"].toString()) + Convert.ToDecimal(Info["YAmtyl"].toString());
+            // dic["DAmtyl"] = Convert.ToDecimal(Info["DAmtyl"].toString());
+            // dic["JAmtyl"] = Convert.ToDecimal(Info["JAmtyl"].toString());
+            // dic["JfAmtyl"] = Convert.ToDecimal(Info["JfAmtyl"].toString());
+            // dic["JCountyl"] = Convert.ToInt32(Info["JCountyl"].toString());
+            // dic["YAmtyl"] = Convert.ToDecimal(Info["YAmtyl"].toString());
+
+            // dic["TBCount"] = Info["TBCount"].toString();
+            // dic["TACount"] = Info["TACount"].toString();
+
+
+        }
+        Dictionary<String, Object> other = new Hashtable<>();
+        Dictionary<String, Object> personal = new Hashtable<>();
+        Dictionary<String, Object> team = new Hashtable<>();
+        // var sumTitleInfo = TradeDaySummaryService.GetSumTitleMonthTrade(UserId, con, cons);
+        // //个人
+        // //扶持期
+        // personal.Add("TotalAmtfc", Convert.ToDecimal(sumTitleInfo["TotalAmtfc"].toString()));
+        // personal.Add("DAmtfc", Convert.ToDecimal(sumTitleInfo["DAmtfc"].toString()));
+        // personal.Add("JAmtfc", Convert.ToDecimal(sumTitleInfo["JAmtfc"].toString()));
+        // personal.Add("JfAmtfc", Convert.ToDecimal(sumTitleInfo["JfAmtfc"].toString()));
+        // personal.Add("JCountfc", Convert.ToDecimal(sumTitleInfo["JCountfc"].toString()));
+        // personal.Add("YAmtfc", Convert.ToDecimal(sumTitleInfo["YAmtfc"].toString()));
+
+        // //稳定期
+        // personal.Add("TotalAmtwd", Convert.ToDecimal(sumTitleInfo["TotalAmtwd"].toString()));
+        // personal.Add("DAmtwd", Convert.ToDecimal(sumTitleInfo["DAmtwd"].toString()));
+        // personal.Add("JAmtwd", Convert.ToDecimal(sumTitleInfo["JAmtwd"].toString()));
+        // personal.Add("JfAmtwd", Convert.ToDecimal(sumTitleInfo["JfAmtwd"].toString()));
+        // personal.Add("JCountwd", Convert.ToDecimal(sumTitleInfo["JCountwd"].toString()));
+        // personal.Add("YAmtwd", Convert.ToDecimal(sumTitleInfo["YAmtwd"].toString()));
+
+        // //盈利期
+        // personal.Add("TotalAmtyl", Convert.ToDecimal(sumTitleInfo["TotalAmtyl"].toString()));
+        // personal.Add("DAmtyl", Convert.ToDecimal(sumTitleInfo["DAmtyl"].toString()));
+        // personal.Add("JAmtyl", Convert.ToDecimal(sumTitleInfo["JAmtyl"].toString()));
+        // personal.Add("JfAmtyl", Convert.ToDecimal(sumTitleInfo["JfAmtyl"].toString()));
+        // personal.Add("JCountyl", Convert.ToDecimal(sumTitleInfo["JCountyl"].toString()));
+        // personal.Add("YAmtyl", Convert.ToDecimal(sumTitleInfo["YAmtyl"].toString()));
+
+        // //团队
+        // //扶持期
+        // team.Add("TotalAmtfc1", Convert.ToDecimal(sumTitleInfo["TotalAmtfc1"].toString()));
+        // team.Add("DAmtfc1", Convert.ToDecimal(sumTitleInfo["DAmtfc1"].toString()));
+        // team.Add("JAmtfc1", Convert.ToDecimal(sumTitleInfo["JAmtfc1"].toString()));
+        // team.Add("JfAmtfc1", Convert.ToDecimal(sumTitleInfo["JfAmtfc1"].toString()));
+        // team.Add("JCountfc1", Convert.ToDecimal(sumTitleInfo["JCountfc1"].toString()));
+        // team.Add("YAmtfc1", Convert.ToDecimal(sumTitleInfo["YAmtfc1"].toString()));
+
+        // //稳定期
+        // team.Add("TotalAmtwd1", Convert.ToDecimal(sumTitleInfo["TotalAmtwd1"].toString()));
+        // team.Add("DAmtwd1", Convert.ToDecimal(sumTitleInfo["DAmtwd1"].toString()));
+        // team.Add("JAmtwd1", Convert.ToDecimal(sumTitleInfo["JAmtwd1"].toString()));
+        // team.Add("JfAmtwd1", Convert.ToDecimal(sumTitleInfo["JfAmtwd1"].toString()));
+        // team.Add("JCountwd1", Convert.ToDecimal(sumTitleInfo["JCountwd1"].toString()));
+        // team.Add("YAmtwd1", Convert.ToDecimal(sumTitleInfo["YAmtwd1"].toString()));
+
+        // //盈利期
+        // team.Add("TotalAmtyl1", Convert.ToDecimal(sumTitleInfo["TotalAmtyl1"].toString()));
+        // team.Add("DAmtyl1", Convert.ToDecimal(sumTitleInfo["DAmtyl1"].toString()));
+        // team.Add("JAmtyl1", Convert.ToDecimal(sumTitleInfo["JAmtyl1"].toString()));
+        // team.Add("JfAmtyl1", Convert.ToDecimal(sumTitleInfo["JfAmtyl1"].toString()));
+        // team.Add("JCountyl1", Convert.ToDecimal(sumTitleInfo["JCountyl1"].toString()));
+        // team.Add("YAmtyl1", Convert.ToDecimal(sumTitleInfo["YAmtyl1"].toString()));
+
+        // personal.Add("PBCount", Convert.ToDecimal(sumTitleInfo["PBCount"].toString()));
+        // personal.Add("PACount", Convert.ToDecimal(sumTitleInfo["PACount"].toString()));
+        // team.Add("TBCount", Convert.ToDecimal(sumTitleInfo["TBCount"].toString()));
+        // team.Add("TACount", Convert.ToDecimal(sumTitleInfo["TACount"].toString()));
+
+        // other.Add("personal", personal);
+        // other.Add("team", team);
+        // other.Add("count", count);
+        // 返回字段:
+        // MakerCode // 创客编号
+        // RealName // 创客姓名
+        // TotalAmtfc // 刷卡交易总额(扶)
+        // DAmtfc // 贷记卡交易额(扶)
+        // JAmtfc // 借记卡非封顶交易额(扶)
+        // JfAmtfc // 借记卡封顶交易额(扶)
+        // JCountfc // 借记卡交易笔数(扶)
+        // YAmtfc // 云闪付小额交易额(扶)
+        // TotalAmtwd // 刷卡交易总额(稳)
+        // DAmtwd // 贷记卡交易额(稳)
+        // JAmtwd // 借记卡非封顶交易额(稳)
+        // JfAmtwd // 借记卡封顶交易额(稳)
+        // JCountwd // 借记卡交易笔数(稳)
+        // YAmtwd // 云闪付小额交易额(稳)
+        // TotalAmtyl // 刷卡交易总额(盈)
+        // DAmtyl // 贷记卡交易额(盈)
+        // JAmtyl // 借记卡非封顶交易额(盈)
+        // JfAmtyl // 借记卡封顶交易额(盈)
+        // JCountyl // 借记卡交易笔数(盈)
+        // YAmtyl // 云闪付小额交易额(盈)
+        // TBCount // 团队机具绑定总数
+        // TACount // 团队机具激活总数
+
+        // 个人交易额:
+        // 刷卡交易总额(扶) TotalAmtfc 贷记卡交易额(扶) DAmtfc 借记卡非封顶交易额(扶) JAmtfc 借记卡封顶交易额(扶) JfAmtfc 借记卡交易笔数(扶) JCountfc 云闪付小额交易额(扶) YAmtfc
+        // 刷卡交易总额(稳) TotalAmtwd 贷记卡交易额(稳) DAmtwd 借记卡非封顶交易额(稳) JAmtwd 借记卡封顶交易额(稳) JfAmtwd 借记卡交易笔数(稳) JCountwd 云闪付小额交易额(稳) YAmtwd
+        // 刷卡交易总额(盈) TotalAmtyl 贷记卡交易额(盈) DAmtyl 借记卡非封顶交易额(盈) JAmtyl 借记卡封顶交易额(盈) JfAmtyl 借记卡交易笔数(盈) JCountyl 云闪付小额交易额(盈) YAmtyl
+        // 个人机具绑定总数 PBCount 个人机具激活总数 PACount
+        // 团队交易额:
+        // 刷卡交易总额(扶) TotalAmtfc1 贷记卡交易额(扶) DAmtfc1 借记卡非封顶交易额(扶) JAmtfc1 借记卡封顶交易额(扶) JfAmtfc1 借记卡交易笔数(扶) JCountfc1 云闪付小额交易额(扶) YAmtfc1
+        // 刷卡交易总额(稳) TotalAmtwd1 贷记卡交易额(稳) DAmtwd1 借记卡非封顶交易额(稳) JAmtwd1 借记卡封顶交易额(稳) JfAmtwd1 借记卡交易笔数(稳) JCountwd1 云闪付小额交易额(稳) YAmtwd1
+        // 刷卡交易总额(盈) TotalAmtyl1 贷记卡交易额(盈) DAmtyl1 借记卡非封顶交易额(盈) JAmtyl1 借记卡封顶交易额(盈) JfAmtyl1 借记卡交易笔数(盈) JCountyl1 云闪付小额交易额(盈) YAmtyl1
+        // 团队机具绑定总数 TBCount 团队机具激活总数 TACoun
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = list;
+        result.Other = other;
+        return result;
+    }
+
+
+    //根据条件查询已注销创客列表
+
+    /// <summary>
+    /// 根据条件查询已注销创客列表
+    /// </summary>
+    /// <returns></returns>
+    @RequestMapping("/main/users/canclelist")
+    public @ResponseBody AppResultJson CancleList(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer page = Integer.parseInt(data.getString("PageNum").toString());
+        Integer limit = Integer.parseInt(data.getString("PageSize").toString());
+        String condition = " and Status=-1"; //查询条件
+        String MakerCode = data.getString("MakerCode").toString(); //创客编号
+        String RealName = data.getString("RealName").toString(); //真实姓名
+        String Mobile = data.getString("Mobile").toString(); //手机号
+        String CertId = data.getString("CertId").toString(); //身份证号
+        String CreateDate = data.getString("CreateDate").toString(); //注册时间
+        String AuthFlag = data.getString("AuthFlag").toString(); //实名状态(0 未实名 1 已实名)
+        if (!Util.IsNullOrEmpty(RealName))
+        {
+            condition += " and RealName like '%" + RealName + "%'";
+        }
+        if (!Util.IsNullOrEmpty(CertId))
+        {
+            condition += " and CertId like '%" + CertId + "%'";
+        }
+        if (!Util.IsNullOrEmpty(Mobile))
+        {
+            condition += " and Mobile like '%" + Mobile + "%'";
+        }
+        if (!Util.IsNullOrEmpty(MakerCode))
+        {
+            condition += " and MakerCode like '%" + MakerCode + "%'";
+        }
+        if (!Util.IsNullOrEmpty(CreateDate))
+        {
+            String[] datelist = CreateDate.split(" - ");
+            String start = datelist[0];
+            String end = datelist[1];
+            condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+        }
+        if (!Util.IsNullOrEmpty(AuthFlag))
+        {
+            condition += " and AuthFlag=" + AuthFlag;
+        }
+
+        //关联表数据
+        List<RelationData> relationData = new ArrayList<>();
+        RelationData RelationDataItem = new RelationData();
+        RelationDataItem.Field = "ParentUserId";
+        RelationDataItem.Table = "Users";
+        List<String> ReturnField = new ArrayList<>();
+        ReturnField.add("MakerCode");
+        ReturnField.add("RealName");
+        RelationDataItem.ReturnField = ReturnField;
+        relationData.add(RelationDataItem);
+
+        Integer count = 0;
+        List<Dictionary<String, Object>> list = UsersService.List(relationData, condition, count, page, limit, "Sort desc,Id desc");
+        for (Dictionary<String, Object> dic : list)
+        {
+            // var userLevel = " and Id=" + Integer.parseInt(dic["UserLevel"].toString());
+            //创客等级
+            // dic["LevelName"] = UserLevelSetService.Query(Integer.parseInt(dic["UserLevel"].toString())).Name;
+
+            //实名状态
+            // dic["AuthFlagName"] = dic["AuthFlag"].toString() == "1" ? "已实名" : "未实名";
+
+            //风控状态
+            // dic["RiskFlagName"] = dic["RiskFlag"].toString() == "1" ? "已风控" : "未风控";
+
+            //商户创客
+            // dic["MerchantTypeName"] = Func.GetMerchantTypeInfo(Integer.parseInt(dic["MerchantType"].toString()));
+
+            if (!Util.IsNullOrEmpty(dic.get("ParentNav").toString()))
+            {
+                String ParentNav = dic.get("ParentNav").toString();
+                String[] ParentNavList = ParentNav.substring(1, ParentNav.length() - 2).replaceAll(",,", ",").split(",");
+                var topUserInfo = new Users();
+                if (ParentNavList.length > 1)
+                {
+                    topUserInfo = UsersService.Query(Integer.parseInt(ParentNavList[1]), "*");
+                }
+                else
+                {
+                    topUserInfo = UsersService.Query(Integer.parseInt(ParentNavList[0]), "*");
+                }
+                dic.put("TopMakerCode", topUserInfo.MakerCode);
+                dic.put("TopRealName", topUserInfo.RealName);
+            }
+            else
+            {
+                dic.put("TopMakerCode", "");
+                dic.put("TopRealName", "");
+            }
+        }
+        // 返回字段:
+        // MakerCode //创客编号
+        // RealName //真实姓名
+        // UserLevel //创客等级(1~9对应K1~K9)
+        // Mobile //手机号
+        // CertId //身份证号
+        // AgentAreas //展业区域
+        // MerchantType //商户创客类型(0 非商户型合伙人 1商户型合伙人)
+        // MerchantDate //成为商户型创客时间
+        // AuthFlag //实名状态(1 已实名 0 未实名)
+        // CreateDate //注册时间
+        // AuthDate //实名时间
+        // ParentUserIdMakerCode //直属创客编号
+        // ParentUserIdRealName //直属创客名称
+        // TopMakerCode //顶级创客编号
+        // TopRealName //顶级创客名称
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = list;
+        result.Other = count;
+        return result;
+    }
+
+
+    //创客详情
+
+    /// <summary>
+    /// 创客详情
+    /// </summary>
+    /// <returns></returns>
+    @GetMapping("/main/users")
+    public @ResponseBody AppResultJson Query(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer Id = Integer.parseInt(Util.CheckInt(data.get("Id").toString()));
+        Users item = UsersService.Query(Id, "*");
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = item;
+        return result;
+    }
+
+
+    //增加创客
+
+    /// <summary>
+    /// 增加或修改创客信息
+    /// </summary>
+    /// <returns></returns>
+    @GetMapping("/main/users")
+    public @ResponseBody AppResultJson Add(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        Users data = JSONObject.parseObject(JSONObject.toJSONString(value), Users.class);
+        Map<String, Object> fields = new HashMap<>();
+        fields.put("NickName", data.NickName); //昵称
+        fields.put("RealName", data.RealName); //真实姓名
+        fields.put("Sex", data.Sex); //性别
+        fields.put("CertId", data.CertId); //身份证号
+        fields.put("Areas", data.Areas); //所在地区
+        fields.put("Address", data.Address); //详细地址
+        fields.put("HeadPhoto", data.HeadPhoto); //头像
+        fields.put("UserLevel", data.UserLevel); //创客等级
+        fields.put("CardNo", data.CardNo); //卡号
+        fields.put("Mobile", data.Mobile); //手机号
+        fields.put("GroupId", data.GroupId); //分组
+        fields.put("Tags", data.Tags); //标签
+        if (!Util.IsNullOrEmpty(data.LoginPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("LoginPwd", Util.MD532(data.LoginPwd)); //登录密码
+        }
+        if (!Util.IsNullOrEmpty(data.PayPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("PayPwd", Util.MD532(data.PayPwd)); //支付密码
+        }
+        fields.put("IsNewUser", data.IsNewUser); //是否新创客
+        fields.put("IdCardEndNo", data.IdCardEndNo); //身份证后四位
+        fields.put("SettleBankCardNo", data.SettleBankCardNo); //结算银行卡号
+        fields.put("SettleBankName", data.SettleBankName); //结算银行名称
+        fields.put("ReferenceCode", data.ReferenceCode); //推荐码
+        fields.put("CardRecCode", data.CardRecCode); //办卡分享图片地址
+        fields.put("ReferenceQrCode", data.ReferenceQrCode); //推广二维码地址
+        fields.put("SignImgUrl", data.SignImgUrl); //特定协议签名图片地址
+        fields.put("UserType", data.UserType); //创客类型
+        fields.put("UserProperty", data.UserProperty); //创客属性
+        fields.put("MerchantType", data.MerchantType); //商户创客类型
+        fields.put("MerchantDate", data.MerchantDate); //成为商户型创客时间
+        fields.put("LoginStatus", data.LoginStatus); //登录状态
+        fields.put("AuditStatus", data.AuditStatus); //审核状态
+        fields.put("LockStatus", data.LockStatus); //锁定状态
+        fields.put("AuthFlag", data.AuthFlag); //实名标识
+        fields.put("AuthDate", data.AuthDate); //实名时间
+        fields.put("RiskFlag", data.RiskFlag); //风控标识
+        fields.put("RiskRemark", data.RiskRemark); //风控备注
+        fields.put("RreezeRemark", data.RreezeRemark); //账户冻结备注信息
+        fields.put("SettleRemark", data.SettleRemark); //结算金额调整备注
+        fields.put("ExpiredDate", data.ExpiredDate); //过期时间
+        fields.put("DeviceId", data.DeviceId); //设备ID
+        fields.put("DeviceToken", data.DeviceToken); //设备令牌
+        fields.put("CertFrontImage", data.CertFrontImage); //身份证正面照
+        fields.put("CertReverseImage", data.CertReverseImage); //身份证反面照
+        fields.put("HandCertImage", data.HandCertImage); //手持身份证
+        fields.put("BankCardPositiveImage", data.BankCardPositiveImage); //银行卡正面照
+        fields.put("Remark", data.Remark); //备注信息
+        if (!Util.IsNullOrEmpty(data.HandPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("HandPwd", Util.MD532(data.HandPwd)); //手势密码
+        }
+        fields.put("MakerCode", data.MakerCode); //创客编号
+        fields.put("CashFreezeAmt", data.CashFreezeAmt); //提现冻结金额
+        fields.put("ActiveRewardAmount", data.ActiveRewardAmount); //激活奖励金额
+        fields.put("ProfitRewardRate", data.ProfitRewardRate); //分润奖励
+        fields.put("CertValidStartDate", data.CertValidStartDate); //身份证有效期开始时间
+        fields.put("CertValidEndDate", data.CertValidEndDate); //身份证有效期结束时间
+        fields.put("SettleBankCardName", data.SettleBankCardName); //结算银行卡户名
+        fields.put("AgentLevel", data.AgentLevel); //代理等级
+        fields.put("AgentAreas", data.AgentAreas); //代理区域
+        fields.put("CashStatus", data.CashStatus); //代付账户状态
+        fields.put("CashNote", data.CashNote); //代付账户备注
+        fields.put("LeaderLevel", data.LeaderLevel); //盟主等级
+        fields.put("BusinessFlag", data.BusinessFlag); //企业标记
+        fields.put("DeviceType", data.DeviceType); //设备类型
+        fields.put("SignPic", data.SignPic); //签名图片
+
+        AppResultJson resultJson = UsersService.Add(fields);
+        return resultJson;
+    }
+
+
+    //修改创客
+
+    /// <summary>
+    /// 增加或修改创客信息
+    /// </summary>
+    /// <returns></returns>
+    @PutMapping("/main/users")
+    public @ResponseBody AppResultJson Edit(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        Users data = JSONObject.parseObject(JSONObject.toJSONString(value), Users.class);
+        Map<String, Object> fields = new HashMap<>();
+        fields.put("NickName", data.NickName); //昵称
+        fields.put("RealName", data.RealName); //真实姓名
+        fields.put("Sex", data.Sex); //性别
+        fields.put("CertId", data.CertId); //身份证号
+        fields.put("Areas", data.Areas); //所在地区
+        fields.put("Address", data.Address); //详细地址
+        fields.put("HeadPhoto", data.HeadPhoto); //头像
+        fields.put("UserLevel", data.UserLevel); //创客等级
+        fields.put("CardNo", data.CardNo); //卡号
+        fields.put("Mobile", data.Mobile); //手机号
+        fields.put("GroupId", data.GroupId); //分组
+        fields.put("Tags", data.Tags); //标签
+        if (!Util.IsNullOrEmpty(data.LoginPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("LoginPwd", Util.MD532(data.LoginPwd)); //登录密码
+        }
+        if (!Util.IsNullOrEmpty(data.PayPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("PayPwd", Util.MD532(data.PayPwd)); //支付密码
+        }
+        fields.put("IsNewUser", data.IsNewUser); //是否新创客
+        fields.put("IdCardEndNo", data.IdCardEndNo); //身份证后四位
+        fields.put("SettleBankCardNo", data.SettleBankCardNo); //结算银行卡号
+        fields.put("SettleBankName", data.SettleBankName); //结算银行名称
+        fields.put("ReferenceCode", data.ReferenceCode); //推荐码
+        fields.put("CardRecCode", data.CardRecCode); //办卡分享图片地址
+        fields.put("ReferenceQrCode", data.ReferenceQrCode); //推广二维码地址
+        fields.put("SignImgUrl", data.SignImgUrl); //特定协议签名图片地址
+        fields.put("UserType", data.UserType); //创客类型
+        fields.put("UserProperty", data.UserProperty); //创客属性
+        fields.put("MerchantType", data.MerchantType); //商户创客类型
+        fields.put("MerchantDate", data.MerchantDate); //成为商户型创客时间
+        fields.put("LoginStatus", data.LoginStatus); //登录状态
+        fields.put("AuditStatus", data.AuditStatus); //审核状态
+        fields.put("LockStatus", data.LockStatus); //锁定状态
+        fields.put("AuthFlag", data.AuthFlag); //实名标识
+        fields.put("AuthDate", data.AuthDate); //实名时间
+        fields.put("RiskFlag", data.RiskFlag); //风控标识
+        fields.put("RiskRemark", data.RiskRemark); //风控备注
+        fields.put("RreezeRemark", data.RreezeRemark); //账户冻结备注信息
+        fields.put("SettleRemark", data.SettleRemark); //结算金额调整备注
+        fields.put("ExpiredDate", data.ExpiredDate); //过期时间
+        fields.put("DeviceId", data.DeviceId); //设备ID
+        fields.put("DeviceToken", data.DeviceToken); //设备令牌
+        fields.put("CertFrontImage", data.CertFrontImage); //身份证正面照
+        fields.put("CertReverseImage", data.CertReverseImage); //身份证反面照
+        fields.put("HandCertImage", data.HandCertImage); //手持身份证
+        fields.put("BankCardPositiveImage", data.BankCardPositiveImage); //银行卡正面照
+        fields.put("Remark", data.Remark); //备注信息
+        if (!Util.IsNullOrEmpty(data.HandPwd)) //密码不为空就修改密码,否则不操作
+        {
+            fields.put("HandPwd", Util.MD532(data.HandPwd)); //手势密码
+        }
+        fields.put("MakerCode", data.MakerCode); //创客编号
+        fields.put("CashFreezeAmt", data.CashFreezeAmt); //提现冻结金额
+        fields.put("ActiveRewardAmount", data.ActiveRewardAmount); //激活奖励金额
+        fields.put("ProfitRewardRate", data.ProfitRewardRate); //分润奖励
+        fields.put("CertValidStartDate", data.CertValidStartDate); //身份证有效期开始时间
+        fields.put("CertValidEndDate", data.CertValidEndDate); //身份证有效期结束时间
+        fields.put("SettleBankCardName", data.SettleBankCardName); //结算银行卡户名
+        fields.put("AgentLevel", data.AgentLevel); //代理等级
+        fields.put("AgentAreas", data.AgentAreas); //代理区域
+        fields.put("CashStatus", data.CashStatus); //代付账户状态
+        fields.put("CashNote", data.CashNote); //代付账户备注
+        fields.put("LeaderLevel", data.LeaderLevel); //盟主等级
+        fields.put("BusinessFlag", data.BusinessFlag); //企业标记
+        fields.put("DeviceType", data.DeviceType); //设备类型
+        fields.put("SignPic", data.SignPic); //签名图片
+
+        AppResultJson resultJson = UsersService.Edit(fields, data.Id);
+        return resultJson;
+    }
+
+
+    //逻辑删除创客信息
+
+    /// <summary>
+    /// 删除创客信息
+    /// </summary>
+    /// <returns></returns>
+    @DeleteMapping("/main/users/remove")
+    public @ResponseBody AppResultJson Remove(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        String Id = jsonObj.get("Id").toString();
+        String[] idlist = Id.split(",");
+        for (String subid : idlist)
+        {
+            Integer id = Integer.parseInt(subid);
+            UsersService.Remove(id);
+        }
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+
+    //彻底删除创客信息
+
+    /// <summary>
+    /// 删除创客信息
+    /// </summary>
+    /// <returns></returns>
+    @DeleteMapping("/main/users")
+    public @ResponseBody AppResultJson Delete(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        String Id = jsonObj.get("Id").toString();
+        String[] idlist = Id.split(",");
+        for (String subid : idlist)
+        {
+            Integer id = Integer.parseInt(subid);
+            UsersService.Delete(id);
+        }
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+
+    //开启
+
+    /// <summary>
+    /// 开启
+    /// </summary>
+    /// <returns></returns>
+    @PutMapping("/main/users/open")
+    public @ResponseBody AppResultJson Open(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        String Id = jsonObj.get("Id").toString();
+        String[] idlist = Id.split(",");
+        for (String subid : idlist)
+        {
+            Integer id = Integer.parseInt(subid);
+            Map<String, Object> Fields = new HashMap<>();
+            Fields.put("Status", 1);
+            UsersService.Edit(Fields, id);
+        }
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+
+    //关闭
+
+    /// <summary>
+    /// 关闭
+    /// </summary>
+    /// <returns></returns>
+    @PutMapping("/main/users/close")
+    public @ResponseBody AppResultJson Close(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        String Id = jsonObj.get("Id").toString();
+        String[] idlist = Id.split(",");
+        for (String subid : idlist)
+        {
+            Integer id = Integer.parseInt(subid);
+            Map<String, Object> Fields = new HashMap<>();
+            Fields.put("Status", 0);
+            UsersService.Edit(Fields, id);
+        }
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+
+    //排序
+    /// <summary>
+    /// 排序
+    /// </summary>
+    /// <param name="Id"></param>
+    @PutMapping("/main/users/sort")
+    public @ResponseBody AppResultJson Sort(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        Integer Id = Integer.parseInt(jsonObj.get("Id").toString());
+        Integer Sort = Integer.parseInt(jsonObj.get("Sort").toString());
+        UsersService.Sort(Id, Sort);
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+    //导入数据
+    /// <summary>
+    /// 导入数据
+    /// </summary>
+    /// <param name="ExcelData"></param>
+    @PostMapping("/main/users/import")
+    public @ResponseBody AppResultJson Import(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject jsonObj = JSONObject.parseObject(value);
+        String ExcelData = jsonObj.get("ExcelData").toString();
+        UsersService.Import(ExcelData);
+        Dictionary<String, Object> obj = new Hashtable<>(); //返回字段
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = obj;
+        return result;
+    }
+
+    //导出Excel
+
+    /// <summary>
+    /// 导出Excel
+    /// </summary>
+    /// <returns></returns>
+    @PostMapping("/main/users/export")
+    public @ResponseBody AppResultJson ExportExcel(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        Users data = JSONObject.parseObject(JSONObject.toJSONString(value), Users.class);
+        String SqlString = "select * from Users order by Id desc limit 20";
+        Dictionary<String, Object> dic = new Hashtable<>();
+        dic.put("Operater", 0); //后台操作员账户Id
+        dic.put("SqlString", SqlString); //sql语句,表头用指定中文
+        dic.put("FileName", "仓库-" + Util.DateFormat(new Date(), "yyyy-MM-dd HH:mm:ss")); //excel文件名
+        dic.put("MaxCount", "0"); //最大返回数,0为不限制
+        redisUtils.addList("ExportQueue", JSONObject.toJSONString(dic));
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        return result;
+    }
+
+
+    //同步创客机具数
+
+    /// <summary>
+    /// 同步创客机具数
+    /// </summary>
+    /// <returns></returns>
+    @PostMapping("/main/users/sycnposcount")
+    public @ResponseBody AppResultJson SycnData(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        String UserId = data.getString("UserId").toString();
+        // var BrandIds = KqProductsService.QueryBrandId();
+        // foreach (var BrandId in BrandIds)
+        // {
+            // BaseClass.SycnUserPosCount(Integer.parseInt(UserId), Integer.parseInt(BrandId.toString()));
+            // RedisDbconn.Instance.AddList("SycnUserMachineCountQueue", "{\"UserId\":\"" + UserId + "\",\"BrandId\":\"" + BrandId + "\"}");
+        // }
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Info = "同步成功!";
+        return result;
+    }
+
+
+    //重置密码
+
+    /// <summary>
+    /// 重置密码
+    /// </summary>
+    /// <returns></returns>
+    @PostMapping("/main/users/resetpwd")
+    public @ResponseBody AppResultJson ResetPwd(String value)
+    {
+        // value = PublicFunction.DesDecrypt(value);
+        JSONObject data = JSONObject.parseObject(value);
+        Integer UserId = Integer.parseInt(data.getString("UserId").toString());
+        var info = "";
+        // info = UsersUtil.ResetLoginPwd(UserId);
+        if (info == "success")
+        {
+            AppResultJson result = new AppResultJson();
+            result.Status = "1";
+            result.Info = "重置成功";
+            return result;
+        }
+        else
+        {
+            AppResultJson result = new AppResultJson();
+            result.Status = "0";
+            result.Info = "重置失败";
+            result.Data = info;
+            return result;
+        }
+    }
+
+}

+ 12 - 0
src/main/java/com/kxs/adminap/enity/AppResultJson.java

@@ -0,0 +1,12 @@
+package com.kxs.adminap.enity;
+
+import java.io.Serializable;
+
+public class AppResultJson implements Serializable
+{
+    public String Info;
+    public Object Data;
+    public Object Other;
+    public String Status;
+    public Integer Timestamp;
+}

+ 10 - 0
src/main/java/com/kxs/adminap/enity/FieldItem.java

@@ -0,0 +1,10 @@
+package com.kxs.adminap.enity;
+
+import java.io.Serializable;
+
+public class FieldItem implements Serializable
+{
+    public String FieldName;
+    public String OperateTag;
+    public Object FieldVal;
+}

+ 11 - 0
src/main/java/com/kxs/adminap/enity/RelationData.java

@@ -0,0 +1,11 @@
+package com.kxs.adminap.enity;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class RelationData implements Serializable
+{
+    public String Field;
+    public String Table;
+    public List<String> ReturnField;
+}

+ 0 - 2
src/main/java/com/kxs/adminap/enity/TestTable.java

@@ -3,8 +3,6 @@ package com.kxs.adminap.enity;
 import java.io.Serializable;
 import java.util.Date;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.GeneratedValue;

+ 98 - 0
src/main/java/com/kxs/adminap/model/Users.java

@@ -0,0 +1,98 @@
+package com.kxs.adminap.model;
+
+import java.sql.Date;
+
+public class Users
+{
+    public Integer Id;
+    public Integer Sort;
+    public Integer QueryCount;
+    public Integer Status;
+    public Integer Version;
+    public Date CreateDate;
+    public Date UpdateDate;
+    public String CreateMan;
+    public String UpdateMan;
+    public String SeoTitle;
+    public String SeoKeyword;
+    public String SeoDescription;
+    public String AgentAreas;
+    public Integer AgentLevel;
+    public String SettleBankCardName;
+    public Date CertValidEndDate;
+    public Date CertValidStartDate;
+    public Date CitySetDate;
+    public Double ProfitRewardRate;
+    public Double ActiveRewardAmount;
+    public Double CashFreezeAmt;
+    public Double SettleAmount;
+    public String MakerCode;
+    public String HandPwd;
+    public String Remark;
+    public String BankCardPositiveImage;
+    public String HandCertImage;
+    public String CertReverseImage;
+    public String CertFrontImage;
+    public String DeviceToken;
+    public String DeviceId;
+    public Date ExpiredDate;
+    public String AccessToken;
+    public String SettleRemark;
+    public String RreezeRemark;
+    public String RiskRemark;
+    public Boolean RiskFlag;
+    public Date AuthDate;
+    public Boolean AuthFlag;
+    public Boolean LockStatus;
+    public Integer AuditStatus;
+    public Integer LoginStatus;
+    public Date MerchantDate;
+    public Integer MerchantType;
+    public Integer UserProperty;
+    public Integer UserType;
+    public String SignImgUrl;
+    public String ReferenceQrCode;
+    public String CardRecCode;
+    public Integer ReferralUserId;
+    public String ReferenceCode;
+    public String SettleBankName;
+    public String SettleBankCardNo;
+    public String IdCardEndNo;
+    public Boolean IsNewUser;
+    public String AlipayUserId;
+    public String OpenId;
+    public String CarIds;
+    public String PayPwd;
+    public String LoginPwd;
+    public String ParentNav;
+    public String Tags;
+    public String GroupId;
+    public String Mobile;
+    public String CardNo;
+    public Integer UserLevel;
+    public Integer ParentUserId;
+    public String HeadPhoto;
+    public String Address;
+    public String Areas;
+    public String CertId;
+    public Integer Sex;
+    public String RealName;
+    public String NickName;
+    public Integer CashStatus;
+    public String CashNote;
+    public Double ThisMonthTrade;
+    public Integer LeaderLevel;
+    public Integer BusinessFlag;
+    public Double ValidAmount;
+    public String DeviceType;
+    public Date HelpProfitAgreeDate;
+    public Boolean HelpProfitAgree;
+    public String SignPic;
+    public Date SignDate;
+    public Boolean IsSign;
+    public Date CreateStoreDate;
+    public Integer StoreStock;
+    public Integer ThisMonthSend;
+    public String BusinessLogo;
+    public String BusinessName;
+}

+ 134 - 7
src/main/java/com/kxs/adminap/service/DbConn.java

@@ -2,6 +2,7 @@ package com.kxs.adminap.service;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.Statement;
@@ -10,12 +11,8 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.List;
 
-public class DbConn {
-    static String url = "jdbc:mysql://localhost:3306/GGSJ?useUnicode=true&characterEncoding=utf8";
-    static String username = "root";
-    static String password = "123456";
- 
-    public static List<Dictionary<String, Object>> Query(String sql) {
+public class DbConn { 
+    public static List<Dictionary<String, Object>> Query(String sql, String url, String username, String password) {
         List<Dictionary<String, Object>> list = new ArrayList<>();
         try {
             //利用反射的方法加载驱动器
@@ -50,7 +47,113 @@ public class DbConn {
         return list;
     }
 
-    public static void Op(String sql) {
+    public static List<Dictionary<String, Object>> Query(String sql, List<Object> params, String url, String username, String password) {
+        List<Dictionary<String, Object>> list = new ArrayList<>();
+        try {
+            //利用反射的方法加载驱动器
+            Class.forName("com.mysql.cj.jdbc.Driver");
+    
+            //使用Drivermanager的getConnectionn方法获取连接对象
+            Connection root = DriverManager.getConnection(url, username, password);
+
+            //获取statement对象
+            PreparedStatement statement = root.prepareStatement(sql); //两个问号表示这个SQL语句有两个参数
+            int index = 0;
+            for (var item : params) {
+                index += 1;
+                statement.setObject(index, item); //设第index个参数的值
+            }
+            statement.execute();
+    
+            ResultSet rs = statement.getResultSet();
+            ResultSetMetaData md = rs.getMetaData();//获取键名
+            int columnCount = md.getColumnCount();//获取列的数量
+            while (rs.next()) {
+                Dictionary<String, Object> rowData = new Hashtable<>();//声明Map
+                for (int i = 1; i <= columnCount; i++) {
+                    Object val = rs.getObject(i);
+                    if(val == null) val = "";
+                    rowData.put(md.getColumnName(i), val);//获取键名及值
+                }
+                list.add(rowData);
+            }
+
+            rs.close();
+            statement.close();
+            root.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    public static Dictionary<String, Object> QueryOne(String sql, String url, String username, String password) {
+        Dictionary<String, Object> object = new Hashtable<>();
+        try {
+            //利用反射的方法加载驱动器
+            Class.forName("com.mysql.cj.jdbc.Driver");
+    
+            //使用Drivermanager的getConnectionn方法获取连接对象
+            Connection root = DriverManager.getConnection(url, username, password);
+    
+            //获取statement对象
+            Statement statement = root.createStatement();
+    
+            //指定sql语句,要执行增删改可使用executeUpdate()方法
+            ResultSet rs = statement.executeQuery(sql);
+            ResultSetMetaData md = rs.getMetaData();//获取键名
+            if (rs.getRow() > 0) {
+                Object val = rs.getObject(0);
+                if(val == null) val = "";
+                object.put(md.getColumnName(0), val);//获取键名及值
+            }
+
+            rs.close();
+            statement.close();
+            root.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return object;
+    }
+
+    public static Dictionary<String, Object> QueryOne(String sql, List<Object> params, String url, String username, String password) {
+        Dictionary<String, Object> object = new Hashtable<>();
+        try {
+            //利用反射的方法加载驱动器
+            Class.forName("com.mysql.cj.jdbc.Driver");
+    
+            //使用Drivermanager的getConnectionn方法获取连接对象
+            Connection root = DriverManager.getConnection(url, username, password);
+    
+            //获取statement对象
+            PreparedStatement statement = root.prepareStatement(sql); //两个问号表示这个SQL语句有两个参数
+            int index = 0;
+            for (var item : params) {
+                index += 1;
+                statement.setObject(index, item); //设第index个参数的值
+            }
+            statement.execute();
+    
+            //指定sql语句,要执行增删改可使用executeUpdate()方法
+            ResultSet rs = statement.getResultSet();
+            ResultSetMetaData md = rs.getMetaData();//获取键名
+            if (rs.getRow() > 0) {
+                Object val = rs.getObject(0);
+                if(val == null) val = "";
+                object.put(md.getColumnName(0), val);//获取键名及值
+            }
+
+            rs.close();
+            statement.close();
+            root.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return object;
+    }
+
+    public static void Op(String sql, String url, String username, String password) {
         try {
             //利用反射的方法加载驱动器
             Class.forName("com.mysql.cj.jdbc.Driver");
@@ -70,4 +173,28 @@ public class DbConn {
             e.printStackTrace();
         }
     }
+
+    public static void Op(String sql, List<Object> params, String url, String username, String password) {
+        try {
+            //利用反射的方法加载驱动器
+            Class.forName("com.mysql.cj.jdbc.Driver");
+    
+            //使用Drivermanager的getConnectionn方法获取连接对象
+            Connection root = DriverManager.getConnection(url, username, password);
+    
+            //获取statement对象
+            PreparedStatement statement = root.prepareStatement(sql); //两个问号表示这个SQL语句有两个参数
+            int index = 0;
+            for (var item : params) {
+                index += 1;
+                statement.setObject(index, item); //设第index个参数的值
+            }
+            statement.execute();
+
+            statement.close();
+            root.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 233 - 0
src/main/java/com/kxs/adminap/service/main/UsersService.java

@@ -0,0 +1,233 @@
+package com.kxs.adminap.service.main;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
+import com.kxs.adminap.config.Base;
+import com.kxs.adminap.enity.AppResultJson;
+import com.kxs.adminap.enity.RelationData;
+import com.kxs.adminap.model.Users;
+import com.kxs.adminap.util.DbService;
+
+public class UsersService
+{
+
+    /// <summary>
+    /// 查询列表
+    /// </summary>
+    /// <param name="relationData">关联表</param>
+    /// <param name="condition">查询条件(sql语句)</param>
+    /// <param name="count">总数(输出)</param>
+    /// <param name="page">页码</param>
+    /// <param name="limit">每页条数</param>
+    /// <returns></returns>
+    public static List<Dictionary<String, Object>> List(List<RelationData> relationData, String condition, Integer count, Integer page, Integer limit, String orderBy)
+    {
+        List<String> fields = new ArrayList<>(); //要显示的列
+        fields.add("Id");
+        fields.add("CreateDate"); //注册时间
+        fields.add("Status"); //状态
+        fields.add("MakerCode"); //创客编号
+        fields.add("RealName"); //真实姓名
+        fields.add("Mobile"); //手机号
+        fields.add("CertId"); //身份证号
+        fields.add("UserLevel"); //创客等级
+        fields.add("AgentAreas"); //代理区域
+        fields.add("MerchantType"); //商户创客类型
+        fields.add("MerchantDate"); //成为商户型创客时间
+        fields.add("AuthFlag"); //实名标识
+        fields.add("AuthDate"); //实名时间
+        fields.add("RiskFlag"); //风控标识
+        fields.add("ParentUserId"); //直属创客Id
+        fields.add("ParentNav"); //父级集合
+        // fields.add("SettleAmount"); //最低结算金额
+        // fields.add("CashFreezeAmt"); //提现冻结金额
+        // fields.add("CertValidStartDate"); //身份证有效期开始时间
+        // fields.add("CertValidEndDate"); //身份证有效期结束时间
+        // fields.add("SettleBankCardName"); //结算银行卡户名
+        // fields.add("AgentLevel"); //代理等级
+        // fields.add("CashStatus"); //代付账户状态
+        // fields.add("LeaderLevel"); //盟主等级
+        // fields.add("BusinessFlag"); //企业标记
+        // fields.add("DeviceType"); //设备类型
+        // fields.add("HelpProfitAgree"); //助利宝协议标记
+        // fields.add("HelpProfitAgreeDate"); //助利宝协议标记时间
+
+        Dictionary<String, Object> obj = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).IndexData("Users", relationData, orderBy, page, limit, condition, fields);
+        Object data = obj.get("data");
+        List<Dictionary<String, Object>> diclist = (List<Dictionary<String, Object>>) data;
+        count = (Integer)obj.get("count");
+        return diclist;
+    }
+    public static List<Dictionary<String, Object>> List(List<RelationData> relationData, String condition, Integer page, Integer limit, String orderBy)
+    {
+        List<String> fields = new ArrayList<>(); //要显示的列
+        fields.add("Id");
+        fields.add("CreateDate"); //添加时间
+        fields.add("Status"); //状态
+        fields.add("RealName"); //真实姓名
+        fields.add("CertId"); //身份证号
+        fields.add("UserLevel"); //创客等级
+        fields.add("MerchantType"); //商户创客类型
+        fields.add("MerchantDate"); //成为商户型创客时间
+        fields.add("AuthFlag"); //实名标识
+        fields.add("RiskFlag"); //风控标识
+        fields.add("MakerCode"); //创客编号
+        fields.add("SettleAmount"); //最低结算金额
+        fields.add("CashFreezeAmt"); //提现冻结金额
+        fields.add("CertValidStartDate"); //身份证有效期开始时间
+        fields.add("CertValidEndDate"); //身份证有效期结束时间
+        fields.add("SettleBankCardName"); //结算银行卡户名
+        fields.add("AgentLevel"); //代理等级
+        fields.add("AgentAreas"); //代理区域
+        fields.add("CashStatus"); //代付账户状态
+        fields.add("LeaderLevel"); //盟主等级
+        fields.add("BusinessFlag"); //企业标记
+        fields.add("DeviceType"); //设备类型
+        fields.add("HelpProfitAgree"); //助利宝协议标记
+        fields.add("HelpProfitAgreeDate"); //助利宝协议标记时间
+
+        Dictionary<String, Object> obj = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).IndexData("Users", relationData, orderBy, page, limit, condition, fields);
+        Object data = obj.get("data");
+        List<Dictionary<String, Object>> diclist = (List<Dictionary<String, Object>>) data;
+        return diclist;
+    }
+
+    /// <summary>
+    /// 查询一条记录
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    /// <returns></returns>
+    public static Users Query(Integer Id, String fields)
+    {
+        if(fields.isEmpty()) fields = "*";
+        var item = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Query(fields, "Users", Id);
+        if (item.size() > 0)
+        {
+            return JSONObject.parseObject(JSONObject.toJSONString(item), Users.class);
+        }
+        return new Users();
+    }
+
+    public static Users Query(String condition, String fields)
+    {
+        if(fields.isEmpty()) fields = "*";
+        var item = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Query(fields, "Users", condition);
+        if (item.size() > 0)
+        {
+            return JSONObject.parseObject(JSONObject.toJSONString(item), Users.class);
+        }
+        return new Users();
+    }
+
+    /// <summary>
+    /// 通过创客编号查询一条记录
+    /// </summary>
+    /// <param name="MakerCode">创客编号</param>
+    /// <returns></returns>
+    public static Users QueryByMakerCode(String MakerCode)
+    {
+        return Query("MakerCode='" + MakerCode + "'", "*");
+    }
+
+    /// <summary>
+    /// 查询记录数
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    /// <returns></returns>
+    public static Integer Count(String condition)
+    {
+        Integer result = 0;
+        var item = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Query("count(Id) count", "Users", condition);
+        if (item.size() > 0)
+        {
+            result = (Integer)item.get("count");
+        }
+        return result;
+    }
+
+    /// <summary>
+    /// 查询是否存在
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    /// <returns></returns>
+    public static Boolean Exist(int Id)
+    {
+        var item = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Query("1", "Users", "Id=" + Id);
+        if (item.size() > 0)
+        {
+            return true;
+        }
+        return false;
+    }
+
+    /// <summary>
+    /// 添加数据
+    /// </summary>
+    /// <param name="Fields">要设置的字段</param>
+    /// <returns></returns>
+    public static AppResultJson Add(Map<String, Object> fields)
+    {
+        int Id = new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Add("Users", fields, 0, true);
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = Id;
+        return result;
+    }
+
+    /// <summary>
+    /// 修改数据
+    /// </summary>
+    /// <param name="Fields">要设置的字段</param>
+    /// <param name="Id">主键Id</param>
+    public static AppResultJson Edit(Map<String, Object> fields, Integer Id)
+    {
+        new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Edit("Users", fields, Id);
+        AppResultJson result = new AppResultJson();
+        result.Status = "1";
+        result.Data = Id;
+        return result;
+    }
+
+    /// <summary>
+    /// 逻辑删除
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    public static void Remove(int Id)
+    {
+        Map<String, Object> fields = new HashMap<>();
+        fields.put("Status", -1);
+        new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Edit("Users", fields, Id);
+    }
+
+    /// <summary>
+    /// 删除数据
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    public static void Delete(int Id)
+    {
+        new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Delete("Users", Id);
+    }
+
+    /// <summary>
+    /// 排序
+    /// </summary>
+    /// <param name="Id">主键Id</param>
+    /// <param name="Sort">排序序号</param>
+    public static void Sort(int Id, int Sort)
+    {
+        new DbService(Base.main_tables, Base.main_url, Base.main_username, Base.main_password).Sort("Users", Sort, Id);
+    }
+
+    /// <summary>
+    /// 导入数据
+    /// </summary>
+    /// <param name="ExcelData">json数据</param>
+    public static void Import(String ExcelData)
+    {
+    }
+}

+ 247 - 0
src/main/java/com/kxs/adminap/util/DbService.java

@@ -0,0 +1,247 @@
+package com.kxs.adminap.util;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import com.kxs.adminap.enity.RelationData;
+import com.kxs.adminap.service.DbConn;
+
+public class DbService {
+    Dictionary<String, Map<String, String>> _database;
+    String _url;
+    String _user;
+    String _pwd;
+
+    public DbService(Dictionary<String, Map<String, String>> database, String url, String username, String password) {
+        _database = database;
+        _url = url;
+        _user = username;
+        _pwd = password;
+    }
+
+    
+    // 根据条件查询列表
+
+    public Dictionary<String, Object> IndexData(String TableName, List<RelationData> RelationDatas, String OrderBy)
+    {
+        return IndexData(TableName, RelationDatas, OrderBy, 1, 20, "", new ArrayList<>());
+    }
+    public Dictionary<String, Object> IndexData(String TableName, List<RelationData> RelationDatas, String OrderBy, int PageNum)
+    {
+        return IndexData(TableName, RelationDatas, OrderBy, PageNum, 20, "", new ArrayList<>());
+    }
+    public Dictionary<String, Object> IndexData(String TableName, List<RelationData> RelationDatas, String OrderBy, int PageNum, int PageSize)
+    {
+        return IndexData(TableName, RelationDatas, OrderBy, PageNum, PageSize, "", new ArrayList<>());
+    }
+    public Dictionary<String, Object> IndexData(String TableName, List<RelationData> RelationDatas, String OrderBy, int PageNum, int PageSize, String Condition, List<String> fields)
+    {
+        String field = "";
+        if(fields.size() > 0)
+        {
+            for(String f : fields)
+            {
+                field += TableName + "." + f + ",";
+            }
+            field = field.substring(0, field.length() - 1);
+        }
+        else
+        {
+            field = TableName + ".*";
+        }
+        if(!OrderBy.isEmpty())
+        {
+            OrderBy = TableName + "." + OrderBy.replaceAll(",", "," + TableName + ".");
+        }
+        String condition = Condition;
+        String leftJoinSql = "";
+        String sqlstr = "";
+        if (RelationDatas.size() > 0)
+        {
+            int index = 0;
+            for(RelationData RelationData : RelationDatas)
+            {
+                index += 1;
+                for(String relationField : RelationData.ReturnField)
+                {
+                    field += "," + RelationData.Table + index + "." + relationField + " " + RelationData.Field + "For" + relationField;
+                }
+                leftJoinSql += " left join " + RelationData.Table + " " + RelationData.Table + index + " on " + TableName + "." + RelationData.Field + "=" + RelationData.Table + index + ".Id";
+            }
+        }
+        if (PageNum > 1)
+        {
+            int spage = (PageNum - 1) * PageSize;
+            sqlstr = "select " + field + " from " + TableName + leftJoinSql + " where 1=1" + condition.replaceAll(" and ", " and " + TableName + ".") + " order by " + OrderBy + " limit " + spage + "," + PageSize;
+        }
+        else
+        {
+            sqlstr = "select " + field + " from " + TableName + leftJoinSql + " where 1=1" + condition.replaceAll(" and ", " and " + TableName + ".") + " order by " + OrderBy + " limit "+ PageSize;
+        }
+        List<Dictionary<String, Object>> list = DbConn.Query(sqlstr, _url, _user, _pwd);
+        Integer recordcount = 0;
+        Dictionary<String, Object> count = DbConn.QueryOne("select count(Id) count from " + TableName + " where 1=1" + condition.replaceAll(" and ", " and " + TableName + "."), _url, _user, _pwd);
+        if (count.size() > 0)
+        {
+            recordcount = (Integer)count.get("count)");
+        }
+        Dictionary<String, Object> obj = new Hashtable<>();
+        obj.put("code", 0);
+        obj.put("msg", "");
+        obj.put("count", recordcount);
+        obj.put("data", list);
+        return obj;
+    }
+
+    // 添加数据
+
+    public int Add(String TableName, Map<String, Object> Fields, int Count, Boolean SycnUpdateDate)
+    {
+        List<Object> pc = new ArrayList<>();
+        Map<String, String> Columns = _database.get(TableName);
+        if (!Columns.containsKey("Status"))
+        {
+            Columns.put("Status", "int");
+        }
+        if (!Columns.containsKey("Sort"))
+        {
+            Columns.put("Sort", "int");
+        }
+        if (!Columns.containsKey("SeoTitle"))
+        {
+            Columns.put("SeoTitle", "nvarchar");
+        }
+        if (!Columns.containsKey("SeoKeyword"))
+        {
+            Columns.put("SeoKeyword", "nvarchar");
+        }
+        if (!Columns.containsKey("SeoDescription"))
+        {
+            Columns.put("SeoDescription", "nvarchar");
+        }
+        if (!Columns.containsKey("CreateDate"))
+        {
+            Columns.put("CreateDate", "datetime");
+        }
+        String FieldList = "", FieldValues = "";
+        for (var item : Fields.entrySet())
+        {
+            String FieldName = item.getKey();
+            if (Fields.get(FieldName) != null)
+            {
+                FieldList += FieldName + ",";
+                FieldValues += "?,";
+                pc.add(Fields.get(FieldName));
+            }
+        }
+        if (SycnUpdateDate)
+        {
+            FieldList += "CreateDate,UpdateDate";
+            FieldValues += "?,?";
+        }
+        else
+        {
+            FieldList += "CreateDate";
+            FieldValues += "?";
+        }
+        pc.add(new Date());
+        if (SycnUpdateDate)
+        {
+            pc.add(new Date());
+        }
+        String sqlstr = "insert into " + TableName + " (" + FieldList + ") values (" + FieldValues + ");select @@IDENTITY";
+        Integer Id = 0;
+        Dictionary<String, Object> dt = DbConn.QueryOne(sqlstr, _url, _user, _pwd);
+        if (dt.size() > 0)
+        {
+            Id = (Integer)dt.get(0);
+        }
+        return Id;
+    }
+
+    // 修改数据
+
+    public void Edit(String TableName, Map<String, Object> Fields, int Id)
+    {
+        List<Object> pc = new ArrayList<>();
+        Map<String, String> Columns = _database.get(TableName);
+        if (!Columns.containsKey("Status"))
+        {
+            Columns.put("Status", "int");
+        }
+        if (!Columns.containsKey("Sort"))
+        {
+            Columns.put("Sort", "int");
+        }
+        if (!Columns.containsKey("SeoTitle"))
+        {
+            Columns.put("SeoTitle", "nvarchar");
+        }
+        if (!Columns.containsKey("SeoKeyword"))
+        {
+            Columns.put("SeoKeyword", "nvarchar");
+        }
+        if (!Columns.containsKey("SeoDescription"))
+        {
+            Columns.put("SeoDescription", "nvarchar");
+        }
+        if (!Columns.containsKey("CreateDate"))
+        {
+            Columns.put("CreateDate", "datetime");
+        }
+        String FieldList = "";
+        for (var item : Fields.entrySet())
+        {
+            String FieldName = item.getKey();
+            if (Fields.get(FieldName) != null)
+            {
+                FieldList += FieldName + "=?,";
+                pc.add(Fields.get(FieldName));
+            }
+        }
+        FieldList += "UpdateDate=?";
+        pc.add(new Date());
+        String sqlstr = "update " + TableName + " set " + FieldList + " where Id=" + Id;
+        DbConn.Op(sqlstr, _url, _user, _pwd);
+    }
+
+    // 删除数据
+
+    public void Delete(String TableName, int Id)
+    {
+        List<Object> pc = new ArrayList<>();
+        pc.add(Id);
+        DbConn.Op("delete from " + TableName + " where Id=?", pc, _url, _user, _pwd);
+    }
+
+    // 排序
+
+    public void Sort(String TableName, int Sort, int Id)
+    {
+        List<Object> pc = new ArrayList<>();
+        pc.add(Sort);
+        pc.add(Id);
+        DbConn.Op("update " + TableName + " set Sort=? where Id=?", pc, _url, _user, _pwd);
+    }
+
+
+    // 获取单条信息
+
+    public Dictionary<String, Object> Query(String Fields, String TableName, String Condition)
+    {
+        String sqlstr = "select " + Fields + " from " + TableName + " where " + Condition + " limit 1";
+        Dictionary<String, Object> result = DbConn.QueryOne(sqlstr, _url, _user, _pwd);
+        return result;
+    }
+    public Dictionary<String, Object> Query(String Fields, String TableName, Integer Id)
+    {
+        String sqlstr = "select " + Fields + " from " + TableName + " where Id=" + Id;
+        Dictionary<String, Object> result = DbConn.QueryOne(sqlstr, _url, _user, _pwd);
+        return result;
+    }
+
+}

+ 16 - 0
src/main/java/com/kxs/adminap/util/UsersUtil.java

@@ -0,0 +1,16 @@
+package com.kxs.adminap.util;
+
+import com.kxs.adminap.model.Users;
+import com.kxs.adminap.service.main.UsersService;
+
+public class UsersUtil {
+
+    public static Users GetTopUserInfo(String ParentNav, Integer Level)
+    {
+        ParentNav = ParentNav.toString().substring(1, ParentNav.length() - 2);
+        String[] ParentNavList = ParentNav.replaceAll(",,", ",").split(",");
+        var userInfo = UsersService.Query(Integer.parseInt(ParentNavList[Level]), "*");
+        return userInfo;
+    }
+
+}

+ 66 - 0
src/main/java/com/kxs/adminap/util/Util.java

@@ -0,0 +1,66 @@
+package com.kxs.adminap.util;
+
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+public class Util {
+    public static String CheckInt(Object str) {
+        if(str instanceof Integer) {
+            return str.toString();
+        }
+        return "0";
+    }
+
+    public static String CheckNull(String str) {
+        if(str.isEmpty() || str == null) {
+            return "";
+        }
+        return str;
+    }
+
+    public static Boolean IsNullOrEmpty(String str) {
+        if(str.isEmpty() || str == null) {
+            return false;
+        }
+        return true;
+    }
+
+    public static Date AddMonth(Date now, Integer month) {
+        Calendar rightNow = Calendar.getInstance();  
+        rightNow.setTime(now);  
+        rightNow.add(Calendar.MONTH, month);  
+        Date dt = rightNow.getTime();
+        return dt;
+    }
+
+    public static String DateFormat(Date date, String patten) {
+        return new SimpleDateFormat(patten).format(date);
+    }
+
+    public static String MD532(String str) {
+        String result = str;
+        try {
+            // 加密对象,指定加密方式
+            MessageDigest md5 = MessageDigest.getInstance("md5");
+            // 准备要加密的数据
+            byte[] b = result.getBytes();
+            // 加密
+            byte[] digest = md5.digest(b);
+            // 十六进制的字符
+            char[] chars = new char[] { '0', '1', '2', '3', '4', '5',
+                 '6', '7' , '8', '9', 'A', 'B', 'C', 'D', 'E','F' };
+            StringBuffer sb = new StringBuffer();
+            // 处理成十六进制的字符串(通常)
+            for (byte bb : digest) {
+                sb.append(chars[(bb >> 4) & 15]);
+                sb.append(chars[bb & 15]);
+            }
+            result = sb.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+}