master
commit
ff022d0e90
|
@ -2,13 +2,9 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-kill/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-alipay/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-slide/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
<component name="MavenProjectsManager">
|
||||||
|
@ -15,5 +14,5 @@
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
File diff suppressed because one or more lines are too long
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-modules</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-authen</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- oss sdk-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.10.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-codec-http</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
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(@RequestParam String side,@RequestParam("file") MultipartFile url) throws IOException {
|
||||||
|
Result result = authenService.ocrScan(side,url);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("commitAuthen")
|
||||||
|
public Result commitAuthen(@RequestParam("face") MultipartFile img1,
|
||||||
|
@RequestParam("back") MultipartFile img2,
|
||||||
|
@RequestParam("file") MultipartFile movie,
|
||||||
|
AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||||
|
Result result = authenService.commitAuthen(img1,img2,movie,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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
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.common.result.Result;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public interface AuthenService {
|
||||||
|
Result ocrScan(String side, MultipartFile url) throws IOException;
|
||||||
|
Result commitAuthen(MultipartFile img1, MultipartFile img2, MultipartFile movie, AuthenReq authenReq) throws ExecutionException, InterruptedException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String upload(MultipartFile multipartFile) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
|
Result idCheck(IdCheckReq ocrReq);
|
||||||
|
|
||||||
|
Result alive(AliveReq ocrReq);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
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.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
@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( String side, MultipartFile url) throws IOException {
|
||||||
|
OCRResponse send = ocrUtil.send(side,url);
|
||||||
|
return Result.success(send);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result commitAuthen(MultipartFile img1, MultipartFile img2, MultipartFile movie, AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||||
|
ThreadPoolExecutor threadPoolExecutor = config.threadPoolExecutor();
|
||||||
|
CompletableFuture<Integer> f1 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
IdCheckReq idCheckReq = new IdCheckReq();
|
||||||
|
idCheckReq.setName(authenReq.getName());
|
||||||
|
idCheckReq.setIdCardNo(authenReq.getIdCord());
|
||||||
|
IdCheckResponse idcheck = idCheckUtil.idcheck(idCheckReq);
|
||||||
|
Integer result = idcheck.getIdData().getResult();
|
||||||
|
if(result!=0){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
OCRResponse send = ocrUtil.send("face", img1);
|
||||||
|
if(send.getNum().equals(authenReq.getIdCord())&&send.getName().equals(authenReq.getName())){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
},threadPoolExecutor);
|
||||||
|
|
||||||
|
CompletableFuture<? extends Serializable> f2= CompletableFuture.supplyAsync(() -> {
|
||||||
|
|
||||||
|
String upload = null;
|
||||||
|
try {
|
||||||
|
upload = osSupload.upload(movie);
|
||||||
|
} 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<Integer> f3 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
String upload = null;
|
||||||
|
try {
|
||||||
|
upload = osSupload.upload(img2);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
String upload2 = null;
|
||||||
|
try {
|
||||||
|
upload2 = osSupload.upload(movie);
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
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 com.bwie.common.result.Result;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|
||||||
|
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(String side, MultipartFile url) throws IOException {
|
||||||
|
|
||||||
|
|
||||||
|
// 对图像进行base64编码
|
||||||
|
|
||||||
|
String encode = Base64.encode(url.getBytes());
|
||||||
|
|
||||||
|
// 拼装请求body的json字符串
|
||||||
|
JSONObject requestObj = new JSONObject();
|
||||||
|
requestObj.put("image", encode);
|
||||||
|
requestObj.put("side", side); // 假设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.getSuccess().equals("true")) {
|
||||||
|
// 处理失败情况,例如记录日志或返回错误信息给调用者
|
||||||
|
throw new RuntimeException("扫描失败" ); // 假设OCRResponse有一个getErrorMessage方法
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成功处理逻辑
|
||||||
|
return msgResponse;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 处理异常,例如记录日志或返回错误信息给调用者
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("请求OCR服务时发生异常", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
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 String name;
|
||||||
|
private String idCord;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;//地址
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.authen.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OCRReq {
|
||||||
|
private String side;
|
||||||
|
private MultipartFile url;
|
||||||
|
}
|
|
@ -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 String success;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.system.mapper.SysMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-modules</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-kill</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.3</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.kill;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class KillApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(KillApplication.class,args);
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
LocalDateTime with = localDateTime.with(LocalTime.of(0, 0, 0));
|
||||||
|
System.out.println(localDateTime.toLocalTime());
|
||||||
|
System.out.println(with.toLocalDate().toString()+" 00:00:00");
|
||||||
|
String localeString = new Date().toLocaleString();
|
||||||
|
System.out.println(localeString);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.bwie.kill.config;
|
||||||
|
|
||||||
|
import org.redisson.Redisson;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.redisson.config.Config;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MyRedissonConfig {
|
||||||
|
@Bean
|
||||||
|
public RedissonClient getRedisson() {
|
||||||
|
// 默认连接地址 127.0.0.1:6379
|
||||||
|
// RedissonClient redisson = Redisson.create();
|
||||||
|
//1.创建配置
|
||||||
|
//Redis url should start with redis:// or rediss:// (for SSL connection)
|
||||||
|
Config config = new Config();
|
||||||
|
config.useSingleServer().setAddress("redis://124.221.30.134:6379");
|
||||||
|
//2.根据config创建处RedissonClient实例
|
||||||
|
RedissonClient redisson = Redisson.create(config);
|
||||||
|
return redisson;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/config")
|
||||||
|
public class KillConfigController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
private Result<PageResult<KillConfig>> getList(@RequestBody VoKillConfigRequest req){
|
||||||
|
return Result.success(
|
||||||
|
killConfigService.getList(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
private Result<String> getUpdate(@RequestBody KillConfig killConfig){
|
||||||
|
killConfigService.updateById(killConfig);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/save")
|
||||||
|
private Result<String> getSave(@RequestBody KillConfig killConfig){
|
||||||
|
killConfigService.save(killConfig);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete")
|
||||||
|
private Result<String> getDelete(@RequestParam Long id){
|
||||||
|
killConfigService.removeById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/goods")
|
||||||
|
public class KillGoodsController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsService killGoodsService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Result<PageResult<KillGoods>> getKillGoodsList(@RequestBody VoKillGoodsRequest req){
|
||||||
|
return Result.success(
|
||||||
|
killGoodsService.getKillGoodsList(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<String> getUpdate(@RequestBody KillGoods killGoods){
|
||||||
|
killGoodsService.updateById(killGoods);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<String> getAdd(@RequestBody KillGoods killGoods){
|
||||||
|
killGoodsService.save(killGoods);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/del")
|
||||||
|
public Result<String> getDel(@RequestParam Long id){
|
||||||
|
killGoodsService.removeById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/server")
|
||||||
|
public class KillGoodsServerController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsServerService killGoodsServerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/sku")
|
||||||
|
public class KillSkuAttrValueController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("kill")
|
||||||
|
public class killController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("goods_sku")
|
||||||
|
public class Goods {
|
||||||
|
/**
|
||||||
|
* skuId
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* spuId
|
||||||
|
*/
|
||||||
|
private Long spuId;
|
||||||
|
/**
|
||||||
|
* sku名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 所属分类id
|
||||||
|
*/
|
||||||
|
private Long catagoryId;
|
||||||
|
/**
|
||||||
|
* 默认图片
|
||||||
|
*/
|
||||||
|
private String defaultImage;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 副标题
|
||||||
|
*/
|
||||||
|
private String subtitle;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 重量(克)
|
||||||
|
*/
|
||||||
|
private Integer weight;
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_config")
|
||||||
|
public class KillConfig {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 秒杀名称
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 轮番图
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer killStatus;
|
||||||
|
/**
|
||||||
|
* 秒杀时段
|
||||||
|
*/
|
||||||
|
private String killDate;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_goods")
|
||||||
|
public class KillGoods {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 秒杀配置表id
|
||||||
|
*/
|
||||||
|
private Long configId;
|
||||||
|
/**
|
||||||
|
* 秒杀配置标题
|
||||||
|
*/
|
||||||
|
private String configTitle;
|
||||||
|
/**
|
||||||
|
* 秒杀时段
|
||||||
|
*/
|
||||||
|
private String killDate;
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long goodsSpuId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String goodsName;
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String goodsImage;
|
||||||
|
/**
|
||||||
|
* 活动标题
|
||||||
|
*/
|
||||||
|
private String activityTitle;
|
||||||
|
/**
|
||||||
|
* 原价
|
||||||
|
*/
|
||||||
|
private BigDecimal oldPrice;
|
||||||
|
/**
|
||||||
|
* 秒杀价
|
||||||
|
*/
|
||||||
|
private BigDecimal killPrice;
|
||||||
|
/**
|
||||||
|
* 活动简介
|
||||||
|
*/
|
||||||
|
private String activityIntroduce;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
/**
|
||||||
|
* 0:包邮 1:不包邮
|
||||||
|
*/
|
||||||
|
private Long freightStatus;
|
||||||
|
/**
|
||||||
|
* 当天参与活动次数
|
||||||
|
*/
|
||||||
|
private Integer activityNum;
|
||||||
|
/**
|
||||||
|
* 活动日期
|
||||||
|
*/
|
||||||
|
private Date activityDate;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private Integer activityStatus;
|
||||||
|
private String createTime;
|
||||||
|
private String updateTime;
|
||||||
|
private String isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_sku_attr_value")
|
||||||
|
public class KillSkuAttrValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 商品属性id
|
||||||
|
*/
|
||||||
|
private Long goodsSkuAttrId;
|
||||||
|
/**
|
||||||
|
* 秒杀表id
|
||||||
|
*/
|
||||||
|
private Long killGoodsId;
|
||||||
|
/**
|
||||||
|
* 秒杀价格
|
||||||
|
*/
|
||||||
|
private BigDecimal killPrice;
|
||||||
|
/**
|
||||||
|
* 限量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 锁定库存数
|
||||||
|
*/
|
||||||
|
private Integer lockNumber;
|
||||||
|
/**
|
||||||
|
* 剩余库存数
|
||||||
|
*/
|
||||||
|
private Integer lastNum;
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PagesUtil {
|
||||||
|
private Long total;
|
||||||
|
|
||||||
|
private List<KillGoods> list;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VoKillConfigRequest {
|
||||||
|
/**
|
||||||
|
* 秒杀名称
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer killStatus;
|
||||||
|
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
private Integer pageSize=3;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VoKillGoodsRequest {
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private Integer activityStatus;
|
||||||
|
/**
|
||||||
|
* 秒杀配置标题
|
||||||
|
*/
|
||||||
|
private String configTitle;
|
||||||
|
/**
|
||||||
|
* id或名称搜索
|
||||||
|
*/
|
||||||
|
private String goodsInfo;
|
||||||
|
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
private Integer pageSize=5;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import javax.annotation.ManagedBean;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillConfigMapper extends BaseMapper<KillConfig> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillGoodsMapper extends BaseMapper<KillGoods> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillSkuAttrValueMapper extends BaseMapper<KillSkuAttrValue> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
|
||||||
|
public interface GoodsService extends IService<Goods> {
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
|
||||||
|
public interface KillConfigService extends IService<KillConfig> {
|
||||||
|
/**
|
||||||
|
* 秒杀配置列表
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<KillConfig> getList(VoKillConfigRequest req);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
public interface KillGoodsServerService {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
|
||||||
|
public interface KillGoodsService extends IService<KillGoods> {
|
||||||
|
/**
|
||||||
|
* 秒杀商品列表
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<KillGoods> getKillGoodsList(VoKillGoodsRequest req);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
|
||||||
|
public interface KillSkuAttrValueService extends IService<KillSkuAttrValue> {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.mapper.GoodsMapper;
|
||||||
|
import com.bwie.kill.service.GoodsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods>
|
||||||
|
implements GoodsService {
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
import com.bwie.kill.mapper.KillConfigMapper;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillConfigServiceImpl extends ServiceImpl<KillConfigMapper, KillConfig>
|
||||||
|
implements KillConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KillConfig> getList(VoKillConfigRequest req) {
|
||||||
|
|
||||||
|
IPage<KillConfig> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
|
||||||
|
IPage<KillConfig> iPage = page(page, new LambdaQueryWrapper<KillConfig>()
|
||||||
|
.eq(KillConfig::getKillStatus, req.getKillStatus())
|
||||||
|
.eq(KillConfig::getTitle, req.getTitle()));
|
||||||
|
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillGoodsServerServiceImpl implements KillGoodsServerService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.utils.StringUtils;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.PagesUtil;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
import com.bwie.kill.mapper.KillGoodsMapper;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillGoodsServiceImpl extends ServiceImpl<KillGoodsMapper, KillGoods>
|
||||||
|
implements KillGoodsService {
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KillGoods> getKillGoodsList(VoKillGoodsRequest req) {
|
||||||
|
|
||||||
|
if (StringUtils.isAllBlank(req.getConfigTitle(),req.getGoodsInfo()) && req.getActivityStatus() == null){
|
||||||
|
|
||||||
|
if (redisCache.hasKey("listPage"+req.getPageNum())){
|
||||||
|
String cacheObject = redisCache.getCacheObject("listPage" + req.getPageNum());
|
||||||
|
PagesUtil pagesUtil = JSONObject.parseObject(cacheObject, PagesUtil.class);
|
||||||
|
return PageResult.toPageResult(pagesUtil.getTotal(),pagesUtil.getList());
|
||||||
|
}else {
|
||||||
|
IPage<KillGoods> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
IPage<KillGoods> iPage = page(page);
|
||||||
|
PagesUtil pagesUtil = PagesUtil.builder().total(iPage.getPages())
|
||||||
|
.list(iPage.getRecords())
|
||||||
|
.build();
|
||||||
|
redisCache.setCacheObject("listPage"+req.getPageNum(),JSONObject.toJSONString(pagesUtil));
|
||||||
|
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
IPage<KillGoods> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
LambdaQueryWrapper<KillGoods> queryWrapper = new LambdaQueryWrapper<KillGoods>();
|
||||||
|
if (req.getActivityStatus() != null){
|
||||||
|
queryWrapper.eq(KillGoods::getActivityStatus, req.getActivityStatus());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getConfigTitle())){
|
||||||
|
queryWrapper.eq(KillGoods::getConfigTitle, req.getConfigTitle());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getGoodsInfo())){
|
||||||
|
String str = req.getGoodsInfo();
|
||||||
|
if (str.matches("\\d+")){
|
||||||
|
queryWrapper.eq(KillGoods::getId,req.getGoodsInfo());
|
||||||
|
}else {
|
||||||
|
queryWrapper.like(KillGoods::getGoodsName,req.getGoodsInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<KillGoods> iPage = page(page, queryWrapper);
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
import com.bwie.kill.mapper.KillSkuAttrValueMapper;
|
||||||
|
import com.bwie.kill.service.KillSkuAttrValueService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillSkuAttrValueServiceImpl extends ServiceImpl<KillSkuAttrValueMapper, KillSkuAttrValue>
|
||||||
|
implements KillSkuAttrValueService {
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9111
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
# 允许定义相同的bean对象 去覆盖原有的
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-Kill
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.system.mapper.SysMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -10,8 +10,8 @@
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bwie-team</artifactId>
|
<artifactId>bwie-team</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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<Goods> findspu(Long spuId);
|
||||||
|
|
||||||
|
List<GoodsSku> findsku(Long spuId);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
|
@ -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<Goods> findspu = backMapper.findspu(spuId);
|
||||||
|
List<GoodsSku> findsku = backMapper.findsku(spuId);
|
||||||
|
SkuBack skuBack = new SkuBack();
|
||||||
|
skuBack.setGg(findspu);
|
||||||
|
skuBack.setSkus(findsku);
|
||||||
|
return skuBack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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<Team> show() {
|
||||||
|
List<Team> show = teamMapper.show();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return show;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 List<GroupSku>skus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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<Goods> gg;
|
||||||
|
private List<GoodsSku> skus;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bwie.team.mapper.BackMapper">
|
||||||
|
|
||||||
|
<select id="findspu" resultType="com.bwie.team.vo.Goods" parameterType="java.lang.Long">
|
||||||
|
select i.url,i.default_status from goods_spu g
|
||||||
|
left join goods_spu_images i on i.spu_id=g.id
|
||||||
|
left join goods_sku k on k.spu_id=g.id
|
||||||
|
where i.spu_id=#{spuId}
|
||||||
|
</select>
|
||||||
|
<select id="findsku" resultType="com.bwie.team.vo.GoodsSku" parameterType="java.lang.Long">
|
||||||
|
select attr_name,attr_value,price,weight,default_image from goods_spu g
|
||||||
|
left join goods_sku p on g.id=p.spu_id
|
||||||
|
left join goods_sku_attr_value v on v.sku_id=p.id
|
||||||
|
where g.id=#{spuId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -2,4 +2,8 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bwie.team.mapper.GoodsSkuMapper">
|
<mapper namespace="com.bwie.team.mapper.GoodsSkuMapper">
|
||||||
|
|
||||||
|
<select id="show" resultType="com.bwie.common.domain.Team">
|
||||||
|
select *
|
||||||
|
from group
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bwie-system</module>
|
<module>bwie-system</module>
|
||||||
|
<module>bwie-xxl</module>
|
||||||
<module>bwie-team</module>
|
<module>bwie-team</module>
|
||||||
<module>bwie-alipay</module>
|
<module>bwie-authen</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue