Procházet zdrojové kódy

人脸识别兼容虹软,批量撤销转售订单

qzy před 1 měsícem
rodič
revize
da95251837
32 změnil soubory, kde provedl 776 přidání a 225 odebrání
  1. 7 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java
  2. 10 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java
  3. 5 1
      sp-core/sp-base/pom.xml
  4. 7 1
      sp-core/sp-base/src/main/java/com/pj/current/config/MyConfig.java
  5. 5 0
      sp-core/sp-base/src/main/java/com/pj/current/config/SystemObject.java
  6. 6 1
      sp-core/sp-base/src/main/java/com/pj/face/brand/FaceBrand.java
  7. 65 0
      sp-core/sp-base/src/main/java/com/pj/face/config/FaceEngineConfig.java
  8. 2 0
      sp-core/sp-base/src/main/java/com/pj/face/handler/IFaceHandler.java
  9. 136 0
      sp-core/sp-base/src/main/java/com/pj/face/handler/impl/ArcsoftFaceHandlerImpl.java
  10. 42 6
      sp-core/sp-base/src/main/java/com/pj/face/handler/impl/TencenFaceHandlerImpl.java
  11. 111 0
      sp-core/sp-base/src/main/java/com/pj/face/handler/impl/TencenRespBO.java
  12. 10 9
      sp-core/sp-nacos/src/main/resources/logback.xml
  13. 11 10
      sp-service/async-server/src/main/resources/logback.xml
  14. 1 1
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java
  15. 128 102
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java
  16. 78 30
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java
  17. 6 1
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleAppController.java
  18. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java
  19. 2 1
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java
  20. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopMapper.xml
  21. 11 10
      sp-service/level-one-server/src/main/resources/logback.xml
  22. 15 0
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java
  23. 30 11
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java
  24. 11 10
      sp-service/level-two-server/src/main/resources/logback.xml
  25. 7 0
      sp-service/payment-server/src/main/java/com/pj/utils/CryptoUtil.java
  26. 12 11
      sp-service/payment-server/src/main/resources/logback.xml
  27. 0 3
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java
  28. 2 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.java
  29. 3 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.xml
  30. 18 4
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java
  31. 21 0
      sp-service/sp-admin/src/main/java/com/pj/project4sp/startup/StartUpInit.java
  32. 11 10
      sp-service/sp-admin/src/main/resources/logback.xml

+ 7 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 /**
  * @Author Mechrevo
  * @Date 2023 08 01 10 38
@@ -42,4 +44,9 @@ public interface LevelTwoServerInterface {
     /** 收到边民缴税以及各服务费回执 */
     @PostMapping("/app/TbOrders/rpc/payTaxFromBank")
     public boolean payTaxFromBank(@RequestParam("orderNo") String orderNo, @RequestParam("MKT008Status")Integer MKT008Status);
+
+    @RequestMapping("/TbOrders/rpc/removeOnSaleOrderByLevelOneOrderId")
+    boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId") Long levelOneOrderId);
+    @RequestMapping("/TbOrders/rpc/removeOnSaleOrderByLevelOneOrderIds")
+    boolean removeOnSaleOrderByLevelOneOrderIds(@RequestParam("levelOneOrderIds")String levelOneOrderIds);
 }

+ 10 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java

@@ -53,6 +53,16 @@ public class LevelTwoServerInterfaceFallback implements FallbackFactory<LevelTwo
             public boolean payTaxFromBank(String orderNo, Integer MKT008Status) {
                 return false;
             }
+
+            @Override
+            public boolean removeOnSaleOrderByLevelOneOrderId(Long levelOneOrderId) {
+                return false;
+            }
+
+            @Override
+            public boolean removeOnSaleOrderByLevelOneOrderIds(String ids) {
+                return false;
+            }
         };
     }
 }

+ 5 - 1
sp-core/sp-base/pom.xml

@@ -41,7 +41,11 @@
             <version>2.1.0</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.arcsoft.face</groupId>
+            <artifactId>arcsoft-sdk-face</artifactId>
+            <version>3.0.0.0</version>
+        </dependency>
         <!--人脸识别 阿里云 新版-->
         <dependency>
             <groupId>com.aliyun</groupId>

+ 7 - 1
sp-core/sp-base/src/main/java/com/pj/current/config/MyConfig.java

@@ -46,7 +46,13 @@ public class MyConfig {
 	/**
 	 * 人脸配置
 	 */
-	private String faceType="tencen";
+	private String faceType;
+
+	private String faceImgPath;
+	private String faceLibs;
+
+	private String arcsoftAppid;
+	private String arcsoftSdkKey;
 
 	
 }

+ 5 - 0
sp-core/sp-base/src/main/java/com/pj/current/config/SystemObject.java

@@ -37,6 +37,10 @@ public class SystemObject {
         return getPasswordMd5(0, password);
     }
 
+    public static String getFaceImgPath() {
+        return config.getFaceImgPath();
+    }
+
 
     // ===================================== yml自定义配置信息 ===================================================
 
@@ -56,6 +60,7 @@ public class SystemObject {
 
 
     public static FaceFactory factory;
+
     @Autowired
     void setConfig(FaceFactory factory) {
         SystemObject.factory = factory;

+ 6 - 1
sp-core/sp-base/src/main/java/com/pj/face/brand/FaceBrand.java

@@ -17,7 +17,12 @@ public enum FaceBrand {
     /**
      * 百度云
      */
-    BAIDU_SMS("baidu");
+    BAIDU_SMS("baidu"),
+    /**
+     * 虹软
+     */
+    ARCSOFT("arcsoft"),
+    ;
 
     private String type;
 }

+ 65 - 0
sp-core/sp-base/src/main/java/com/pj/face/config/FaceEngineConfig.java

@@ -0,0 +1,65 @@
+package com.pj.face.config;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.log.StaticLog;
+import com.arcsoft.face.ActiveFileInfo;
+import com.arcsoft.face.EngineConfiguration;
+import com.arcsoft.face.FaceEngine;
+import com.arcsoft.face.FunctionConfiguration;
+import com.arcsoft.face.enums.DetectMode;
+import com.arcsoft.face.enums.DetectOrient;
+import com.arcsoft.face.enums.ErrorInfo;
+import com.pj.current.config.SystemObject;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.File;
+
+@Slf4j
+public class FaceEngineConfig {
+
+    public static FaceEngine faceEngine = null;
+
+    public static void initFaceEngine() {
+        String sdk = SystemObject.config.getFaceLibs();
+        log.info("exit:{}", FileUtil.exist(sdk + File.separator + "libarcsoft_face.dll"));
+        faceEngine = new FaceEngine(sdk);
+        //激活引擎
+        int errorCode = faceEngine.activeOnline(SystemObject.config.getArcsoftAppid(), SystemObject.config.getArcsoftSdkKey());
+        log.info("activate:{}", errorCode);
+        StaticLog.info("activate:{}", errorCode);
+
+        if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
+            StaticLog.error("引擎激活失败");
+        }
+
+
+        ActiveFileInfo activeFileInfo = new ActiveFileInfo();
+        errorCode = faceEngine.getActiveFileInfo(activeFileInfo);
+        if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
+            StaticLog.error("获取激活文件信息失败");
+        }
+
+        //引擎配置
+        EngineConfiguration engineConfiguration = new EngineConfiguration();
+        engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
+        engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);
+        engineConfiguration.setDetectFaceMaxNum(10);
+        engineConfiguration.setDetectFaceScaleVal(16);
+        //功能配置
+        FunctionConfiguration functionConfiguration = new FunctionConfiguration();
+        functionConfiguration.setSupportFaceDetect(true);
+        functionConfiguration.setSupportFaceRecognition(true);
+        functionConfiguration.setSupportLiveness(true);
+        engineConfiguration.setFunctionConfiguration(functionConfiguration);
+
+
+        //初始化引擎
+        errorCode = faceEngine.init(engineConfiguration);
+
+        if (errorCode != ErrorInfo.MOK.getValue()) {
+            StaticLog.error("初始化引擎失败");
+        }
+
+
+    }
+}

+ 2 - 0
sp-core/sp-base/src/main/java/com/pj/face/handler/IFaceHandler.java

@@ -2,6 +2,7 @@ package com.pj.face.handler;
 
 import com.pj.common.core.utils.sign.Base64;
 import com.pj.face.brand.FaceBrand;
+import com.pj.face.handler.impl.TencenRespBO;
 import com.pj.sms.brand.SmsType;
 
 import java.util.List;
@@ -29,6 +30,7 @@ public interface IFaceHandler {
     void createPersonByBase(String faceId, String name, String imageBase);
 
     void deletePerson(String faceId);
+    boolean checkHasPerson(String img);
 
     /**
      * 检查校验

+ 136 - 0
sp-core/sp-base/src/main/java/com/pj/face/handler/impl/ArcsoftFaceHandlerImpl.java

@@ -0,0 +1,136 @@
+package com.pj.face.handler.impl;
+
+import cn.hutool.core.io.FileUtil;
+import com.arcsoft.face.FaceFeature;
+import com.arcsoft.face.FaceInfo;
+import com.arcsoft.face.FaceSimilar;
+import com.arcsoft.face.LivenessInfo;
+import com.arcsoft.face.toolkit.ImageInfo;
+import com.pj.current.config.SystemObject;
+import com.pj.face.brand.FaceBrand;
+import com.pj.face.config.FaceEngineConfig;
+import com.pj.face.handler.IFaceHandler;
+import com.pj.face.handler.VerifyVO;
+import com.pj.utils.sg.AjaxError;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+
+import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
+
+/**
+ * 基于ArcSoft Face的人��识别
+ */
+@Service
+@Slf4j
+public class ArcsoftFaceHandlerImpl implements IFaceHandler {
+    @Override
+    public boolean checkIsLive(String baseImg) {
+        List<LivenessInfo> livenessInfoList = new ArrayList<>();
+        FaceEngineConfig.faceEngine.getLiveness(livenessInfoList);
+        return livenessInfoList.get(0).getLiveness() == 1;
+    }
+
+    @Override
+    public void createPersonByBase(String faceId, String name, String imageBase) {
+        byte[] imageBytes = Base64.getDecoder().decode(imageBase);
+        String facePath = SystemObject.getFaceImgPath();
+        File outputFile = new File(facePath + File.separator + faceId + ".png");
+        FileUtil.del(outputFile);
+        // 创建输出流
+        try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
+            // 写入数据到文件
+            fileOutputStream.write(imageBytes);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void deletePerson(String faceId) {
+        String facePath = SystemObject.getFaceImgPath();
+        File outputFile = new File(facePath + File.separator + faceId + ".png");
+        FileUtil.del(outputFile);
+    }
+
+    @Override
+    public boolean checkHasPerson(String img) {
+        byte[] imageBytes = Base64.getDecoder().decode(img);
+        ImageInfo imageInfo = getRGBData(imageBytes);
+        List<FaceInfo> faceInfoList = new ArrayList<>();
+        FaceEngineConfig.faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
+        return faceInfoList.size() == 1;
+    }
+
+    @Override
+    public VerifyVO verify(String faceId, String baseImage) {
+        VerifyVO vo = new VerifyVO();
+        String facePath = SystemObject.getFaceImgPath();
+        File file = new File(facePath + File.separator + faceId + ".png");
+        if (!file.exists()){
+            vo.setMsg("人员ID不存在");
+            return vo;
+        }
+        ImageInfo imageInfo2 = getRGBData(file);
+        byte[] imageBytes = Base64.getDecoder().decode(baseImage);
+        ImageInfo imageInfo = getRGBData(imageBytes);
+        List<FaceInfo> faceInfoList = new ArrayList<>();
+        FaceEngineConfig.faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
+        if (faceInfoList.size() == 0) {
+            vo.setMsg("No faces");
+            return vo;
+            //throw new AjaxError("请正视摄像头");
+        }
+        if (faceInfoList.size() > 1) {
+            vo.setMsg("图片中存在多个人脸");
+            return vo;
+            //throw new AjaxError("图片中存在多个人脸");
+        }
+        FaceInfo faceInfo = faceInfoList.get(0);
+        FaceFeature faceFeature = new FaceFeature();
+        FaceEngineConfig.faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfo, faceFeature);
+        System.out.println("特征值大小:" + faceFeature.getFeatureData().length);
+
+
+        //人脸检测2
+
+        List<FaceInfo> faceInfoList2 = new ArrayList<FaceInfo>();
+        FaceEngineConfig.faceEngine.detectFaces(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(), imageInfo2.getImageFormat(), faceInfoList2);
+        System.out.println(faceInfoList2);
+
+        //特征提取2
+        FaceFeature faceFeature2 = new FaceFeature();
+        FaceEngineConfig.faceEngine.extractFaceFeature(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(), imageInfo2.getImageFormat(), faceInfoList2.get(0), faceFeature2);
+        System.out.println("特征值大小:" + faceFeature2.getFeatureData().length);
+
+        FaceFeature targetFaceFeature = new FaceFeature();
+        targetFaceFeature.setFeatureData(faceFeature.getFeatureData());
+        FaceFeature sourceFaceFeature = new FaceFeature();
+        sourceFaceFeature.setFeatureData(faceFeature2.getFeatureData());
+        FaceSimilar faceSimilar = new FaceSimilar();
+        FaceEngineConfig.faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
+        System.out.println("相似度:" + faceSimilar.getScore());
+        boolean result = faceSimilar.getScore() > 0.75f;
+        String msg = result ? "人脸一致" : "不匹配";
+        vo.setSuccess(result);
+        vo.setMsg(msg);
+        return vo;
+    }
+
+    @Override
+    public List<String> faceSearch(String baseImg) {
+        return null;
+    }
+
+    @Override
+    public FaceBrand faceBrand() {
+        return FaceBrand.ARCSOFT;
+    }
+}

+ 42 - 6
sp-core/sp-base/src/main/java/com/pj/face/handler/impl/TencenFaceHandlerImpl.java

@@ -1,17 +1,21 @@
 package com.pj.face.handler.impl;
 
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.pj.face.brand.FaceBrand;
 import com.pj.face.handler.IFaceHandler;
 import com.pj.face.handler.VerifyVO;
 import com.pj.face.properties.TencenProperties;
 import com.pj.utils.sg.AjaxError;
+import com.tencentcloudapi.common.AbstractModel;
 import com.tencentcloudapi.common.Credential;
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
 import com.tencentcloudapi.common.profile.ClientProfile;
 import com.tencentcloudapi.common.profile.HttpProfile;
 import com.tencentcloudapi.iai.v20200303.IaiClient;
 import com.tencentcloudapi.iai.v20200303.models.*;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
@@ -99,7 +103,7 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
         req.setImage(imageBase);
         // 返回的resp是一个CreatePersonResponse的实例,与请求对象对应
         try {
-            client.CreatePerson(req);
+            CreatePersonResponse response=   client.CreatePerson(req);
         } catch (TencentCloudSDKException e) {
             e.printStackTrace();
         }
@@ -109,16 +113,48 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
     @Override
     public void deletePerson(String faceId) {
         IaiClient client = this.createClient();
-        DeleteFaceRequest request = new DeleteFaceRequest();
+        DeletePersonRequest request = new DeletePersonRequest();
         request.setPersonId(faceId);
-        request.setFaceIds(new String[]{faceId});
         try {
-            DeleteFaceResponse response = client.DeleteFace(request);
-           Long num= response.getSucDeletedNum();
+            DeletePersonResponse response = client.DeletePerson(request);
+            String requestId = response.getRequestId();
+            log.info("delete face : {},{}", faceId, requestId);
         } catch (TencentCloudSDKException e) {
             log.error("delete face fail,{}", e.getMessage());
         }
-        log.info("delete face : {}", faceId);
+    }
+
+    @Override
+    public boolean checkHasPerson(String img) {
+        IaiClient client = this.createClient();
+        // 实例化一个请求对象,每个接口都会对应一个request对象
+        DetectFaceRequest req = new DetectFaceRequest();
+        req.setMaxFaceNum(1L);
+        req.setMinFaceSize(1L);
+        req.setImage(img);
+        // 返回的resp是一个DetectFaceResponse的实例,与请求对象对应
+        DetectFaceResponse resp = null;
+        try {
+            resp = client.DetectFace(req);
+        } catch (TencentCloudSDKException e) {
+            log.error("Error while:{}", e.getMessage());
+            return false;
+        }
+        if (resp == null || StrUtil.contains(AbstractModel.toJsonString(resp), "NoFaceInPhoto")) {
+            return false;
+        }
+        // 输出json格式的字符串回包
+        log.info(AbstractModel.toJsonString(resp));
+        FaceInfo[] faceInfos = resp.getFaceInfos();
+        if (faceInfos.length>1){
+            throw new AjaxError("存在多个人脸");
+        }
+        FaceInfo faceInfo=faceInfos[0];
+       Long score= faceInfo.getFaceQualityInfo().getScore();
+        if (score == null || score < 70) {
+            throw new AjaxError("请正视摄像头");
+        }
+        return true;
     }
 
     public boolean checkIsLive(String baseImg) {

+ 111 - 0
sp-core/sp-base/src/main/java/com/pj/face/handler/impl/TencenRespBO.java

@@ -0,0 +1,111 @@
+package com.pj.face.handler.impl;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class TencenRespBO implements Serializable {
+
+    @JsonProperty("ImageWidth")
+    private Integer imageWidth;
+    @JsonProperty("ImageHeight")
+    private Integer imageHeight;
+    @JsonProperty("FaceInfos")
+    private List<FaceInfosDTO> faceInfos;
+    @JsonProperty("FaceModelVersion")
+    private String faceModelVersion;
+    @JsonProperty("RequestId")
+    private String requestId;
+
+    @NoArgsConstructor
+    @Data
+    public static class FaceInfosDTO {
+        @JsonProperty("X")
+        private Integer x;
+        @JsonProperty("Y")
+        private Integer y;
+        @JsonProperty("Width")
+        private Integer width;
+        @JsonProperty("Height")
+        private Integer height;
+        @JsonProperty("FaceAttributesInfo")
+        private FaceAttributesInfoDTO faceAttributesInfo;
+        @JsonProperty("FaceQualityInfo")
+        private FaceQualityInfoDTO faceQualityInfo;
+
+        @NoArgsConstructor
+        @Data
+        public static class FaceAttributesInfoDTO {
+            @JsonProperty("Gender")
+            private Integer gender;
+            @JsonProperty("Age")
+            private Integer age;
+            @JsonProperty("Expression")
+            private Integer expression;
+            @JsonProperty("Hat")
+            private Boolean hat;
+            @JsonProperty("Glass")
+            private Boolean glass;
+            @JsonProperty("EyeOpen")
+            private Boolean eyeOpen;
+            @JsonProperty("Mask")
+            private Boolean mask;
+            @JsonProperty("Hair")
+            private HairDTO hair;
+            @JsonProperty("Pitch")
+            private Integer pitch;
+            @JsonProperty("Yaw")
+            private Integer yaw;
+            @JsonProperty("Roll")
+            private Integer roll;
+            @JsonProperty("Beauty")
+            private Integer beauty;
+
+            @NoArgsConstructor
+            @Data
+            public static class HairDTO {
+                @JsonProperty("Length")
+                private Integer length;
+                @JsonProperty("Bang")
+                private Integer bang;
+                @JsonProperty("Color")
+                private Integer color;
+            }
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class FaceQualityInfoDTO {
+            @JsonProperty("Score")
+            private Integer score;
+            @JsonProperty("Sharpness")
+            private Integer sharpness;
+            @JsonProperty("Brightness")
+            private Integer brightness;
+            @JsonProperty("Completeness")
+            private CompletenessDTO completeness;
+
+            @NoArgsConstructor
+            @Data
+            public static class CompletenessDTO {
+                @JsonProperty("Eyebrow")
+                private Integer eyebrow;
+                @JsonProperty("Eye")
+                private Integer eye;
+                @JsonProperty("Nose")
+                private Integer nose;
+                @JsonProperty("Cheek")
+                private Integer cheek;
+                @JsonProperty("Mouth")
+                private Integer mouth;
+                @JsonProperty("Chin")
+                private Integer chin;
+            }
+        }
+    }
+}

+ 10 - 9
sp-core/sp-nacos/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>market</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,7 +115,7 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="info">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
         <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>

+ 11 - 10
sp-service/async-server/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>async</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,9 +115,9 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
-<!--        <appender-ref ref="STDOUT"/>-->
+        <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>
         <!--<appender-ref ref="FILEWARN"/>-->
         <appender-ref ref="FILE_INFO"/>

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java

@@ -198,7 +198,7 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
             //发送短信
             if (result == 1) {
                 String content = "您好,您的[边民互市订单]已经生成,订单商品是[" + tbOrder.getGoodsNames() + "]。请前往app进行交易确认";
-                SystemObject.smsFactory.handler().sendSMS(tbPeople.getPhone(), content);
+              // SystemObject.smsFactory.handler().sendSMS(tbPeople.getPhone(), content);
             }
         }
         htTradeSettlement.setTotalPrice(totalPrice);

+ 128 - 102
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java

@@ -2,6 +2,7 @@ package com.pj.tb_order;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -35,26 +36,6 @@ public class TbOrderController {
     TbOrderService tbOrderService;
 
 
-    /**
-     * 删
-     */
-    @RequestMapping("delete")
-    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
-    public AjaxJson delete(Long id) {
-        tbOrderService.delete(id);
-        return AjaxJson.getSuccess();
-    }
-
-    /**
-     * 删 - 根据id列表
-     */
-    @RequestMapping("deleteByIds")
-    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
-    public AjaxJson deleteByIds() {
-        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-        int line = SP.publicMapper.deleteByIds(TbOrder.TABLE_NAME, ids);
-        return AjaxJson.getByLine(line);
-    }
 
     /**
      * 改
@@ -128,87 +109,132 @@ public class TbOrderController {
         return AjaxJson.toAjax(batch);
     }
 
-	/** 订单补扣款 */
-	@RequestMapping("deduction")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
-	public AjaxJson deduction(Long id){
-		tbOrderService.deduction(id);
-		return AjaxJson.getSuccess();
-	}
-	/** 订单补扣款——按车,并且未扣款 */
-	@RequestMapping("deductionByVeNo")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
-	public AjaxJson deductionByVeNo(String veNo, Long id){
-		tbOrderService.deductionByVeNo(veNo, id);
-		return AjaxJson.getSuccess();
-	}
-	@RequestMapping("getDeductionByVeNoList")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE)
-	public AjaxJson getDeductionByVeNoList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbOrder> list = tbOrderService.getDeductionByVeNoList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/**
-	 * 订单补扣款
-	 */
-	@RequestMapping("staticsStatus")
-	public AjaxJson staticsStatus(Long saleMainId) {
-		Map<String, Object> result = tbOrderService.staticsStatus(saleMainId);
-		return AjaxJson.getSuccessData(result);
-	}
-	/** 订单补发送009信息到航通 */
-	@RequestMapping("send009ToHt")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_SEND009)
-	public AjaxJson send009ToHt(Long id){
-		TbOrder order = tbOrderService.getById(id);
-		if (order == null) {
-			throw new AjaxError("订单不存在");
-		}
-		tbOrderService.sendConfirmMsgToHt(order);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 订单补推结关信息给银行 */
-	@RequestMapping("sendCXB001")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
-	public AjaxJson sendCXB001(Long id){
-		tbOrderService.sendCXB001(id);
-		return AjaxJson.getSuccess();
-	}
-	/** 订单补推结关信息给银行——按车,并且未完成 */
-	@RequestMapping("sendCXB001ByVeNo")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
-	public AjaxJson sendCXB001ByVeNo(String veNo, Long id){
-		tbOrderService.sendCXB001ByVeNo(veNo, id);
-		return AjaxJson.getSuccess();
-	}
-	@RequestMapping("getSendCXB001ByVeNoList")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE)
-	public AjaxJson getSendCXB001ByVeNoList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbOrder> list = tbOrderService.getSendCXB001ByVeNoList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
-
-
-	/** 系统接收到航通接口信息:进出口申报单退单 **/
-	@RequestMapping("rpc/chargeback")
-	public boolean chargeback(@RequestBody HtDeclareChargebackDto htDeclareChargebackDto) {
-		return tbOrderService.chargeback(htDeclareChargebackDto);
-	}
-	@RequestMapping("rpc/getOrderListByMainIds")
-	public List<OrderDto> getOrderListByMainIds(String mainIds) {
-		return tbOrderService.getOrderListByMainIds(mainIds);
-	}
-
-	/** 系统接收到航通接口信息:车辆已出一级市场 ,相对应的一级市场订单状态修改 **/
-	@RequestMapping("rpc/orderFinish")
-	public boolean orderFinish(@RequestBody HtPassCardDTO htPassCardDTO) {
-		return tbOrderService.orderFinish(htPassCardDTO);
-	}
+    /**
+     * 订单补扣款
+     */
+    @RequestMapping("deduction")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson deduction(Long id) {
+        tbOrderService.deduction(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 撤销转售
+     */
+    @RequestMapping("cancelSale")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson cancelSale(Long id) {
+        tbOrderService.cancelSale(id);
+        return AjaxJson.getSuccess();
+    }
+    /**
+     * 撤销转售
+     */
+    @RequestMapping("cancelSaleBatch")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson cancelSaleBatch() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        tbOrderService.cancelSaleBatch(ids);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补扣款——按车,并且未扣款
+     */
+    @RequestMapping("deductionByVeNo")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson deductionByVeNo(String veNo, Long id) {
+        tbOrderService.deductionByVeNo(veNo, id);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("getDeductionByVeNoList")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getDeductionByVeNoList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbOrder> list = tbOrderService.getDeductionByVeNoList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * 订单补扣款
+     */
+    @RequestMapping("staticsStatus")
+    public AjaxJson staticsStatus(Long saleMainId) {
+        Map<String, Object> result = tbOrderService.staticsStatus(saleMainId);
+        return AjaxJson.getSuccessData(result);
+    }
+
+    /**
+     * 订单补发送009信息到航通
+     */
+    @RequestMapping("send009ToHt")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SEND009)
+    public AjaxJson send009ToHt(Long id) {
+        TbOrder order = tbOrderService.getById(id);
+        if (order == null) {
+            throw new AjaxError("订单不存在");
+        }
+        order.setPeopleConfirmStatus(1)
+				.setPeopleConfirmTime(new Date())
+				.setCooperEntrustStatus(1)
+                .setApplyConfirmStatus(1);
+        tbOrderService.updateById(order);
+        tbOrderService.sendConfirmMsgToHt(order);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补推结关信息给银行
+     */
+    @RequestMapping("sendCXB001")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
+    public AjaxJson sendCXB001(Long id) {
+        tbOrderService.sendCXB001(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补推结关信息给银行——按车,并且未完成
+     */
+    @RequestMapping("sendCXB001ByVeNo")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
+    public AjaxJson sendCXB001ByVeNo(String veNo, Long id) {
+        tbOrderService.sendCXB001ByVeNo(veNo, id);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("getSendCXB001ByVeNoList")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getSendCXB001ByVeNoList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbOrder> list = tbOrderService.getSendCXB001ByVeNoList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
+
+
+    /**
+     * 系统接收到航通接口信息:进出口申报单退单
+     **/
+    @RequestMapping("rpc/chargeback")
+    public boolean chargeback(@RequestBody HtDeclareChargebackDto htDeclareChargebackDto) {
+        return tbOrderService.chargeback(htDeclareChargebackDto);
+    }
+
+    @RequestMapping("rpc/getOrderListByMainIds")
+    public List<OrderDto> getOrderListByMainIds(String mainIds) {
+        return tbOrderService.getOrderListByMainIds(mainIds);
+    }
+
+    /**
+     * 系统接收到航通接口信息:车辆已出一级市场 ,相对应的一级市场订单状态修改
+     **/
+    @RequestMapping("rpc/orderFinish")
+    public boolean orderFinish(@RequestBody HtPassCardDTO htPassCardDTO) {
+        return tbOrderService.orderFinish(htPassCardDTO);
+    }
 
 }

+ 78 - 30
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -4,11 +4,13 @@ import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.injector.methods.SelectBatchByIds;
 import com.pj.api.client.admin.AdminInterface;
 import com.pj.api.client.async_server.AsyncServerInterface;
 import com.pj.api.client.level_one_server.LevelOneServerInterface;
@@ -462,30 +464,36 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         TbPeople tbPeople = tbPeopleService.getById(tbOrder.getBuyUserId());
         StaticLog.info("tbPeople:{}", JSONUtil.toJsonStr(tbPeople));
-        if (tbPeople != null) {
-            paymentDto.setBankCode(tbPeople.getBankCode());
-            paymentDto.setBankName(tbPeople.getBankName());
-            paymentDto.setBankNo(tbPeople.getBankNo());
-            paymentDto.setBorderName(tbPeople.getName());
-            paymentDto.setBorderidno(tbPeople.getIdCard());
-            paymentDto.setBorderTel(tbPeople.getPhone());
-            paymentDto.setPapersType(tbPeople.getPapersType());
-            paymentDto.setBorderNationality(tbPeople.getNationality());
+        if (tbPeople == null) {
+            throw new AjaxError("查询不到边民信息");
+        }
+        if (StrUtil.isEmpty(tbPeople.getBankCode())) {
+            throw new AjaxError(tbPeople.getName() + "银行账号不完善");
         }
+        paymentDto.setBankCode(tbPeople.getBankCode());
+        paymentDto.setBankName(tbPeople.getBankName());
+        paymentDto.setBankNo(tbPeople.getBankNo());
+        paymentDto.setBorderName(tbPeople.getName());
+        paymentDto.setBorderidno(tbPeople.getIdCard());
+        paymentDto.setBorderTel(tbPeople.getPhone());
+        paymentDto.setPapersType(tbPeople.getPapersType());
+        paymentDto.setBorderNationality(tbPeople.getNationality());
 
         TbShop tbShop = tbShopService.findByCode(htTradeSettlement.getShopNo());
-        StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
-        if (tbShop != null) {
-            paymentDto.setOwnerName(tbShop.getOwnerName());
-            paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
-            paymentDto.setBankAccount(tbShop.getBankAccount());
-            paymentDto.setBank(tbShop.getBank());
-            paymentDto.setOwnerTel(tbShop.getOwnerTel());
-            paymentDto.setShopSccd(tbShop.getShopSccd());
-            paymentDto.setNationality(tbShop.getNationality());
+        if (tbShop == null) {
+            throw new AjaxError("查询不到商铺信息");
         }
-
-
+        if (StrUtil.isEmpty(tbShop.getBankAccount())) {
+            throw new AjaxError(tbShop.getShopName() + "银行账号不完善");
+        }
+        StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
+        paymentDto.setOwnerName(tbShop.getOwnerName());
+        paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
+        paymentDto.setBankAccount(tbShop.getBankAccount());
+        paymentDto.setBank(tbShop.getBank());
+        paymentDto.setOwnerTel(tbShop.getOwnerTel());
+        paymentDto.setShopSccd(tbShop.getShopSccd());
+        paymentDto.setNationality(tbShop.getNationality());
         return paymentDto;
     }
 
@@ -647,7 +655,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             htWrapper.lambda().eq(HtTradeSettlement::getId, order.getSaleMainId())
                     .eq(HtTradeSettlement::getHzsConfirmStatus, 1);
             List<HtTradeSettlement> tradeSettlementList = htTradeSettlementService.list(htWrapper);
-            if(tradeSettlementList.size() > 0) {
+            if (tradeSettlementList.size() > 0) {
                 orderList.add(order);
             }
         }
@@ -735,6 +743,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         return super.updateById(tbOrder);
     }
+
     /**
      * 订单补扣款——按车,并且未扣款
      */
@@ -757,6 +766,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         return super.updateBatchById(tbOrders);
     }
+
     List<TbOrder> getDeductionByVeNoList(SoMap so) {
         LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
@@ -871,6 +881,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         return updateById(tbOrder);
     }
+
     /**
      * 订单补推结关信息给银行——按车,并且未完成
      */
@@ -878,7 +889,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbOrder::getVeNo, veNo);
         wrapper.eq(TbOrder::getSaleMainId, id);
-        wrapper.ne(TbOrder::getFinishStatus, 1).orderByDesc(TbOrder::getCreateTime);
+        wrapper.orderByDesc(TbOrder::getCreateTime);
         List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
 
         if (!tbOrders.isEmpty()) {
@@ -895,6 +906,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
                 paymentDto.setTradeNo(tbOrder.getTradeNo());
                 paymentDto.setDeclTime(htTradeSettlement.getDeclTime());
                 StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+                log.info("log sendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
                 paymentServerInterface.sendCXB001(paymentDto);
             }
             this.updateBatchById(tbOrders);
@@ -910,11 +922,12 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         }
         return true;
     }
+
     List<TbOrder> getSendCXB001ByVeNoList(SoMap so) {
         LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
         wrapper.eq(TbOrder::getSaleMainId, so.getLong("id"));
-        wrapper.ne(TbOrder::getFinishStatus, 1).orderByDesc(TbOrder::getCreateTime);
+        wrapper.orderByDesc(TbOrder::getCreateTime);
         List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
         return tbOrders;
     }
@@ -1138,18 +1151,53 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         SoMap soMap = new SoMap();
         soMap.put("saleMainId", saleMainId);
         List<TbOrder> list = tbOrderMapper.getList(soMap);
-        int total=list.size();
-        List<TbOrder>upList=list.stream().filter(tbOrder -> !Objects.isNull(tbOrder.getUpPrice())).collect(Collectors.toList());
-        int upSize=upList.size();
+        int total = list.size();
+        List<TbOrder> upList = list.stream().filter(tbOrder -> !Objects.isNull(tbOrder.getUpPrice())).collect(Collectors.toList());
+        int upSize = upList.size();
         double upTotalPrice = upList.stream().collect(Collectors.summarizingDouble(order -> order.getUpPrice().doubleValue())).getSum();
-        List<TbOrder>saleList=list.stream().filter(tbOrder -> tbOrder.getResaleStatus()==1).collect(Collectors.toList());
-        int saleSize=saleList.size();
+        List<TbOrder> saleList = list.stream().filter(tbOrder -> tbOrder.getResaleStatus() == 1).collect(Collectors.toList());
+        int saleSize = saleList.size();
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("upTotalPrice", upTotalPrice);
         resultMap.put("upSize", upSize);
-        resultMap.put("notUpSize", total-upSize);
+        resultMap.put("notUpSize", total - upSize);
         resultMap.put("saleSize", saleSize);
-        resultMap.put("notSaleSize", total-saleSize);
+        resultMap.put("notSaleSize", total - saleSize);
         return resultMap;
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void cancelSale(Long id) {
+        TbOrder tbOrder = getById(id);
+        if (tbOrder.getBeingOrder() == 1) {
+            throw new AjaxError("该订单在二级市场被下单,无法取消转售");
+        }
+        tbOrder.setResaleStatus(0);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
+        htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
+        boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderId(id);
+        if (!result) {
+            throw new AjaxError("无法撤销转售");
+        }
+        updateById(tbOrder);
+        htTradeSettlementService.updateById(htTradeSettlement);
+
+    }
+
+    public void cancelSaleBatch(List<Long> ids) {
+        String idsStr = ids.stream().map(id -> id + "").collect(Collectors.joining(","));
+        List<TbOrder> orders = tbOrderMapper.selectBatchIds(ids);
+        TbOrder tbOrder = orders.get(0);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
+        boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderIds(idsStr);
+        if (!result) {
+            throw new AjaxError("无法撤销转售");
+        }
+        for (TbOrder order : orders) {
+            order.setResaleStatus(0);
+            htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
+        }
+        this.updateBatchById(orders);
+        htTradeSettlementService.updateById(htTradeSettlement);
+    }
 }

+ 6 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleAppController.java

@@ -58,6 +58,9 @@ public class TbPeopleAppController {
             return AjaxJson.getSuccess();
         }
         TbPeople t = tbPeopleService.getById(fkId);
+        if (t.getGroupId()==null){
+            return AjaxJson.getSuccess();
+        }
         SoMap soMap = SoMap.getRequestSoMap();
         soMap.put("groupId", t.getGroupId());
         List<TbPeople> list = tbPeopleService.getList(soMap.startPage());
@@ -106,8 +109,10 @@ public class TbPeopleAppController {
      * 边民保存银行卡信息
      */
     @RequestMapping("rpc/saveBankInfo")
+    @Deprecated
     public boolean saveBankByPeople(@RequestParam("id") Long id, @RequestParam("bankName") String bankName, @RequestParam("bankAccount") String bankAccount) {
-        return tbPeopleService.saveBankByPeople(id, bankName, bankAccount);
+       return false;
+       // return tbPeopleService.saveBankByPeople(id, bankName, bankAccount,bankName);
     }
 
     /**

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -250,8 +250,8 @@ public class TbPeopleController {
      * 保存银行卡信息
      */
     @RequestMapping("saveBankInfo")
-    public AjaxJson saveBankByPeople(@RequestParam("id") Long id, @RequestParam("bankName") String bankName, @RequestParam("bankAccount") String bankAccount) {
-        boolean result = tbPeopleService.saveBankByPeople(id, bankName, bankAccount);
+    public AjaxJson saveBankByPeople(@RequestParam("id") Long id, @RequestParam("bankNo") String bankNo, @RequestParam("bankAccount") String bankAccount, @RequestParam("bankName") String bankName) {
+        boolean result = tbPeopleService.saveBankByPeople(id, bankNo, bankAccount,bankName);
         if (result) {
             return AjaxJson.getSuccess("修改成功!");
         }

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -704,8 +704,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
     /**
      * 边民保存银行卡信息
      */
-    public boolean saveBankByPeople(Long id, String bankName, String bankAccount) {
+    public boolean saveBankByPeople(Long id, String bankNo, String bankAccount,String bankName) {
         LambdaUpdateWrapper<TbPeople> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(TbPeople::getBankNo, bankNo);
         wrapper.set(TbPeople::getBankName, bankName);
         wrapper.set(TbPeople::getBankCode, bankAccount);
         wrapper.eq(TbPeople::getId, id);

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopMapper.xml

@@ -38,7 +38,7 @@
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("remark") '> and remark = #{remark} </if>
 			<if test=' this.has("enterpriseName") '> and enterprise_name like cancat('%',#{enterpriseName},'%')  </if>
-			<if test=' this.has("ownerName") '> and owner_name like cancat('%',#{ownerName},'%')  </if>
+			<if test=' this.has("ownerName") '> and owner_name like concat('%',#{ownerName},'%')  </if>
 			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
 		</where>
 		order by

+ 11 - 10
sp-service/level-one-server/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>one</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,9 +115,9 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
-<!--        <appender-ref ref="STDOUT"/>-->
+        <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>
         <!--<appender-ref ref="FILEWARN"/>-->
         <appender-ref ref="FILE_INFO"/>

+ 15 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java

@@ -213,4 +213,19 @@ public class TbOrdersController {
         TbOrdersEmailVo t = tbOrdersService.getSubEmail(id);
         return AjaxJson.getSuccessData(t);
     }
+
+    /**
+     * 根据一级市场订单删除二级市场订单
+     */
+    @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderId")
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId")Long levelOneOrderId) {
+        return tbOrdersService.removeOnSaleOrderByLevelOneOrderId(levelOneOrderId);
+    }
+    /**
+     * 根据一级市场订单删除二级市场订单
+     */
+    @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderIds")
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderIds")String levelOneOrderIds) {
+        return tbOrdersService.removeOnSaleOrderByLevelOneOrderIds(levelOneOrderIds);
+    }
 }

+ 30 - 11
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -160,7 +161,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         StaticLog.info("采购商purchaser:{}", JSONUtil.toJsonStr(purchaser));
         if (purchaser != null) {
             paymentTwoDto.setPcName(purchaser.getBusinessName());
-            if(purchaser.getType() == 2) {
+            if (purchaser.getType() == 2) {
                 paymentTwoDto.setPcName(purchaser.getName());
             }
             paymentTwoDto.setDutyParagraph(purchaser.getDutyParagraph());
@@ -181,7 +182,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         // 获取收购商ID与名称
         TbPurchaser purchaser = tbPurchaserMapper.selectById(purchaserId);
         if (null == purchaser) throw new RuntimeException("当前收购商账号异常,请重新登录或联系管理员!");
-        log.info("收购商采购:{},{}",purchaser.getName(),idStr);
+        log.info("收购商采购:{},{}", purchaser.getName(), idStr);
 
         Long[] idArr = Convert.toLongArray(idStr);
         for (Long id : idArr) {
@@ -202,7 +203,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
             //修改对应的一级市场订单状态:BeingOrder值为已被下单
             boolean updateResult = levelOneServerInterface.updateBeingOrder(orderTwo.getLevelOneOrderId());
-            if (!updateResult) throw new AjaxError(orderTwo.getOrderNo()+"下单异常");
+            if (!updateResult) throw new AjaxError(orderTwo.getOrderNo() + "下单异常");
 
             OrderDto orderOne = levelOneServerInterface.getOrderDtoById(orderTwo.getLevelOneOrderId());
 
@@ -684,7 +685,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         PaymentTwoDto paymentTwoDto = this.getPaymentData(tbOrders, orderOne);
         StaticLog.info("\n---采购商补扣款---sendMKT006_NoCommission——PaymentTwoDto——:{}", JSONUtil.toJsonStr(paymentTwoDto));
         paymentServerInterface.sendMKT006_NoCommission(paymentTwoDto);
-
+        tbOrders.setIsPay(3);
         tbOrders.setDeductionCount(tbOrders.getDeductionCount() + 1);
         tbOrders.setDeductionTime(new Date());
 
@@ -701,10 +702,10 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         BeanUtils.copyProperties(tbOrders, vo);
 
         List<BankInfoDto> bankInfoList = paymentServerInterface.getListBySource(tbOrders.getOrderNo());
-        if(bankInfoList.size()>0) vo.setResult(bankInfoList.get(0).getResult());
+        if (bankInfoList.size() > 0) vo.setResult(bankInfoList.get(0).getResult());
 
         PeopleDto people = levelOneServerInterface.getRpcById(tbOrders.getLeaderId());
-        if(people != null) {
+        if (people != null) {
             vo.setIdCard(people.getIdCard());
             vo.setGroupName(people.getGroupName());
         }
@@ -722,23 +723,23 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         BeanUtils.copyProperties(tbOrders, vo);
 
         OrderDto orderOne = levelOneServerInterface.getOrderDtoById(tbOrders.getLevelOneOrderId());
-        if(orderOne != null) {
+        if (orderOne != null) {
             vo.setSettleBillNo(orderOne.getSettleBillNo());
         }
 
         List<BankInfoDto> bankInfoList = paymentServerInterface.getListBySource(tbOrders.getOrderNo());
-        if(bankInfoList.size()>0) {
+        if (bankInfoList.size() > 0) {
             vo.setResult(bankInfoList.get(0).getResult());
         }
 
         PeopleDto people = levelOneServerInterface.getRpcById(tbOrders.getLeaderId());
-        if(people != null) {
+        if (people != null) {
             vo.setIdCard(people.getIdCard());
             vo.setGroupName(people.getGroupName());
         }
 
         PeopleTaxAccountDto peopleTaxAccount = levelOneServerInterface.getTaxAccountByPeopleId(tbOrders.getLeaderId());
-        if(peopleTaxAccount != null) {
+        if (peopleTaxAccount != null) {
             vo.setBusinessName(peopleTaxAccount.getBusinessName());
             vo.setContacts(peopleTaxAccount.getContacts());
             vo.setPhone(peopleTaxAccount.getPhone());
@@ -748,7 +749,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         }
 
         TbPurchaser purchaser = tbPurchaserMapper.selectById(tbOrders.getPurchaserId());
-        if(purchaser != null) {
+        if (purchaser != null) {
             vo.setPurchaserBusinessName(purchaser.getBusinessName());
             vo.setLegalPerson(purchaser.getLegalPerson());
             vo.setPurchaserContact(purchaser.getContact());
@@ -759,4 +760,22 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
         return vo;
     }
+
+    public boolean removeOnSaleOrderByLevelOneOrderId(Long levelOneOrderId) {
+        LambdaQueryWrapper<TbOrders> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrders::getLevelOneOrderId, levelOneOrderId)
+                .eq(TbOrders::getOrderFinish, OrderStatus.ORDER_STATUS_ZERO.getCode()).eq(TbOrders::getIsPay, 0);
+
+        return tbOrdersMapper.delete(wrapper) == 1;
+    }
+
+    public boolean removeOnSaleOrderByLevelOneOrderIds(String levelOneOrderIds) {
+        List<Long> ids = StrUtil.split(levelOneOrderIds, ",").stream().map(Long::valueOf).collect(Collectors.toList());
+        LambdaQueryWrapper<TbOrders> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(TbOrders::getLevelOneOrderId, ids)
+                .eq(TbOrders::getOrderFinish, OrderStatus.ORDER_STATUS_ZERO.getCode())
+                .eq(TbOrders::getIsPay, 0);
+
+        return tbOrdersMapper.delete(wrapper) == ids.size();
+    }
 }

+ 11 - 10
sp-service/level-two-server/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>two</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,9 +115,9 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
-<!--        <appender-ref ref="STDOUT"/>-->
+        <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>
         <!--<appender-ref ref="FILEWARN"/>-->
         <appender-ref ref="FILE_INFO"/>

+ 7 - 0
sp-service/payment-server/src/main/java/com/pj/utils/CryptoUtil.java

@@ -76,4 +76,11 @@ public class CryptoUtil {
         logger.debug("解密出来的 明文:{}", new String(plainBytesDecrypted, StandardCharsets.UTF_8));
         return new String(plainBytesDecrypted, StandardCharsets.UTF_8);
     }
+
+
+    public static void main(String[] args) {
+        String srt="10647709f1b40467917932891d4360bb4759d7b45a931e416fdefc176ece24b941ddd67999dde1e03377cf8ab903abe8cda5e57d8d0f82892a0717fb14faa0fd3604ba07c632ff8c70a9cdf821ff82732122cf2dba8b3e6587cab29ac8fbbe80616fa56a6ce27c92b075ed970523842f12455e488452a82bd15a3693d5643554ec9609459d2ea0ab97145630795b0f333e66d8ae8cb564d57c6272e370fa96de6ef24b01c22063b3f2b60358b14353d363c5e5b77db5f57b20823afedd23a7bbcfaa76e56f730f91c6882d29f3d3a5301b87af39d16712dbf8dcac0aa03d74a485ab22978a6b39ab75bb825a2b3965ff927ff8f82bc9f465c9592f74bd0c14f92e";
+        System.out.println(decrypt(srt));
+
+    }
 }

+ 12 - 11
sp-service/payment-server/src/main/resources/logback.xml

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
-    <contextName>payment</contextName>
+    <contextName>pay</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,9 +115,9 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
-<!--        <appender-ref ref="STDOUT"/>-->
+        <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>
         <!--<appender-ref ref="FILEWARN"/>-->
         <appender-ref ref="FILE_INFO"/>

+ 0 - 3
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -132,9 +132,6 @@ public class AppUserController {
         if (StrUtil.isEmpty(faceId)) {
             return AjaxJson.getSuccess();
         }
-        AppUser db = appUserService.getById(appUserDto.getId());
-        db.setFaceId(null).setFace(0).setFaceTime(null);
-        appUserService.updateById(db);
         appUserService.cleanFace(faceId);
         return AjaxJson.getSuccess();
     }

+ 2 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.java

@@ -31,4 +31,6 @@ public interface AppUserMapper extends BaseMapper <AppUser> {
 	Map<String, Object> selectUsers();
 
     void changeBindShopStatus(@Param("fkId") String fkId, @Param("bindShop")Integer bindShop);
+
+    void cleanFace(String faceId);
 }

+ 3 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.xml

@@ -19,6 +19,9 @@
     <update id="changeBindShopStatus">
 		update app_user set bind_shop=#{bindShop} where fk_id=#{fkId}
 	</update>
+    <update id="cleanFace">
+		update app_user set face_id=null,face=0,face_time=null where face_id=#{faceId}
+	</update>
 
 
     <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->

+ 18 - 4
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -660,7 +660,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
             AppUser db = getById(loginId);
             VerifyVO result = faceFactory.handler().verify(db.getFaceId(), img);
             if (!result.isSuccess()) {
-                if (result.getMsg().contains("人员ID不存在")){
+                if (result.getMsg().contains("人员ID不存在")) {
                     faceFactory.handler().createPersonByBase(db.getFaceId(), db.getName(), img);
                     return;
                 }
@@ -689,12 +689,25 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
      * @param type
      */
     public void authFace(Long loginId, String img, Integer type) {
+        boolean hasPerson = faceFactory.handler().checkHasPerson(img);
+        if (!hasPerson){
+            throw new AjaxError("请正视摄像头");
+        }
         if (type == 2) {
             AppUser db = getById(loginId);
-            VerifyVO result = faceFactory.handler().verify(db.getFaceId(), img);
+            String faceId = db.getFaceId();
+            if (StrUtil.isEmpty(faceId)) {
+                throw new AjaxError("人脸未录入");
+            }
+            VerifyVO result = faceFactory.handler().verify(faceId, img);
             if (!result.isSuccess()) {
-                if (result.getMsg().contains("人员ID不存在")){
-                    faceFactory.handler().createPersonByBase(db.getFaceId(), db.getName(), img);
+                if (result.getMsg().contains("人员ID不存在")) {
+                    faceFactory.handler().createPersonByBase(faceId, db.getName(), img);
+                    return;
+                }
+                if (result.getMsg().contains("不匹配")) {
+                    faceFactory.handler().deletePerson(faceId);
+                    faceFactory.handler().createPersonByBase(faceId, db.getName(), img);
                     return;
                 }
                 log.info("Verification:{},{}", loginId, img);
@@ -874,5 +887,6 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 
     public void cleanFace(String faceId) {
         faceFactory.handler().deletePerson(faceId);
+        appUserMapper.cleanFace(faceId);
     }
 }

+ 21 - 0
sp-service/sp-admin/src/main/java/com/pj/project4sp/startup/StartUpInit.java

@@ -0,0 +1,21 @@
+package com.pj.project4sp.startup;
+
+import com.pj.current.config.SystemObject;
+import com.pj.face.brand.FaceBrand;
+import com.pj.face.config.FaceEngineConfig;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StartUpInit implements CommandLineRunner {
+
+    @Override
+    public void run(String... args) throws Exception {
+        String systemSetting=SystemObject.config.getFaceType();
+        String domain=SystemObject.config.getDomain();
+        String type=FaceBrand.ARCSOFT.getType();
+        if (type.equals(systemSetting)) {
+            FaceEngineConfig.initFaceEngine();
+        }
+    }
+}

+ 11 - 10
sp-service/sp-admin/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>admin</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,9 +115,9 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
-<!--        <appender-ref ref="STDOUT"/>-->
+        <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>
         <!--<appender-ref ref="FILEWARN"/>-->
         <appender-ref ref="FILE_INFO"/>