master
parent
ac2e093631
commit
2d23012c0f
|
@ -2,8 +2,13 @@
|
|||
<project version="4">
|
||||
<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/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/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/resources" 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-team/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
||||
|
|
|
@ -5,8 +5,15 @@
|
|||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/bwie-modules/bwie-alipay/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/bwie-modules/bwie-slide/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/bwie-modules/bwie-xxl/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -0,0 +1,28 @@
|
|||
package com.bwie;
|
||||
|
||||
import com.bwie.common.handler.GlobalExceptionHandle;
|
||||
import com.bwie.common.redis.RedisCache;
|
||||
|
||||
import com.bwie.common.remote.system.RemoteUserService;
|
||||
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;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients("com.bwie.**")
|
||||
@Import({GlobalExceptionHandle.class, RedisCache.class, RemoteUserService.class})
|
||||
public class AuthApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(AuthApp.class,args);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.bwie.auth.controller;
|
||||
|
||||
import com.bwie.auth.service.AuthService;
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.domain.request.PhoneLoginRequest;
|
||||
import com.bwie.common.domain.request.UserReq;
|
||||
import com.bwie.common.domain.request.UserResponse;
|
||||
import com.bwie.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@RestController
|
||||
public class AuthController {
|
||||
|
||||
|
||||
private final AuthService authService;
|
||||
|
||||
public AuthController(AuthService authService) {
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param loginRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public Result<UserResponse> login(@RequestBody LoginRequest loginRequest){
|
||||
return Result.success(
|
||||
authService.login(loginRequest)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param userReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/reg")
|
||||
public Result regUser(@RequestBody UserReq userReq){
|
||||
return authService.reg(userReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
* @param userPhone
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sendCode/{userPhone}")
|
||||
public Result sencCode(@PathVariable("userPhone") String userPhone){
|
||||
return authService.sendCode(userPhone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号登录
|
||||
* @param userPhone
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/sendCode/{userPhone}")
|
||||
public Result sendCode(@PathVariable String userPhone){
|
||||
|
||||
Result result = authService.sencCode(userPhone);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
* @param phoneLoginRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/phoneLogin")
|
||||
public Result phoneLogin1(@RequestBody PhoneLoginRequest phoneLoginRequest){
|
||||
Result result = authService.phoneLogin(phoneLoginRequest);
|
||||
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public Result<User> getInfo(){
|
||||
return Result.success(
|
||||
authService.getInfo()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.bwie.auth.service;
|
||||
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.domain.request.PhoneLoginRequest;
|
||||
import com.bwie.common.domain.request.UserReq;
|
||||
import com.bwie.common.domain.request.UserResponse;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface AuthService {
|
||||
|
||||
|
||||
|
||||
Result reg(UserReq userReq);
|
||||
|
||||
Result sendCode(String userPhone);
|
||||
|
||||
UserResponse login(LoginRequest loginRequest);
|
||||
|
||||
User getInfo();
|
||||
|
||||
Result sencCode(String userPhone);
|
||||
|
||||
Result phoneLogin(PhoneLoginRequest phoneLoginRequest);
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
package com.bwie.auth.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bwie.auth.service.AuthService;
|
||||
import com.bwie.common.constant.JwtConstants;
|
||||
import com.bwie.common.constant.TokenConstants;
|
||||
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
|
||||
import com.bwie.common.domain.request.PhoneLoginRequest;
|
||||
import com.bwie.common.domain.request.UserReq;
|
||||
import com.bwie.common.domain.request.UserResponse;
|
||||
import com.bwie.common.redis.RedisCache;
|
||||
import com.bwie.common.remote.system.RemoteUserService;
|
||||
import com.bwie.common.result.BizException;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.common.utils.JwtUtils;
|
||||
import com.bwie.common.utils.SecurityUtils;
|
||||
import com.bwie.common.utils.StringUtils;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class AuthServiceImpl implements AuthService {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteLoginService;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
||||
@Override
|
||||
public UserResponse login(LoginRequest loginRequest) {
|
||||
|
||||
Assert.isTrue(
|
||||
!StringUtils.isAnyBlank(loginRequest.getUserPwd(),
|
||||
loginRequest.getUserName()),"账号或密码不能为空"
|
||||
);
|
||||
Result<User> result = remoteLoginService.login(loginRequest);
|
||||
User user = result.getData();
|
||||
Assert.notNull(user,"该账号不是系统用户");
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
String userKey = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
map.put(JwtConstants.USER_KEY,userKey);
|
||||
map.put(JwtConstants.DETAILS_USERNAME,user.getUserName());
|
||||
map.put(JwtConstants.DETAILS_USER_ID,user.getUserId());
|
||||
String token = JwtUtils.createToken(map);
|
||||
redisCache.setCacheObject(
|
||||
TokenConstants.LOGIN_TOKEN_KEY+userKey,
|
||||
JSON.toJSONString(user),
|
||||
TokenConstants.EXPIRATION,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
return UserResponse.builder()
|
||||
.token(token)
|
||||
.expired(TokenConstants.EXPIRATION)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result reg(UserReq userReq) {
|
||||
String password = SecureUtil.md5(userReq.getUserPwd() + "|" +"");
|
||||
Result result = remoteLoginService.register(
|
||||
User.builder()
|
||||
.userName(userReq.getUserName())
|
||||
.userPwd(password)
|
||||
.userPhone(userReq.getUserPhone())
|
||||
.userRole(userReq.getUserRole())
|
||||
.build()
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result sendCode(String userPhone) {
|
||||
Result<User> result = remoteLoginService.findByPhone(userPhone);
|
||||
User user = result.getData();
|
||||
if(null == user){
|
||||
throw new BizException(408,"请先注册手机号");
|
||||
}
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
redisCache.setCacheObject("Send_sms_"+userPhone,code);
|
||||
|
||||
return Result.success("验证码为:"+code,"发送成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result sencCode(String userPhone) {
|
||||
Result<User> result = remoteLoginService.phoneLogin(userPhone);
|
||||
if(StringUtils.isNull(result.getData())){
|
||||
return Result.error("手机号不存在");
|
||||
}
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
System.out.println("验证码为:"+code);
|
||||
redisTemplate.opsForValue().set(userPhone,code,5,TimeUnit.MINUTES);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result phoneLogin(PhoneLoginRequest phoneLoginRequest) {
|
||||
Result<User> result = remoteLoginService.phoneLogin(phoneLoginRequest.getUserPhone());
|
||||
User user = result.getData();
|
||||
if(null==user){
|
||||
return Result.error("手机号不存在");
|
||||
}
|
||||
if(!redisTemplate.hasKey(phoneLoginRequest.getUserPhone())){
|
||||
return Result.error("验证码过期");
|
||||
}
|
||||
String code = redisTemplate.opsForValue().get(phoneLoginRequest.getUserPhone());
|
||||
if(!phoneLoginRequest.getUserCode().equals(code)){
|
||||
return Result.error("验证码错误");
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
String userKey = UUID.randomUUID().toString().replaceAll("-","");
|
||||
map.put(JwtConstants.DETAILS_USERNAME,user.getUserName());
|
||||
map.put(JwtConstants.DETAILS_USER_ID,user.getUserId());
|
||||
map.put(JwtConstants.USER_KEY,userKey);
|
||||
String token = JwtUtils.createToken(map);
|
||||
redisCache.setCacheObject(TokenConstants.LOGIN_TOKEN_KEY, user, TokenConstants.EXPIRATION, TimeUnit.HOURS);
|
||||
|
||||
UserResponse userResponse = new UserResponse();
|
||||
userResponse.setToken(token);
|
||||
userResponse.setExpired(TokenConstants.EXPIRATION);
|
||||
return Result.success(userResponse,"登陆成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getInfo() {
|
||||
String token = request.getHeader(TokenConstants.TOKEN);
|
||||
Claims claims = JwtUtils.parseToken(token);
|
||||
String userKey = JwtUtils.getUserKey(claims);
|
||||
String cacheObject = redisCache.getCacheObject(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||
User user = JSONObject.parseObject(cacheObject, User.class);
|
||||
return user;
|
||||
}
|
||||
}
|
|
@ -110,5 +110,9 @@
|
|||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.42</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -2,5 +2,5 @@ package com.bwie.common.constant;
|
|||
|
||||
public class ServerNameConstants {
|
||||
|
||||
public final static String SYSTEM_NAME="bwie-system";
|
||||
public final static String SYSTEM_NAME="bwie-User";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.bwie.common.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
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("order")
|
||||
|
||||
public class BuyOrder {
|
||||
private Long orderId;
|
||||
private Long userId;
|
||||
private String userPhone;
|
||||
private Integer orderState;
|
||||
private Integer orderInventory;
|
||||
private String orderName;
|
||||
private String orderNumber;
|
||||
private Long attrId;
|
||||
private Long addrId;
|
||||
private BigDecimal orderPrice;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private Integer isDelete;
|
||||
private String orderAddr;
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.bwie.common.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;
|
||||
|
||||
/**
|
||||
*商品的属性
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_attr")
|
||||
public class GoodAttr {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;//属性ID
|
||||
@TableField("name")
|
||||
private String name;//属性名称
|
||||
@TableField("search_type")
|
||||
private Integer searchType;//是否需要检索(0.不需要,1.需要)
|
||||
@TableField("icon")
|
||||
private String icon;//属性图标
|
||||
@TableField("value_select")
|
||||
private String valueSelect;//可选值链表(用逗号分隔)
|
||||
@TableField("type")
|
||||
private Integer type;//属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]
|
||||
@TableField("enable")
|
||||
private Integer enable;//启用状态[0 - 禁用,1 - 启用]
|
||||
@TableField("show_desc")
|
||||
private Integer showDesc;//快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整
|
||||
@TableField("category_id")
|
||||
private Long categoryId;//所属分类
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.bwie.common.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.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品的sku
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("good_sku")
|
||||
public class GoodSku {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;//正常的ID
|
||||
@TableField("spu_id")
|
||||
private Long spuId;//spuId
|
||||
@TableField("name")
|
||||
private String name;//名称
|
||||
@TableField("category_id")
|
||||
private Long categoryId;//类型ID
|
||||
@TableField("default_image")
|
||||
private String defaultImage;//图片
|
||||
@TableField("title")
|
||||
private String title;//标题
|
||||
@TableField("subtitle")
|
||||
private String subTitle;//副标题
|
||||
@TableField("price")
|
||||
private BigDecimal price;
|
||||
@TableField("weight")
|
||||
private Integer weight;
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.bwie.common.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;
|
||||
|
||||
/**
|
||||
* 商品的spu
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_spu")
|
||||
public class GoodSpu {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;//物品ID
|
||||
@TableField("name")
|
||||
private String name;//物品名称
|
||||
@TableField("good_sales")
|
||||
private Integer goodSales;//物品销量
|
||||
@TableField("good_inventory")
|
||||
private Integer goodInventory;//物品库存
|
||||
@TableField("category_id")
|
||||
private Long categoryId;//物品类型ID
|
||||
@TableField("publish_status")
|
||||
private Integer publishStatus;//上架状态(0.下架,1.上架)
|
||||
@TableField("keywords")
|
||||
private String keyWords;//关键字
|
||||
@TableField("good_brief")
|
||||
private String goodBrief;//物品简介
|
||||
@TableField("good_unit")
|
||||
private String goodUnit;//物品单位
|
||||
@TableField("good_freight")
|
||||
private Integer goodFreight;//运费模版
|
||||
@TableField("create_time")
|
||||
private Date createTime;//创建时间字段
|
||||
@TableField("update_time")
|
||||
private Date updateTime;//修改时间字段
|
||||
@TableField("is_delete")
|
||||
private Integer isDelete;//逻辑删除字段
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.bwie.common.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;
|
||||
|
||||
/**
|
||||
* 商品的类型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_category")
|
||||
public class GoodsCateGory {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;//正常的Id
|
||||
@TableField("name")
|
||||
private String name;//名称
|
||||
@TableField("parent_id")
|
||||
private Long parentId;//父类ID
|
||||
@TableField("status")
|
||||
private Long status;//是否显示(0.不显示,1.显示)
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 商品sku的属性名称
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_sku_attr_value")
|
||||
public class GoodsSkuAttrValue {
|
||||
|
||||
@TableField("id")
|
||||
private Long id;//正常主键ID
|
||||
@TableField("skuId")
|
||||
private Long skuId;//skuId
|
||||
@TableField("attrId")
|
||||
private Long attrId;//属性的ID
|
||||
@TableField("attrName")
|
||||
private String attrName;//属性名称
|
||||
@TableField("attrValue")
|
||||
private String attrValue;//属性值
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.bwie.common.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;
|
||||
|
||||
/**
|
||||
* 商品spu的属性名称
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_spu_attr_value")
|
||||
public class GoodsSpuAttrValue {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;//Id
|
||||
@TableField("spu_id")
|
||||
private Long spuId;//商品ID
|
||||
@TableField("attr_id")
|
||||
private Long attrId;//属性ID
|
||||
@TableField("attr_name")
|
||||
private String attrName;//属性名字
|
||||
@TableField("attr_value")
|
||||
private String attrValue;//属性值
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.bwie.common.domain;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 添加商品的图片及其图片类型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("goods_spu_images")
|
||||
public class GoodsSpuImages {
|
||||
@TableField("id")
|
||||
private Long id;//正常主键的ID
|
||||
@TableField("spuId")
|
||||
private Long spuId;//spuId
|
||||
@TableField("url")
|
||||
private String url;//图片的路径
|
||||
@TableField("default_status")
|
||||
private Integer defaultStatus;//(0.封面图,1.轮播图)
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 支付明细表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("trade")
|
||||
public class PaymentEntity {
|
||||
|
||||
|
||||
private Long tradeId;
|
||||
private String tradeNum;
|
||||
private String ordersNumber;
|
||||
private BigDecimal tradeMoney;
|
||||
private Integer tradeStatus;
|
||||
private String thirdNum;
|
||||
private Integer thirdStatus;
|
||||
private String thirdMessage;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date backTime;
|
||||
private String tradeType;
|
||||
private Integer isDelete;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updTime;
|
||||
private Long userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*登录表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("user")
|
||||
public class User {
|
||||
|
||||
|
||||
private Long userId;//用户名Id
|
||||
private String userName;//用户名
|
||||
private String userPwd;//密码
|
||||
private String userPhone;//手机号
|
||||
private Integer userRole;//角色
|
||||
private Integer userGrade;//用户等级
|
||||
private Date createTime;//创建时间
|
||||
private Date updateTime;//修改时间
|
||||
private Integer isDelete;//逻辑删除
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.bwie.common.domain.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class LoginRequest {
|
||||
|
||||
|
||||
private String userName;
|
||||
private String userPwd;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.bwie.common.domain.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class PhoneLoginRequest {
|
||||
|
||||
private String userPhone;
|
||||
private String userCode;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.bwie.common.domain.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class UserReq {
|
||||
private String userName;
|
||||
/*
|
||||
密码
|
||||
*/
|
||||
private String userPwd;
|
||||
/*
|
||||
手机号
|
||||
*/
|
||||
private String userPhone;
|
||||
/*
|
||||
用户等级()
|
||||
*/
|
||||
private Integer userGrade;
|
||||
/*
|
||||
登陆人身份【0-经纪人 1-用户】
|
||||
*/
|
||||
private Integer userRole;
|
||||
/*
|
||||
入职时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
/*
|
||||
最新修改时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/*
|
||||
逻辑删除字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.bwie.common.domain.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class UserResponse {
|
||||
|
||||
private String token;
|
||||
private Long expired;
|
||||
}
|
|
@ -1,11 +1,43 @@
|
|||
package com.bwie.common.remote.system;
|
||||
|
||||
import com.bwie.common.constant.ServerNameConstants;
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.remote.system.factory.RemoteUserFactory;
|
||||
import com.bwie.common.result.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(
|
||||
name = ServerNameConstants.SYSTEM_NAME,
|
||||
fallbackFactory = RemoteUserService.class
|
||||
name = "bwie-User",
|
||||
fallbackFactory = RemoteUserFactory.class
|
||||
)
|
||||
public interface RemoteUserService {
|
||||
|
||||
@PostMapping("/login")
|
||||
public Result<User> login(@RequestBody LoginRequest loginRequest);
|
||||
|
||||
|
||||
@PostMapping("/register")
|
||||
public Result register(@RequestBody User user);
|
||||
|
||||
|
||||
@GetMapping("/findByPhone/{userPhone}")
|
||||
public Result<User> findByPhone(@PathVariable("userPhone") String userPhone);
|
||||
|
||||
|
||||
@PostMapping("/phoneLogin/{userPhone}")
|
||||
public Result<User> phoneLogin(@PathVariable("userPhone") String userPhone);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,50 @@
|
|||
package com.bwie.common.remote.system.factory;
|
||||
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.remote.system.RemoteUserService;
|
||||
import com.bwie.common.result.Result;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
public class RemoteUserFactory implements FallbackFactory<RemoteUserService> {
|
||||
@Override
|
||||
public RemoteUserService create(Throwable cause) {
|
||||
return null;
|
||||
|
||||
return new RemoteUserService() {
|
||||
|
||||
@Override
|
||||
public Result<User> login(@RequestBody LoginRequest loginRequest){
|
||||
log.error("用户登录失败:[{}]",cause.getMessage(),cause);
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
@Override
|
||||
public Result register(@RequestBody User user){
|
||||
log.error("用户登录失败:[{}]",cause.getMessage(),cause);
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
@Override
|
||||
public Result<User> findByPhone(@PathVariable("userPhone") String userPhone){
|
||||
log.error("手机号登录失败:[{}]",cause.getMessage(),cause);
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
@Override
|
||||
public Result<User> phoneLogin(@PathVariable String userPhone){
|
||||
log.error("手机号登录失败:[{}]",cause.getMessage(),cause);
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package com.bwie.common.result;
|
||||
|
||||
/**
|
||||
* @ClassName
|
||||
* @Description 描述
|
||||
* @Author XuWen.Luo
|
||||
* @Date
|
||||
*/
|
||||
|
||||
public class BizException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msg;
|
||||
private int code = 500;
|
||||
|
||||
public BizException(String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public BizException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public BizException(int code, String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public BizException(String msg, int code, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
|
@ -9,14 +9,20 @@
|
|||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bwie-xxl</artifactId>
|
||||
<artifactId>bwie-alipay</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!--支付宝接口pom文件-->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.39.2.ALL</version>
|
||||
</dependency>
|
||||
<!-- 系统公共 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
|
@ -58,11 +64,26 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>bwie-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.8.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,16 @@
|
|||
package com.bwie.alipay;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
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;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.bwie.alipay.mapper")
|
||||
public class AlipayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AlipayApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.bwie.alipay.config;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConstants;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "alipay")
|
||||
public class AlipayConfig {
|
||||
|
||||
/**
|
||||
* 商户appid
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 商户PID,卖家支付宝账号ID
|
||||
*/
|
||||
private String sellerId;
|
||||
|
||||
/**
|
||||
* 私钥 pkcs8格式的,rsc中的私钥
|
||||
*/
|
||||
private String privateKey;
|
||||
|
||||
/**
|
||||
* 支付宝公钥
|
||||
*/
|
||||
private String publicKey;
|
||||
|
||||
/**
|
||||
* 请求网关地址
|
||||
*/
|
||||
private String serverUrl;
|
||||
|
||||
/**
|
||||
* 页面跳转同步通知(可以直接返回前端页面、或者通过后端进行跳转)
|
||||
*/
|
||||
private String returnUrl;
|
||||
|
||||
/**
|
||||
* 服务器异步通知
|
||||
*/
|
||||
private String notifyUrl;
|
||||
|
||||
/**
|
||||
* 获得初始化的AlipayClient
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public AlipayClient alipayClien() {
|
||||
// 获得初始化的AlipayClient
|
||||
return new DefaultAlipayClient(serverUrl, appId, privateKey,
|
||||
AlipayConstants.FORMAT_JSON, AlipayConstants.CHARSET_UTF8,
|
||||
publicKey, AlipayConstants.SIGN_TYPE_RSA2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.alipay.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/alipay")
|
||||
public class AlipayController {
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package com.bwie.alipay.controller;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayConstants;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bwie.alipay.service.AlimentPayService;
|
||||
import com.bwie.alipay.service.AlipayWayService;
|
||||
import com.bwie.alipay.utils.service.AlipayWay;
|
||||
import com.bwie.alipay.utils.PayServive;
|
||||
import com.bwie.alipay.vo.Alipay;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import com.bwie.common.domain.PaymentEntity;
|
||||
import com.bwie.common.result.BizException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class AlipayWayController {
|
||||
@Autowired
|
||||
private AlipayWay alipayWay;
|
||||
@Autowired
|
||||
private AlipayWayService alipayWayService;//buyOrder
|
||||
@Autowired
|
||||
private AlimentPayService alimentPayService;//PaymentEntity
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
@ResponseBody
|
||||
@GetMapping("/pay")
|
||||
public String pay(Long buyOrderId,String type) throws AlipayApiException {
|
||||
BuyOrder buyOrder = alipayWayService.getOne(
|
||||
new LambdaQueryWrapper<BuyOrder>().eq(BuyOrder::getOrderId, buyOrderId));
|
||||
|
||||
|
||||
if(buyOrder.getOrderState().equals(3)){
|
||||
throw new BizException(500,"不能重复支付!!!!!");
|
||||
}
|
||||
PaymentEntity paymentEntity = PaymentEntity.builder()
|
||||
.ordersNumber(buyOrder.getOrderNumber())
|
||||
.userId(buyOrder.getUserId())
|
||||
.tradeMoney(buyOrder.getOrderPrice())
|
||||
.backTime(new Date())
|
||||
.tradeStatus(1).build();
|
||||
//添加到数据库
|
||||
alimentPayService.save(paymentEntity);
|
||||
|
||||
|
||||
alipayWayService.updateById(
|
||||
BuyOrder.builder()
|
||||
.orderId(buyOrder.getOrderId())
|
||||
.orderState(2).build()
|
||||
);
|
||||
PayServive bean = (PayServive)applicationContext.getBean(type);
|
||||
return bean.alipay(buyOrder);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private Alipay alipay;
|
||||
@Transactional
|
||||
@RequestMapping("/notifyUrl")
|
||||
public void notifyUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
request.setCharacterEncoding("utf-8");
|
||||
|
||||
HashMap<String, String> params = new HashMap<>(8);
|
||||
|
||||
Map<String, String[]> requestParams = request.getParameterMap();
|
||||
|
||||
for (Map.Entry<String, String[]> stringEntry : requestParams.entrySet()) {
|
||||
|
||||
String[] values = stringEntry.getValue();
|
||||
|
||||
String valueStr="";
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||
: valueStr + values[i] + ",";
|
||||
}
|
||||
System.out.println("key="+stringEntry.getKey()+" value="+valueStr);
|
||||
params.put(stringEntry.getKey(), valueStr);
|
||||
}
|
||||
boolean signVerified = AlipaySignature.rsaCheckV1(params,alipay.getAlipayPublicKey(), AlipayConstants.CHARSET_UTF8, AlipayConstants.SIGN_TYPE_RSA2);
|
||||
if(!signVerified){
|
||||
log.error("验签失败!!!!");
|
||||
}
|
||||
String orderSn = new String(params.get("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
BuyOrder buyOrder = alipayWayService.getOne(
|
||||
new LambdaQueryWrapper<BuyOrder>()
|
||||
.eq(BuyOrder::getOrderNumber, orderSn)
|
||||
);
|
||||
if(buyOrder.getOrderState().equals(3)){
|
||||
throw new BizException(500,"已经支付成功,禁止重复回掉");
|
||||
}
|
||||
List<PaymentEntity> paymentEntityList = alimentPayService.list(
|
||||
new LambdaQueryWrapper<PaymentEntity>()
|
||||
.eq(PaymentEntity::getOrdersNumber, buyOrder.getOrderNumber())
|
||||
);
|
||||
paymentEntityList.forEach(c->{
|
||||
if(c.getTradeStatus().equals(2)){
|
||||
throw new BizException(500,"已经支付成功,禁止重复回掉");
|
||||
}
|
||||
});
|
||||
paymentEntityList.forEach(c->{
|
||||
if(c.getTradeStatus().equals(1)){ //正在支付
|
||||
alimentPayService.updateById(
|
||||
PaymentEntity.builder()
|
||||
.tradeId(c.getTradeId())
|
||||
.thirdStatus(2).build()
|
||||
); //修改为已支付
|
||||
}
|
||||
});
|
||||
alipayWayService.updateById(
|
||||
buyOrder.builder()
|
||||
.orderId(buyOrder.getOrderId())
|
||||
.orderState(3).build()
|
||||
);
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.alipay.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class Test01 {
|
||||
|
||||
@GetMapping("/test")
|
||||
public String aaaa(){
|
||||
return "succerr";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.alipay.demo;
|
||||
|
||||
public interface ListenerPer {
|
||||
|
||||
|
||||
public void test03(String message);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.alipay.demo;
|
||||
|
||||
public interface MonitorPer {
|
||||
|
||||
void test01(ListenerPer listenerPer);
|
||||
void test02(ListenerPer listenerPer);
|
||||
|
||||
void test04(String message);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.bwie.alipay.demo;
|
||||
|
||||
public interface Newspaper {
|
||||
/**
|
||||
* 添加订阅者
|
||||
* @param subscriber
|
||||
*/
|
||||
void addSubscriber(Subscriber subscriber);
|
||||
|
||||
/**
|
||||
* 移除订阅者
|
||||
* @param subscriber
|
||||
*/
|
||||
void removeSubscriber(Subscriber subscriber);
|
||||
|
||||
/**
|
||||
* 通知订阅者
|
||||
* @param message
|
||||
*/
|
||||
void notifySubscribers(String message);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.bwie.alipay.demo;
|
||||
|
||||
public interface Subscriber {
|
||||
|
||||
public void update(String message);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.bwie.alipay.demo.controller;
|
||||
import com.bwie.alipay.demo.MonitorPer;
|
||||
import com.bwie.alipay.demo.Newspaper;
|
||||
import com.bwie.alipay.demo.Subscriber;
|
||||
import com.bwie.alipay.demo.service.ListenerImpl;
|
||||
import com.bwie.alipay.demo.service.MonitorImpl;
|
||||
import com.bwie.alipay.demo.service.NewspaperImpl;
|
||||
import com.bwie.alipay.demo.service.SubscriberImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
public class TestObserver {
|
||||
@Test
|
||||
void testObserver() {
|
||||
Newspaper newspaper = new NewspaperImpl();
|
||||
|
||||
Subscriber li = new SubscriberImpl("李老头");
|
||||
Subscriber wang = new SubscriberImpl("王奶奶");
|
||||
//李老头和王奶奶订阅了报纸
|
||||
newspaper.addSubscriber(li);
|
||||
|
||||
newspaper.addSubscriber(wang);
|
||||
//报纸到了,通知订阅者
|
||||
newspaper.notifySubscribers("今天的报纸到了!!!");
|
||||
//李老头取消订阅了,移除
|
||||
newspaper.removeSubscriber(li);
|
||||
|
||||
newspaper.notifySubscribers("明天的报纸还是这个点到!!!");
|
||||
}
|
||||
|
||||
@Test
|
||||
void test04(){
|
||||
MonitorPer monitor = new MonitorImpl();
|
||||
|
||||
ListenerImpl listener = new ListenerImpl("佩奇佩奇");
|
||||
ListenerImpl listener1 = new ListenerImpl("狗嘉狗嘉");
|
||||
monitor.test01(listener);
|
||||
monitor.test04("我爱你,爱你爱你");
|
||||
monitor.test02(listener);
|
||||
monitor.test01(listener1);
|
||||
monitor.test04("我想拉拉手,拉拉手,拉拉手");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.bwie.alipay.demo.service;
|
||||
|
||||
import com.bwie.alipay.demo.ListenerPer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ListenerImpl implements ListenerPer {
|
||||
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public void test03(String message){
|
||||
System.out.println(name+"本次收到的内容是: "+message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.bwie.alipay.demo.service;
|
||||
|
||||
import com.bwie.alipay.demo.ListenerPer;
|
||||
import com.bwie.alipay.demo.MonitorPer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MonitorImpl implements MonitorPer{
|
||||
|
||||
|
||||
ArrayList<ListenerPer> arrayList = new ArrayList<>();
|
||||
//添加
|
||||
@Override
|
||||
public void test01(ListenerPer listenerPer){
|
||||
arrayList.add(listenerPer);
|
||||
}
|
||||
//删除
|
||||
@Override
|
||||
public void test02(ListenerPer listenerPer){
|
||||
arrayList.remove(listenerPer);
|
||||
}
|
||||
//通知
|
||||
@Override
|
||||
public void test04(String message){
|
||||
for (ListenerPer s : arrayList) {
|
||||
s.test03(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.bwie.alipay.demo.service;
|
||||
|
||||
import com.bwie.alipay.demo.Newspaper;
|
||||
import com.bwie.alipay.demo.Subscriber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewspaperImpl implements Newspaper {
|
||||
List<Subscriber> subscribers = new ArrayList<>();
|
||||
//添加订阅者
|
||||
@Override
|
||||
public void addSubscriber(Subscriber subscriber) {
|
||||
subscribers.add(subscriber);
|
||||
}
|
||||
//移除订阅者
|
||||
@Override
|
||||
public void removeSubscriber(Subscriber subscriber) {
|
||||
subscribers.remove(subscriber);
|
||||
}
|
||||
//通知订阅者
|
||||
@Override
|
||||
public void notifySubscribers(String message) {
|
||||
for (Subscriber s : subscribers) {
|
||||
s.update(message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.bwie.alipay.demo.service;
|
||||
|
||||
import com.bwie.alipay.demo.Subscriber;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class SubscriberImpl implements Subscriber {
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public void update(String message) {
|
||||
System.out.println(name + "---接到消息: " + message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.PaymentEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AlimentPayMapper extends BaseMapper<PaymentEntity> {
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.alipay.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface AlipayMapper{
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.alipay.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AlipayWayMapper extends BaseMapper<BuyOrder> {
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.bwie.alipay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.PaymentEntity;
|
||||
|
||||
public interface AlimentPayService extends IService<PaymentEntity> {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import com.bwie.common.domain.PaymentEntity;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface AlipayService {
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.alipay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
|
||||
public interface AlipayWayService extends IService<BuyOrder> {
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.alipay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.alipay.mapper.AlimentPayMapper;
|
||||
import com.bwie.alipay.mapper.AlipayWayMapper;
|
||||
import com.bwie.alipay.service.AlimentPayService;
|
||||
import com.bwie.common.domain.PaymentEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AlimentPayServiceImpl extends ServiceImpl<AlimentPayMapper, PaymentEntity> implements AlimentPayService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.service.impl;
|
||||
|
||||
import com.bwie.alipay.service.AlipayService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class AlipayServiceImpl implements AlipayService {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.alipay.mapper.AlipayWayMapper;
|
||||
import com.bwie.alipay.service.AlipayWayService;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AlipayWayServiceImpl extends ServiceImpl<AlipayWayMapper, BuyOrder> implements AlipayWayService {
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.bwie.alipay.time;
|
||||
|
||||
import com.bwie.alipay.service.AlimentPayService;
|
||||
import com.bwie.alipay.service.AlipayWayService;
|
||||
import com.bwie.alipay.utils.service.AlipayWay;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Log4j2
|
||||
@Component
|
||||
public class CreateTime {
|
||||
|
||||
@Autowired
|
||||
private AlipayWayService alipayWayService;
|
||||
@Autowired
|
||||
private AlipayWay alipayWay;
|
||||
|
||||
@Autowired
|
||||
private AlimentPayService alimentPayService;
|
||||
// @Scheduled(cron = "0/5 * * * * *")
|
||||
// public void findOrderSn(){
|
||||
// List<BuyOrder> buyOrderList = alipayWayService.list(
|
||||
// new LambdaQueryWrapper<BuyOrder>()
|
||||
// .eq(BuyOrder::getBuyOrderZt, 3)
|
||||
//
|
||||
// );
|
||||
// buyOrderList.forEach(c->{
|
||||
// try {
|
||||
// OrderSnRequest buyOrderDh = alipayWay.findBuyOrderDh(c.getBuyOrderDh());
|
||||
// OrderSnRequest.AlipayTradeQueryResponseBean queryResponse = buyOrderDh.getAlipay_trade_query_response();
|
||||
// String tradeStatus = queryResponse.getTrade_status();
|
||||
// if(tradeStatus.equals("TRADE_SUCCESS")){
|
||||
// alipayWayService.updateById(
|
||||
// BuyOrder.builder()
|
||||
// .buyOrderId(c.getBuyOrderId())
|
||||
// .buyOrderZt(c.getBuyOrderZt())
|
||||
// .build()
|
||||
// );
|
||||
// }
|
||||
// alimentPayService.list(
|
||||
// new LambdaQueryWrapper<PaymentEntity>()
|
||||
// .eq(PaymentEntity::getPaymentDh,c.getBuyOrderDh())
|
||||
// ).forEach(s->{
|
||||
// if(s.getPaymentState().equals(2)){
|
||||
// alimentPayService.updateById(
|
||||
// PaymentEntity.builder()
|
||||
// .paymentId(s.getPaymentId())
|
||||
// .paymentState(3)
|
||||
// .build()
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }catch(AlipayApiException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.utils;
|
||||
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
|
||||
public interface PayServive{
|
||||
|
||||
public String alipay(BuyOrder buyOrder) throws AlipayApiException;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.bwie.alipay.utils.service;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||
import com.bwie.alipay.vo.OrderSnRequest;
|
||||
import com.bwie.alipay.utils.PayServive;
|
||||
import com.bwie.alipay.vo.Alipay;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Component("Alipay")
|
||||
public class AlipayWay implements PayServive {
|
||||
@Autowired
|
||||
private Alipay alipay;
|
||||
public String alipay(BuyOrder buyOrder) throws AlipayApiException {
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl(alipay.getServerUrl());
|
||||
alipayConfig.setAppId(alipay.getAppId());
|
||||
alipayConfig.setPrivateKey(alipay.getPrivateKey());
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setAlipayPublicKey(alipay.getAlipayPublicKey());
|
||||
alipayConfig.setCharset(alipay.getCharset());
|
||||
alipayConfig.setSignType(alipay.getSignType());
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||
JSONObject bizContent = new JSONObject();
|
||||
//商户订单号,商家自定义,保持唯一性
|
||||
bizContent.put("out_trade_no", buyOrder.getOrderNumber());
|
||||
//支付金额,最小值0.01元
|
||||
bizContent.put("total_amount",buyOrder.getOrderPrice());
|
||||
//订单标题,不可使用特殊符号
|
||||
bizContent.put("subject", buyOrder.getOrderName());
|
||||
//电脑网站支付场景固定传值FAST_INSTANT_TRADE_PAY
|
||||
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY");
|
||||
request.setBizContent(bizContent.toString());
|
||||
request.setNotifyUrl(" http://eeh7ds.natappfree.cc/notifyUrl");
|
||||
AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "GET");
|
||||
String pageRedirectionData = response.getBody();
|
||||
System.out.println(pageRedirectionData);
|
||||
if (response.isSuccess()) {
|
||||
System.out.println("调用成功!!!!");
|
||||
} else {
|
||||
System.out.printf("调用失败!!!!");
|
||||
}
|
||||
return pageRedirectionData;
|
||||
}
|
||||
|
||||
public OrderSnRequest findBuyOrderDh(String buyOrderDh) throws AlipayApiException {
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl(alipay.getServerUrl());
|
||||
alipayConfig.setAppId(alipay.getAppId());
|
||||
alipayConfig.setPrivateKey(alipay.getPrivateKey());
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setAlipayPublicKey(alipay.getAlipayPublicKey());
|
||||
alipayConfig.setCharset(alipay.getCharset());
|
||||
alipayConfig.setSignType(alipay.getSignType());
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||
|
||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||
|
||||
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
|
||||
model.setOutTradeNo(buyOrderDh);
|
||||
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
arrayList.add("trade_settle_info");
|
||||
model.setQueryOptions(arrayList);
|
||||
request.setBizModel(model);
|
||||
AlipayTradePagePayResponse response = alipayClient.execute(request);
|
||||
OrderSnRequest orderSnRequest = JSON.parseObject(response.getBody().toString(), OrderSnRequest.class);
|
||||
if (response.isSuccess()) {
|
||||
System.out.println("调用成功!!!!");
|
||||
} else {
|
||||
System.out.printf("调用失败!!!!");
|
||||
}
|
||||
return orderSnRequest;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.bwie.alipay.utils.service;
|
||||
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("UnionPay")
|
||||
public class UnionWay {
|
||||
|
||||
public String alipay(BuyOrder buyOrder){
|
||||
return "你好消费者,这是银联支付奥,支付金额是: "+buyOrder.getOrderPrice()+"元,支付的名称是: "+buyOrder.getOrderName()+",支付的单号是: "+buyOrder.getOrderNumber();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.alipay.utils.service;
|
||||
|
||||
import com.bwie.alipay.utils.PayServive;
|
||||
import com.bwie.common.domain.BuyOrder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("Wechpay")
|
||||
public class Wechpay implements PayServive {
|
||||
|
||||
|
||||
public String alipay(BuyOrder buyOrder){
|
||||
return "你好消费者,这是微信支付奥,支付金额是: "+buyOrder.getOrderPrice()+"元,支付的名称是: "+buyOrder.getOrderName()+",支付的单号是: "+buyOrder.getOrderNumber();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.bwie.alipay.vo;
|
||||
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConstants;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "zhipay")
|
||||
@Data
|
||||
public class Alipay {
|
||||
private String privateKey;//私钥
|
||||
private String alipayPublicKey;//支付宝公钥
|
||||
private String appId;//商户ID
|
||||
private String notifyUrl;//
|
||||
private String returnUrl;//
|
||||
private String serverUrl;
|
||||
private String charset;
|
||||
private String signType;
|
||||
private BigDecimal ordersPrice;
|
||||
@Bean
|
||||
public AlipayClient alipayClient() {
|
||||
// 获得初始化的AlipayClient
|
||||
return new DefaultAlipayClient(serverUrl, appId, privateKey,
|
||||
AlipayConstants.FORMAT_JSON, AlipayConstants.CHARSET_UTF8,
|
||||
alipayPublicKey, AlipayConstants.SIGN_TYPE_RSA2);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.bwie.alipay.vo;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ToString
|
||||
@Data
|
||||
public class OrderSnRequest {
|
||||
private AlipayTradeQueryResponseBean alipay_trade_query_response;
|
||||
private String sign;
|
||||
@ToString
|
||||
@Data
|
||||
public static class AlipayTradeQueryResponseBean {
|
||||
private String code;
|
||||
private String msg;
|
||||
private String trade_no;
|
||||
private String out_trade_no;
|
||||
private String buyer_logon_id;
|
||||
private String trade_status;
|
||||
private String total_amount;
|
||||
private String buyer_pay_amount;
|
||||
private String point_amount;
|
||||
private String invoice_amount;
|
||||
private String send_pay_date;
|
||||
private String receipt_amount;
|
||||
private String store_id;
|
||||
private String terminal_id;
|
||||
private String store_name;
|
||||
private String buyer_user_id;
|
||||
private String buyer_open_id;
|
||||
private String buyer_user_type;
|
||||
private String mdiscount_amount;
|
||||
private String discount_amount;
|
||||
private String ext_infos;
|
||||
private List<FundBillListBean> fund_bill_list;
|
||||
@ToString
|
||||
@Data
|
||||
public static class FundBillListBean {
|
||||
private String fund_channel;
|
||||
private String amount;
|
||||
private String real_amount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9090
|
||||
# Spring
|
||||
spring:
|
||||
# datasource:
|
||||
# url: jdbc:mysql:xm_house//localhost:3306/mydatabase
|
||||
# username: root
|
||||
# password: admin111.
|
||||
main:
|
||||
allow-circular-references: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-alipay
|
||||
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}
|
||||
zhipay:
|
||||
serverUrl: "https://openapi-sandbox.dl.alipaydev.com/gateway.do"
|
||||
charset: "UTF-8"
|
||||
signType: "RSA2"
|
||||
appId: "9021000135679979"
|
||||
privateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx8r9WaFV7CujWc9AzpbgsCq8axYJWm4s7x2eDcJXC+qhDXWsFW0xDX+xs4JCuVJ54+FGiflB24BeqgFDLNOchtkocK65BJohG5ojVONHq/ciruqbzAD0W6x96h8fKqlVuvz3EotMXuejg5J1gbDRmgTvPx7mYq94TXjxt75CUEserThSMF0geB0DJhrPxNe5JLAPKA5pRXd2e6wDybi2yKL2s2j4YuaTgDZuNAnlBYAiV6Pk7WpFB06LtbGg7JiM+Jawn3N64fL/24d4VIzcJD3AxWbGDZAXtW9+XZtsDa8z6ik3OGpbrSKu+RK0jjWzT2ETHnb/BdhtDJzFBo4dnAgMBAAECggEBAKWvrWIqATVwof1Tlk8QhVxUklfuAP7dExYVA5fJ01fZhaQ7rjMtn+O3w+5YZb48QdXG+FPBIvCclMyHbzLVzkOAdJ6oOTamRwslCdDmd+ZCaH8lat8loLvfLs8q7+cPFD7qx/t30+7qhiAoHTSza1LqD6PWhkPV+w+zlbaS8d471COE8P7XyxouFZ70qe9Aa7uVLEClxQemviSqIYOuHTFkNjWMleQR48tL2HA2ifKpa309Ifnbf3kGktyNaiG7plC5x3gUU3dSQdWZpnRHq/wh65TBhJHgLrjsIPhnfB9mmwCMZ66EJiUKajuqlvEjC/J0dkduMO6uPLYzTkejxbkCgYEA4arhCQgLquzRJDk5pI94ZzBiSWXaP3JUzfYEHQbbzcNvRPZBYJLDBUXNRVReujjt6efIcyrCi1zD3XvHfN2QmaNubeD5yF7aObYPVwoxDCvqHzZDVbYd9ZUGR2yIa+jdkVc5py0vmyfyxLSx3RvMuSP+rYtzhCJbowQiCkN4XUMCgYEAyd3efuY/0f59XF2DBSu8vCEaer7Wkieit980VZm06jxwt/3b5UcRlknKpum32n+mGlbpu4M/r5Zbpta+uuWbx6ajbIjc43rMuElkK6cz5d6AUTm6AsOKq8ARQPh4F5pzI18vrNAQrNyVpxwDMXIdmyArHD0Dv4NeIjlwucCT2Q0CgYBTAXGoysbP5i+/bTUgrI0TF57vdIFkmP9MitNUgfNTqjFBYnsFtLX7OIOansABK3OHd/QpOG86p7J7w03LRgwsFwtFa101MH6Af9EAqQUFfxmsxV7bJhO7A0e9+dPsLUlibn0MWviJz5XieLx7ogAZkX3aA9NHpQOj4J9MuyiI1QKBgQC/NyIuNG5ZvWYEGzQjrsVtszHA+YqJEXBqGc0aFKoxgyUGtDoamdJH+Qg0SYl1OJsfshpfG7k02wlgJWSv5xVD7k45Xf9Wn5jSK/rt+skHQldsGXFgctelTx9I2tPvD8dmxyCC4ugYxi4gCEHiEYWHztXnPsiRHaAKbTyhR5EE9QKBgGQRjcds+qeZeNTKrwSPFG/KD8h/kI0jTnFfeKMm1WXfuXcadTavbaruGUihLzveO9/dsizKJm38Pc2j5xNyBxGYUdbSxGZtC5uNmYuIsR3u8gy2oT3qFBPaFp/Y1PoHzLu6QTAYeo8Cz0TG+U8ah/81O9JPzZWyrkGLHIp5XyKq"
|
||||
alipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkVyIo6qyxzk0YWnBo3ueKIpcpUPnrX0MuhdaUAoyJPtp19u2M67g8jSw7BWqppJ0Vso8sm7Px6VS3rOunlmgW5lyN0uMgy6+mE76gW8+2msjwR/DrzNL7aQn2idu9NgxxKk2BnLzajpR7W5Tk+sXmB9woLffbQ9hJW+SWJ6DnMtAbaB+3E/xaDO4o5yjTFbY063Vr2mgyt+PfK5i3unb3ffZj9jtqICWsDfpoY42fxxrRsKa3eLCJVO6sqUz3XLRex8WV7vcjtAuMsp6rFbwTPT5ELSYHXEY3uWuHHJChDE4eAKUpvavYj/hTZhlsOyTe1xPOAbnkAQ2B+kA+XHDRQIDAQAB"
|
||||
notifyUrl: "http://m8gu77.natappfree.cc/notifyUrl"
|
||||
# returnUrl: "http://m8gu77.natappfree.cc/notifyUrl"
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="true" scanPeriod="1 seconds">
|
||||
|
||||
<contextName>logback</contextName>
|
||||
<property name="log.path" value="./applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
|
||||
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="file"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -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.alipay.mapper.AlipayWayMapper">
|
||||
|
||||
</mapper>
|
|
@ -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.alipay.mapper.AlimentPayMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +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 namespace="com.bwie.alipay.mapper.AlipayMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,4 +1,4 @@
|
|||
package com.bwie.xxl;
|
||||
package com.bwie;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
@ -8,8 +8,14 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class XxlApp {
|
||||
@EnableFeignClients("com.bwie.**")
|
||||
@MapperScan("com.bwie.user.mapper")
|
||||
public class UserApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XxlApp.class);
|
||||
|
||||
SpringApplication.run(UserApp.class,args);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.bwie.user.controller;
|
||||
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.user.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.Past;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
public UserController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/login")
|
||||
public Result<User> login(@RequestBody LoginRequest loginRequest){
|
||||
|
||||
return Result.success(
|
||||
userService.login(loginRequest)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public Result register(@RequestBody User user){
|
||||
userService.register(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/findByPhone/{userPhone}")
|
||||
public Result<User> findByPhone(@PathVariable("userPhone") String userPhone){
|
||||
return userService.findByPhone(userPhone);
|
||||
}
|
||||
|
||||
@PostMapping("/phoneLogin/{userPhone}")
|
||||
public Result<User> phoneLogin(@PathVariable String userPhone){
|
||||
User user = userService.phoneLogin(userPhone);
|
||||
|
||||
return Result.success(user);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
|
||||
User phoneLogin(@Param("userPhone") String userPhone);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.bwie.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
|
||||
User login(LoginRequest loginRequest);
|
||||
|
||||
void register(User user);
|
||||
|
||||
Result<User> findByPhone(String userPhone);
|
||||
|
||||
User phoneLogin(String userPhone);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.bwie.user.service.impl;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.bwie.common.domain.User;
|
||||
import com.bwie.common.domain.request.LoginRequest;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.user.mapper.UserMapper;
|
||||
import com.bwie.user.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public User login(LoginRequest loginRequest) {
|
||||
String userPwd = SecureUtil.md5(loginRequest.getUserPwd() + "|" + "");
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getUserName,loginRequest.getUserName())
|
||||
.eq(User::getUserPwd,userPwd);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(User user) {
|
||||
this.save(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<User> findByPhone(String userPhone) {
|
||||
User user = this.getOne(new LambdaQueryWrapper<User>()
|
||||
.eq(User::getUserPhone, userPhone));
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User phoneLogin(String userPhone) {
|
||||
|
||||
return userMapper.phoneLogin(userPhone);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ spring:
|
|||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-system
|
||||
name: bwie-User
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?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.user.mapper.UserMapper">
|
||||
|
||||
<select id="phoneLogin" resultType="com.bwie.common.domain.User">
|
||||
select * from user where user_phone = #{userPhone}
|
||||
</select>
|
||||
</mapper>
|
|
@ -8,9 +8,7 @@
|
|||
<artifactId>bwie-modules</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bwie-team</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
@ -27,7 +25,6 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
@ -45,7 +42,6 @@
|
|||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
|
@ -58,5 +54,46 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>9.3.7.v20160115</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tobato</groupId>
|
||||
<artifactId>fastdfs-client</artifactId>
|
||||
<version>1.27.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tobato</groupId>
|
||||
<artifactId>fastdfs-client</artifactId>
|
||||
<version>1.26.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.team;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
//@MapperScan("com.bwie.team")
|
||||
public class TeamApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TeamApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class GoodsAttrController {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class GoodsCateGoryController {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class GoodsSkuAttrValueController {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class GoodsSkuController{
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class GoodsSpuAttrValueController {
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
import com.bwie.common.domain.GoodSpu;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.team.service.GoodsSpuService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class GoodsSpuController {
|
||||
|
||||
private final GoodsSpuService goodsSpuService;
|
||||
|
||||
public GoodsSpuController(GoodsSpuService goodsSpuService) {
|
||||
this.goodsSpuService = goodsSpuService;
|
||||
}
|
||||
|
||||
@PostMapping("/shouall")
|
||||
public Result<List<GoodSpu>> shouall(){
|
||||
return Result.success(goodsSpuService.shouall());
|
||||
}
|
||||
|
||||
@PostMapping("/addGoodSpu")
|
||||
public Result addGoodSpu(@RequestBody GoodSpu goodSpu){
|
||||
return goodsSpuService.addGoodSpu(goodSpu);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.bwie.team.controller;
|
||||
import com.bwie.common.domain.GoodsSpuImages;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.team.service.GoodsSpuImageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
public class GoodsSpuImageController {
|
||||
@Autowired
|
||||
private GoodsSpuImageService goodsSpuImageService;
|
||||
@PostMapping("/addImage")
|
||||
public Result addImage(@RequestBody GoodsSpuImages goodsSpuImages){
|
||||
return goodsSpuImageService.addImage(goodsSpuImages);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/addImages")
|
||||
public Result addImages(@RequestBody GoodsSpuImages goodsSpuImages){
|
||||
return goodsSpuImageService.addImage(goodsSpuImages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package com.bwie.team.controller;
|
||||
|
||||
public class TeamController {
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.bwie.team.demo;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
public class demo {
|
||||
// public static void main(String[] args) {
|
||||
// String host = "https://D:\\mq\\aaaaa.jpg";
|
||||
// String path = "/iden2OCR";
|
||||
// String method = "POST";
|
||||
// String appcode = "你自己的AppCode";
|
||||
// Map<String, String> headers = new HashMap<String, String>();
|
||||
// //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||
// headers.put("Authorization", "APPCODE " + appcode);
|
||||
// //根据API的要求,定义相对应的Content-Type
|
||||
// headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
// //需要给X-Ca-Nonce的值生成随机字符串,每次请求不能相同
|
||||
// headers.put("X-Ca-Nonce", UUID.randomUUID().toString());
|
||||
// Map<String, String> querys = new HashMap<String, String>();
|
||||
// Map<String, String> bodys = new HashMap<String, String>();
|
||||
// bodys.put("imgbase64", "/9j/4AAQSkZJRgABAQAA... ...3F/9k=");
|
||||
// bodys.put("side", "front");
|
||||
// try {
|
||||
// /**
|
||||
// * 重要提示如下:
|
||||
// * HttpUtils请从
|
||||
// * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
|
||||
// * 下载
|
||||
// *
|
||||
// * 相应的依赖请参照
|
||||
// * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
||||
// */
|
||||
// HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||
// System.out.println(response.toString());
|
||||
// //获取response的body
|
||||
// //System.out.println(EntityUtils.toString(response.getEntity()));
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
public static void main(String[] args) {
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("admin","admin");
|
||||
map.put("hashmao","hashmap");
|
||||
Iterator it = map.keySet().iterator();
|
||||
//获取迭代器
|
||||
while(it.hasNext()){
|
||||
Object key = it.next();
|
||||
System.out.println(map.get(key));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodAttr;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsAttrMapper extends BaseMapper<GoodAttr> {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodsCateGory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsCateGoryMapper extends BaseMapper<GoodsCateGory> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodsSkuAttrValue;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsSkuAttrValueMapper extends BaseMapper<GoodsSkuAttrValue> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodSku;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsSkuMapper extends BaseMapper<GoodSku> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodsSpuAttrValue;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsSpuAttrValueMapper extends BaseMapper<GoodsSpuAttrValue> {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodsSpuImages;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsSpuImageMapper extends BaseMapper<GoodsSpuImages>{
|
||||
Integer addImages(GoodsSpuImages goodsSpuImages);
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.GoodSpu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GoodsSpuMapper extends BaseMapper<GoodSpu> {
|
||||
Integer addGoodSpu(GoodSpu goodSpu);
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package com.bwie.team.mapper;
|
||||
|
||||
public interface TeamMapper {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface GoodsAttrService {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface GoodsCateGoryService {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface GoodsSkuAttrValueService {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface GoodsSkuService {
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface GoodsSpuAttrValueService {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
import com.bwie.common.domain.GoodsSpuImages;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface GoodsSpuImageService {
|
||||
|
||||
public Result addImage(GoodsSpuImages goodsSpuImages);
|
||||
|
||||
public Result addImages(GoodsSpuImages goodsSpuImages);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
import com.bwie.common.domain.GoodSpu;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GoodsSpuService {
|
||||
|
||||
List<GoodSpu> shouall();
|
||||
|
||||
Result addGoodSpu(GoodSpu goodSpu);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public interface TeamService {
|
||||
// 查询商品信息
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package com.bwie.team.service;
|
||||
|
||||
public class TeamServiceImpl {
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.GoodAttr;
|
||||
import com.bwie.team.mapper.GoodsAttrMapper;
|
||||
import com.bwie.team.service.GoodsAttrService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GoodsAttrServiceImpl extends ServiceImpl<GoodsAttrMapper, GoodAttr> implements GoodsAttrService {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.GoodsCateGory;
|
||||
import com.bwie.team.mapper.GoodsCateGoryMapper;
|
||||
import com.bwie.team.service.GoodsCateGoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GoodsCateGoryServiceImpl extends ServiceImpl<GoodsCateGoryMapper, GoodsCateGory> implements GoodsCateGoryService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.GoodsSkuAttrValue;
|
||||
import com.bwie.team.mapper.GoodsSkuAttrValueMapper;
|
||||
import com.bwie.team.service.GoodsSkuAttrValueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GoodsSkuAttrValueServiceImpl extends ServiceImpl<GoodsSkuAttrValueMapper, GoodsSkuAttrValue> implements GoodsSkuAttrValueService {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.bwie.team.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.GoodSku;
|
||||
import com.bwie.team.mapper.GoodsSkuMapper;
|
||||
import com.bwie.team.service.GoodsSkuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodSku> implements GoodsSkuService {}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue