Commit 10744cf2 authored by mengbali153's avatar mengbali153

授权码,修改商品价格,折扣

parent b2d70349
......@@ -9,15 +9,12 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
#namespace: e7390df7-1dd2-4caf-8a0f-035664c1acbd
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
#命名空间
#namespace: e7390df7-1dd2-4caf-8a0f-035664c1acbd
#nacos日志等级
logging:
level:
......
......@@ -12,7 +12,6 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
#namespace: e7390df7-1dd2-4caf-8a0f-035664c1acbd
rabbitmq:
host: 81.68.92.175
password: admin
......
......@@ -38,5 +38,11 @@
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>1.9.6</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.8.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package cn.wise.sc.pay.common.swagger;
import cn.wise.sc.pay.common.swagger.config.SwaggerAutoConfiguration;
//import cn.wise.sc.pay.common.swagger.config.SwaggerAutoConfiguration;
import cn.wise.sc.pay.common.swagger.config.Swagger2Configuration;
import org.springframework.context.annotation.Import;
import java.lang.annotation.Documented;
......@@ -17,6 +18,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import({SwaggerAutoConfiguration.class})
//@Import({SwaggerAutoConfiguration.class})
@Import({Swagger2Configuration.class})
public @interface EnableWiseSwagger2 {
}
package cn.wise.sc.pay.common.swagger.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.MappedInterceptor;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
@Configuration
@EnableSwagger2
public class Swagger2Configuration {
//api接口包扫描路径
public static final String SWAGGER_SCAN_BASE_PACKAGE = "cn.wise.sc";
public static final String VERSION = "1.0.0";
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2).groupName("swagger接口文档")
.apiInfo(new ApiInfoBuilder().title("swagger接口文档")
.contact(new Contact("Wisenergy", "http://www.wisenergy.cn/", "service@wisenergy.cn"))
.description("无卡支付")
.version(VERSION).build())
.select()
.apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
.paths(PathSelectors.any()).build()
.securitySchemes(newArrayList(apiKey()))
.securityContexts(newArrayList(securityContext()))
.enableUrlTemplating(false);
}
private ApiKey apiKey() {
return new ApiKey("BearerToken", "Authorization", "header");
}
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("/.*"))
.build();
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return newArrayList(new SecurityReference("BearerToken", authorizationScopes));
}
@Value("${swagger.basic.username}")
private String username;
@Value("${swagger.basic.password}")
private String password;
/* 必须在此处配置拦截器,要不然拦不到swagger的静态资源 */
@Bean
@ConditionalOnProperty(name = "swagger.basic.enable", havingValue = "true")
public MappedInterceptor getMappedInterceptor() {
return new MappedInterceptor(new String[]{"/swagger-ui.html", "/webjars/**"}, new SwaggerInterceptor(username, password));
}
}
\ No newline at end of file
package cn.wise.sc.pay.common.swagger.config;
//package cn.wise.sc.pay.common.swagger.config;
//
//
////import com.github.xiaoymin.knife4j.spring.annotations.EnableSwaggerBootstrapUi;
//
//import com.github.xiaoymin.knife4j.spring.annotations.EnableSwaggerBootstrapUi;
import com.github.xiaoymin.knife4j.spring.annotations.EnableSwaggerBootstrapUi;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* swagger配置
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUi
@EnableAutoConfiguration
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
public class SwaggerAutoConfiguration {
/**
* 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
*/
private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error","/actuator/**");
private static final String BASE_PATH = "/**";
@Bean
@ConditionalOnMissingBean
public SwaggerProperties swaggerProperties() {
return new SwaggerProperties();
}
@Bean
public Docket api(SwaggerProperties swaggerProperties) {
// base-path处理
if (swaggerProperties.getBasePath().isEmpty()) {
swaggerProperties.getBasePath().add(BASE_PATH);
}
//noinspection unchecked
List<Predicate<String>> basePath = new ArrayList();
swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
// exclude-path处理
if (swaggerProperties.getExcludePath().isEmpty()) {
swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
}
List<Predicate<String>> excludePath = new ArrayList<>();
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
//noinspection Guava
return new Docket(DocumentationType.SWAGGER_2)
.protocols(Collections.singleton(swaggerProperties.getProtocol()))
.host(swaggerProperties.getHost()+swaggerProperties.getModule())
.apiInfo(apiInfo(swaggerProperties)).select()
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
.paths(Predicates.and(Predicates.not(Predicates.or(excludePath)), Predicates.or(basePath)))
.build()
.securitySchemes(Collections.singletonList(securitySchemes()))
.securityContexts(Collections.singletonList(securityContexts()))
.pathMapping("/");
}
private ApiKey securitySchemes() {
return new ApiKey("Authorization", "Authorization", "header");
}
private SecurityContext securityContexts() {
return SecurityContext.builder()
.securityReferences(Collections.singletonList(defaultAuth()))
.forPaths(PathSelectors.regex("^(?!auth).*$"))
.build();
}
private SecurityReference defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return new SecurityReference("Authorization", authorizationScopes);
}
private ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
return new ApiInfoBuilder()
.title(swaggerProperties.getTitle())
.description(swaggerProperties.getDescription())
.license(swaggerProperties.getLicense())
.licenseUrl(swaggerProperties.getLicenseUrl())
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
.version(swaggerProperties.getVersion())
.build();
}
}
//import com.google.common.base.Predicate;
//import com.google.common.base.Predicates;
//import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.ApiKey;
//import springfox.documentation.service.AuthorizationScope;
//import springfox.documentation.service.Contact;
//import springfox.documentation.service.SecurityReference;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spi.service.contexts.SecurityContext;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//
///**
// * swagger配置
// */
//@Configuration
//@EnableSwagger2
//@EnableSwaggerBootstrapUi
//@EnableAutoConfiguration
//@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
//public class SwaggerAutoConfiguration {
//
// /**
// * 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
// */
// private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error","/actuator/**");
// private static final String BASE_PATH = "/**";
//
// @Bean
// @ConditionalOnMissingBean
// public SwaggerProperties swaggerProperties() {
// return new SwaggerProperties();
// }
//
// @Bean
// public Docket api(SwaggerProperties swaggerProperties) {
// // base-path处理
// if (swaggerProperties.getBasePath().isEmpty()) {
// swaggerProperties.getBasePath().add(BASE_PATH);
// }
// //noinspection unchecked
// List<Predicate<String>> basePath = new ArrayList();
// swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
//
// // exclude-path处理
// if (swaggerProperties.getExcludePath().isEmpty()) {
// swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
// }
// List<Predicate<String>> excludePath = new ArrayList<>();
// swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
//
// //noinspection Guava
// return new Docket(DocumentationType.SWAGGER_2)
// .protocols(Collections.singleton(swaggerProperties.getProtocol()))
// .host(swaggerProperties.getHost()+swaggerProperties.getModule())
// .apiInfo(apiInfo(swaggerProperties)).select()
// .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
// .paths(Predicates.and(Predicates.not(Predicates.or(excludePath)), Predicates.or(basePath)))
// .build()
// .securitySchemes(Collections.singletonList(securitySchemes()))
// .securityContexts(Collections.singletonList(securityContexts()))
// .pathMapping("/");
// }
//
// private ApiKey securitySchemes() {
// return new ApiKey("Authorization", "Authorization", "header");
// }
//
// private SecurityContext securityContexts() {
// return SecurityContext.builder()
// .securityReferences(Collections.singletonList(defaultAuth()))
// .forPaths(PathSelectors.regex("^(?!auth).*$"))
// .build();
// }
//
// private SecurityReference defaultAuth() {
// AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
// AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
// authorizationScopes[0] = authorizationScope;
// return new SecurityReference("Authorization", authorizationScopes);
// }
//
// private ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
// return new ApiInfoBuilder()
// .title(swaggerProperties.getTitle())
// .description(swaggerProperties.getDescription())
// .license(swaggerProperties.getLicense())
// .licenseUrl(swaggerProperties.getLicenseUrl())
// .termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
// .contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
// .version(swaggerProperties.getVersion())
// .build();
// }
//
//}
package cn.wise.sc.pay.common.swagger.config;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import sun.misc.BASE64Decoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class SwaggerInterceptor extends HandlerInterceptorAdapter {
private String username;
private String password;
public SwaggerInterceptor(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String authorization = request.getHeader("Authorization");
boolean isAuthSuccess = httpBasicAuth(authorization);
if (!isAuthSuccess) {
response.setCharacterEncoding("utf-8");
response.setStatus(401);
// response.setStatus(401,"Unauthorized");
response.setHeader("WWW-authenticate", "Basic realm=\"Realm\"");
try (PrintWriter writer = response.getWriter()) {
writer.print("Forbidden, unauthorized user");
}
}
return isAuthSuccess;
}
public boolean httpBasicAuth(String authorization) throws IOException {
if (authorization != null && authorization.split(" ").length == 2) {
String userAndPass = new String(new BASE64Decoder().decodeBuffer(authorization.split(" ")[1]));
String username = userAndPass.split(":").length == 2 ? userAndPass.split(":")[0] : null;
String password = userAndPass.split(":").length == 2 ? userAndPass.split(":")[1] : null;
if (this.username.equals(username) && this.password.equals(password)) {
return true;
}
}
return false;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
String uri = request.getRequestURI();
AntPathMatcher pathMatcher = new AntPathMatcher();
if (!pathMatcher.match("/swagger-ui.html", uri) && !pathMatcher.match("/webjars/**", uri)) {
response.setStatus(404);
return;
}
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources("classpath:/META-INF/resources" + uri);
if (resources != null && resources.length > 0) {
FileCopyUtils.copy(resources[0].getInputStream(), response.getOutputStream());
} else {
response.setStatus(404);
}
}
}
......@@ -21,6 +21,17 @@ import java.util.List;
*/
public interface IGoodsService extends IService<Goods> {
/**
* 按条件查询列表
*
* @param sellerId 商户id
* @param key 条件key
* @param type 类型
* @param status 状态
* @return
*/
BaseResponse list(long sellerId, String key, String type, int status);
/**
* 添加一个新的商品
*
......@@ -60,17 +71,6 @@ public interface IGoodsService extends IService<Goods> {
*/
GoodsResponse shelveGoods(long id, long sellerId);
/**
* 按条件查询列表
*
* @param sellerId 商户id
* @param key 条件key
* @param type 类型
* @param status 状态
* @return
*/
BaseResponse list(long sellerId, String key, String type, int status);
/**
* 获取商品
......@@ -181,4 +181,11 @@ public interface IGoodsService extends IService<Goods> {
* @return list
*/
List<Goods> getByGoodIds(List<Long> ids);
/**
* 根据id修改商品价格
* @param id id
* @return String
*/
BaseResponse<String> updateField1(Long id , String field1);
}
......@@ -47,6 +47,48 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Autowired
IMerchantService merchantService;
@Override
public BaseResponse list(long sellerId, String key, String type, int status) {
QueryWrapper qw = new QueryWrapper();
if (StrUtil.isNotEmpty(type)) {
qw.like("type", type);
}
if (sellerId != 0) {
qw.eq("seller_id", sellerId);
}
if (StrUtil.isNotEmpty(key)) {
try {
int id = Integer.valueOf(key);
qw.eq("id", id);
} catch (Exception ex) {
qw.like("name", key);
}
}
if (status != -1) {
qw.eq("status", status);
}
try {
List<Goods> list = this.list(qw);
List<GoodsVO> goodsVOList = new ArrayList<>(list.size());
for (Goods goods : list) {
GoodsVO goodsVO = new GoodsVO(goods);
goodsVO.setCover(goods.getCover());
goodsVOList.add(goodsVO);
}
BaseResponse baseResponse = BaseResponse.ok("查询集合成功");
baseResponse.setData(goodsVOList);
return baseResponse;
} catch (Exception ex) {
BaseResponse baseResponse = BaseResponse.error("查询集合异常", GoodsVO.class.getName());
return baseResponse;
}
}
@Override
public GoodsResponse newGoods(GoodsQuery goodsQuery) {
......@@ -195,47 +237,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
return isSuccess ? GoodsResponse.ok("上架成功") : GoodsResponse.error("上架失败");
}
@Override
public BaseResponse list(long sellerId, String key, String type, int status) {
QueryWrapper qw = new QueryWrapper();
if (StrUtil.isNotEmpty(type)) {
qw.like("type", type);
}
if (sellerId != 0) {
qw.eq("seller_id", sellerId);
}
if (StrUtil.isNotEmpty(key)) {
try {
int id = Integer.valueOf(key);
qw.eq("id", id);
} catch (Exception ex) {
qw.like("name", key);
}
}
if (status != -1) {
qw.eq("status", status);
}
try {
List<Goods> list = this.list(qw);
List<GoodsVO> goodsVOList = new ArrayList<>(list.size());
for (Goods goods : list) {
GoodsVO goodsVO = new GoodsVO(goods);
goodsVO.setCover(goods.getCover());
goodsVOList.add(goodsVO);
}
BaseResponse baseResponse = BaseResponse.ok("查询集合成功");
baseResponse.setData(goodsVOList);
return baseResponse;
} catch (Exception ex) {
BaseResponse baseResponse = BaseResponse.error("查询集合异常", GoodsVO.class.getName());
return baseResponse;
}
}
@Override
public GoodsResponse getGoods(int goodsId) {
......@@ -541,4 +542,29 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
return this.list(queryWrapper);
}
@Override
public BaseResponse<String> updateField1(Long id , String field1){
if (id == null){
return BaseResponse.error("商品id不能为空",String.class.getName());
}
if (field1.isEmpty()){
return BaseResponse.error("商品价格不能为空",String.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("id",id);
Goods one = this.getOne(queryWrapper);
if (one == null){
return BaseResponse.error("该商品不存在",String.class.getName());
}else {
one.setField1(field1);
boolean update = this.update(one, queryWrapper);
if (update){
return BaseResponse.ok("商品价格修改成功");
}else {
return BaseResponse.error("商品价格修改失败",String.class.getName());
}
}
}
}
package cn.wise.sc.pay.pass.business.app.controller.cashier;
import cn.hutool.core.bean.BeanUtil;
import cn.wise.sc.pay.api.cashier.service.ICashierOrdersService;
import cn.wise.sc.pay.api.cashier.service.IGoodsService;
import cn.wise.sc.pay.api.cashier.service.OrderDetailQuery;
import cn.wise.sc.pay.api.merchant.service.IMerchantProfitService;
import cn.wise.sc.pay.api.merchant.service.IMerchantService;
import cn.wise.sc.pay.api.order.service.IOrdersService;
import cn.wise.sc.pay.business.goods.model.vo.GoodsVO;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.core.query.PageQuery;
import cn.wise.sc.pay.common.core.query.PageWrapperQuery;
import cn.wise.sc.pay.common.core.query.PageWrapperQueryUtil;
import cn.wise.sc.pay.domain.merchant.bean.Merchant;
import cn.wise.sc.pay.domain.order.OrderStatusUtils;
import cn.wise.sc.pay.domain.order.model.OrderResponse;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.model.Orders;
import cn.wise.sc.pay.domain.order.model.PayStatus;
import cn.wise.sc.pay.pass.business.app.config.FastDfsUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: 在线点单 商铺
......@@ -43,6 +50,13 @@ public class AppShopController {
IGoodsService iGoodsService;
@Autowired
FastDfsUtil fastDfsUtil;
@Autowired
ICashierOrdersService iCashierOrdersService;
@Autowired
IOrdersService ordersService;
@Autowired
IMerchantProfitService merchantProfitService;
@PostMapping("/list")
@ApiOperation("获取正在营业和未关闭的店铺")
......@@ -78,4 +92,100 @@ public class AppShopController {
}
@PostMapping("/newOrder")
@ApiOperation("新增一个订单")
@ApiImplicitParam(name = "orderDetailQuery",value = "订单请求",paramType = "body",dataType = "OrderDetailQuery")
public BaseResponse newOrder(@RequestBody OrderDetailQuery orderDetailQuery){
orderDetailQuery.setStatus(OrderStatus.WAIT_PAY.name());
if (orderDetailQuery.getPayPrice() == 0){
BaseResponse response = iCashierOrdersService.newOrder(orderDetailQuery);
if (response.getCode() == 200){
Orders order = (Orders) response.getData();
orderDetailQuery.setOrderNo(order.getOrderNo());
orderDetailQuery.setPayStatus(PayStatus.PAY_YES.name());
orderDetailQuery.setStatus(OrderStatus.COMPLETE.name());
orderDetailQuery.setPayment("赠送");
return iCashierOrdersService.editEntryOrder(orderDetailQuery);
}else {
return BaseResponse.ok("赠送超时!请重试","");
}
}else {
orderDetailQuery.setPaas("APP");
return iCashierOrdersService.newOrder(orderDetailQuery);
}
}
public static void main(String[] args) {
OrderDetailQuery orderDetailQuery = new OrderDetailQuery();
orderDetailQuery.setOrderNo("123456789");
orderDetailQuery.setCreateTime(1576746683827L);
orderDetailQuery.setPayment("支付宝");
orderDetailQuery.setPayPrice(80.00);
orderDetailQuery.setUserId(1234L);
orderDetailQuery.setUserPhone("13123456789");
orderDetailQuery.setRemark("测试");
orderDetailQuery.setPaas("app");
System.out.println(JSON.toJSONString(orderDetailQuery));
}
@DeleteMapping("{orderNo}")
@ApiOperation("取消订单")
@ApiImplicitParam(name = "orderNo", value = "订单号儿", paramType = "path", dataType = "String")
public BaseResponse delOrder(@PathVariable("orderNo") String orderNo) {
return iCashierOrdersService.delOrder(orderNo);
}
@GetMapping("listApp/user/{userId}/{status}")
@ApiOperation("查询用户订单")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId",value = "用户id",paramType = "path",dataType = "Integer"),
@ApiImplicitParam(name = "status",value = "订单状态",paramType = "path",dataType = "Integer")
})
public BaseResponse listUsers(@PathVariable("userId") Integer userId , @PathVariable("status") Integer status){
BaseResponse responseEntity;
responseEntity = iCashierOrdersService.listUsers(userId,status);
return responseEntity;
}
@GetMapping("pageApp/user/{userId}/{status}")
@ApiOperation("查询用户订单/分页")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId",value = "用户id",paramType = "path",dataType = "String"),
@ApiImplicitParam(name = "status",value = "订单状态",paramType = "path",dataType = "Integer")
})
public BaseResponse pageAppUser(@PathVariable("userId") String userId,@PathVariable("status") Integer status,PageQuery pageQuery){
BaseResponse responseEntity;
responseEntity = iCashierOrdersService.getOrdersPage(userId,status,pageQuery);
return responseEntity;
}
@PutMapping("/afterApp/success/{orderNo}")
@ApiOperation("支付成功后的回调")
public BaseResponse afterSuccess(@PathVariable("orderNo")String orderNo){
BaseResponse response = iCashierOrdersService.afterSuccess(orderNo);
if (response.code == 200){
Map map = new HashMap();
map.put("order_no",orderNo);
OrderResponse oneOrderResponse = ordersService.getOneOrder(JSON.toJSONString(map));
Orders orders = oneOrderResponse.getData();
//佣金推送
if (orders != null && oneOrderResponse.getCode() == 200){
if (OrderStatus.WAIT_COMMENT.name().equals(orders.getOrderStatus())){
merchantProfitService.addMoneyData(orders.getSellerId(),
orders.getId(),orders.getPaymentMethodName(),orders.getPayPrice(),
orders.getCreateTime());
}
}
}
return response;
}
@PutMapping("/afterApp/fail/{orderNo}")
@ApiOperation("支付失败后的回调")
public BaseResponse afterFail(@PathVariable("orderNo") String orderNo) {
return iCashierOrdersService.afterFail(orderNo);
}
}
......@@ -30,6 +30,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
druid:
url: jdbc:mysql://127.0.0.1:3306/oxo_main_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://81.68.92.175:3306/oxo_main_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: admin!@#123
driver-class-name: com.mysql.cj.jdbc.Driver
......
......@@ -3,9 +3,12 @@ package cn.wise.sc.pay.pass.business.cashiers.controller.merchant;
import cn.wise.sc.pay.api.merchant.service.IMerchDiscountService;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.domain.merchant.bean.MerchDiscount;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -15,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @description: 店铺折扣
* @author: qh
......@@ -36,19 +42,48 @@ public class MerchDiscountController {
@GetMapping("/{seller}")
@ApiOperation("根据商户id获取折扣配置")
@ApiImplicitParam(name = "seller", value = "商户id")
BaseResponse<MerchDiscount> getMerchDiscountBySeller(@PathVariable("seller") Long seller){
BaseResponse<List<MerchDiscount>> getMerchDiscountBySeller(@PathVariable("seller") Long seller){
return iMerchDiscountService.getMerchDiscountBySeller(seller);
}
@PutMapping
@ApiOperation("更新商户折扣信息")
BaseResponse<Boolean> updateMerchDiscountBySeller(@RequestBody MerchDiscount merchDiscount){
return iMerchDiscountService.updateMerchDiscountBySeller(merchDiscount);
}
// @PostMapping("/updateMerchDiscount")
// @ApiOperation("更新商户折扣信息")
// BaseResponse<Boolean> updateMerchDiscount(@RequestBody MerchDiscount merchDiscount){
// return iMerchDiscountService.updateMerchDiscount(merchDiscount);
// }
@PostMapping
@PostMapping("/addOrUpdateMerchDiscount")
@ApiOperation("新增一个折扣信息")
BaseResponse<MerchDiscount> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount){
BaseResponse<Boolean> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount){
return iMerchDiscountService.addNewMerchDiscount(merchDiscount);
}
public static void main(String[] args) {
MerchDiscount merchDiscount = new MerchDiscount();
merchDiscount.setId(1L);
merchDiscount.setSellerId(1L);
List<MerchDiscount.DiscountSetting> list = new ArrayList<>();
MerchDiscount.DiscountSetting a = new MerchDiscount.DiscountSetting();
a.setDiscount(200D);
a.setId("1");
MerchDiscount.DiscountSetting b = new MerchDiscount.DiscountSetting();
b.setDiscount(200D);
b.setId("1");
list.add(a);
list.add(b);
String str = JSON.toJSONString(list);
merchDiscount.setDiscountStr(str);
System.out.println(JSON.toJSONString(merchDiscount));
}
@PostMapping("/delete/{id}")
@ApiOperation("删除一个折扣信息")
BaseResponse<Boolean> deleteMerchDiscount(@PathVariable("id") Long id){
return iMerchDiscountService.deleteMerchDiscount(id);
}
@PostMapping("/deleteBySeller/{seller}")
@ApiOperation("按照商户id删除折扣信息")
BaseResponse<Boolean> deleteMerchDiscountBySeller(@PathVariable("seller") String seller){
return iMerchDiscountService.deleteMerchDiscountBySeller(seller);
}
}
......@@ -10,14 +10,19 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
# 设置swagger用户名密码
swagger:
basic:
enable: false
username: admin
password: admin
#变量名字
nacos:
ip: 81.68.92.175 #nacosd地址
......
......@@ -10,14 +10,12 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
#变量名字
nacos:
......
......@@ -10,15 +10,19 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
# 设置swagger用户名密码
swagger:
basic:
enable: false
username: admin
password: admin
#用的的变量名字
nacos:
ip: 81.68.92.175 #nacosd地址
......
......@@ -3,10 +3,13 @@ package cn.wise.sc.pay.api.cashier.service;
import cn.wise.sc.pay.api.cashier.service.impl.CashierOrdersServiceImpl;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.core.query.PageQuery;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author qh
*/
......@@ -50,4 +53,18 @@ public interface ICashierOrdersService {
@GetMapping("/page/seller/{seller}/{status}")
BaseResponse pageSeller(@PathVariable("seller") int seller, @PathVariable("status") int status,
@RequestParam("start") long start, @RequestParam("end") long end, @SpringQueryMap PageQuery pageQuery);
@PutMapping("/afterSuccess")
@ApiOperation("成功后回调")
BaseResponse afterSuccess(@RequestParam("orderNo")String orderNo);
@PutMapping("/afterFail")
@ApiOperation("失败后回调")
BaseResponse afterFail(@RequestParam("orderNo")String orderNo);
@GetMapping("pageApp/user/{userId}/{status}")
@ApiOperation("获取用户订单分页")
BaseResponse getOrdersPage(@RequestParam("userId") String userId,@RequestParam("status") Integer status,PageQuery pageQuery);
}
......@@ -255,14 +255,6 @@ public interface IGoodsService {
@ApiImplicitParam(name = "code", value = "二维码", paramType = "query", dataTypeClass = String.class)
BaseResponse<Goods> getGoodsInfoByCode(@RequestParam("code") String code);
/**
* 批量添加
* @param data List<GoodsSpecExcel>
* @return BaseResponse
*/
@PostMapping("/batch/add")
BaseResponse<Goods> batchAdd(List<GoodsSpecExcel> data);
/**
* 获取商品所有规格
*
......@@ -271,6 +263,14 @@ public interface IGoodsService {
@GetMapping("/allGoodsSpc")
List<GoodsSpecExcel> getAllGoodsSpc();
/**
* 批量添加
* @param data List<GoodsSpecExcel>
* @return BaseResponse
*/
@PostMapping("/batch/add")
BaseResponse<Goods> batchAdd(List<GoodsSpecExcel> data);
/**
* 获取商品列表 根据ids
* @param ids id集合
......@@ -278,5 +278,14 @@ public interface IGoodsService {
*/
@PostMapping("/goodIds")
List<Goods> getByGoodIds(@RequestBody List<Long> ids);
/**
* 修改商品价格
* @param id 商品id
* @param field1 商品价格
* @return List
*/
@PostMapping("/updateFields")
BaseResponse<String> updateField1(@RequestParam("id")Long id,@RequestParam("field1")String field1);
}
......@@ -6,6 +6,8 @@ import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.core.query.PageQuery;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
*
* @author qh
......@@ -13,6 +15,21 @@ import org.springframework.stereotype.Component;
@Component
public class CashierOrdersServiceImpl implements ICashierOrdersService {
@Override
public BaseResponse afterSuccess(String orderNo) {
return null;
}
@Override
public BaseResponse afterFail(String orderNo) {
return null;
}
@Override
public BaseResponse getOrdersPage(String userId,Integer status, PageQuery pageQuery) {
return null;
}
@Override
public BaseResponse newOrder(OrderDetailQuery orderQuery) {
error();
......
......@@ -160,6 +160,11 @@ public class GoodsServiceImplHystrix implements IGoodsService {
return null;
}
@Override
public BaseResponse<String> updateField1(Long id, String field1) {
return null;
}
/**
* 服务异常
......
......@@ -84,11 +84,6 @@ public class GoodsController {
this.fastFileStorageClient = fastFileStorageClient;
}
@PostMapping("/batch/add")
public BaseResponse<Boolean> batchAdd(@RequestBody List<Goods> goods) {
return iGoodsService.batchAdd(goods);
}
@GetMapping("/list/{sellerId}")
@ApiOperation("所有商品集合(管理端)")
@ApiImplicitParams({
......@@ -424,7 +419,6 @@ public class GoodsController {
@ApiOperation("扫码录入商品")
@ApiImplicitParam(value = "扫码商品", name = "goodsScanQuery", paramType = "body", dataTypeClass = GoodsScanQuery.class)
public BaseResponse<Goods> scanAddGoods(@RequestBody GoodsScanQuery goodsScanQuery) {
return iGoodsService.scanAddGoods(goodsScanQuery);
}
......@@ -435,8 +429,25 @@ public class GoodsController {
return iGoodsService.getGoodsInfoByCode(code);
}
@PostMapping("/batch/add")
@ApiOperation("批量添加")
public BaseResponse<Boolean> batchAdd(@RequestBody List<Goods> goods) {
return iGoodsService.batchAdd(goods);
}
@PostMapping("/goodIds")
public List<Goods> getByGoodIds(@RequestBody List<Long> ids){
return iGoodsService.getByGoodIds(ids);
}
@PostMapping("/updateFields")
@ApiOperation("修改商品价格")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "类型id", paramType = "path", dataType = "Long"),
@ApiImplicitParam(name = "field1", value = "商品价格", paramType = "path", dataType = "String")
})
public BaseResponse<String> updateField1(Long id,String field1){
return iGoodsService.updateField1(id,field1);
}
}
......@@ -199,6 +199,14 @@ public class OrderController {
BaseResponse baseResponse = iOrderService.orderByNo(orderNo);
return baseResponse;
}
@GetMapping("/v2/orderByNo")
@ApiOperation(value = "根据订单号查询订单")
@ApiImplicitParam(name = "orderNo", value = "订单编号", dataType = "String", paramType = "query")
public BaseResponse orderByNoV2(String orderNo) {
BaseResponse baseResponse = iOrderService.orderByNoV2(orderNo);
return baseResponse;
}
/**
* 统计 根据支付类型 统计金额
*/
......@@ -223,4 +231,29 @@ public class OrderController {
}
return BaseResponse.error("统计失败!", null);
}
@PutMapping("/afterSuccess")
@ApiOperation("成功后回调")
public BaseResponse afterSuccess(String orderNo) {
return iOrderService.afterSuccess(orderNo);
}
@PutMapping("/afterFail")
@ApiOperation("成功后回调")
public BaseResponse afterFail(String orderNo) {
return iOrderService.afterFail(orderNo);
}
@GetMapping("pageApp/user/{userId}/{status}")
@ApiOperation("获取用户订单分页")
public BaseResponse getOrdersPage(String userId,Integer status,PageQuery pageQuery){
Map<String ,Object> condition = new HashMap<>();
condition.put("user_id",userId);
OrderStatus orderStatus = OrderStatusUtils.getStatus(status);
condition.put("order_status",orderStatus);
return iOrderService.getOrdersPage(condition,pageQuery);
}
}
......@@ -4,6 +4,7 @@ import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.common.core.query.PageQuery;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.query.OrderDetailQuery;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
......@@ -112,6 +113,12 @@ public interface IPaasOrderService {
*/
BaseResponse orderByNo(String orderNo);
/**
* 根据订单号查询订单
* @param orderNo 订单号
* @return BaseResponse
*/
BaseResponse orderByNoV2(String orderNo);
/**
* 查询商户订单
* @param seller 商户订单
......@@ -131,4 +138,10 @@ public interface IPaasOrderService {
* @return BaseResponse
*/
BaseResponse getSellerOrdersPage(int seller, int status, long start, long end, PageQuery pageQuery);
BaseResponse getOrdersPage(Map<String, Object> condition, PageQuery pageQuery);
BaseResponse afterSuccess(String orderNo);
BaseResponse afterFail(String orderNo);
}
......@@ -12,9 +12,11 @@ import cn.wise.sc.pay.domain.order.OrderStatusUtils;
import cn.wise.sc.pay.domain.order.model.OrderResponse;
import cn.wise.sc.pay.domain.order.model.OrderStatus;
import cn.wise.sc.pay.domain.order.model.Orders;
import cn.wise.sc.pay.domain.order.model.PayStatus;
import cn.wise.sc.pay.domain.order.query.OrderDetailQuery;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,15 +48,18 @@ public class IPaasOrderServiceImpl implements IPaasOrderService {
@Override
public BaseResponse payOrder(String orderNo) {
public BaseResponse payOrder(@NonNull String orderNo) {
if (StringUtils.isEmpty(orderNo)) {
return BaseResponse.error("订单号不能为空", new Orders());
return BaseResponse.error("订单号不能为空", null);
}
Map<String, Object> condition = new HashMap<>();
condition.put("order_no", orderNo);
String conditionJson = JSON.toJSONString(condition);
List<OrderGoodsDO> orderGoodsDOS = (List<OrderGoodsDO>) iOrderService.getOrders(conditionJson).getData();
String goods = iOrderService.getOneOrder(conditionJson).getData().getGoods();
List<OrderGoodsDO> orderGoodsDOS = JSON.parseArray(goods, OrderGoodsDO.class);
ThreadFactory threadFactory = r -> new Thread();
......@@ -80,13 +85,13 @@ public class IPaasOrderServiceImpl implements IPaasOrderService {
});
}
threadPoolExecutor.shutdown();
boolean isSuccess = iOrderService.changeOrderStatus(orderNo, OrderStatus.COMPLETE, null).getCode() == 200;
boolean isSuccess = iOrderService.changeOrderStatus(orderNo, OrderStatus.COMPLETE, JSON.toJSONString(new HashMap<>())).getCode() == 200;
if (isSuccess) {
return BaseResponse.ok("支付成功", new Orders());
return BaseResponse.ok("支付成功");
} else {
iOrderService.changeOrderStatus(orderNo, OrderStatus.CANCELLED, null);
return BaseResponse.ok("订单支付失败,请重新下单", new Orders());
iOrderService.changeOrderStatus(orderNo, OrderStatus.CANCELLED, JSON.toJSONString(new HashMap<>()));
return BaseResponse.ok("订单支付失败,请重新下单");
}
}
......@@ -96,7 +101,7 @@ public class IPaasOrderServiceImpl implements IPaasOrderService {
}
@Override
public BaseResponse changeOrderStatus(String orderNo, OrderStatus orderStatus, Map<String, Object> condition) {
public BaseResponse<Orders> changeOrderStatus(String orderNo, OrderStatus orderStatus, Map<String, Object> condition) {
String conditionJson = JSON.toJSONString(condition);
return iOrderService.changeOrderStatus(orderNo, orderStatus, conditionJson);
}
......@@ -232,7 +237,16 @@ public class IPaasOrderServiceImpl implements IPaasOrderService {
OrderResponse oneOrder = iOrderService.getOneOrder(string);
return oneOrder == null ? BaseResponse.error("数据不存在", this.getClass().getName()) : BaseResponse.ok(oneOrder);
}
@Override
public BaseResponse orderByNoV2(String orderNo) {
if (StringUtils.isBlank(orderNo)) {
return BaseResponse.error("请传入参数值", this.getClass().getName());
}
Map<String, Object> map = new HashMap<>(1);
map.put("order_no", orderNo);
String string = JSON.toJSONString(map);
return iOrderService.getOneOrder(string);
}
@Override
public BaseResponse getSellerOrders(int seller, int status, long start, long end) {
......@@ -295,4 +309,66 @@ public class IPaasOrderServiceImpl implements IPaasOrderService {
return response;
}
@Override
public BaseResponse getOrdersPage(Map<String, Object> condition, PageQuery pageQuery) {
PageWrapperQuery query = new PageWrapperQuery();
query.setPageQuery(new PageQuery());
query.setEq(condition);
return iOrderService.page(query);
}
@Override
public BaseResponse afterSuccess(String orderNo) {
//获取订单
Map condition = new HashMap();
condition.put("order_status", OrderStatus.CONFIRM);
condition.put("order_no", orderNo);
Orders orders = iOrderService.getOneOrder(JSON.toJSONString(condition)).getData();
if (orders != null) {
//获取商品 扣减库存
String goods = orders.getGoods();
List<OrderGoodsDO> orderGoodsDOS = JSON.parseArray(goods, OrderGoodsDO.class);
ThreadFactory threadFactory = r -> new Thread();
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(orderGoodsDOS.size(),
orderGoodsDOS.size(),
2000,
TimeUnit.MILLISECONDS,
new LinkedBlockingDeque(),
threadFactory);
for (OrderGoodsDO goodsDO : orderGoodsDOS) {
threadPoolExecutor.execute(() -> {
boolean flag = true;
List<Long> spcIds = goodsDO.getSpcDetailId();
for (Long spcDetailId : spcIds) {
while (flag) {
flag = iSpcDetailService.subStore(spcDetailId, goodsDO.getNum()).getData();
if (flag == true) {
flag = false;
}
}
}
});
}
threadPoolExecutor.shutdown();
//修改订单状态 cashier为面对面交易 所以订单状态修改为 待评价
OrderDetailQuery orderDetailQuery = OrderDetailQuery.builder()
.orderNo(orderNo)
.payStatus(PayStatus.PAY_YES.name())
.status(OrderStatus.WAIT_COMMENT.name())
.build();
return iOrderService.editOrder(orderDetailQuery);
}
return BaseResponse.error("回调失败", "Cashiers.class");
}
@Override
public BaseResponse afterFail(String orderNo) {
Map condition = new HashMap();
condition.put("order_status", OrderStatus.CONFIRM.name());
return iOrderService.changeOrderStatus(orderNo, OrderStatus.CANCELLED, JSON.toJSONString(condition));
}
}
......@@ -25,8 +25,13 @@
<artifactId>merchant-domain</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.wisenergy.sc.card</groupId>-->
<!-- <artifactId>merchant-business</artifactId>-->
<!-- <version>0.0.1-SNAPSHOT</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
......@@ -35,5 +40,4 @@
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package cn.wise.sc.pay.api.merchant.service;
import cn.wise.sc.pay.api.merchant.service.hystrix.BankPermitServiceImpl;
import cn.wise.sc.pay.api.merchant.service.hystrix.MerchDiscountImpl;
import cn.wise.sc.pay.api.merchant.service.hystrix.MerchantImpl;
import cn.wise.sc.pay.common.core.model.BaseResponse;
......@@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @description:
* @author: qh
......@@ -24,13 +27,21 @@ public interface IMerchDiscountService {
@GetMapping("/{seller}")
@ApiOperation("根据商户id获取折扣配置")
@ApiImplicitParam(name = "seller", value = "商户id")
BaseResponse<MerchDiscount> getMerchDiscountBySeller(@PathVariable("seller") Long seller);
BaseResponse<List<MerchDiscount>> getMerchDiscountBySeller(@PathVariable("seller") Long seller);
@PutMapping
@PostMapping("/updateMerchDiscount")
@ApiOperation("更新商户折扣信息")
BaseResponse<Boolean> updateMerchDiscountBySeller(@RequestBody MerchDiscount merchDiscount);
BaseResponse<Boolean> updateMerchDiscount(@RequestBody MerchDiscount merchDiscount);
@PostMapping
@PostMapping("/addOrUpdateMerchDiscount")
@ApiOperation("新增一个折扣信息")
BaseResponse<MerchDiscount> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount);
BaseResponse<Boolean> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount);
@PostMapping("/delete/{id}")
@ApiOperation("删除一个折扣信息")
BaseResponse<Boolean> deleteMerchDiscount(@PathVariable("id") Long id);
@PostMapping("/deleteBySeller/{seller}")
@ApiOperation("按照商户id删除折扣信息")
BaseResponse<Boolean> deleteMerchDiscountBySeller(@PathVariable("seller") String seller);
}
......@@ -131,4 +131,34 @@ public interface IMerchantService {
@PostMapping("/check/pwd")
BaseResponse<Boolean> checkPwd(@RequestParam("seller") String seller,
@RequestParam("pwd") String pwd);
/**
* 新增商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return bool
*/
@PostMapping("addSensitivePwd")
BaseResponse<String> addSensitivePwd(@RequestParam("seller")Integer seller,@RequestParam("sensitivePwd")String sensitivePwd);
/**
* 修改商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return String
*/
@PostMapping("updateSensitivePwd")
BaseResponse<String> updateSensitivePwd(@RequestParam("seller")String seller,@RequestParam("sensitivePwd")String sensitivePwd);
/**
* 删除商户授权码
*
* @param seller 商户id
* @return String
*/
@PostMapping("deleteSensitivePwd")
BaseResponse<String> deleteSensitivePwd(@RequestParam("seller")String seller);
}
......@@ -4,6 +4,9 @@ import cn.wise.sc.pay.api.merchant.service.IMerchDiscountService;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.domain.merchant.bean.MerchDiscount;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @description:
......@@ -14,19 +17,27 @@ import org.springframework.stereotype.Component;
public class MerchDiscountImpl implements IMerchDiscountService {
@Override
public BaseResponse<MerchDiscount> getMerchDiscountBySeller(Long seller) {
return BaseResponse.error("获取失败!",this.getClass().getName());
public BaseResponse<List<MerchDiscount>> getMerchDiscountBySeller(Long seller) {
return null;
}
@Override
public BaseResponse<Boolean> updateMerchDiscountBySeller(MerchDiscount merchDiscount) {
return BaseResponse.error("更新失败!",this.getClass().getName());
public BaseResponse<Boolean> updateMerchDiscount(MerchDiscount merchDiscount) {
return null;
}
@Override
public BaseResponse<Boolean> addNewMerchDiscount(MerchDiscount merchDiscount) {
return null;
}
@Override
public BaseResponse<MerchDiscount> addNewMerchDiscount(MerchDiscount merchDiscount) {
return BaseResponse.error("添加失败!",this.getClass().getName());
public BaseResponse<Boolean> deleteMerchDiscount(Long id) {
return null;
}
@Override
public BaseResponse<Boolean> deleteMerchDiscountBySeller(String seller) {
return null;
}
}
......@@ -151,6 +151,23 @@ public class MerchantImpl implements IMerchantService {
return null;
}
@Override
public BaseResponse<String> addSensitivePwd(Integer seller, String sensitivePwd) {
return null;
}
@Override
public BaseResponse<String> updateSensitivePwd(String seller, String sensitivePwd) {
error();
return null;
}
@Override
public BaseResponse<String> deleteSensitivePwd(String seller) {
error();
return null;
}
/**
* 服务异常
*
......
......@@ -40,19 +40,19 @@ public class MerchDiscountController {
@GetMapping("/{seller}")
@ApiOperation("根据商户id获取折扣配置")
@ApiImplicitParam(name = "seller",value = "商户id")
public BaseResponse<MerchDiscount> getMerchDiscountBySeller(@PathVariable("seller") Long seller) {
public BaseResponse<List<MerchDiscount>> getMerchDiscountBySeller(@PathVariable("seller") Long seller) {
return iMerchDiscountService.getBySellerId(seller);
}
@PutMapping
@ApiOperation("更新商户折扣信息")
public BaseResponse<Boolean> updateMerchDiscountBySeller(@RequestBody MerchDiscount merchDiscount){
return iMerchDiscountService.updateMerchDiscountBySeller(merchDiscount);
}
// @PostMapping("/updateMerchDiscount")
// @ApiOperation("更新商户折扣信息")
// public BaseResponse<Boolean> updateMerchDiscount(@RequestBody MerchDiscount merchDiscount){
// return iMerchDiscountService.updateMerchDiscount(merchDiscount);
// }
@PostMapping
@PostMapping("/addOrUpdateMerchDiscount")
@ApiOperation("新增一个折扣信息")
public BaseResponse<MerchDiscount> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount){
public BaseResponse<Boolean> addNewMerchDiscount(@RequestBody MerchDiscount merchDiscount){
return iMerchDiscountService.addNewMerchDiscount(merchDiscount);
}
......@@ -77,4 +77,16 @@ public class MerchDiscountController {
System.out.println(JSON.toJSONString(merchDiscount));
}
@PostMapping("/delete/{id}")
@ApiOperation("根据ID删除一个折扣信息")
public BaseResponse<Boolean> deleteMerchDiscount(@PathVariable("id") Long id){
return iMerchDiscountService.deleteMerchDiscount(id);
}
@PostMapping("/deleteBySeller/{seller}")
@ApiOperation("根据商户ID删除折扣信息")
public BaseResponse<Boolean> deleteMerchDiscountBySeller(@PathVariable("seller") Long seller){
return iMerchDiscountService.deleteMerchDiscountBySeller(seller);
}
}
......@@ -389,4 +389,56 @@ public class MerchantController extends BaseController<IMerchantService, Merchan
BaseResponse<Boolean> checkPwd(String seller, String pwd) {
return merchantService.checkPwd(seller, pwd);
}
/**
* 新增商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return String
*/
// @PostMapping("addSensitivePwd")
// @ApiImplicitParams(
// {
// @ApiImplicitParam(name = "seller", value = "商户id", paramType = "query", dataType = "String"),
// @ApiImplicitParam(name = "sensitivePwd", value = "授权码", paramType = "query", dataType = "String")
// }
// )
// BaseResponse<String> addSensitivePwd(String seller,String sensitivePwd){
// return merchantService.addSensitivePwd(seller,sensitivePwd);
// }
/**
* 修改商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return String
*/
@ApiOperation(value = "修改授权码")
@PostMapping("updateSensitivePwd")
@ApiImplicitParams(
{
@ApiImplicitParam(name = "seller", value = "商户id", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "sensitivePwd", value = "授权码", paramType = "query", dataType = "String")
}
)
BaseResponse<String> updateSensitivePwd(String seller,String sensitivePwd){
return merchantService.updateSensitivePwd(seller,sensitivePwd);
}
/**
* 删除商户授权码
*
* @param seller 商户id
* @return String
*/
@ApiOperation(value = "删除商户授权码")
@PostMapping("deleteSensitivePwd")
@ApiImplicitParams(
@ApiImplicitParam(name = "seller", value = "商户id", paramType = "query", dataType = "Integer")
)
BaseResponse<String> deleteSensitivePwd(String seller){
return merchantService.deleteSensitivePwd(seller);
}
}
......@@ -3,6 +3,11 @@ package cn.wise.sc.pay.business.merchant.service;
import cn.wise.sc.pay.common.core.model.BaseResponse;
import cn.wise.sc.pay.domain.merchant.bean.MerchDiscount;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @description:
......@@ -16,20 +21,34 @@ public interface IMerchDiscountService extends IService<MerchDiscount> {
*
* @return MerchDiscount
*/
BaseResponse<MerchDiscount> getBySellerId(Long seller);
BaseResponse<List<MerchDiscount>> getBySellerId(Long seller);
/**
* 更新商户折扣 商户id
* @param merchDiscount 商户折扣
* @return MerchDiscount
*/
BaseResponse<Boolean> updateMerchDiscountBySeller(MerchDiscount merchDiscount);
BaseResponse<Boolean> updateMerchDiscount(MerchDiscount merchDiscount);
/**
* 给商户新增一个折扣信息配置
* @param merchDiscount 商户折扣信息
* @return 是否成功
*/
BaseResponse<MerchDiscount> addNewMerchDiscount(MerchDiscount merchDiscount);
BaseResponse<Boolean> addNewMerchDiscount(MerchDiscount merchDiscount);
/**
* 根据id删除用户的折扣信息
* @param id 商户折扣id
* @return 是否成功
*/
BaseResponse<Boolean> deleteMerchDiscount(Long id);
/**
* 根据商户id删除用户的折扣信息
* @param seller 商户id
* @return 是否成功
*/
BaseResponse<Boolean> deleteMerchDiscountBySeller(Long seller);
}
......@@ -129,4 +129,30 @@ public interface IMerchantService extends IService<Merchant> {
* @return bool
*/
BaseResponse<Boolean> checkPwd(String seller,String pwd);
/**
* 新增商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return bool
*/
BaseResponse<String> addSensitivePwd(String seller,String sensitivePwd);
/**
* 维护商户授权码
*
* @param seller 商户id
* @param sensitivePwd 授权码
* @return bool
*/
BaseResponse<String> updateSensitivePwd(String seller,String sensitivePwd);
/**
* 删除商户授权码
*
* @param seller 商户id
* @return bool
*/
BaseResponse<String> deleteSensitivePwd(String seller);
}
......@@ -21,20 +21,25 @@ public class MerchDiscountServiceImpl extends ServiceImpl<MerchDiscountMapper, M
implements IMerchDiscountService {
@Override
public BaseResponse<MerchDiscount> getBySellerId(Long seller) {
public BaseResponse<List<MerchDiscount>> getBySellerId(Long seller) {
if (seller == null || seller == 0L) {
return BaseResponse.error("seller不能为空!", MerchDiscount.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
QueryWrapper<MerchDiscount> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("seller_id", seller);
return BaseResponse.ok(this.getOne(queryWrapper));
try {
List<MerchDiscount> list = this.list(queryWrapper);
return BaseResponse.ok(list);
}catch (Exception e){
return BaseResponse.ok();
}
}
@Override
public BaseResponse<Boolean> updateMerchDiscountBySeller(MerchDiscount merchDiscount) {
public BaseResponse<Boolean> updateMerchDiscount(MerchDiscount merchDiscount) {
//判断折扣信息是否有效
String discountStr = merchDiscount.getDiscountStr();
......@@ -63,7 +68,7 @@ public class MerchDiscountServiceImpl extends ServiceImpl<MerchDiscountMapper, M
}
@Override
public BaseResponse<MerchDiscount> addNewMerchDiscount(MerchDiscount merchDiscount) {
public BaseResponse<Boolean> addNewMerchDiscount(MerchDiscount merchDiscount) {
//判断折扣信息是否有效
String discountStr = merchDiscount.getDiscountStr();
......@@ -73,6 +78,9 @@ public class MerchDiscountServiceImpl extends ServiceImpl<MerchDiscountMapper, M
if (merchDiscount.getSellerId() == null || merchDiscount.getSellerId() == 0) {
return BaseResponse.error("折扣信息不能为空!", MerchDiscount.class.getName());
}
QueryWrapper<MerchDiscount> qw = new QueryWrapper<>();
qw.lambda().eq(MerchDiscount::getSellerId,merchDiscount.getSellerId());
MerchDiscount one = this.getOne(qw);
try {
List<MerchDiscount.DiscountSetting> discountSettings =
JSON.parseArray(discountStr, MerchDiscount.DiscountSetting.class);
......@@ -80,13 +88,54 @@ public class MerchDiscountServiceImpl extends ServiceImpl<MerchDiscountMapper, M
return BaseResponse.error("折扣信息配置格式不正确!",
MerchDiscount.class.getName());
}
//添加新的折扣信息
boolean save = this.save(merchDiscount);
if (save){
return BaseResponse.ok(merchDiscount);
if (one == null){
//添加新的折扣信息
boolean save = this.save(merchDiscount);
if (save){
return BaseResponse.ok("添加成功",true);
}else {
return BaseResponse.error("添加失败!",false);
}
}else {
one.setDiscountStr(merchDiscount.getDiscountStr());
boolean update = this.updateById(one);
if (update){
return BaseResponse.ok("修改成功",true);
}else {
return BaseResponse.error("修改失败!",false);
}
}
}
@Override
public BaseResponse<Boolean> deleteMerchDiscount(Long id){
if (id == null){
return BaseResponse.error("折扣ID不能为空",String.class.getName());
}
boolean delete = this.removeById(id);
if (delete){
return BaseResponse.ok("删除成功",true);
}else {
return BaseResponse.error("添加失败!",MerchDiscount.class.getName());
return BaseResponse.error("删除失败",String.class.getName());
}
}
@Override
public BaseResponse<Boolean> deleteMerchDiscountBySeller(Long seller) {
if (seller == 0L){
return BaseResponse.error("请输入商户id",String.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("seller_id",seller);
boolean remove = this.remove(queryWrapper);
if (remove){
return BaseResponse.ok("删除成功",true);
}else {
return BaseResponse.error("删除失败",false);
}
}
}
......@@ -108,6 +108,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant>
.linkPhone(merchantQuery.getLinkPhone())
.linkEmail(merchantQuery.getLinkEmail())
.staffNum(merchantQuery.getStaffNum())
.sensitivePwd(merchantQuery.getSensitivePwd())
.establishTime(merchantQuery.getEstablishTime())
.registerMoney(merchantQuery.getRegisterMoney())
.attached(merchantQuery.getAttached())
......@@ -470,4 +471,77 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant>
return BaseResponse.ok(false);
}
}
@Override
public BaseResponse<String> addSensitivePwd(String seller, String sensitivePwd) {
if (seller.isEmpty()){
return BaseResponse.error("商户id不能为空",String.class.getName());
}
if (sensitivePwd.isEmpty()){
return BaseResponse.error("授权码不能为空",String.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("merch_appid",seller);
Merchant one = this.getOne(queryWrapper);
if (one != null){
return BaseResponse.error("该商户已存在授权码,无法添加",String.class.getName());
}else {
one.setSensitivePwd(sensitivePwd);
boolean add = this.update(one, queryWrapper);
if (add){
return BaseResponse.ok("添加授权码成功");
}else {
return BaseResponse.ok("添加授权码失败");
}
}
}
@Override
public BaseResponse<String> updateSensitivePwd(String seller, String sensitivePwd) {
if (seller.isEmpty()){
return BaseResponse.error("商户id不能为空",String.class.getName());
}
if (sensitivePwd.isEmpty()){
return BaseResponse.error("授权码不能为空",String.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("merch_appid",seller);
Merchant one = this.getOne(queryWrapper);
if (one == null){
return BaseResponse.error("该商户不存在",String.class.getName());
}else {
one.setSensitivePwd(sensitivePwd);
boolean b = this.update(one,queryWrapper);
if (b){
return BaseResponse.ok("修改授权码成功");
}else{
return BaseResponse.ok("修改授权码失败");
}
}
}
@Override
public BaseResponse<String> deleteSensitivePwd(String seller) {
if (seller.isEmpty()){
return BaseResponse.error("商户id不能为空",String.class.getName());
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("merch_appid",seller);
Merchant one = this.getOne(queryWrapper);
if (one == null){
return BaseResponse.error("该商户不存在",String.class.getName());
}else {
one.setSensitivePwd("");
boolean b = this.update(one,queryWrapper);
if (b){
return BaseResponse.ok("删除授权码成功");
}else {
return BaseResponse.ok("删除授权码失败");
}
}
}
}
......@@ -10,14 +10,19 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
# 设置swagger用户名密码
swagger:
basic:
enable: false
username: admin
password: admin
#用的的变量名字
nacos:
ip: 81.68.92.175 #nacosd地址
......
......@@ -23,5 +23,12 @@
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -144,6 +144,12 @@ public class MerchantQuery extends Model<MerchantQuery> {
@ApiModelProperty("详情展示的封面图片 多张 用/隔开")
private String detailImgs;
/**
* 授权码
*/
@ApiModelProperty("授权码")
private String sensitivePwd;
@Override
protected Serializable pkVal() {
return null;
......
......@@ -166,4 +166,9 @@ public class StoreVo {
*/
private String detailImgs;
/**
* 授权码
*/
private String sensitivePwd;
}
......@@ -16,4 +16,13 @@
<module>merchant-business</module>
<module>merchant-domain</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -459,6 +459,20 @@ public class WXController {
e.printStackTrace();
}
}
if (orders != null && "APP".equals(orders.getPaas())) {
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(JSON.toJSONString(orders));
transactionMessage.setQueue("pointAndExpQue");
transactionMessage.setRouteKey("pointAndExpQue");
try {
log.info("积分和经验增加 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("积分和经验增长msg 推送失败了哒!");
e.printStackTrace();
}
}
}
/**
......@@ -598,7 +612,8 @@ public class WXController {
//修改订单状态 网上商城 --> 支付完 --> 待收货
if ("ESHOP".equals(orders.getPaas())) {
orderDetailQuery.setStatus(OrderStatus.WAIT_DELIVERING.name());
} else {
}
else {
//收银端和展览支付完成 --> 待评价
orderDetailQuery.setStatus(OrderStatus.WAIT_COMMENT.name());
}
......@@ -840,8 +855,41 @@ public class WXController {
}
}
}
//收银系统 打印小票
if ("APP".equals(orders.getPaas())) {
String[] strs = msgInfo.split("\\|");
if (strs.length >= 2) {
String msg = strs[strs.length - 3];
String sn = strs[strs.length - 2];
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
transactionMessage.setQueue(sn);
transactionMessage.setRouteKey(sn);
transactionMessage.setStatus(999);
try {
log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("app端打印小票,mq消息推送失败!");
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage("ashfdkjsgdhf" + "|" + "1341276633818075136");
transactionMessage.setQueue("T208D94L40388");
transactionMessage.setRouteKey("T208D94L40388");
transactionMessage.setStatus(999);
String s = JSON.toJSONString(transactionMessage);
System.out.println(s);
}
public OrderResponse mqpost(@RequestBody TransactionMessage msg) throws IOException {
msg.setCreateTime(LocalDateTime.now());
......
......@@ -12,14 +12,18 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
# 设置swagger用户名密码
swagger:
basic:
enable: false
username: admin
password: admin
#变量名字
nacos:
ip: 81.68.92.175 #nacosd地址
......
......@@ -53,49 +53,9 @@ public class WxPayConfigure {
// */
// public static String PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCc540quYC9xzCMZeFOe8UmE3W5LWrqFd/2DDSHQASxq8vmOiwFRSG2hsVXtjfmNLQNhtpTR0SGDUjkCsx+SJH0JDnOfQ2xXHasO65Rnv2wrHs64P6U0aUrMWjgapjkmLwzRV12AKNAX77MGIocpcB0KZhk+0AVc6oQCBybV65JTGu+pAyFLMJRtIP5kH3VMuXmig6VeiZAsjEewD/emxgK3cXejMQvqlNYFnCLsZ7ovAhr+bhz6SHkOws3p80O6zfQbKfLzdSVaZK8FnwNPznUxAK77bRZN0zF3V9mL9+zrarvFPD5VkcVHNLj0DRzLmr2c5TbiCigs4+I+NMfhpoLAgMBAAECggEAbM8GzoImDXV87WAZhtu+NFF6ahhc9EiHL5H3O3PhzXRdyiK9NEpkvrdnUxRCX5pc4qSJ8waRNoUv7zSt60VYMf6NN+zw+fYtNfONR30CYOq76nDtGzbnW7TADiDeNmjU2plX3uVCUPoUzmSWIpevht7xl9XE8xtq7AM0E2YSrzEADcxtqQslM0uVOf+ki1eu0/OwCz13FzPlPtnDwt2Lw9xxCxWqTgpN4oD5m6EWTqbognUIJ0EFD0dHXjrYnHXc+/Za5e+CDXYApHuhR9bifa1e4HMN084oLY+rkSXUV3+Te0APPCfbeEeqvubziDmKxxKaWUq1wPbYi4c06ZQdgQKBgQDhF7zDWgiJFTgrLGmExJRKiR/3QZN4sugYE1itdRDJmiPV4xhWPXSsND3WtqR5+0otb/hbzRa3cyl/RXV/1ZmBbE46fX2DKnmLQ1gP74iOuqWpfxjh/qpk+3kEY9aP57le/O0QEEPsJmqCsGM7XnzfNsxGAFYaDHooRbcGtv++AwKBgQCycuvRUQjV4dxTuRJuwFbmdq4odSBMu7yCS4i5I9I73d3TGZBWfiXQWFmuiPh+pf3HdvMbgyA243Uv/NGapSmNvARXm0/eEyfTxV7+GVdwLf3sSe8DQMCR1eJA9VzuS+jhCrHkFgyW3V/3ki66W8YITENlgC+VebOatfFE8i/ZWQKBgQCZ2VmhxFX1LFW53J86qgoZb+QzYdTkOJQ+cGq6FDunL/2yYYfu2g527TYfHbMJ1OH8cH22cVVHiiUg4l7PQzWqqlZF0CQLlOqCb0MvkS8rLxOv6DkfrqrUXrV2dK7gqSegbwuxYQyryg4eyWTp3UlIX/H7Hpu7LjAIeq4Anu/p9QKBgFMtpiYHM6segGi2F5VwKhF6uGs7TTb3O0MwmiZSQCiPnlpLzC/E1TNsO0FTryC5lrVnCKKGWHm9RF595eXDnr7mKM/9IRlOrH3VvhWLEmrDxVxiifpmMFzJ6ZCFzi91SrO7HHhIns2jmpv3k7hiFsi/Y5roSUXPWJyAull82jjhAoGAaKujjF4HL91UXZFetkkKiBIpIrH5+XbiX9z7H9/Tv8NSy/zTvXp3hFl3dr9gO722i/96dTq4th23Gqtih4cA9x8Wd7RChR9yAK/ffSj1lW6RhBWj1j2JCPFCm1TJD5iO3bIeuHm2sAuafKKoWT/VCUkKRwt9Wwh9yF20vMQ3kFw=";
// private static final String notifyUrl = "https://shapp.mbcloud.com/payment/sms/payResultNotice";
private static final String notifyUrl = "http://139.199.165.188:8008/sms/payResultNotice";
private static final String refundNotify = "https://shapp.mbcloud.com/payment/sms/refundNotice";
public static String P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CAQ8AMIIBCgKCAQEA4kiyxywWfQZGzA0hIDqS\n" +
"MebA4METK60XojqiYOccp6pkTkyrHX9zcYBDisMw6KbvoIP9nbyrbNnTctY3mijU\n" +
"432JfMiaNDtMtmMeVs8gOT4wV42G4PAwsWscCy5Qql+S7IQVh6Zjh3zquaYHSwaI\n" +
"Ay83KrviBVf1GYS/WJPxt+z+7KFMz6D1JBaeS9Bec1vomFAqvGU/3TR9qIwZ8MjI\n" +
"cCau96B2JuZ1pnCjzqyTOmx4mEGrueAFcxyeHd9PO46qQHHH6NtvZbRoXEeLSvyY\n" +
"bA53MdJc20ovWKXemee4bH5jBsxxlNKXcIEMMgPHkiZYWT/57jcXAIdWPBUnYlw4\n" +
"BwIDAQAB\n" +
"-----END PUBLIC KEY-----\n";
public static String APP_PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----\n" +
"MIIEpQIBAAKCAQEA4kiyxywWfQZGzA0hIDqSMebA4METK60XojqiYOccp6pkTkyr\n" +
"HX9zcYBDisMw6KbvoIP9nbyrbNnTctY3mijU432JfMiaNDtMtmMeVs8gOT4wV42G\n" +
"4PAwsWscCy5Qql+S7IQVh6Zjh3zquaYHSwaIAy83KrviBVf1GYS/WJPxt+z+7KFM\n" +
"z6D1JBaeS9Bec1vomFAqvGU/3TR9qIwZ8MjIcCau96B2JuZ1pnCjzqyTOmx4mEGr\n" +
"ueAFcxyeHd9PO46qQHHH6NtvZbRoXEeLSvyYbA53MdJc20ovWKXemee4bH5jBsxx\n" +
"lNKXcIEMMgPHkiZYWT/57jcXAIdWPBUnYlw4BwIDAQABAoIBAQDXYG6ZWINHGLRF\n" +
"/7Ep5dXEnWe0BNFkXuoBxWFMbm09wNacGCk+eFK/E2A2MTbaGho2Y6r/edaIUoQJ\n" +
"548gsgB/TruQA7eSQ2buqkT0R0zabzDABLr+Wl9eXx5gHgM1Rqana8i6RkqxaNpZ\n" +
"PYfvhxXqQgR2LkIg5+koEsu1WYtWjPgWxk/ZLJbhFGLPJ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PM1XTZhy6OUMBbdoHKzg5RGjeEkDip2AX3Vf2FXbRUpiLyXe8djc72dc205EzYwQQvu2xe0cN3CrhRAZJPLcyT7BpWLgdrHKecaal57/+lbNnFlcG+9mz1dB3xBgrpOn5NYMCgYEAgTD9zw35lLUeoHbYTqSFDx/46QgtIYs8cSY+b6HnMPvERrlRiV65M7OFMZ/BEJRFZHans1ikmQMTkKr9gLPBcSTM7TzmviPmz+taiAeLCdbBphOrdtWC7X7jE+liDAEpxrHeOiOmseB9FvnYEn8S8O36qTzQb0uyeQuvfHDClqUCgYA+zJ3FIGxsM4o2YmR+6JxFVpKwHhfLh+Ago1Pl1B/IfzmU1f8yIyY6KT1sNRSntfsbrHsiIP+VQ9idHEgRzSNrqmBE6OxjJfNtMVU33lwAhwqMmZtDanJxMNpprggVo4zqQqZUY6ARm5xU4Ansx7s3M/WpbZ2plPvuYIzHggbTRwKBgQCLh7Xm/30SPZtbWw7v4hu1VdpKdG/fxLeqgSDMIUh+9QhIDDYv6avt/ZjiBgaYRV2MXixW3HIxrm2+AVT7nvVMPQfOqv2vCwBNLJf84aqCWQKz2VmDdTxHuIgRksM4n9l48WB5mFDxsM4kZRKGaWVtVOQhuDZhmfmhwsnZuzZ3XA==";
/**
* 小程序id 微信
......@@ -119,7 +79,10 @@ public class WxPayConfigure {
public String CMB_USERID;
@Value("${cmb.unifiedorder.notifyUrl}")
public String CMB_NOTIFYURL;
@Value("${cmb.unifiedorder.notifyUrl}")
public String notifyUrl;
@Value("${cmb.unifiedorder.refundNotify}")
public String refundNotify;
/**
* 微信统一下单 系统参数初始化
*
......
......@@ -10,13 +10,11 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
#共享文件设置
refreshable-dataids: common.yaml
namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
#变量名字
nacos:
......
......@@ -200,8 +200,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......
......@@ -52,7 +52,6 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
ribbon:
ConnectTimeout: 50000
ReadTimeout: 50000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment