From 458c3c22030b1ddccccacfd03116a2829a5ace03 Mon Sep 17 00:00:00 2001 From: jia <2744404105@qq.com> Date: Wed, 1 May 2024 10:09:17 +0800 Subject: [PATCH] OCR --- .idea/encodings.xml | 1 + .idea/inspectionProfiles/Project_Default.xml | 6 + .idea/misc.xml | 2 +- .idea/uiDesigner.xml | 124 +++++++++++++++++ .../java/com/bwie/common/domain/Team.java | 48 +++++++ bwie-modules/bwie-authen/pom.xml | 74 +++++++++++ .../main/java/com/bwie/authen/AuthenApp.java | 14 ++ .../authen/controller/AuthenController.java | 63 +++++++++ .../bwie/authen/service/AuthenService.java | 33 +++++ .../authen/service/AuthenServiceImpl.java | 125 ++++++++++++++++++ .../java/com/bwie/authen/util/AliveUtil.java | 62 +++++++++ .../com/bwie/authen/util/IdCheckUtil.java | 70 ++++++++++ .../java/com/bwie/authen/util/OCRUtil.java | 90 +++++++++++++ .../java/com/bwie/authen/util/OSSupload.java | 105 +++++++++++++++ .../authen/util/ThreadPoolExecutorConfig.java | 31 +++++ .../java/com/bwie/authen/vo/AliveData.java | 13 ++ .../java/com/bwie/authen/vo/AliveMotions.java | 11 ++ .../java/com/bwie/authen/vo/AliveReq.java | 14 ++ .../java/com/bwie/authen/vo/AliveRes.java | 19 +++ .../java/com/bwie/authen/vo/AuthenReq.java | 31 +++++ .../java/com/bwie/authen/vo/IdCheckReq.java | 13 ++ .../com/bwie/authen/vo/IdCheckResponse.java | 30 +++++ .../main/java/com/bwie/authen/vo/IdData.java | 16 +++ .../java/com/bwie/authen/vo/OCRConfig.java | 13 ++ .../main/java/com/bwie/authen/vo/OCRReq.java | 15 +++ .../java/com/bwie/authen/vo/OCRResponse.java | 27 ++++ .../src/main/resources/bootstrap.yml | 58 ++++++++ .../src/main/resources/mapper/SysMapper.xml | 5 + bwie-modules/bwie-team/pom.xml | 4 +- .../src/main/java/com/bwie/team/TeamApp.java | 13 ++ .../bwie/team/controller/BackController.java | 32 +++++ .../bwie/team/controller/TeamController.java | 18 +++ .../java/com/bwie/team/mapper/BackMapper.java | 13 ++ .../java/com/bwie/team/mapper/TeamMapper.java | 8 ++ .../com/bwie/team/service/BackService.java | 12 ++ .../com/bwie/team/service/TeamService.java | 8 ++ .../bwie/team/service/TeamServiceImpl.java | 4 - .../team/service/impl/BackServiceImpl.java | 30 +++++ .../team/service/impl/TeamServiceImpl.java | 27 ++++ .../main/java/com/bwie/team/vo/AddGroup.java | 36 +++++ .../src/main/java/com/bwie/team/vo/Goods.java | 15 +++ .../main/java/com/bwie/team/vo/GoodsSku.java | 20 +++ .../main/java/com/bwie/team/vo/GroupSku.java | 19 +++ .../main/java/com/bwie/team/vo/SkuBack.java | 15 +++ .../src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/mapper/BackMapper.xml | 18 +++ .../src/main/resources/mapper/TeamMapper.xml | 4 + bwie-modules/bwie-xxl/pom.xml | 4 +- bwie-modules/pom.xml | 1 + 49 files changed, 1407 insertions(+), 11 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 bwie-common/src/main/java/com/bwie/common/domain/Team.java create mode 100644 bwie-modules/bwie-authen/pom.xml create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/AuthenApp.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/AliveUtil.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/IdCheckUtil.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OSSupload.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/ThreadPoolExecutorConfig.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveData.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveMotions.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveReq.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveRes.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckReq.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckResponse.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdData.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRConfig.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java create mode 100644 bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java create mode 100644 bwie-modules/bwie-authen/src/main/resources/bootstrap.yml create mode 100644 bwie-modules/bwie-authen/src/main/resources/mapper/SysMapper.xml create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/TeamApp.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/BackController.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/BackMapper.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/service/BackService.java delete mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/BackServiceImpl.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/TeamServiceImpl.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/AddGroup.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/Goods.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GoodsSku.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GroupSku.java create mode 100644 bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/SkuBack.java create mode 100644 bwie-modules/bwie-team/src/main/resources/mapper/BackMapper.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 2b1474b..7d7de4a 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -4,6 +4,7 @@ + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..c32584c --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 67e1e61..d5cd614 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bwie-common/src/main/java/com/bwie/common/domain/Team.java b/bwie-common/src/main/java/com/bwie/common/domain/Team.java new file mode 100644 index 0000000..b2df9f1 --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/Team.java @@ -0,0 +1,48 @@ +package com.bwie.common.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("group") +public class Team { + private Long id; + private Long goodsSpuId; + private String title; + private String groupIntroduce; + private Date groupStart; + private String unit; + private Date groupEnd; + private Integer hours; + private Integer groupPeople; + private Integer groupNum; + private Integer sort; + private BigDecimal groupOrigin; + private Integer freightStatus; + private Integer activityStatus; + private Date createTime; + private Date updateTime; + private Integer isDelete; + + + + + + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/pom.xml b/bwie-modules/bwie-authen/pom.xml new file mode 100644 index 0000000..905c8fb --- /dev/null +++ b/bwie-modules/bwie-authen/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.bwie + bwie-modules + 1.0.0 + ../pom.xml + + + bwie-authen + + + 8 + 8 + UTF-8 + + + + + com.bwie + bwie-common + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.alibaba + druid-spring-boot-starter + 1.2.8 + + + + mysql + mysql-connector-java + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.2 + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.4.1 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.aliyun.oss + aliyun-sdk-oss + 3.10.2 + + + io.netty + netty-codec-http + + + + diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/AuthenApp.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/AuthenApp.java new file mode 100644 index 0000000..372ae41 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/AuthenApp.java @@ -0,0 +1,14 @@ +package com.bwie.authen; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@EnableDiscoveryClient +public class AuthenApp { + public static void main(String[] args) { + SpringApplication.run(AuthenApp.class); + } +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java new file mode 100644 index 0000000..028af19 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java @@ -0,0 +1,63 @@ +package com.bwie.authen.controller; + +import com.bwie.authen.service.AuthenService; +import com.bwie.authen.vo.AliveReq; +import com.bwie.authen.vo.AuthenReq; +import com.bwie.authen.vo.IdCheckReq; +import com.bwie.authen.vo.OCRReq; +import com.bwie.common.result.Result; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.concurrent.ExecutionException; + +@RestController +public class AuthenController { + private final AuthenService authenService; + + public AuthenController(AuthenService authenService) { + this.authenService = authenService; + } + + @PostMapping("ocrScan") + public Result ocrScan(@RequestBody OCRReq ocrReq) throws IOException { + Result result = authenService.ocrScan(ocrReq); + return result; + } + + @PostMapping("commitAuthen") + public Result commitAuthen(@RequestBody AuthenReq authenReq) throws ExecutionException, InterruptedException { + Result result = authenService.commitAuthen(authenReq); + return result; + } + + + + + + + @PostMapping("upload") + public Result upload(@RequestParam("file")MultipartFile multipartFile) throws IOException { + String upload = authenService.upload(multipartFile); + return Result.success(upload); + } + + + @PostMapping("idCheck") + public Result idCheck(@RequestBody IdCheckReq ocrReq) { + Result result = authenService.idCheck(ocrReq); + return result; + } + @PostMapping("alive") + public Result alive(@RequestBody AliveReq ocrReq) { + Result result = authenService.alive(ocrReq); + return result; + } +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java new file mode 100644 index 0000000..09dc195 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java @@ -0,0 +1,33 @@ +package com.bwie.authen.service; + +import com.bwie.authen.vo.AliveReq; +import com.bwie.authen.vo.AuthenReq; +import com.bwie.authen.vo.IdCheckReq; +import com.bwie.authen.vo.OCRReq; +import com.bwie.common.result.Result; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.concurrent.ExecutionException; + +public interface AuthenService { + Result ocrScan(OCRReq ocrReq) throws IOException; + + Result commitAuthen(AuthenReq authenReq) throws ExecutionException, InterruptedException; + + + + + + + + String upload(MultipartFile multipartFile) throws IOException; + + + Result idCheck(IdCheckReq ocrReq); + + Result alive(AliveReq ocrReq); +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java new file mode 100644 index 0000000..a4eed41 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java @@ -0,0 +1,125 @@ +package com.bwie.authen.service; + +import com.bwie.authen.util.*; +import com.bwie.authen.vo.*; +import com.bwie.common.result.Result; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.Serializable; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.stream.Collectors; + +@Service +@Log4j2 +public class AuthenServiceImpl implements AuthenService{ + + private final OSSupload osSupload; + private final IdCheckUtil idCheckUtil; + private final OCRUtil ocrUtil; + private final AliveUtil aliveUtil; + private final ThreadPoolExecutorConfig config; + + public AuthenServiceImpl(OSSupload osSupload, IdCheckUtil idCheckUtil, OCRUtil ocrUtil, AliveUtil aliveUtil, ThreadPoolExecutorConfig config) { + this.osSupload = osSupload; + this.idCheckUtil = idCheckUtil; + this.ocrUtil = ocrUtil; + this.aliveUtil = aliveUtil; + this.config = config; + } + + @Override + public Result ocrScan(OCRReq ocrReq) throws IOException { + OCRResponse send = ocrUtil.send(ocrReq); + return Result.success(send); + } + + @Override + public Result commitAuthen(AuthenReq authenReq) throws ExecutionException, InterruptedException { + ThreadPoolExecutor threadPoolExecutor = config.threadPoolExecutor(); + CompletableFuture f1 = CompletableFuture.supplyAsync(() -> { + IdCheckReq idCheckReq = new IdCheckReq(); + idCheckReq.setName(authenReq.getName()); + idCheckReq.setIdCardNo(authenReq.getIdCord()); + IdCheckResponse idcheck = idCheckUtil.idcheck(idCheckReq); + return idcheck.getIdData().getResult(); + },threadPoolExecutor); + + CompletableFuture f2= CompletableFuture.supplyAsync(() -> { + + String upload = null; + try { + upload = osSupload.upload(authenReq.getMovie()); + } catch (IOException e) { + throw new RuntimeException(e); + } + + + if(upload==null){ + return false; + } + //url添加数据库 + AliveReq aliveReq = new AliveReq(); + aliveReq.setUrl(upload); + aliveReq.setMotions(authenReq.getMotions()); + AliveRes alive = aliveUtil.alive(aliveReq); + String success = alive.getSuccess(); + return success; + },threadPoolExecutor); + + CompletableFuture f3 = CompletableFuture.supplyAsync(() -> { + String upload = null; + try { + upload = osSupload.upload(authenReq.getImg2()); + } catch (IOException e) { + throw new RuntimeException(e); + } + String upload2 = null; + try { + upload2 = osSupload.upload(authenReq.getMovie()); + } catch (IOException e) { + throw new RuntimeException(e); + } + if(upload==null ||upload2==null){ + return 1; + } + //存入数据库 + return 0; + },threadPoolExecutor); + + Integer i = f1.get(); + Serializable serializable = f2.get(); + Integer b1 = f3.get(); + + if ((i == 0) && serializable.equals("true")||b1==0) { + return Result.success(); + } + return Result.error(); + } + + + @Override + public String upload(MultipartFile multipartFile) throws IOException { + return osSupload.upload(multipartFile); + } + + + + @Override + public Result idCheck(IdCheckReq ocrReq) { + IdCheckResponse idcheck = idCheckUtil.idcheck(ocrReq); + return Result.success(idcheck); + } + + @Override + public Result alive(AliveReq ocrReq) { + AliveRes alive = aliveUtil.alive(ocrReq); + return Result.success(alive); + } +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/AliveUtil.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/AliveUtil.java new file mode 100644 index 0000000..de9f507 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/AliveUtil.java @@ -0,0 +1,62 @@ +package com.bwie.authen.util; + +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.bwie.authen.vo.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +import java.util.HashMap; +import java.util.Map; + + +@Configuration +public class AliveUtil { + @Value("${alive.appcode}") + private String appcode; + @Value("${alive.host}") + private String host; + + public AliveRes alive(AliveReq aliveReq){ + Map stringStringMap = new HashMap<>(); + stringStringMap.put("url", aliveReq.getUrl()); + stringStringMap.put("motions", aliveReq.getMotions()); + String result = HttpUtil.createPost(host ) // 不在URL中拼接查询参数,因为我们将它们放在请求体中 + .header("Authorization", "APPCODE " + appcode) + .form(stringStringMap) + .execute() + .body(); + System.out.println("result = " + result); + AliveRes aliveRes = JSON.parseObject(result, AliveRes.class); + AliveData aliveData = JSON.parseObject(aliveRes.getData(), AliveData.class); + AliveMotions aliveMotions = JSON.parseObject(aliveData.getMotions(), AliveMotions.class); + aliveData.setAliveMotions(aliveMotions); + aliveRes.setAliveData(aliveData); +// msgResponse.setIdData(idData); + if(aliveRes.getCode()!=200){ + System.out.println("msgResponse = -------------------" + aliveRes.getMsg()); + throw new RuntimeException(aliveRes.getMsg()); + } + return aliveRes; + + } + + + + + + + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/IdCheckUtil.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/IdCheckUtil.java new file mode 100644 index 0000000..39d92c0 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/IdCheckUtil.java @@ -0,0 +1,70 @@ +package com.bwie.authen.util; + +import cn.hutool.http.HttpResponse; + +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.bwie.authen.vo.IdCheckReq; +import com.bwie.authen.vo.IdCheckResponse; + +import com.bwie.authen.vo.IdData; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +import java.util.HashMap; +import java.util.Map; + +@Configuration +public class IdCheckUtil { + @Value("${idcheck.appcode}") + private String appcode; + @Value("${idcheck.host}") + private String host; + @Value("${idcheck.path}") + private String path; + + +public IdCheckResponse idcheck(IdCheckReq idCheckReq){ + + Map stringStringMap = new HashMap<>(); + stringStringMap.put("name", idCheckReq.getName()); + stringStringMap.put("idCardNo", idCheckReq.getIdCardNo()); + String result = HttpUtil.createPost(host + path) // 不在URL中拼接查询参数,因为我们将它们放在请求体中 + .header("Authorization", "APPCODE " + appcode) + .form(stringStringMap) + .execute() + .body(); + System.out.println("result = " + result); + IdCheckResponse msgResponse = JSON.parseObject(result, IdCheckResponse.class); + IdData idData = JSON.parseObject(msgResponse.getData(), IdData.class); + msgResponse.setIdData(idData); + if(msgResponse.getCode()!=200){ + System.out.println("msgResponse = -------------------" + msgResponse); + throw new RuntimeException(msgResponse.getMsg()); + } + return msgResponse; + + + + +} + + + + + + + + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java new file mode 100644 index 0000000..5781b4a --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java @@ -0,0 +1,90 @@ +package com.bwie.authen.util; +import cn.hutool.core.codec.Base64; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.bwie.authen.vo.OCRReq; +import com.bwie.authen.vo.OCRResponse; + + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; + + +@Configuration +public class OCRUtil { + @Value("${ocr.appcode}") + private String appcode; + @Value("${ocr.host}") + private String host; + @Value("${ocr.Content-Type}") + private String contentType; + @Value("${ocr.path}") + private String path; + + public OCRResponse send(OCRReq ocrReq) throws IOException { + + +// 对图像进行base64编码 + + String encode = Base64.encode(ocrReq.getUrl().getBytes()); + +// 拼装请求body的json字符串 + JSONObject requestObj = new JSONObject(); + requestObj.put("image", encode); + requestObj.put("side", ocrReq.getSide()); // 假设ocrReq有getSide()方法返回要识别的身份证面(正/反) +// 如果API还有其他配置参数,可以从ocrReq中获取并添加到requestObj中 + + String bodys = requestObj.toString(); + + try { + // 创建并执行POST请求 + String result = HttpUtil.createPost(host + path) // 不在URL中拼接查询参数,因为我们将它们放在请求体中 + .header("Authorization", "APPCODE " + appcode) + .header("Content-Type", contentType) // 确保这里与headers中的Content-Type一致 + .body(bodys) // 设置请求体 + .execute() + .body(); + + System.out.println("result = " + result); + + OCRResponse msgResponse = JSON.parseObject(result, OCRResponse.class); + + // 检查是否成功,而不是使用Assert(Assert通常用于测试) + if (!msgResponse.equals("true")) { + // 处理失败情况,例如记录日志或返回错误信息给调用者 + throw new RuntimeException("扫描失败" ); // 假设OCRResponse有一个getErrorMessage方法 + } + + // 成功处理逻辑 + return msgResponse; + } catch (Exception e) { + // 处理异常,例如记录日志或返回错误信息给调用者 + e.printStackTrace(); + throw new RuntimeException("请求OCR服务时发生异常", e); + } + + } + + + + +} + + + + + + + + + diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OSSupload.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OSSupload.java new file mode 100644 index 0000000..ff9c633 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OSSupload.java @@ -0,0 +1,105 @@ +package com.bwie.authen.util; + +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.model.ObjectMetadata; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.security.SecureRandom; +import java.text.SimpleDateFormat; +import java.util.Date; +@Log4j2 +@Configuration +public class OSSupload { + @Value("${aliyun.end-point}") + private String endPoint; + + + @Value("${aliyun.access-key-id}") + private String accessKeyId; + + @Value("${aliyun.access-key-secret}") + private String accesskeySecret; + +// @Value("${aliyun.access-pre}") +// private String accessPre; + + @Value("${aliyun.bucket-name}") + private String bucketName; + + public String upload(MultipartFile multipartFile) throws IOException { + + + OSSClient ossClient = new OSSClient(endPoint, accessKeyId, accesskeySecret); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); +// 获取文件名 + String fileName = multipartFile.getOriginalFilename(); +// 获取文件后缀名 + String suffixName = fileName.substring(fileName.lastIndexOf(".")); +// 最后上传生成的文件名 + String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + suffixName; +// oss中的文件夹名 + String objectName = sdf.format(new Date()) + "/" + finalFileName; +// 创建上传文件的元信息,可以通过文件元信息设置HTTP header(设置了才能通过返回的链接直接访问)。 + ObjectMetadata objectMetadata = new ObjectMetadata(); + String contentType = getcontentType(suffixName.substring(suffixName.lastIndexOf("."))); // 注意这里加1 + objectMetadata.setContentType(contentType); + // 设置Content-Disposition为inline + objectMetadata.setContentDisposition("inline"); +// 文件上传 + ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(multipartFile.getBytes()), objectMetadata); +//// 设置URL过期时间为1小时。 +// Date expiration = new Date(System.currentTimeMillis() + 3600 * 1000); + // 构造对象的完整URL + String url = "http://" + bucketName + "." + endPoint + "/" + objectName; + + log.info("阿里云OSS的文件url:{}", url); + ossClient.shutdown(); + return url; + } + public static String getcontentType(String FilenameExtension) { + if (FilenameExtension.equalsIgnoreCase(".bmp")) { + return "image/bmp"; + } + if (FilenameExtension.equalsIgnoreCase(".gif")) { + return "image/gif"; + } + if (FilenameExtension.equalsIgnoreCase(".jpeg") || + FilenameExtension.equalsIgnoreCase(".jpg") || + FilenameExtension.equalsIgnoreCase(".png")) { + return "image/jpg"; + } + if (FilenameExtension.equalsIgnoreCase(".html")) { + return "text/html"; + } + if (FilenameExtension.equalsIgnoreCase(".txt")) { + return "text/plain"; + } + if (FilenameExtension.equalsIgnoreCase(".vsd")) { + return "application/vnd.visio"; + } + if (FilenameExtension.equalsIgnoreCase(".pptx") || + FilenameExtension.equalsIgnoreCase(".ppt")) { + return "application/vnd.ms-powerpoint"; + } + if (FilenameExtension.equalsIgnoreCase(".docx") || + FilenameExtension.equalsIgnoreCase(".doc")) { + return "application/msword"; + } + if (FilenameExtension.equalsIgnoreCase(".xml")) { + return "text/xml"; + } + return "image/jpg"; + } + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/ThreadPoolExecutorConfig.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/ThreadPoolExecutorConfig.java new file mode 100644 index 0000000..d7306b6 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/ThreadPoolExecutorConfig.java @@ -0,0 +1,31 @@ +package com.bwie.authen.util; + +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +@Configuration +@Log4j2 +public class ThreadPoolExecutorConfig { + @Value("${authen.coreSize}") + private Integer coreSize; + @Value("${authen.coreMax}") + private Integer coreMax; + + + + @Bean + public ThreadPoolExecutor threadPoolExecutor(){ +// int coreSize = 3 * Runtime.getRuntime().availableProcessors(); +// int coreMax = coreSize + 30; + ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(coreSize, coreMax, 5, TimeUnit.SECONDS, + new LinkedBlockingQueue<>(100)); + return threadPoolExecutor; + } + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveData.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveData.java new file mode 100644 index 0000000..37b200c --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveData.java @@ -0,0 +1,13 @@ +package com.bwie.authen.vo; + +import lombok.Data; + +@Data +public class AliveData{ + private boolean passed; + private String feature_image_id; + private String hack_score; + private String order_no; + private String motions; + private AliveMotions aliveMotions; +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveMotions.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveMotions.java new file mode 100644 index 0000000..7624c38 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveMotions.java @@ -0,0 +1,11 @@ +package com.bwie.authen.vo; + +import lombok.Data; + +@Data +public class AliveMotions{ + private Double score; + private String motion; + private boolean passed; + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveReq.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveReq.java new file mode 100644 index 0000000..c711812 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveReq.java @@ -0,0 +1,14 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class AliveReq { + private String url; + private String motions; +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveRes.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveRes.java new file mode 100644 index 0000000..f637b9b --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveRes.java @@ -0,0 +1,19 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class AliveRes { + + private Integer code; + private String msg; + private String data; + private String success; + private AliveData aliveData; + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java new file mode 100644 index 0000000..9963129 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java @@ -0,0 +1,31 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class AuthenReq { + private String motions; + private MultipartFile img1; + private MultipartFile img2; + private MultipartFile movie; + private String name; + private String idCord; + + + + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckReq.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckReq.java new file mode 100644 index 0000000..b63d62c --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckReq.java @@ -0,0 +1,13 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class IdCheckReq { + private String name; + private String idCardNo; +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckResponse.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckResponse.java new file mode 100644 index 0000000..bc2815a --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckResponse.java @@ -0,0 +1,30 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class IdCheckResponse { + + private Integer code; + private String msg; + private String taskNo; // 本次请求号 + private IdData idData; + private String data; + + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdData.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdData.java new file mode 100644 index 0000000..6b38d11 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdData.java @@ -0,0 +1,16 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class IdData { + private Integer result;// 0: 一致,1: 不一致 + private String desc;//描述 + private String sex;//性别 + private String birthday; + private String address;//地址 +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRConfig.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRConfig.java new file mode 100644 index 0000000..06f3122 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRConfig.java @@ -0,0 +1,13 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OCRConfig { + private String side; + private String url; +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java new file mode 100644 index 0000000..8d88bc7 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java @@ -0,0 +1,15 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; + +@Data +@NoArgsConstructor +public class OCRReq { + private String side; + private MultipartFile url; + + +} diff --git a/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java new file mode 100644 index 0000000..dac2037 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java @@ -0,0 +1,27 @@ +package com.bwie.authen.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OCRResponse { + private String address; + private String name; + private String sex; + private String num; + private String birth; + private boolean success; + + + + + + + + + + +} diff --git a/bwie-modules/bwie-authen/src/main/resources/bootstrap.yml b/bwie-modules/bwie-authen/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..8da42c9 --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/resources/bootstrap.yml @@ -0,0 +1,58 @@ +# Tomcat +server: + port: 9004 +# Spring +spring: + main: + allow-circular-references: true + allow-bean-definition-overriding: true + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + application: + # 应用名称 + name: bwie-authen + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 124.221.177.197:8848 + config: + # 配置中心地址 + server-addr: 124.221.177.197:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + + +aliyun: + end-point: oss-cn-shanghai.aliyuncs.com + access-key-id: LTAI5tEoxVDPCxDpxXLRjUuz + access-key-secret: 503OGWrDojxpI5fNrojaXaRJC6ya6y +# access-pre: https://dongxiaojie.oss-cn-shanghai.aliyuncs.com + bucket-name: ueana + +ocr: + host: https://cardnumber.market.alicloudapi.com + path: /rest/160601/ocr/ocr_idcard.json + appcode: 13a8b5b781bc4c458ce2de65ed79be80 + Content-Type: application/json; charset=UTF-8 + +idcheck: + host: https://jumdata.market.alicloudapi.com + path: /idcard/validate + appcode: 13a8b5b781bc4c458ce2de65ed79be80 + +alive: + appcode: 13a8b5b781bc4c458ce2de65ed79be80 + host: https://life.shumaidata.com/checklife + + +authen: + coreSize: 21 + coreMax: 51 diff --git a/bwie-modules/bwie-authen/src/main/resources/mapper/SysMapper.xml b/bwie-modules/bwie-authen/src/main/resources/mapper/SysMapper.xml new file mode 100644 index 0000000..d8da7bb --- /dev/null +++ b/bwie-modules/bwie-authen/src/main/resources/mapper/SysMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/bwie-modules/bwie-team/pom.xml b/bwie-modules/bwie-team/pom.xml index 6d402d8..38b5ef3 100644 --- a/bwie-modules/bwie-team/pom.xml +++ b/bwie-modules/bwie-team/pom.xml @@ -12,8 +12,8 @@ bwie-team - 17 - 17 + 8 + 8 UTF-8 diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/TeamApp.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/TeamApp.java new file mode 100644 index 0000000..1f965a3 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/TeamApp.java @@ -0,0 +1,13 @@ +package com.bwie.team; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@SpringBootApplication +@EnableDiscoveryClient +public class TeamApp { + public static void main(String[] args) { + SpringApplication.run(TeamApp.class); + } +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/BackController.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/BackController.java new file mode 100644 index 0000000..eb2e59d --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/BackController.java @@ -0,0 +1,32 @@ +package com.bwie.team.controller; + +import com.bwie.common.result.Result; +import com.bwie.team.service.BackService; +import com.bwie.team.vo.Goods; +import com.bwie.team.vo.SkuBack; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +public class BackController { + private final BackService backService; + + public BackController(BackService backService) { + this.backService = backService; + } + + @PostMapping("findSpu") + public Result findSpu(@RequestParam Long spuId){ + SkuBack skuBack = backService.findSpu(spuId); + return Result.success(skuBack); + } + + + + + + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java index 2e3eefb..66fd697 100644 --- a/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java @@ -1,4 +1,22 @@ package com.bwie.team.controller; +import com.bwie.common.result.Result; +import com.bwie.team.service.TeamService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController public class TeamController { + private final TeamService teamService; + + public TeamController(TeamService teamService) { + this.teamService = teamService; + } + + @GetMapping("show") + public Result show(){ + return Result.success(teamService.show()); + } + + } diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/BackMapper.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/BackMapper.java new file mode 100644 index 0000000..e2bb079 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/BackMapper.java @@ -0,0 +1,13 @@ +package com.bwie.team.mapper; + +import com.bwie.team.vo.Goods; +import com.bwie.team.vo.GoodsSku; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +@Mapper +public interface BackMapper { + List findspu(Long spuId); + + List findsku(Long spuId); +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java index a9b6ee7..41445df 100644 --- a/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java @@ -1,4 +1,12 @@ package com.bwie.team.mapper; +import com.bwie.common.domain.Team; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper public interface TeamMapper { + List show(); + } diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/BackService.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/BackService.java new file mode 100644 index 0000000..fb4f16f --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/BackService.java @@ -0,0 +1,12 @@ +package com.bwie.team.service; + +import com.bwie.team.vo.Goods; +import com.bwie.team.vo.GoodsSku; +import com.bwie.team.vo.SkuBack; + +import java.util.List; + +public interface BackService { + SkuBack findSpu(Long spuId); + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java index d5a2f93..910ce10 100644 --- a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java @@ -1,7 +1,15 @@ package com.bwie.team.service; +import com.aliyun.tea.Tea; +import com.bwie.common.domain.Team; +import com.bwie.team.vo.GroupSku; + + +import java.util.List; + public interface TeamService { // 查询商品信息 + List show(); diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java deleted file mode 100644 index 69f1979..0000000 --- a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.bwie.team.service; - -public class TeamServiceImpl { -} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/BackServiceImpl.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/BackServiceImpl.java new file mode 100644 index 0000000..fab2213 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/BackServiceImpl.java @@ -0,0 +1,30 @@ +package com.bwie.team.service.impl; + +import com.bwie.team.mapper.BackMapper; +import com.bwie.team.service.BackService; +import com.bwie.team.vo.Goods; +import com.bwie.team.vo.GoodsSku; +import com.bwie.team.vo.SkuBack; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class BackServiceImpl implements BackService { + private final BackMapper backMapper; + + public BackServiceImpl(BackMapper backMapper) { + this.backMapper = backMapper; + } + + @Override + public SkuBack findSpu(Long spuId) { + List findspu = backMapper.findspu(spuId); + List findsku = backMapper.findsku(spuId); + SkuBack skuBack = new SkuBack(); + skuBack.setGg(findspu); + skuBack.setSkus(findsku); + return skuBack; + } +} + + diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/TeamServiceImpl.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/TeamServiceImpl.java new file mode 100644 index 0000000..5d50ccf --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/TeamServiceImpl.java @@ -0,0 +1,27 @@ +package com.bwie.team.service.impl; + +import com.bwie.common.domain.Team; +import com.bwie.team.mapper.TeamMapper; +import com.bwie.team.service.TeamService; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class TeamServiceImpl implements TeamService { + + private final TeamMapper teamMapper; + + public TeamServiceImpl(TeamMapper teamMapper) { + this.teamMapper = teamMapper; + } + + @Override + public List show() { + List show = teamMapper.show(); + + + + + return show; + } +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/AddGroup.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/AddGroup.java new file mode 100644 index 0000000..5100792 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/AddGroup.java @@ -0,0 +1,36 @@ +package com.bwie.team.vo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AddGroup { + private Long goodsSpuId; + private String title; + private String groupIntroduce; + private Date groupStart; + private Date groupEnd; + private Integer hours; + private String unit; + private Integer groupPeople; + private Integer groupNum; + private Integer sort; + private BigDecimal groupOrigin; + private Integer freightStatus; + private Integer activityStatus; + private Date createTime; + private Date updateTime; + private Listskus; + + + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/Goods.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/Goods.java new file mode 100644 index 0000000..396b1d7 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/Goods.java @@ -0,0 +1,15 @@ +package com.bwie.team.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Goods { + private String url; + private Integer defaultStatus; +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GoodsSku.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GoodsSku.java new file mode 100644 index 0000000..86c99be --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GoodsSku.java @@ -0,0 +1,20 @@ +package com.bwie.team.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class GoodsSku { + private String defaultImage; + private BigDecimal price; + private Integer weight; + private String attrName; + private String attrValue; + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GroupSku.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GroupSku.java new file mode 100644 index 0000000..07bf089 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GroupSku.java @@ -0,0 +1,19 @@ +package com.bwie.team.vo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class GroupSku { + private Long goodsSkuId; + private Integer groupNum; + private BigDecimal groupPrice; + +} diff --git a/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/SkuBack.java b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/SkuBack.java new file mode 100644 index 0000000..fd0785c --- /dev/null +++ b/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/SkuBack.java @@ -0,0 +1,15 @@ +package com.bwie.team.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SkuBack { + private List gg; + private List skus; +} diff --git a/bwie-modules/bwie-team/src/main/resources/bootstrap.yml b/bwie-modules/bwie-team/src/main/resources/bootstrap.yml index 12fa2a2..be0ec35 100644 --- a/bwie-modules/bwie-team/src/main/resources/bootstrap.yml +++ b/bwie-modules/bwie-team/src/main/resources/bootstrap.yml @@ -19,10 +19,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.221.177.197:8848 + server-addr: 124.221.30.134:8848 config: # 配置中心地址 - server-addr: 124.221.177.197:8848 + server-addr: 124.221.30.134:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/bwie-modules/bwie-team/src/main/resources/mapper/BackMapper.xml b/bwie-modules/bwie-team/src/main/resources/mapper/BackMapper.xml new file mode 100644 index 0000000..7cc9ea4 --- /dev/null +++ b/bwie-modules/bwie-team/src/main/resources/mapper/BackMapper.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml b/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml index 187f42b..a1208d1 100644 --- a/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml +++ b/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml @@ -2,4 +2,8 @@ + diff --git a/bwie-modules/bwie-xxl/pom.xml b/bwie-modules/bwie-xxl/pom.xml index 7b1d590..457cb8a 100644 --- a/bwie-modules/bwie-xxl/pom.xml +++ b/bwie-modules/bwie-xxl/pom.xml @@ -12,8 +12,8 @@ bwie-xxl - 17 - 17 + 8 + 8 UTF-8 diff --git a/bwie-modules/pom.xml b/bwie-modules/pom.xml index 9a18ffa..35861a0 100644 --- a/bwie-modules/pom.xml +++ b/bwie-modules/pom.xml @@ -15,6 +15,7 @@ bwie-system bwie-xxl bwie-team + bwie-authen