Browse Source

Merge branch 'master' of http://git.zthymaoyi.com/wangchao/businessCard

achao 2 năm trước cách đây
mục cha
commit
8e4db0f79b
14 tập tin đã thay đổi với 706 bổ sung145 xóa
  1. 8 1
      unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/ICertificateManagementInfoService.java
  2. 11 1
      unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/ICircleManagementInfoService.java
  3. 2 2
      unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CardExchangeInfoServiceImpl.java
  4. 239 93
      unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CertificateManagementInfoServiceImpl.java
  5. 9 44
      unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CircleManagementInfoServiceImpl.java
  6. 2 2
      unimall-data/src/main/java/com/iotechn/unimall/data/domain/CardManagementInfo.java
  7. 10 0
      unimall-data/src/main/java/com/iotechn/unimall/data/domain/CertificateManagementInfo.java
  8. 5 0
      unimall-data/src/main/java/com/iotechn/unimall/data/domain/CircleManagementInfo.java
  9. 12 0
      unimall-data/src/main/java/com/iotechn/unimall/data/dto/DistinguishView.java
  10. 3 1
      unimall-data/src/main/java/com/iotechn/unimall/data/mapper/CardExchangeInfoMapper.java
  11. 6 0
      unimall-data/src/main/java/com/iotechn/unimall/data/mapper/CardManagementInfoMapper.java
  12. 314 0
      unimall-data/src/main/java/com/iotechn/unimall/data/util/HttpUtils.java
  13. 18 0
      unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/CardExchangeInfoMapper.xml
  14. 67 1
      unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/CardManagementInfoMapper.xml

+ 8 - 1
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/ICertificateManagementInfoService.java

@@ -8,6 +8,7 @@ import com.iotechn.unimall.core.annotation.HttpParam;
 import com.iotechn.unimall.core.annotation.HttpParamType;
 import com.iotechn.unimall.core.annotation.HttpParamType;
 import com.iotechn.unimall.core.annotation.param.NotNull;
 import com.iotechn.unimall.core.annotation.param.NotNull;
 import com.iotechn.unimall.core.exception.ServiceException;
 import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.data.dto.DistinguishView;
 import com.iotechn.unimall.data.model.Page;
 import com.iotechn.unimall.data.model.Page;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -42,7 +43,13 @@ public interface ICertificateManagementInfoService{
 
 
 	@HttpMethod(description = "查询",  permissionName = "证件管理管理")
 	@HttpMethod(description = "查询",  permissionName = "证件管理管理")
 	public CertificateManagementInfo get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id)throws ServiceException;
 	public CertificateManagementInfo get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id)throws ServiceException;
-	
+
+	@HttpMethod(description = "识别身份证",  permissionName = "证件管理管理")
+	public DistinguishView personShibie(@HttpParam(name = "certificateImage", type = HttpParamType.COMMON, description = "证件图") String certificateImage)throws ServiceException;
+
+	@HttpMethod(description = "识别银行卡",  permissionName = "证件管理管理")
+	public DistinguishView bankShibie(@HttpParam(name = "certificateImage", type = HttpParamType.COMMON, description = "证件图") String certificateImage)throws ServiceException;
+
 	@HttpMethod(description = "导出excl表", permissionName = "证件管理管理")
 	@HttpMethod(description = "导出excl表", permissionName = "证件管理管理")
 	public String export(
 	public String export(
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,

+ 11 - 1
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/ICircleManagementInfoService.java

@@ -1,6 +1,7 @@
 package com.iotechn.unimall.admin.api.card;
 package com.iotechn.unimall.admin.api.card;
 
 
 
 
+import com.iotechn.unimall.data.domain.CardManagementInfo;
 import com.iotechn.unimall.data.domain.CircleManagementInfo;
 import com.iotechn.unimall.data.domain.CircleManagementInfo;
 import com.iotechn.unimall.core.annotation.HttpMethod;
 import com.iotechn.unimall.core.annotation.HttpMethod;
 import com.iotechn.unimall.core.annotation.HttpOpenApi;
 import com.iotechn.unimall.core.annotation.HttpOpenApi;
@@ -44,7 +45,16 @@ public interface ICircleManagementInfoService{
 	@HttpMethod(description = "查询",  permissionName = "圈子管理管理")
 	@HttpMethod(description = "查询",  permissionName = "圈子管理管理")
 	public CircleManagementInfo get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id,
 	public CircleManagementInfo get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id,
 									@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId)throws ServiceException;
 									@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId)throws ServiceException;
-	
+
+	@HttpMethod(description = "圈子详情名片列表",  permissionName = "圈子管理管理")
+	public Page<CardManagementInfo> circleCardlist(
+			@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,
+			@HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id,
+			@HttpParam(name = "status", type = HttpParamType.COMMON, description = " 1已交换 2未交换") Long status,
+			@HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
+			@HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit)
+			throws ServiceException;
+
 	@HttpMethod(description = "导出excl表",  permissionName = "圈子管理管理")
 	@HttpMethod(description = "导出excl表",  permissionName = "圈子管理管理")
 	public String export(
 	public String export(
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,

+ 2 - 2
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CardExchangeInfoServiceImpl.java

@@ -82,8 +82,8 @@ public class CardExchangeInfoServiceImpl implements ICardExchangeInfoService {
             wrapper.eq("delete_flag", deleteFlag);
             wrapper.eq("delete_flag", deleteFlag);
         }
         }
         wrapper.eq("delete_flag", 0);
         wrapper.eq("delete_flag", 0);
-        Integer count = cardExchangeInfoMapper.selectCount(wrapper);
-        List<CardExchangeInfo> list = cardExchangeInfoMapper.getCardExchangeInfoPage((page - 1) * limit, limit, receiveId);
+        Integer count = cardExchangeInfoMapper.getCardExchangeCount(status,(page - 1) * limit, limit, receiveId);
+        List<CardExchangeInfo> list = cardExchangeInfoMapper.getCardExchangeInfoPage(status,(page - 1) * limit, limit, receiveId);
         return new Page<CardExchangeInfo>(list, page, limit, count);
         return new Page<CardExchangeInfo>(list, page, limit, count);
     }
     }
 
 

+ 239 - 93
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CertificateManagementInfoServiceImpl.java

@@ -1,7 +1,20 @@
 package com.iotechn.unimall.admin.api.card.impl;
 package com.iotechn.unimall.admin.api.card.impl;
 
 
-import java.util.List;
+import java.util.*;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.iotechn.unimall.data.dto.DistinguishView;
+import com.iotechn.unimall.data.util.HttpUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
 import org.apache.ibatis.session.RowBounds;
 import org.apache.ibatis.session.RowBounds;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -15,9 +28,7 @@ import com.iotechn.unimall.data.mapper.CertificateManagementInfoMapper;
 import com.iotechn.unimall.data.domain.CertificateManagementInfo;
 import com.iotechn.unimall.data.domain.CertificateManagementInfo;
 import com.iotechn.unimall.admin.api.card.ICertificateManagementInfoService;
 import com.iotechn.unimall.admin.api.card.ICertificateManagementInfoService;
 import com.iotechn.unimall.data.model.Page;
 import com.iotechn.unimall.data.model.Page;
-
 import java.util.Date;
 import java.util.Date;
-
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 /**
 /**
@@ -28,94 +39,229 @@ import org.springframework.transaction.annotation.Transactional;
  */
  */
 @Service
 @Service
 public class CertificateManagementInfoServiceImpl implements ICertificateManagementInfoService {
 public class CertificateManagementInfoServiceImpl implements ICertificateManagementInfoService {
-    @Autowired
-    private CertificateManagementInfoMapper certificateManagementInfoMapper;
-
-    @Override
-    public Boolean add(CertificateManagementInfo certificateManagementInfo) throws ServiceException {
-        Date now = new Date();
-        certificateManagementInfo.setGmtCreate(now);
-        certificateManagementInfo.setGmtUpdate(now);
-        return certificateManagementInfoMapper.insert(certificateManagementInfo) > 0;
-    }
-
-    @Override
-    public Page<CertificateManagementInfo> list(Long commonId, String certificateName, String certificateImage, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
-        Wrapper<CertificateManagementInfo> wrapper = new EntityWrapper<CertificateManagementInfo>();
-        if (!StringUtils.isEmpty(commonId)) {
-            wrapper.eq("common_id", commonId);
-        }
-        if (!StringUtils.isEmpty(certificateName)) {
-            wrapper.eq("certificate_name", certificateName);
-        }
-        if (!StringUtils.isEmpty(certificateImage)) {
-            wrapper.eq("certificate_image", certificateImage);
-        }
-        if (!StringUtils.isEmpty(gmtCreate)) {
-            wrapper.eq("gmt_create", gmtCreate);
-        }
-        if (!StringUtils.isEmpty(gmtUpdate)) {
-            wrapper.eq("gmt_update", gmtUpdate);
-        }
-        if (!StringUtils.isEmpty(deleteFlag)) {
-            wrapper.eq("delete_flag", deleteFlag);
-        }
-        wrapper.eq("delete_flag", 0);
-        List<CertificateManagementInfo> list = certificateManagementInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
-        Integer count = certificateManagementInfoMapper.selectCount(wrapper);
-        return new Page<CertificateManagementInfo>(list, page, limit, count);
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Boolean delete(String id) {
-        String[] ids = String.valueOf(id).split(",");
-        for (String tt : ids) {
-            CertificateManagementInfo tmp = certificateManagementInfoMapper.selectById(Long.parseLong(tt));
-            if (tmp != null) {
-                tmp.setDeleteFlag(1l);
-                tmp.setGmtUpdate(new Date());
-                certificateManagementInfoMapper.updateById(tmp);
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public Boolean update(CertificateManagementInfo certificateManagementInfo) throws ServiceException {
-        Date now = new Date();
-        certificateManagementInfo.setGmtUpdate(now);
-        return certificateManagementInfoMapper.updateById(certificateManagementInfo) > 0;
-    }
-
-    @Override
-    public CertificateManagementInfo get(Long id) throws ServiceException {
-        return certificateManagementInfoMapper.selectById(id);
-    }
-
-    @Override
-    public String export(Long commonId, String certificateName, String certificateImage, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
-        Wrapper<CertificateManagementInfo> wrapper = new EntityWrapper<CertificateManagementInfo>();
-        if (!StringUtils.isEmpty(commonId)) {
-            wrapper.eq("common_id", commonId);
-        }
-        if (!StringUtils.isEmpty(certificateName)) {
-            wrapper.eq("certificate_name", certificateName);
-        }
-        if (!StringUtils.isEmpty(certificateImage)) {
-            wrapper.eq("certificate_image", certificateImage);
-        }
-        if (!StringUtils.isEmpty(gmtCreate)) {
-            wrapper.eq("gmt_create", gmtCreate);
-        }
-        if (!StringUtils.isEmpty(gmtUpdate)) {
-            wrapper.eq("gmt_update", gmtUpdate);
-        }
-        if (!StringUtils.isEmpty(deleteFlag)) {
-            wrapper.eq("delete_flag", deleteFlag);
-        }
-        List<CertificateManagementInfo> list = certificateManagementInfoMapper.selectList(wrapper);
-        ExcelUtil<CertificateManagementInfo> util = new ExcelUtil<CertificateManagementInfo>(CertificateManagementInfo.class);
-        return util.exportExcel(list, "操作日志");
-    }
+	@Autowired
+	private CertificateManagementInfoMapper certificateManagementInfoMapper;
+
+	@Override
+	public Boolean add(CertificateManagementInfo certificateManagementInfo) throws ServiceException {
+		Date now = new Date();
+		certificateManagementInfo.setGmtCreate(now);
+		certificateManagementInfo.setGmtUpdate(now);
+		return certificateManagementInfoMapper.insert(certificateManagementInfo) > 0;
+	}
+
+	@Override
+	public Page<CertificateManagementInfo> list(Long commonId, String certificateName, String certificateImage, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
+		Wrapper<CertificateManagementInfo> wrapper = new EntityWrapper<CertificateManagementInfo>();
+		if (!StringUtils.isEmpty(commonId)) {
+			wrapper.eq("common_id", commonId);
+		}
+		if (!StringUtils.isEmpty(certificateName)) {
+			wrapper.eq("certificate_name", certificateName);
+		}
+		if (!StringUtils.isEmpty(certificateImage)) {
+			wrapper.eq("certificate_image", certificateImage);
+		}
+		if (!StringUtils.isEmpty(gmtCreate)) {
+			wrapper.eq("gmt_create", gmtCreate);
+		}
+		if (!StringUtils.isEmpty(gmtUpdate)) {
+			wrapper.eq("gmt_update", gmtUpdate);
+		}
+		if (!StringUtils.isEmpty(deleteFlag)) {
+			wrapper.eq("delete_flag", deleteFlag);
+		}
+		wrapper.eq("delete_flag", 0);
+		List<CertificateManagementInfo> list = certificateManagementInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
+		Integer count = certificateManagementInfoMapper.selectCount(wrapper);
+		return new Page<CertificateManagementInfo>(list, page, limit, count);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public Boolean delete(String id) {
+		String[] ids = String.valueOf(id).split(",");
+		for (String tt : ids) {
+			CertificateManagementInfo tmp = certificateManagementInfoMapper.selectById(Long.parseLong(tt));
+			if (tmp != null) {
+				tmp.setDeleteFlag(1l);
+				tmp.setGmtUpdate(new Date());
+				certificateManagementInfoMapper.updateById(tmp);
+			}
+		}
+		return true;
+	}
+
+	@Override
+	public Boolean update(CertificateManagementInfo certificateManagementInfo) throws ServiceException {
+		Date now = new Date();
+		certificateManagementInfo.setGmtUpdate(now);
+		return certificateManagementInfoMapper.updateById(certificateManagementInfo) > 0;
+	}
+
+	@Override
+	public CertificateManagementInfo get(Long id) throws ServiceException {
+		return certificateManagementInfoMapper.selectById(id);
+	}
+
+	@Override
+	public String export(Long commonId, String certificateName, String certificateImage, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
+		Wrapper<CertificateManagementInfo> wrapper = new EntityWrapper<CertificateManagementInfo>();
+		if (!StringUtils.isEmpty(commonId)) {
+			wrapper.eq("common_id", commonId);
+		}
+		if (!StringUtils.isEmpty(certificateName)) {
+			wrapper.eq("certificate_name", certificateName);
+		}
+		if (!StringUtils.isEmpty(certificateImage)) {
+			wrapper.eq("certificate_image", certificateImage);
+		}
+		if (!StringUtils.isEmpty(gmtCreate)) {
+			wrapper.eq("gmt_create", gmtCreate);
+		}
+		if (!StringUtils.isEmpty(gmtUpdate)) {
+			wrapper.eq("gmt_update", gmtUpdate);
+		}
+		if (!StringUtils.isEmpty(deleteFlag)) {
+			wrapper.eq("delete_flag", deleteFlag);
+		}
+		List<CertificateManagementInfo> list = certificateManagementInfoMapper.selectList(wrapper);
+		ExcelUtil<CertificateManagementInfo> util = new ExcelUtil<CertificateManagementInfo>(CertificateManagementInfo.class);
+		return util.exportExcel(list, "操作日志");
+	}
+
+	@Override
+	public DistinguishView personShibie(String certificateImage) throws ServiceException {
+		String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
+		//API产品路径
+		String requestUrl = "https://personcard.market.alicloudapi.com/ai_market/ai_ocr_universal/shen_fen_zheng/ch/v1";
+		//阿里云APPCODE
+		DistinguishView distinguishView = new DistinguishView();
+		CloseableHttpClient httpClient = null;
+		try {
+			httpClient = HttpClients.createDefault();
+			List<NameValuePair> params = new ArrayList<NameValuePair>();
+			//启用URL方式进行识别
+			//内容数据类型是图像文件URL链接
+			params.add(new BasicNameValuePair("IMAGE", certificateImage));
+			params.add(new BasicNameValuePair("IMAGE_TYPE", "1"));
+
+			// 创建一个HttpPost实例
+			HttpPost httpPost = new HttpPost(requestUrl);
+			httpPost.addHeader("Authorization", "APPCODE " + appcode);
+			httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+
+			// 设置请求参数
+			httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
+
+			// 发送POST请求
+			HttpResponse execute = httpClient.execute(httpPost);
+
+			// 获取状态码
+			int statusCode = execute.getStatusLine().getStatusCode();
+			System.out.println(statusCode);
+
+			// 获取结果
+			HttpEntity entity = execute.getEntity();
+			String body = EntityUtils.toString(entity);
+			System.out.println(body);
+			JSONObject jsonObject = JSONObject.parseObject(body);
+			distinguishView.setRecPersonNo(jsonObject.getJSONObject("身份证识别实体信息").getJSONObject("身份证人像面实体信息").getString("身份证号"));
+			return distinguishView;
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	@Override
+	public DistinguishView bankShibie(String certificateImage) throws ServiceException {
+		String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
+		String host = "https://api06.aliyun.venuscn.com";
+		String path = "/ocr/bank-card";
+		String method = "POST";
+		Map<String, String> headers = new HashMap<String, String>();
+		//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
+		headers.put("Authorization", "APPCODE " + appcode);
+		//根据API的要求,定义相对应的Content-Type
+		headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+		Map<String, String> querys = new HashMap<String, String>();
+		Map<String, String> bodys = new HashMap<String, String>();
+		bodys.put("pic", certificateImage);
+		try {
+			HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
+			String body = EntityUtils.toString(response.getEntity());
+			System.out.println(body);
+			JSONObject jsonObject = JSONObject.parseObject(body);
+			if ("200".equals(jsonObject.getString("ret"))) {
+				JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
+				DistinguishView distinguishView = new DistinguishView();
+				distinguishView.setBankNo(data.getString("number"));
+
+				host = "https://yhkgsd.market.alicloudapi.com";
+				path = "/bankcard/region";
+				method = "GET";
+				headers = new HashMap<String, String>();
+				//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
+				headers.put("Authorization", "APPCODE " + appcode);
+				querys = new HashMap<String, String>();
+				querys.put("bankcard", distinguishView.getBankNo());
+				try {
+					response = HttpUtils.doGet(host, path, method, headers, querys);
+					body = EntityUtils.toString(response.getEntity());
+					System.out.println(body);
+					jsonObject = JSONObject.parseObject(body);
+					if ("0".equals(jsonObject.getString("code"))) {
+						data = JSONObject.parseObject(jsonObject.getString("data"));
+						JSONObject detail = JSONObject.parseObject(data.getString("detail"));
+						String[] area = detail.getString("area").split(" - ");
+						String province = "";
+						String city = "";
+						if (area.length > 1) {
+							province = area[0];
+							city = area[1];
+						}
+
+						host = "https://cnaps.market.alicloudapi.com";
+						path = "/lianzhuo/querybankaps";
+						method = "GET";
+						headers = new HashMap<String, String>();
+						//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
+						headers.put("Authorization", "APPCODE " + appcode);
+						querys = new HashMap<String, String>();
+						querys.put("card", distinguishView.getBankNo());
+						querys.put("province", province);
+						querys.put("city", city);
+						try {
+							response = HttpUtils.doGet(host, path, method, headers, querys);
+							System.out.println(response.toString());
+							body = EntityUtils.toString(response.getEntity());
+							System.out.println(body);
+							jsonObject = JSONObject.parseObject(body);
+							JSONObject jsonData = jsonObject.getJSONObject("data");
+							JSONObject res = jsonObject.getJSONObject("resp");
+							if ("200".equals(res.get("RespCode"))) {
+								JSONArray jsonArray = jsonData.getJSONArray("record");
+								List<String> bankList = new ArrayList<>();
+								for (int i = 0; i < jsonArray.size(); i++) {
+									bankList.add(jsonArray.getJSONObject(i).get("lName").toString());
+								}
+							}
+						} catch (Exception e) {
+							e.printStackTrace();
+						}
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+				return distinguishView;
+			} else {
+				System.out.println(jsonObject.getString("msg"));
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
 }
 }
+

+ 9 - 44
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CircleManagementInfoServiceImpl.java

@@ -125,50 +125,6 @@ public class CircleManagementInfoServiceImpl implements ICircleManagementInfoSer
     @Override
     @Override
     public CircleManagementInfo get(Long id, Long commonId) throws ServiceException {
     public CircleManagementInfo get(Long id, Long commonId) throws ServiceException {
         CircleManagementInfo circleManagementInfo = circleManagementInfoMapper.selectById(id);
         CircleManagementInfo circleManagementInfo = circleManagementInfoMapper.selectById(id);
-        //查询圈子名片关系表
-        List<CircleCardInfo> circleCardInfoList = circleCardInfoMapper.selectList(new EntityWrapper<CircleCardInfo>()
-                .eq("circle_id", id)
-                .eq("delete_flag", 0));
-        List<CardManagementInfo> cardManagementInfoList = new ArrayList<>();
-        for (CircleCardInfo circleCardInfo : circleCardInfoList) {
-            //查询名片信息
-            CardManagementInfo cardManagementInfo = cardManagementInfoMapper.selectById(circleCardInfo.getCardId());
-            if (cardManagementInfo != null) {
-                //我的名片
-                if (cardManagementInfo.getCommonId().equals(commonId)) {
-                    cardManagementInfo.setNotDisplay(1l);
-                }
-                List<CardHolderInfo> cardHolderInfoList = cardHolderInfoMapper.selectList(new EntityWrapper<CardHolderInfo>()
-                        .eq("delete_flag", 0)
-                        .eq("common_id", commonId)
-                        .eq("card_id", cardManagementInfo.getId()));
-                //我拥有的名片
-                if (cardHolderInfoList.size() > 0) {
-                    cardManagementInfo.setNotDisplay(1l);
-                    cardManagementInfo.setExchangeFlag(1l);
-                }
-                List<CardExchangeInfo> cardExchangeInfoList = cardExchangeInfoMapper.selectList(new EntityWrapper<CardExchangeInfo>()
-                        .eq("delete_flag", 0)
-                        .eq("send_id", commonId)
-                        .eq("receive_card_id", cardManagementInfo.getId()));
-                //发送过邀请的名片
-                if (cardHolderInfoList.size() > 0) {
-                    for (CardExchangeInfo cardExchangeInfo : cardExchangeInfoList) {
-                        //已接收未处理或者拉黑的
-                        if ("1".equals(cardExchangeInfo.getStatus()) || "7".equals(cardExchangeInfo.getStatus()) || "0".equals(cardExchangeInfo.getStatus())) {
-                            cardManagementInfo.setNotDisplay(1l);
-                        }
-                    }
-                }
-                //查看是否允许圈子成员查看主页
-                CommonUserInfo commonUserInfo = commonUserInfoMapper.selectById(cardManagementInfo.getCommonId());
-                if (commonUserInfo != null) {
-                    cardManagementInfo.setLookPage(commonUserInfo.getLookPage());
-                }
-                cardManagementInfoList.add(cardManagementInfo);
-            }
-        }
-        circleManagementInfo.setCardManagementInfoList(cardManagementInfoList);
         CircleCardInfo circleCardInfo = new CircleCardInfo();
         CircleCardInfo circleCardInfo = new CircleCardInfo();
         circleCardInfo.setCommonId(commonId);
         circleCardInfo.setCommonId(commonId);
         circleCardInfo.setCircleId(circleManagementInfo.getId());
         circleCardInfo.setCircleId(circleManagementInfo.getId());
@@ -181,6 +137,15 @@ public class CircleManagementInfoServiceImpl implements ICircleManagementInfoSer
         return circleManagementInfo;
         return circleManagementInfo;
     }
     }
 
 
+    @Override
+    public Page<CardManagementInfo> circleCardlist(Long commonId, Long id, Long status, Integer page, Integer limit) throws ServiceException {
+        Wrapper<CardManagementInfo> wrapper = new EntityWrapper<CardManagementInfo>();
+        wrapper.eq("delete_flag", 0);
+        Integer count = cardManagementInfoMapper.getCardManagementCount(status,(page - 1) * limit, limit, commonId,id);
+        List<CardManagementInfo> list = cardManagementInfoMapper.getCardManagementPage(status,(page - 1) * limit, limit, commonId,id);
+        return new Page<CardManagementInfo>(list, page, limit, count);
+    }
+
     @Override
     @Override
     public String export(Long commonId, String circleName, String circleLabel, Long status, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
     public String export(Long commonId, String circleName, String circleLabel, Long status, Date gmtCreate, Date gmtUpdate, Long deleteFlag, Integer page, Integer limit) throws ServiceException {
         Wrapper<CircleManagementInfo> wrapper = new EntityWrapper<CircleManagementInfo>();
         Wrapper<CircleManagementInfo> wrapper = new EntityWrapper<CircleManagementInfo>();

+ 2 - 2
unimall-data/src/main/java/com/iotechn/unimall/data/domain/CardManagementInfo.java

@@ -130,9 +130,9 @@ public class CardManagementInfo extends SuperDO {
     /** 交换按钮不显示标识(1不显示) */
     /** 交换按钮不显示标识(1不显示) */
     @TableField(exist = false)
     @TableField(exist = false)
     private Long notDisplay;
     private Long notDisplay;
-    /** 已交换标识 */
+    /** 业务范围 */
     @TableField(exist = false)
     @TableField(exist = false)
-    private Long exchangeFlag;
+    private String scopeOfBusiness;
 
 
     @Override
     @Override
     public String toString() {
     public String toString() {

+ 10 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/CertificateManagementInfo.java

@@ -43,6 +43,16 @@ public class CertificateManagementInfo extends SuperDO {
     @TableField("certificate_image")
     @TableField("certificate_image")
     private String certificateImage;
     private String certificateImage;
 
 
+    /** 身份证号 */
+    @Excel(name = "身份证号")
+    @TableField("person_no")
+    private String personNo;
+
+    /** 银行卡号 */
+    @Excel(name = "银行卡号")
+    @TableField("bank_no")
+    private String bankNo;
+
     /**  */
     /**  */
     @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
     @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
     @TableField("gmt_create")
     @TableField("gmt_create")

+ 5 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/CircleManagementInfo.java

@@ -44,6 +44,11 @@ public class CircleManagementInfo extends SuperDO {
     @TableField("circle_label")
     @TableField("circle_label")
     private String circleLabel;
     private String circleLabel;
 
 
+    /** 圈子头像 */
+    @Excel(name = "圈子头像")
+    @TableField("circle_head")
+    private String circleHead;
+
     /** 0未审核 1已通过 */
     /** 0未审核 1已通过 */
     @Excel(name = "0未审核 1已通过")
     @Excel(name = "0未审核 1已通过")
     @TableField("status")
     @TableField("status")

+ 12 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/dto/DistinguishView.java

@@ -0,0 +1,12 @@
+package com.iotechn.unimall.data.dto;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import lombok.Data;
+
+@Data
+public class DistinguishView extends SuperDTO{
+
+    private String recPersonNo;
+
+    private String bankNo;
+}

+ 3 - 1
unimall-data/src/main/java/com/iotechn/unimall/data/mapper/CardExchangeInfoMapper.java

@@ -13,5 +13,7 @@ import java.util.List;
  * @date 2023-04-12
  * @date 2023-04-12
  */
  */
 public interface CardExchangeInfoMapper extends BaseMapper<CardExchangeInfo> {
 public interface CardExchangeInfoMapper extends BaseMapper<CardExchangeInfo> {
-    public List<CardExchangeInfo> getCardExchangeInfoPage(@Param("offset") Integer offset, @Param("limit") Integer limit, @Param("receiveId") Long receiveId);
+    public List<CardExchangeInfo> getCardExchangeInfoPage(@Param("status") String status,@Param("offset") Integer offset, @Param("limit") Integer limit, @Param("receiveId") Long receiveId);
+    public Integer getCardExchangeCount(@Param("status") String status,@Param("offset") Integer offset, @Param("limit") Integer limit, @Param("receiveId") Long receiveId);
 }
 }
+

+ 6 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/mapper/CardManagementInfoMapper.java

@@ -2,6 +2,9 @@ package com.iotechn.unimall.data.mapper;
 
 
 import com.iotechn.unimall.data.domain.CardManagementInfo;
 import com.iotechn.unimall.data.domain.CardManagementInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+import java.util.List;
+
 /**
 /**
  * 名片管理Mapper接口
  * 名片管理Mapper接口
  * 
  * 
@@ -10,4 +13,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  */
  */
 public interface CardManagementInfoMapper extends BaseMapper<CardManagementInfo>{
 public interface CardManagementInfoMapper extends BaseMapper<CardManagementInfo>{
 
 
+    Integer getCardManagementCount(Long status, int i, Integer limit, Long commonId,Long id);
+
+    List<CardManagementInfo> getCardManagementPage(Long status, int i, Integer limit, Long commonId,Long id);
 }
 }

+ 314 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/util/HttpUtils.java

@@ -0,0 +1,314 @@
+package com.iotechn.unimall.data.util;
+
+import com.iotechn.unimall.core.util.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+
+    /**
+     * get
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doGet(String host, String path, String method,
+                                     Map<String, String> headers,
+                                     Map<String, String> querys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpGet request = new HttpGet(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * post form
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path, String method,
+                                      Map<String, String> headers,
+                                      Map<String, String> querys,
+                                      Map<String, String> bodys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (bodys != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : bodys.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+            formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+            request.setEntity(formEntity);
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Post String
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path, String method,
+                                      Map<String, String> headers,
+                                      Map<String, String> querys,
+                                      String body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+            request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Post stream
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path, String method,
+                                      Map<String, String> headers,
+                                      Map<String, String> querys,
+                                      byte[] body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+            request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Put String
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPut(String host, String path, String method,
+                                     Map<String, String> headers,
+                                     Map<String, String> querys,
+                                     String body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+            request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Put stream
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPut(String host, String path, String method,
+                                     Map<String, String> headers,
+                                     Map<String, String> querys,
+                                     byte[] body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+            request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Delete
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doDelete(String host, String path, String method,
+                                        Map<String, String> headers,
+                                        Map<String, String> querys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+    private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
+        StringBuilder sbUrl = new StringBuilder();
+        sbUrl.append(host);
+        if (!StringUtils.isBlank(path)) {
+            sbUrl.append(path);
+        }
+        if (null != querys) {
+            StringBuilder sbQuery = new StringBuilder();
+            for (Map.Entry<String, String> query : querys.entrySet()) {
+                if (0 < sbQuery.length()) {
+                    sbQuery.append("&");
+                }
+                if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+                    sbQuery.append(query.getValue());
+                }
+                if (!StringUtils.isBlank(query.getKey())) {
+                    sbQuery.append(query.getKey());
+                    if (!StringUtils.isBlank(query.getValue())) {
+                        sbQuery.append("=");
+                        sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+                    }
+                }
+            }
+            if (0 < sbQuery.length()) {
+                sbUrl.append("?").append(sbQuery);
+            }
+        }
+
+        return sbUrl.toString();
+    }
+
+    private static HttpClient wrapClient(String host) {
+        HttpClient httpClient = new DefaultHttpClient();
+        if (host.startsWith("https://")) {
+            sslClient(httpClient);
+        }
+
+        return httpClient;
+    }
+
+    private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                @Override
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+                @Override
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+                }
+                @Override
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}

+ 18 - 0
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/CardExchangeInfoMapper.xml

@@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         card_exchange_info
         card_exchange_info
         WHERE
         WHERE
         receive_id = #{receiveId}
         receive_id = #{receiveId}
+        and delete_flag=0
         <if test="status != null">
         <if test="status != null">
             <if test="status == 1">
             <if test="status == 1">
                 AND status != 7
                 AND status != 7
@@ -32,4 +33,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LIMIT #{offset}, #{limit}
         LIMIT #{offset}, #{limit}
 
 
     </select>
     </select>
+    <select id="getCardExchangeCount" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        card_exchange_info
+        WHERE
+        receive_id = #{receiveId}
+        and delete_flag=0
+        <if test="status != null">
+            <if test="status == 1">
+                AND status != 7
+            </if>
+            <if test="status == 2">
+                AND status = 7
+            </if>
+        </if>
+    </select>
 </mapper>
 </mapper>

+ 67 - 1
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/CardManagementInfoMapper.xml

@@ -3,7 +3,73 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.iotechn.unimall.data.mapper.CardManagementInfoMapper">
 <mapper namespace="com.iotechn.unimall.data.mapper.CardManagementInfoMapper">
-    
 
 
 
 
+    <select id="getCardManagementPage" resultType="com.iotechn.unimall.data.domain.CardManagementInfo">
+        SELECT
+        cmi.id as id,
+        cmi.name AS name,
+        cmi.post AS post,
+        cmi.company_name as companyName,
+        phi.scope_of_business AS scopeOfBusiness,
+        cui.look_page AS lookPage,
+        case when (cmi.common_id={commonId})  then 1
+        when IFNULL((SELECT count(chi.id)
+        FROM card_holder_info chi
+        WHERE chi.delete_flag = '0'
+        AND chi.common_id ={commonId}
+        AND chi.card_id =cmi.id ),0) >0 then 1
+        when IFNULL((SELECT count(cei.id)
+        FROM card_exchange_info cei
+        WHERE cei.delete_flag = '0'
+        AND cei.send_id ={commonId}
+        AND (cei.status=1 or cei.status=0 or cei.status=7)
+        AND cei.receive_card_id =cmi.id ),0) >0 then 1  else 0 end as notDisplay,
+        cci.gmt_update AS gmtUpdate,
+        cci.gmt_create AS gmtCreate
+        FROM
+        circle_card_info cci
+        LEFT JOIN card_management_info cmi on cmi.id=cci.card_id and cmi.delete_flag=0
+        LEFT JOIN personal_homepage_info phi on phi.common_id=cmi.common_id and phi.delete_flag=0
+        LEFT JOIN common_user_info cui on cui.id=cmi.common_id and cui.delete_flag=0
+        LEFT JOIN card_holder_info ch on ch.common_id={commonId} and ch.card_id=cmi.id and ch.delete_flag=0
+        WHERE
+        cci.circle_id = {id}
+        and cci.delete_flag=0
+        <if test="status != null">
+            <if test="status == 1">
+                AND ch.id is not null
+            </if>
+            <if test="status == 2">
+                AND ch.id is null
+            </if>
+        </if>
+        GROUP BY cci.id
+        ORDER BY cci.gmt_update DESC
+        LIMIT #{offset}, #{limit}
+    </select>
+    <select id="getCardManagementCount" resultType="java.lang.Integer">
+        select
+        count(1)
+        from( SELECT
+        count(1)
+        FROM
+        circle_card_info cci
+        LEFT JOIN card_management_info cmi on cmi.id=cci.card_id and cmi.delete_flag=0
+        LEFT JOIN personal_homepage_info phi on phi.common_id=cmi.common_id and phi.delete_flag=0
+        LEFT JOIN common_user_info cui on cui.id=cmi.common_id and cui.delete_flag=0
+        LEFT JOIN card_holder_info ch on ch.common_id={commonId} and ch.card_id=cmi.id and ch.delete_flag=0
+        WHERE
+        cci.circle_id = {id}
+        and cci.delete_flag=0
+        <if test="status != null">
+            <if test="status == 1">
+                AND ch.id is not null
+            </if>
+            <if test="status == 2">
+                AND ch.id is null
+            </if>
+        </if>
+        GROUP BY cci.id ) tt
+    </select>
 </mapper>
 </mapper>