From 520433f6d88c1f4c1a2d31ca950f2309da2d4a9a Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 01 七月 2025 14:02:25 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/api/common/PublicController.java                       |   56 +++++++++++++++++-
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyOnServiceImpl.java |   23 +++++--
 server/platform/src/main/resources/application.yml                                             |    2 
 server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java           |   61 +++++++++++++++-----
 4 files changed, 116 insertions(+), 26 deletions(-)

diff --git a/server/platform/src/main/resources/application.yml b/server/platform/src/main/resources/application.yml
index 368c575..781f762 100644
--- a/server/platform/src/main/resources/application.yml
+++ b/server/platform/src/main/resources/application.yml
@@ -11,7 +11,7 @@
 #  application:
 #  name: doumeemes
   profiles:
-    active: dev
+    active: pro
 
   # JSON杩斿洖閰嶇疆
   jackson:
diff --git a/server/service/src/main/java/com/doumee/api/common/PublicController.java b/server/service/src/main/java/com/doumee/api/common/PublicController.java
index 93429dc..7c7015a 100644
--- a/server/service/src/main/java/com/doumee/api/common/PublicController.java
+++ b/server/service/src/main/java/com/doumee/api/common/PublicController.java
@@ -4,16 +4,23 @@
 import com.doumee.api.BaseController;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.annotation.trace.Trace;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.aliyun.ALiYunUtil;
 import com.doumee.core.utils.aliyun.ProgressModel;
+import com.doumee.dao.business.model.InterfaceLog;
+import com.doumee.service.business.InsuranceApplyService;
+import com.doumee.service.business.InterfaceLogService;
+import com.jzq.common.bean.sign.NotifyDataReq;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,10 +34,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * @author Eva.Caesar Liu
@@ -46,6 +50,49 @@
 
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
+
+    @Autowired
+    private InsuranceApplyService insuranceApplyService;
+
+    @Autowired
+    public InterfaceLogService interfaceLogService = null;
+
+    @ApiOperation("鍚涘瓙绛剧绾﹀洖璋冮�氱煡")
+    @PostMapping("/signNotify")
+    public void updateStatus(@RequestParam Map<String,String> req, HttpServletResponse response) {
+        Map<String, Object> context = new HashMap<>();
+        context.put("success",true);
+        InterfaceLog log=new InterfaceLog();
+        log.setType(1);
+        log.setCreateDate(new Date());
+        log.setIsdeleted(0);
+        log.setRequest(JSONObject.toJSONString(req));
+        log.setName("鍚涘瓙绛剧绾﹀洖璋冮�氱煡");
+        log.setUrl(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode());
+        try {
+            String appKey = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPKEY).getCode();
+            String appSecret  = systemDictDataBiz.queryByCode(Constants.SIGN,Constants.SIGN_APPSECRET).getCode();
+            if(!StringUtils.equals(appKey,req.get("appkey"))){
+                throw  new BusinessException(com.doumee.core.constants.ResponseStatus.BAD_REQUEST.getCode(),"appkey涓嶅尮閰�");
+            }
+            String sign = DigestUtils.sha1Hex("data"+ req.get("data")+"method"+req.get("method")+"version"+req.get("version")+"timestamp"+req.get("timestamp")
+                    +"appKey"+appKey+"appSecret"+appSecret);
+            if(!StringUtils.equals(sign,req.get("sign"))){
+                throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"楠岀涓嶉�氳繃");
+            }
+            NotifyDataReq data   = JSONObject.parseObject(req.get("data"), NotifyDataReq.class);
+            String r =  insuranceApplyService.dealSignResult(data);
+            log.setRepose(r);
+        }catch (Exception e){
+            log.setRepose("澶勭悊寮傚父锛�"+e.getMessage());
+            context.put("success",false);
+            context.put("msg","澶勭悊鍙戠敓寮傚父");
+            throw  e;
+        }finally {
+            interfaceLogService.create(log);
+        }
+        writerJson(response, context);
+    }
 
     @ApiOperation(value = "涓婁紶", notes = "涓婁紶", httpMethod = "POST", position = 6)
     @ApiImplicitParams({
@@ -340,4 +387,5 @@
         writerJson(response, context);
         return;
     }
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyOnServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyOnServiceImpl.java
index ece16af..782660c 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyOnServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyOnServiceImpl.java
@@ -701,9 +701,14 @@
             //鏈湀鏂板鎶曚繚浼佷笟
             insuranceApplyDataVO.setMonthAddInsuranceCompanyNum(Objects.nonNull(monthAddInsuranceCompanyNum)?monthAddInsuranceCompanyNum:Constants.ZERO);
             //鐩翠繚淇濆崟鏁伴噺
-            insuranceApplyDataVO.setZbInsuranceNum(insuranceApplyList.stream().filter(i -> Constants.equalsInteger(i.getSolutionType(), Constants.ZERO)).collect(Collectors.toList()).size());
+            insuranceApplyDataVO.setZbInsuranceNum(insuranceApplyList.stream().filter(i -> Constants.equalsInteger(i.getSolutionType(), Constants.ZERO)
+                            &&(Constants.equalsInteger(i.getStatus(), Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                    || Constants.equalsInteger(i.getStatus(), Constants.InsuranceApplyStatus.WTB_DONE.getKey())))
+                    .collect(Collectors.toList()).size());
             //濮旀墭淇濅繚鍗曟暟閲�
-            insuranceApplyDataVO.setWtbInsuranceNum(insuranceApplyList.stream().filter(i -> Constants.equalsInteger(i.getSolutionType(), Constants.ONE)).collect(Collectors.toList()).size());
+            insuranceApplyDataVO.setWtbInsuranceNum(insuranceApplyList.stream().filter(i -> Constants.equalsInteger(i.getSolutionType(), Constants.ONE)
+                    &&(Constants.equalsInteger(i.getStatus(), Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                    || Constants.equalsInteger(i.getStatus(), Constants.InsuranceApplyStatus.WTB_DONE.getKey()))).collect(Collectors.toList()).size());
         }
 
             //鍚堣鎬昏垂鐢�
@@ -993,13 +998,18 @@
         DataListVO dataListVOA = new DataListVO();
         dataListVOA.setDataFirst("涓嶅湪淇�");
         dataListVOA.setDataSecond(
-                applyDetailJoinMapper.selectJoinCount( new MPJLambdaWrapper<ApplyDetail>()
+                applyDetailJoinMapper.selectJoinList(ApplyDetail.class, new MPJLambdaWrapper<ApplyDetail>()
+                        .select(ApplyDetail::getMemberId)
                                 .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyDetail::getApplyId)
                                 .eq(ApplyDetail::getIsdeleted, Constants.ZERO)
                                 .eq(InsuranceApply::getIsdeleted, Constants.ZERO)
                                 .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey())
                                 .eq(InsuranceApply::getCompanyId,loginUserInfo.getCompanyId())
-                                .apply("  t.END_TIME < now() ")).toString()
+
+                                .apply("  t.END_TIME < now() ")
+                        .groupBy(ApplyDetail::getMemberId)
+
+                ).size()+""
 
         );
         dataListVOList.add(dataListVOA);
@@ -1008,13 +1018,14 @@
         DataListVO dataListVOB = new DataListVO();
         dataListVOB.setDataFirst("淇濋殰涓�");
         dataListVOB.setDataSecond(
-                applyDetailJoinMapper.selectJoinCount( new MPJLambdaWrapper<ApplyDetail>()
+                applyDetailJoinMapper.selectJoinList(ApplyDetail.class, new MPJLambdaWrapper<ApplyDetail>()
+                .select(ApplyDetail::getMemberId)
                         .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyDetail::getApplyId)
                         .eq(ApplyDetail::getIsdeleted, Constants.ZERO)
                         .eq(InsuranceApply::getIsdeleted, Constants.ZERO)
                         .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey())
                         .eq(InsuranceApply::getCompanyId,loginUserInfo.getCompanyId())
-                        .apply("  t.END_TIME >= now() ")).toString()
+                        .apply("  t.END_TIME >= now() ").groupBy(ApplyDetail::getMemberId)).size()+""
         );
 
         dataListVOList.add(dataListVOB);
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
index acc8c9a..54105ea 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -229,27 +229,27 @@
         LoginUserInfo loginUserInfo =(LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹�
         if(loginUserInfo.getType().equals(Constants.ONE)){
-            queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId())
-                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+"  and b.status in (" +
-                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
-                            " and  a.end_time >= now() ) ", Member::getValidNum )
-
-                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+"  and b.status in (" +
-                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
-                            " and a.end_time < now() ) ", Member::getInvalidNum );
+            queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId());
+//                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+"  and b.status in (" +
+//                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
+//                            " and  a.end_time >= now() ) ", Member::getValidNum )
+//
+//                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.company_id = "+loginUserInfo.getCompanyId()+"  and b.status in (" +
+//                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
+//                            " and a.end_time < now() ) ", Member::getInvalidNum );
         }else{
             if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){
                 queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList());
             }else{
                 queryWrapper.eq(InsuranceApply::getCompanyId, -1);
             }
-            queryWrapper.eq(pageWrap.getModel().getCompanyId()!=null,InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId())
-                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.status in (" +
-                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
-                            " and  a.end_time >= now() ) ", Member::getValidNum )
-                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.status in (" +
-                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
-                            " and a.end_time < now() ) ", Member::getInvalidNum );
+            queryWrapper.eq(pageWrap.getModel().getCompanyId()!=null,InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId());
+//                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.status in (" +
+//                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
+//                            " and  a.end_time >= now() ) ", Member::getValidNum )
+//                    .select( " ( select count(1) from apply_detail a inner join insurance_apply b on a.APPLY_ID = b.id  where a.member_id = t.id and b.status in (" +
+//                            " "+Constants.InsuranceApplyStatus.WTB_DONE.getKey()+","+Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()+" ) " +
+//                            " and a.end_time < now() ) ", Member::getInvalidNum );
         }
         queryWrapper.selectAll(Member.class)
                 .and(StringUtils.isNotBlank(memberQueryDTO.getKeywords()),
@@ -268,6 +268,7 @@
          queryWrapper.orderByAsc(Member::getName);
         PageData<Member> pageData = PageData.from(memberJoinMapper.selectJoinPage(page,Member.class, queryWrapper));
 
+        this.getValidNum(pageData,loginUserInfo);
         Integer sn = 0;
         for (Member member:pageData.getRecords()) {
             sn = sn + 1;
@@ -280,6 +281,36 @@
         return pageData;
     }
 
+    public void getValidNum(PageData<Member> pageData,LoginUserInfo loginUserInfo){
+        List<Integer> listId = pageData.getRecords().stream().map(i->i.getId()).collect(Collectors.toList());
+        if(CollectionUtils.isNotEmpty(listId)){
+            Integer companyId = null;
+            if(Objects.nonNull(loginUserInfo.getType())&&Constants.equalsInteger(loginUserInfo.getType(),Constants.ONE)){
+                companyId = loginUserInfo.getShowCompany().getId();
+            }
+            List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,
+                    new MPJLambdaWrapper<ApplyDetail>()
+                            .select(ApplyDetail::getMemberId,ApplyDetail::getStartTime,ApplyDetail::getEndTime,ApplyDetail::getId)
+                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
+                            .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                            .in(ApplyDetail::getMemberId,listId)
+                            .eq(Objects.nonNull(companyId)
+                                    ,InsuranceApply::getCompanyId,companyId)
+            );
+
+            if(CollectionUtils.isNotEmpty(applyDetailList)){
+                for (Member member:pageData.getRecords()) {
+                    member.setInvalidNum(applyDetailList.stream().filter(i->Constants.equalsInteger(i.getMemberId(),member.getId())&&i.getEndTime().getTime()<System.currentTimeMillis()).collect(Collectors.toList()).size());
+                    member.setValidNum(
+                            applyDetailList.stream().filter(i->Constants.equalsInteger(i.getMemberId(),member.getId())&&i.getEndTime().getTime()>=System.currentTimeMillis()).collect(Collectors.toList()).size()
+                    );
+                }
+            }
+        }
+    }
+
+
+
     @Override
     public long count(Member member) {
         QueryWrapper<Member> wrapper = new QueryWrapper<>(member);

--
Gitblit v1.9.3