# v1.2.1 更新内容

## 更新列表
    1. 短信后台升级,更新供应商
    2. 替换官方swagger文档提升友好和易用[swagger-bootstrap-ui] https://doc.xiaominfo.com/knife4j
    3. 添加商品分类必要素材,可在配置好图片服务后自行维护
This commit is contained in:
stivepeim
2020-11-17 15:19:43 +08:00
parent f24cc527af
commit bd467b13bc
11 changed files with 93 additions and 72 deletions

View File

@@ -26,12 +26,12 @@
### 加技术交流群
* 企业微信
![加技术交流群](https://stivepeim.gitee.io/my-image/allGroup-QRCode.jpg "开发技术群二维码.png")
![加技术交流群](https://stivepeim.gitee.io/my-image/gourp_QRCode_2020_11-17.png "开发技术群二维码.png")
如果群二维码过期请加开发者微信拉你进群
![开发者微信](https://stivepeim.gitee.io/my-image/stivepeim_qywx_qrcode.png "屏幕截图.png")
![开发者微信](https://stivepeim.gitee.io/my-image/stivepeim_qywx_qrcode.png "开发者企业微信.png")
### 演示站
1. 移动端:[https://java.crmeb.net](https://java.crmeb.net)
@@ -46,13 +46,11 @@ CRMEB知识付费项目https://gitee.com/ZhongBangKeJi/crmeb_zzff_class
CRMEB打通版https://gitee.com/ZhongBangKeJi/CRMEB
### Swagger接口文档
演示站接口:
1. 移动端http://app.beta.java.crmeb.net/api_html/app_api.html
2. 后台http://app.beta.java.crmeb.net/api_html/admin_api.html
演示站接口: http://api.java.crmeb.net/doc.html
自己部署站点接口地址:域名/swagger-ui.html#
自己部署站点接口地址:域名/doc.html#
本地启动Java Api项目接口地址http://localhost:8080/swagger-ui.html# 8080为配置文件里配置的 server/port
本地启动Java Api项目接口地址http://localhost:8080/doc.html# 8080为配置文件里配置的 server/port
prod环境swagger默认账号密码在 prod.yml配置里
@@ -154,7 +152,7 @@ Excel数据导出,导出表格更加美观可视;
# Java项目框架
1. SpringBoot 2.2.6.RELEASE
2. Maven 3.6.1
3. Swagger 2.9.2
3. swagger-bootstrap-ui-demo 1.0
4. Mybatis Plus 3.3.1
@@ -181,6 +179,12 @@ Excel数据导出,导出表格更加美观可视;
3. [如何导入第三方JAVA SDK包](https://blog.csdn.net/weixin_46028577/article/details/106342938?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase "如何导入第三方JAVA SDK包")
#
# v1.2.1 更新内容
## 更新列表
1. 短信后台升级,更新供应商
2. 替换官方swagger文档提升友好和易用[swagger-bootstrap-ui] https://doc.xiaominfo.com/knife4j
3. 添加商品分类必要素材,可在配置好图片服务后自行维护
# v1.2 功能更新列表
### 更新Note
## 修复内容列表

View File

@@ -88,9 +88,9 @@ export default {
getNumber() {
smsInfoApi().then(async res => {
const data = res
this.numbers = data.number
this.sendTotal = data.send_total
this.amount = data.number + data.send_total
this.numbers = data.num
this.sendTotal = data.surp
this.amount = data.num + data.surp
this.smsAccount = data.account
})
},

View File

@@ -16,6 +16,9 @@
<properties>
<java.version>1.8</java.version>
<springfox.version>2.9.2</springfox.version>
<swagger-models.version>1.5.22</swagger-models.version>
<swagger-bootstrap-ui.version>1.9.3</swagger-bootstrap-ui.version>
</properties>
<!-- <profiles>-->
@@ -161,30 +164,28 @@
<version>1.5.21</version>
</dependency>
<!--swagger-->
<!-- swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- swagger2 -->
<!-- doc -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<version>${springfox.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>${swagger-models.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger-bootstrap-ui.version}</version>
</dependency>
<dependency>

View File

@@ -3,6 +3,7 @@ package com.zbkj.crmeb.config;
import com.constants.Constants;
import com.google.common.base.Predicate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -34,6 +35,7 @@ import static com.google.common.collect.Lists.newArrayList;
*/
@Configuration
@EnableSwagger2
@ConfigurationProperties(prefix = "api.doc")
public class SwaggerConfig{
//是否开启swagger正式环境一般是需要关闭的可根据springboot的多环境配置进行设置
@@ -129,7 +131,7 @@ public class SwaggerConfig{
return new ApiInfoBuilder()
.title("Crmeb Java")
.description("Crmeb")
.termsOfServiceUrl("http://host:port/swagger-ui.html#/")
.termsOfServiceUrl("http://host:port")
.version("1.0.0").build();
}

View File

@@ -115,13 +115,13 @@ public class WebConfig implements WebMvcConfigurer {
excludePathPatterns("/api/front/seckill/list/*").
excludePathPatterns("/api/front/seckill/detail/*").
// excludePathPatterns("/api/front/cart/count").
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
}
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
@@ -140,7 +140,8 @@ public class WebConfig implements WebMvcConfigurer {
@Bean
@ConditionalOnProperty(name = "swagger.basic.enable", havingValue = "true")
public MappedInterceptor getMappedInterceptor() {
return new MappedInterceptor(new String[]{"/swagger-ui.html", "/webjars/**"}, new SwaggerInterceptor(username, password, check));
return new MappedInterceptor(new String[]{"/doc.html", "/webjars/**"}, new SwaggerInterceptor(username, password, check));
}
// 验证参数是否完全匹配
// @Override

View File

@@ -35,7 +35,6 @@ public class SmsRecordController {
@Autowired
private SmsService smsService;
/**
* 注册账户时发送短信api
* @param phone 手机号码
@@ -55,7 +54,7 @@ public class SmsRecordController {
@ApiOperation(value = " 发送短信")
@RequestMapping(value = "/sendCode", method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(name="phone", value="手机号码", required = true)
@ApiImplicitParam(name="phone", value="手机号码", required = true)
})
public CommonResult<Object> sendCode(@RequestParam String phone){
ValidateFormUtil.isPhone(phone,"手机号码错误");
@@ -198,12 +197,14 @@ public class SmsRecordController {
@ApiImplicitParams({
@ApiImplicitParam(name="payType", value="支付类型 weixin微信支付/alipay支付宝支付"),
@ApiImplicitParam(name="mealId", value="套餐id"),
@ApiImplicitParam(name="price", value="价格")
@ApiImplicitParam(name="price", value="价格"),
@ApiImplicitParam(name="num", value="套餐条数"),
})
public CommonResult<JSONObject> payQrCode(@RequestParam(name = "payType", defaultValue = SmsConstants.PAY_DEFAULT_PAY_TYPE) String payType,
@RequestParam(name = "mealId", required = false, defaultValue = "0") Integer mealId,
@RequestParam(name = "price", required = false, defaultValue = "0") BigDecimal price){
JSONObject result = smsService.getPayQrCode(payType, mealId, price);
@RequestParam(name = "mealId", required = true) Integer mealId,
@RequestParam(name = "price", required = true) BigDecimal price,
@RequestParam(name = "num", required = false, defaultValue = "0") Integer num){
JSONObject result = smsService.getPayQrCode(payType, mealId, price, num);
return CommonResult.success(getDataByResult(result));
}
@@ -223,8 +224,8 @@ public class SmsRecordController {
@ApiImplicitParam(name="type", value="type (1=验证码 2=通知 3=推广)"),
})
public CommonResult<JSONObject> applyTempMessage(@RequestParam(name = "title") String title,
@RequestParam(name = "content") String content,
@RequestParam(name = "type", required = false, defaultValue = "1") Integer type){
@RequestParam(name = "content") String content,
@RequestParam(name = "type", required = false, defaultValue = "1") Integer type){
JSONObject result = smsService.applyTempMessage(title, content, type);
return CommonResult.success(getMsgByResult(result));
}
@@ -274,4 +275,3 @@ public class SmsRecordController {
}

View File

@@ -57,4 +57,6 @@ public class RegisterRequest implements Serializable {
private String code;
private String verify_code;
private String url;
}

View File

@@ -11,10 +11,10 @@ import java.util.HashMap;
import java.util.List;
/**
* @author Mr.Zhang
* @Description SmsService 接口
* @since 2020-04-16
*/
* @author Mr.Zhang
* @Description SmsService 接口
* @since 2020-04-16
*/
public interface SmsService{
JSONObject register(RegisterRequest registerRequest);
@@ -33,7 +33,7 @@ public interface SmsService{
JSONObject payTempList(PageParamRequest pageParamRequest);
JSONObject getPayQrCode(String payType, Integer mealId, BigDecimal price);
JSONObject getPayQrCode(String payType, Integer mealId, BigDecimal price, Integer num);
JSONObject applyTempMessage(String title, String content, Integer type);

View File

@@ -179,15 +179,17 @@ public class SmsServiceImpl implements SmsService {
public JSONObject register(RegisterRequest registerRequest) {
registerRequest.setPassword(DigestUtils.md5Hex(registerRequest.getPassword()));
registerRequest.setVerify_code(registerRequest.getCode());
registerRequest.setUrl(registerRequest.getDomain());
Map<String, Object> map = CrmebUtil.objectToMap(registerRequest);
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
param.setAll(map);
// JSONObject post = post(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_REGISTER_URI, map);
JSONObject post = postFrom(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_REGISTER_URI, param, null);
// token存入Redis
String accessToken = SmsConstants.SMS_USER_TOKEN_PREFIX.concat(post.getJSONObject("data").getString("access_token"));
Long expiresIn = post.getJSONObject("data").getLong("expires_in");
expiresIn = expiresIn - System.currentTimeMillis()/1000;
redisUtil.set(StrUtil.format(SmsConstants.SMS_USER_TOKEN_REDIS_PREFIX, getMd5Token()), accessToken, expiresIn, TimeUnit.SECONDS);
// 开通短信服务
HashMap<String, String> header = getCommonHeader(accessToken);
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
@@ -349,10 +351,11 @@ public class SmsServiceImpl implements SmsService {
@Override
public JSONObject payTempList(PageParamRequest pageParamRequest) {
init();
Map<String, Object> map = mergeToken(CrmebUtil.objectToMap(pageParamRequest));
map.put("type", "sms");
// Map<String, Object> map = mergeToken(CrmebUtil.objectToMap(pageParamRequest));
// map.put("type", "sms");
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.setAll(map);
params.add("type", "sms");
// params.setAll(map);
String accessToken = getSmsUserTokenByRedis();
HashMap<String, String> header = getCommonHeader(accessToken);
// return get(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_PAY_TEMP_LIST_URI, map);
@@ -369,19 +372,28 @@ public class SmsServiceImpl implements SmsService {
* @return JSONObject
*/
@Override
public JSONObject getPayQrCode(String payType, Integer mealId, BigDecimal price) {
public JSONObject getPayQrCode(String payType, Integer mealId, BigDecimal price, Integer num) {
init();
Map<String, Object> map = getTokenMap();
// map.put("payType", payType);
map.put("pay_type", payType);
// map.put("mealId", mealId);
map.put("meal_id", mealId);
map.put("price", price);
// map.put("uid", getAccount());
// map.put("token", getMd5Token());
map.put("type", "sms");
map.put("notify", getPayNotifyUrl());
return post(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_PAY_QR_CODE_URI, map);
// Map<String, Object> map = getTokenMap();
//// map.put("payType", payType);
// map.put("pay_type", payType);
//// map.put("mealId", mealId);
// map.put("meal_id", mealId);
// map.put("price", price);
//// map.put("uid", getAccount());
//// map.put("token", getMd5Token());
// map.put("type", "sms");
// map.put("notify", getPayNotifyUrl());
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("meal_id", mealId);
params.add("price", price);
params.add("num", num);
params.add("type", "sms");
params.add("pay_type", payType);
String accessToken = getSmsUserTokenByRedis();
HashMap<String, String> header = getCommonHeader(accessToken);
// return post(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_PAY_QR_CODE_URI, map);
return postFrom(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_PAY_QR_CODE_URI, params, header);
}
/**
@@ -646,7 +658,6 @@ public class SmsServiceImpl implements SmsService {
public JSONObject sendCodeForRegister(String phone) {
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("phone", phone);
// return getData(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_CAPTCHA_URI+"?phone="+phone);
return postFrom(SmsConstants.SMS_API_URL + SmsConstants.SMS_API_CAPTCHA_URI, map, null);
}

View File

@@ -14,14 +14,14 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_test?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: youMysqlAccount
password: youMysqlPwd
url: jdbc:mysql://121.196.17.222:3306/crmeb_java_beta?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: crmeb_java_beta
password: Yx7Scb8zk7KZShM5
redis:
host: redisPath #地址
host: 121.196.17.222 #地址
port: 6379 #端口
password: #密码
timeout: 30000 # 连接超时时间(毫秒)
password: 9c4d4a99a3fa3122d9
timeout: 1000 # 连接超时时间(毫秒)
database: 0 #默认数据库
jedis:
pool:

View File

@@ -30,14 +30,14 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_test?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: youMysqlAccount
password: youMysqlPwd
url: jdbc:mysql://121.196.17.222:3306/crmeb_java_beta?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: crmeb_java_beta
password: Yx7Scb8zk7KZShM5
redis:
host: redisPath #地址
host: 121.196.17.222 #地址
port: 6379 #端口
password: #密码
timeout: 30000 # 连接超时时间(毫秒)
password: 9c4d4a99a3fa3122d9
timeout: 1000 # 连接超时时间(毫秒)
database: 0 #默认数据库
jedis:
pool: