Commit a17a094f by 郑云飞

init

parents
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
This diff is collapsed. Click to expand it.
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%
This diff is collapsed. Click to expand it.
package com.yunniu.farming;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@MapperScan("com.yunniu.farming.webadmin.dao")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.webadmin.model.Accountalterrec;
import com.yunniu.farming.webadmin.service.impl.AccountalterrecServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @功能 账户收益
* @author
*/
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/app/accountalterrec")
public class AccountalterrecAppController {
@Autowired
private AccountalterrecServiceImpl accountalterrecServiceImpl;
@RequestMapping(value = "/list")
public String accountalterrec(Model model) {
return "accountalterrec/list";
}
@RequestMapping(value = "/rebateList")
public String rebateList(Model model) {
return "userRebate/list";
}
@RequestMapping(value = "/saList")
public String saList(Model model) {
return "accountalterrec/saList";
}
/**
* 新增 编辑方法
*
* @param item
* @return 返回封装好的ReturnResult对象 对象中data是所需要的数据
*/
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public ReturnResult add(@RequestBody Accountalterrec item) {
// 调用service 方法 返回结果
return this.accountalterrecServiceImpl.add(item);
}
/**
* 根据 对象id 删除对象
*
* @param id=对象id
* @return 返回封装好的returnResult对象 对象中data是数据
*/
@RequestMapping(value = "/{id}/deleteById", method = RequestMethod.GET)
@ResponseBody
public ReturnResult deleteByid(@PathVariable Integer id) {
// 调用service 方法 返回结果
this.accountalterrecServiceImpl.deleteById(id);
return ReturnResult.getSuccessResult();
}
/**
* 多参数条件分页
*
* @param item 对象查找的条件 以及分页的参数
* @return 封装好的数据集合 都存放在ReturnResult里面的data中
*/
@RequestMapping(value = "/findPageList", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findPageList(@RequestBody Accountalterrec item) {
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<Accountalterrec> items=this.accountalterrecServiceImpl.findPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return ReturnResult.getSuccessResult(rmap);
}
/**
* FRICE TODO 根据 ”多参数“ 查找对象集合
*
* @param item Java对象
* @return ReturnResult 对象列表List<JavaObject>
*/
@RequestMapping(value = "/findByParam", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findByParam(@RequestBody Accountalterrec item) {
// 1. 调用 Service 方法
List<Accountalterrec> docs = this.accountalterrecServiceImpl.findByParam(item);
// 2. 返回查询结果
return ReturnResult.getSuccessResult(docs);
}
/**
* 根据”对象id“ 查找对象
*
* @param id=对象id
* @return ReturnResult 单个JavaObject
*/
@RequestMapping(value = "/{id}/findById", method = RequestMethod.GET)
@ResponseBody
public ReturnResult findById(@PathVariable Integer id) {
Accountalterrec m = this.accountalterrecServiceImpl.findById(id);
return ReturnResult.getSuccessResult(m);
}
/**
* 根据”对象id“ 查询余额
*
* @param id=对象id
* @return ReturnResult 单个JavaObject
*/
@RequestMapping(value = "/findBalanceByParam", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findBalanceByParam(@RequestBody Accountalterrec item) {
// 1. 调用Service方法
return this.accountalterrecServiceImpl.findBalanceByid(item);
}
/**
* 提现申请
* @param
* @return ReturnResult
*/
@RequestMapping(value = "/toAuditWithDraw", method = RequestMethod.POST)
@ResponseBody
public ReturnResult toAuditWithDraw(@RequestBody JSONObject json)throws Exception{
Accountalterrec rec = JSONObject.toJavaObject(json,Accountalterrec.class);
return this.accountalterrecServiceImpl.toAuditWithDraw(rec);
}
/**
* @提现申请 审核处理:通过或拒绝
* @param
* @return ReturnResult
*/
@RequestMapping(value = "/auditWithDraw", method = RequestMethod.POST)
@ResponseBody
public ReturnResult auditWithDraw(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Accountalterrec user = JSONObject.toJavaObject(json,Accountalterrec.class);
//1. 调用Service方法
return this.accountalterrecServiceImpl.auditWithDraw(user);
}
/**
* 统计个人收益
*/
@RequestMapping(value = "/countShouYi", method = RequestMethod.POST)
@ResponseBody
public ReturnResult countShouYi(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Accountalterrec accountalterrec = JSONObject.toJavaObject(json,Accountalterrec.class);
//2. 调用service方法
ReturnResult result = this.accountalterrecServiceImpl.countShouYi(accountalterrec);
return result;
}
/**
* 统计团队津贴
*/
@RequestMapping(value = "/countTeamJt", method = RequestMethod.POST)
@ResponseBody
public ReturnResult countTeamJt(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Accountalterrec accountalterrec = JSONObject.toJavaObject(json,Accountalterrec.class);
//2. 调用service方法
ReturnResult result = this.accountalterrecServiceImpl.countTeamJt(accountalterrec);
return result;
}
/**
* 统计管理津贴
*/
@RequestMapping(value = "/countManageJt", method = RequestMethod.POST)
@ResponseBody
public ReturnResult countManageJt(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Accountalterrec accountalterrec = JSONObject.toJavaObject(json,Accountalterrec.class);
//2. 调用service方法
ReturnResult result = this.accountalterrecServiceImpl.countManageJt(accountalterrec);
return result;
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.Address;
import com.yunniu.farming.webadmin.service.impl.AddressServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* 地址
*/
@Controller
@RequestMapping("/app/address")
public class AddressAppController {
@Autowired
private AddressServiceImpl service;
//---------------------增、删、改、查方法------------------------
/**
* 新增、编辑 方法
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody JSONObject json){
Address address = JSONObject.toJavaObject(json,Address.class);
return this.service.add(address);
}
/**
* 编辑 方法
*/
@RequestMapping(value = "/update",method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody JSONObject json){
Address address = JSONObject.toJavaObject(json,Address.class);
return this.service.update(address);
}
/**
* 根据 ”多参数“ 查找对象集合 带分页
*/
@RequestMapping(value = "/findPageList",method = RequestMethod.POST)
@ResponseBody
public Result findPageList(@RequestBody Address address){
//2. 返回查询结果
return this.service.findPageList(address);
}
/**
* 根据 ”多参数“ 查找对象集合 不带分页
*/
@RequestMapping(value = "/findByParam",method = RequestMethod.POST)
@ResponseBody
public Result findByParam(@RequestBody Address address){
//2. 返回查询结果
return service.findByParam(address);
}
/**
* 根据”对象id“ 查找对象
* @param id=对象id
* @return ReturnResult 单个JavaObject
*/
@RequestMapping(value = "/{id}/findById", method = RequestMethod.GET)
@ResponseBody
public Result findById(@PathVariable Integer id){
//1. 调用Service方法
Address u = this.service.findByid(id);
//2. 返回查询结果
return Result.success(u);
}
/**
* 根据”对象id“ 删除对象
* @param id=对象id
* @return ReturnResult
*/
@RequestMapping(value = "/{id}/deleteById", method = RequestMethod.GET)
@ResponseBody
public Result deleteById(@PathVariable Integer id){
return this.service.deleteByid(id);
}
}
package com.yunniu.farming.app;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.Article;
import com.yunniu.farming.webadmin.service.impl.ArticleServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/app/article")
public class ArticleAppController {
@Autowired
private ArticleServiceImpl service;
/**
* 新增 编辑方法
* @param item
* @return
*/
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Article item){
return this.service.insertSelective(item);
}
/**
* 新增 编辑方法
*/
@RequestMapping(value = "/saveIdea", method = RequestMethod.POST)
@ResponseBody
public Result saveIdea(@RequestBody Article item){
//调用service 方法 返回结果
return this.service.saveIdea(item);
}
/**
* 根据 查询参数统计 数量
* @return
*/
@RequestMapping(value = "/findAdminCount", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findAdminCount(@RequestBody Article doc){
return ReturnResult.getSuccessResult(this.service.findAdminCount(doc));
}
/**
* 根据 对象id 删除对象
* @param id=对象id
* @return
*/
@RequestMapping(value = "/{id}/deleteByid", method = RequestMethod.GET)
@ResponseBody
public ReturnResult deleteByid(@PathVariable Integer id){
//调用service 方法 返回结果
return ReturnResult.getSuccessResult(this.service.deleteByid(id));
}
/**
* 根据 多参数查询集合 是否阅读
* @param item 对象
* @return ReturnResult 对象列表集合
*/
@RequestMapping(value = "/findParamRead", method = RequestMethod.POST)
@ResponseBody
public Result findParamRead(@RequestBody Article item){
//调用service 方法 返回查询结果集
return this.service.findParamRead(item);
}
/**
* 多参数条件分页
* @param doc
* @return
*/
@RequestMapping("/findPageList")
@ResponseBody
public ReturnResult findPageList(@RequestBody Article item){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<Article> items = this.service.findPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return ReturnResult.getSuccessResult(rmap);
}
/**
* 根据 多参数查询对象结合
* @param item 对象
* @return ReturnResult 对象列表集合
*/
@RequestMapping("/findByParam")
@ResponseBody
public Result findByParam(@RequestBody Article item){
//调用service 方法 返回查询结果集
return this.service.findByParam(item);
}
/**
* 根据”对象id“ 查找对象
* @param id=对象id
* @return ReturnResult 单个JavaObject
*/
@RequestMapping(value = "/{id}/findByid", method = RequestMethod.GET)
@ResponseBody
public ReturnResult findByid(@PathVariable Integer id){
//1. 调用Service方法
Article activity= this.service.findByid(id);
//2. 返回查询结果
return ReturnResult.getSuccessResult(activity);
}
}
package com.yunniu.farming.app;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.Banner;
import com.yunniu.farming.webadmin.model.Product;
import com.yunniu.farming.webadmin.service.impl.BannerServiceImpl;
import com.yunniu.farming.webadmin.service.impl.ProductServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/app/banner")
public class BannerAppController {
@Autowired
private BannerServiceImpl service;
@Autowired
private ProductServiceImpl productService;
/**
* 根据 对象id 删除对象
*/
@RequestMapping(value = "/{id}/deleteById", method = RequestMethod.GET)
@ResponseBody
public Result deleteByid(@PathVariable Integer id){
//调用service 方法 返回结果
return this.service.deleteByid(id);
}
/**
* 多参数条件分页
*/
@RequestMapping("/findPageList")
@ResponseBody
public Result findPageList(@RequestBody Banner item){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<Banner> items = this.service.findPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return Result.success(rmap);
}
/**
* 根据 多参数查询对象结合
*/
@RequestMapping("/findByParam")
@ResponseBody
public Result findByParam(){
//调用service 方法 返回查询结果集
return this.service.findByParam();
}
/**
* 根据”对象id“ 查找对象
*/
@GetMapping(value = "/getInfo")
public Result findById(Integer id){
Banner banner= this.service.findById(id);
return Result.success(banner);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(Banner banner) {
return this.service.add(banner);
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.util.COSUtil;
import com.yunniu.farming.util.FileUtil;
import com.yunniu.farming.util.OssUtil;
import com.yunniu.farming.webadmin.model.Customer;
import com.yunniu.farming.webadmin.service.impl.CustomerServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/app/customer")
public class CustomerAppController {
@Autowired
private CustomerServiceImpl customerService;
/**
* APP端注册
*/
@RequestMapping(value = "/regist",method = RequestMethod.POST)
@ResponseBody
public Result regist(@RequestBody Customer u){
return this.customerService.regist(u);
}
/**
* APP端登录,通过账号+密码
*/
@RequestMapping(value = "/appLogin",method = RequestMethod.POST)
@ResponseBody
public Result appLogin(@RequestBody Customer u) {
return this.customerService.appLogin(u);
}
/**
* 修改密码
*/
@RequestMapping(value = "/modifyPassword", method = RequestMethod.POST)
@ResponseBody
public Result modifyPassword(@RequestBody Customer u){
return this.customerService.modifyPassword(u);
}
/**
* 根据 Object对象参数 查找 对象列表
* 带参 分页查询
* 注意:这里分页是通过分页插件拦截器实现的,分页相关的数据是通过 查询参数对象 又重新返回了
* @return
*/
@RequestMapping(value = "/findPageList", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findPageList(@RequestBody Customer doc){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
// 分页数据处理
// 传入当前页数,适配PC端Layui分页
if(doc.getCurpage() != null || doc.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(doc.getCurpage() != null) {
pinfo.setCurPage(doc.getCurpage());
}
if(doc.getPagesize() != null) {
pinfo.setPageSize(doc.getPagesize());
}
doc.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = doc.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
doc.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
doc.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<Customer> docs = this.customerService.selectByParamPageList(doc);
// 3.将查询结果的 分页数据封装后返回
//总记录数
int totalRs = pinfo.getTotalRecords();
//总页数
int totalPs = 0;
//总页数计算
if(totalRs % pinfo.getPageSize() == 0){
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", docs);
return ReturnResult.getSuccessResult(rmap);
}
/**
* FRICE TODO 根据 ”多参数“ 查找对象集合
*
* @param Customer Java对象
* @return ReturnResult 对象列表List<JavaObject>
*/
@RequestMapping(value = "/findByParam", method = RequestMethod.POST)
@ResponseBody
public ReturnResult findByParam(@RequestBody Customer item) {
// 1. 调用 Service 方法
List<Customer> docs = this.customerService.findByParam(item);
// 2. 返回查询结果
return ReturnResult.getSuccessResult(docs);
}
/**
* 更新
* @param json
* @return
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody JSONObject json) {
// 1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Customer user = JSONObject.toJavaObject(json, Customer.class);
// 2. 调用service方法
return this.customerService.update(user);
}
/**
* 新增、编辑 方法
*
* @param JSONObject userJson前台封装的json对象
* @return ReturnResult
*/
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public ReturnResult add(@RequestBody JSONObject json) {
// 1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
Customer user = JSONObject.toJavaObject(json, Customer.class);
// 保存订单主表信息
user = this.customerService.add(user);
return ReturnResult.getSuccessResult(user);
}
/**
* 根据”对象id“ 查找对象
*
* @param id =对象id
* @return ReturnResult 单个JavaObject
*/
@RequestMapping(value = "/{id}/findById", method = RequestMethod.GET)
@ResponseBody
public ReturnResult findById(@PathVariable Integer id) {
// 1. 调用Service方法
Customer item = this.customerService.findByid(id);
// 2. 返回查询结果
return ReturnResult.getSuccessResult(item);
}
/**
* 根据”对象id“ 删除对象
*
* @param id =对象id
* @return ReturnResult
*/
@RequestMapping(value = "/{id}/deleteById", method = RequestMethod.POST)
@ResponseBody
public ReturnResult deleteById(@PathVariable Integer id) {
// 1. 调用Service方法
int deleteR = this.customerService.deleteByid(id);
// 2. 返回查询结果
return ReturnResult.getSuccessResult(deleteR);
}
//文件上传
@RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
@ResponseBody
public Result fileUpload(@RequestParam(value = "file", required = false) MultipartFile file) {
String path = FileUtil.saveFile(file, "catering");
String url = COSUtil.uploadFileByPath(path);
return Result.success("成功", url);
}
}
package com.yunniu.farming.app;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.DocCatalog;
import com.yunniu.farming.webadmin.service.impl.DocCatalogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
@RequestMapping("/app/catalog")
public class DocCatalogAppController {
@Autowired
private DocCatalogServiceImpl catalogServiceImpl;
/**
* 根据 ”多参数“ 查找对象集合
*/
@RequestMapping(value = "/findByParam",method = RequestMethod.POST)
@ResponseBody
public Result findByParam(@RequestBody DocCatalog item){
List<DocCatalog> docs = this.catalogServiceImpl.findByParam(item);
return Result.success(docs);
}
/**
* 查询商品分类
*/
@RequestMapping(value = "/findProInfo",method = RequestMethod.POST)
@ResponseBody
public Result findProInfo(@RequestBody DocCatalog item){
item.setItype(DocCatalog.TYPE_PRO);//商品
List<DocCatalog> docs = this.catalogServiceImpl.findByParam(item);
return Result.success(docs);
}
/**
* @参数查询商品分类,带分类商品
*/
@RequestMapping(value = "/findProSubs", method = RequestMethod.POST)
@ResponseBody
public Result findProSubs(@RequestBody DocCatalog item){
item.setItype(DocCatalog.TYPE_PRO);//商品
return this.catalogServiceImpl.selectProSubByParam(item);
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.Integralrec;
import com.yunniu.farming.webadmin.service.impl.IntegralrecServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/app/integralrec")
public class IntegralrecAppController {
/**
* 系统用户Service 注册
*/
@Autowired
private IntegralrecServiceImpl service;
//---------------------增、删、改、查方法------------------------
/**
* 新增、编辑 方法
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody JSONObject json){
Integralrec user = JSONObject.toJavaObject(json,Integralrec.class);
return this.service.add(user);
}
/**
* 根据 ”多参数“ 查找对象集合
*/
@RequestMapping(value = "/findByParam",method = RequestMethod.POST)
@ResponseBody
public Result findByParam(@RequestBody JSONObject json){
Integralrec item = JSONObject.toJavaObject(json,Integralrec.class);
List<Integralrec> docs = this.service.findByParam(item);
return Result.success(docs);
}
/**
* 根据 多参数 分页查找 对象集合
* 注意:这里分页是通过分页插件拦截器实现的,分页相关的数据是通过 查询参数对象 又重新返回了
* @return
*/
@RequestMapping(value = "/findPageList", method = RequestMethod.POST)
@ResponseBody
public Result findPageList(@RequestBody Integralrec item){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<Integralrec> items = this.service.findByParamPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return Result.success(rmap);
}
/**
* 根据”对象id“ 查找对象
*/
@RequestMapping(value = "/{id}/findByid", method = RequestMethod.GET)
@ResponseBody
public Result findById(@PathVariable Integer id){
Integralrec u = this.service.findByid(id);
return Result.success(u);
}
/**
* 根据”对象id“ 删除对象
*/
@RequestMapping(value = "/{id}/deleteByid", method = RequestMethod.GET)
@ResponseBody
public Result deleteById(@PathVariable Integer id){
//1. 调用Service方法
int deleteR = this.service.deleteByid(id);
//2. 返回查询结果
return Result.success(deleteR);
}
//-------------------其他 业务方法-------------------------
/**
* 统计积分余额
*/
@RequestMapping(value = "/sumIntegral", method = RequestMethod.POST)
@ResponseBody
public Result sumIntegral(@RequestBody Integralrec item){
Double inte = this.service.sumIntegral(item);
return Result.success(inte);
}
}
package com.yunniu.farming.app;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.webadmin.model.NoticeRead;
import com.yunniu.farming.webadmin.service.impl.NoticeReadServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("/app/noticeread")
public class NoticeReadAppController {
@Autowired
private NoticeReadServiceImpl service;
/**
* 新增 编辑方法
* @param item
* @return
*/
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public ReturnResult add(@RequestBody NoticeRead item){
//调用service 方法 返回结果
return this.service.insertSelective(item);
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.service.impl.OrderMainServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/app/order/")
public class OrderMainAppController {
@Autowired
private OrderMainServiceImpl orderService;
/**
* 多参数条件分页
*/
@RequestMapping(value = "/findPageList", method = RequestMethod.POST)
@ResponseBody
public Result findPageList(@RequestBody OrderMain item) {
if(item.getCustomerid() == null || item.getCustomerid().equals("")) return Result.success();
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<OrderMain> items=this.orderService.selectByParamPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return Result.success(rmap);
}
/**
* FRICE TODO 根据 ”多参数“ 查找对象集合
*/
@RequestMapping(value = "/findByParam", method = RequestMethod.POST)
@ResponseBody
public Result findByParam(@RequestBody OrderMain item) {
List<OrderMain> docs = this.orderService.findByParam(item);
return Result.success(docs);
}
/**
* 更新订单
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody JSONObject json) {
OrderMain orderM = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.update(orderM);
}
/**
* 创建订单
*/
@RequestMapping(value = "/addOrder", method = RequestMethod.POST)
@ResponseBody
public Result addOrder(@RequestBody JSONObject json) {
OrderMain main = JSONObject.toJavaObject(json, OrderMain.class);
main = this.orderService.addOrder(main);
return Result.success(main);
}
/**
* 创建积分订单
*/
@RequestMapping(value = "/addIntOrder", method = RequestMethod.POST)
@ResponseBody
public Result addIntOrder(@RequestBody JSONObject json) {
OrderMain main = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.addIntOrder(main);
}
/**
* 根据”对象id“ 查找对象
*/
@RequestMapping(value = "/{id}/findById", method = RequestMethod.GET)
@ResponseBody
public Result findById(@PathVariable Integer id) {
OrderMain titem = this.orderService.findByid(id);
return Result.success(titem);
}
/**
* 根据”对象id“ 删除对象
*
*/
@RequestMapping(value = "/{id}/deleteById", method = RequestMethod.POST)
@ResponseBody
public Result deleteById(@PathVariable Integer id) {
return this.orderService.deleteByid(id);
}
/**
* 根据参数,查询订单数量
*/
@RequestMapping(value = "/findOrderNum",method = RequestMethod.POST)
@ResponseBody
public Result findOrderNum(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
int orderNum = this.orderService.findOrderNum(user);
return Result.success(orderNum);
}
/**
* 取消订单
*/
@RequestMapping(value = "/cancelOrder",method = RequestMethod.POST)
@ResponseBody
public Result cancelOrder(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.cancelOrder(user);
}
/**
* 订单已完成
*/
@RequestMapping(value = "/updateOkStatus",method = RequestMethod.POST)
@ResponseBody
public Result updateOkStatus(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.updateOkStatus(user);
}
/**
* @积分兑换 商品
*/
@RequestMapping(value = "/integralPay", method = RequestMethod.POST)
public Result integralPay(Integer userId, Integer orderId){
return this.orderService.integralPay(userId,orderId);
}
/**
* 微信支付
*/
@RequestMapping(value = "/appWxPay", method = RequestMethod.POST)
public Result appWxPay(Integer userId, Integer orderId, HttpServletRequest request) {
try {
return orderService.appWxPay(userId, orderId, request);
} catch (Exception e) {
return Result.error();
}
}
}
package com.yunniu.farming.app;
import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.config.ReturnResult;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.Banner;
import com.yunniu.farming.webadmin.model.SysSet;
import com.yunniu.farming.webadmin.service.impl.SysSetServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @功能:系统参数
*/
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/app/sysset")
public class SysSetAppController {
@Autowired
private SysSetServiceImpl service;
/**
* 新增
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody JSONObject json){
SysSet item = JSONObject.toJavaObject(json,SysSet.class);
return this.service.add(item);
}
/**
* 带参查询
*/
@RequestMapping(value = "/findByParam",method = RequestMethod.POST)
@ResponseBody
public Result findByEntity(){
SysSet docs = this.service.findByParam();
return Result.success(docs);
}
/**
* 根据id查找
*/
@RequestMapping(value = "/{id}/findByid", method = RequestMethod.GET)
@ResponseBody
public Result findById(@PathVariable Integer id){
return this.service.finById(id);
}
/**
* 根据id更新
*/
@RequestMapping(value = "/updateById",method = RequestMethod.POST)
@ResponseBody
public ReturnResult updateById(@RequestBody JSONObject json){
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
SysSet user = JSONObject.toJavaObject(json,SysSet.class);
//2. 调用service方法
int result = this.service.update(user);
return ReturnResult.getSuccessResult(result);
}
@RequestMapping(value = "/getBanner", method = RequestMethod.POST)
@ResponseBody
public Banner getBanner() {
return service.getBanner();
}
}
package com.yunniu.farming.app;
import com.yunniu.farming.webadmin.model.Result;
import com.yunniu.farming.webadmin.service.WxService;
import com.yunniu.farming.webadmin.service.impl.OrderMainServiceImpl;
import com.yunniu.farming.webadmin.service.impl.WxServiceImpl;
import org.jdom.JDOMException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/wx/")
public class WxController {
@Resource
private WxService wxService;
@Resource
private WxServiceImpl wxServiceImpl;
@Resource
private OrderMainServiceImpl orderMainServiceImpl;
/**
* 短信登录
*
* @param code
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result login(String code) {
return wxService.login(code);
}
/**
* 微信支付
*
* @param request
* @return
*/
@RequestMapping(value = "/wxPay", method = RequestMethod.POST)
public Result wxPay(Integer userId, Integer orderId, HttpServletRequest request) {
try {
return wxService.wxPay(userId, orderId, request);
} catch (Exception e) {
return new Result(103);
}
}
/**
* 微信异步通知
*/
@RequestMapping(value = "/notify", method = {RequestMethod.POST, RequestMethod.GET})
public void wxNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException {
wxService.notify(request, response);
}
/**
* 回调测试
*/
@RequestMapping(value = "/testNotifyOk/{id}", method = RequestMethod.GET)
@ResponseBody
public String testNotifyOk(@PathVariable Integer id){
if(id == null) return null;
this.wxServiceImpl.testNotifyOk(id);
return "ok";
}
// @RequestMapping(value = "/asd", method = {RequestMethod.POST, RequestMethod.GET})
// public void asd(String outTradeNo) throws IOException, JDOMException {
// wxService.asd(outTradeNo);
// }
}
\ No newline at end of file
package com.yunniu.farming.common.exceptions;
import org.apache.log4j.Logger;
/**
*<p> 运行时异常 </p>
*@date 2011-08-10
*@author Frice
*@since v0.1
*/
@SuppressWarnings("unused")
public class ApplicationException extends RuntimeException {
// ------------------------------ FIELDS ------------------------------
/**
*
*/
public static int errorCode = 10000;
// --------------------------- CONSTRUCTORS ---------------------------
public ApplicationException(final String message) {
super(message);
log();
}
public ApplicationException(final Throwable cause) {
super(cause);
log();
}
public ApplicationException(final String message, final Throwable cause) {
super(message, cause);
log();
}
public ApplicationException(final Throwable cause,
final int errorCode) {
super(cause);
this.errorCode = errorCode;
log();
}
public ApplicationException(final String message,
final int errorCode) {
super(message + ", ErrorCode:" + errorCode);
this.errorCode = errorCode;
log();
}
public ApplicationException(final String message,
final Throwable cause,
final int errorCode) {
super(message + ", ErrorCode:" + errorCode, cause);
this.errorCode = errorCode;
log();
}
// -------------------------- OTHER METHODS --------------------------
protected Logger getLogger() {
return Logger.getLogger(this.getClass());
}
protected void log() {
getLogger().error(this.getMessage(), this);
}
}
package com.yunniu.farming.common.exceptions;
/**
*<p> 业务运行时异常 </p>
*@date 2011-08-10
*@author Frice
*@since v0.1
*/
public class BusinessException extends ApplicationException {
// ------------------------------ FIELDS ------------------------------
public static final int errorCode = 12000;
public static final int errorCodeNoLogin = 12001;//未登录
public static final int errorCodeTokenExpire = 12002;//token失效
// --------------------------- CONSTRUCTORS ---------------------------
public BusinessException(final String message) {
super(message);
}
public BusinessException(final Throwable cause) {
super(cause);
}
public BusinessException(final String message, final Throwable cause) {
super(message, cause);
}
public BusinessException(final Throwable cause, final int errorCode) {
super(cause, errorCode);
}
public BusinessException(final String message, final int errorCode) {
super(message, errorCode);
}
public BusinessException(final String message, final Throwable cause, final int errorCode) {
super(message, cause, errorCode);
}
}
package com.yunniu.farming.common.plugin;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.io.Serializable;
import java.util.List;
/**
* 分页对象
* @author Administrator
*
*/
public class PageInfo implements Serializable {
private static final long serialVersionUID = 587754556498974978L;
// pagesize ,每一页显示多少
private int pageSize = 10;
// 总页数
private int totalPages = 0;
// 总记录数
private int totalRecords = 0;
// 当前页数:默认查询第一页
private int curPage = 1;
// 当前的记录的条数,意为从第“N”条记录开始查询,
// 在mysql中 select ... limit arg1,arg2 中就是第一个参数arg1;
// 第二个参数是 arg2,意为 这一次查询要查询几条记录,就是每页的记录数.
private int curRecord = 0;//默认从第0条开始查询
//排序相关
private List<String> sortFields;
private List<String> sortMode;
public static final String SORT_DESC = "DESC";
public static final String SORT_ASC = "ASC";
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
public int getCurPage() {
return curPage;
}
public void setCurPage(int curPage) {
this.curPage = curPage;
}
public int getCurRecord() {
return curRecord;
}
public void setCurRecord(int curRecord) {
this.curRecord = curRecord;
}
public List<String> getSortFields() {
return sortFields;
}
public void setSortFields(List<String> sortFields) {
this.sortFields = sortFields;
}
public List<String> getSortMode() {
return sortMode;
}
public void setSortMode(List<String> sortMode) {
this.sortMode = sortMode;
}
@Override
public String toString(){
return JSONObject.toJSONString(this);
}
public JSONObject toJSON() {
return JSON.parseObject(this.toString());
}
}
package com.yunniu.farming.common.plugin;
import com.yunniu.farming.util.ReflectHelper;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.executor.statement.BaseStatementHandler;
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.property.PropertyTokenizer;
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
@Component
@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integer.class}) })
public class PagePlugin implements Interceptor {
private static String dialect = "mysql";
private static String pageSqlId = ".*PageList.*";
@SuppressWarnings("unchecked")
public Object intercept(Invocation ivk) throws Throwable {
if (ivk.getTarget() instanceof RoutingStatementHandler) {
RoutingStatementHandler statementHandler = (RoutingStatementHandler) ivk.getTarget();
BaseStatementHandler delegate = (BaseStatementHandler) ReflectHelper.getValueByFieldName(statementHandler, "delegate");
MappedStatement mappedStatement = (MappedStatement) ReflectHelper.getValueByFieldName(delegate, "mappedStatement");
if (mappedStatement.getId().matches(pageSqlId)) {
BoundSql boundSql = delegate.getBoundSql();
Object parameterObject = boundSql.getParameterObject();
if (parameterObject == null) {
throw new NullPointerException("parameterObject error");
} else {
Connection connection = (Connection) ivk.getArgs()[0];
String sql = boundSql.getSql();
String countSql = "select count(0) from (" + sql + ") myCount";
System.out.println("==> 查询总记录数SQL语句:" + countSql);
PreparedStatement countStmt = connection.prepareStatement(countSql);
BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(), countSql, boundSql.getParameterMappings(), parameterObject);
setParameters(countStmt, mappedStatement, countBS, parameterObject);
ResultSet rs = countStmt.executeQuery();
int count = 0;
if (rs.next()) {
count = rs.getInt(1);
}
rs.close();
countStmt.close();
/**
* 2017.12.21 FRICE TODO ADD 下面是处理 分页请求参数对象 PageInfo,主要是接收分页参数
* 这里有一个坑:不管前端参数是 PageInfo对象、Map对象、或者自定义实体对象,后面两种情况,必须包含pageinfo对象参数
* 否则,这里解析是通不过的
* 另外,分页相关的数据,通过“反射”又封装至传来的 参数对象中返回了,比如 PaperMain,直接去取即可
*/
PageInfo page = null;
if (parameterObject instanceof PageInfo) {
page = (PageInfo) parameterObject;
page.setTotalRecords(count);
} else if (parameterObject instanceof Map) {
Map<String, Object> map = (Map<String, Object>) parameterObject;
page = (PageInfo) map.get("pageinfo");
if (page == null)
page = new PageInfo();
page.setTotalRecords(count);
} else {
Field pageField = ReflectHelper.getFieldByFieldName(parameterObject, "pageinfo");
if (pageField != null) {
page = (PageInfo) ReflectHelper.getValueByFieldName(parameterObject, "pageinfo");
if (page == null)
page = new PageInfo();
page.setTotalRecords(count);
ReflectHelper.setValueByFieldName(parameterObject, "pageinfo", page);
} else {
throw new NoSuchFieldException(parameterObject.getClass().getName());
}
}
String pageSql = generatePageSql(sql, page);
System.out.println("==> 查询总页数 SQL:" + pageSql);
ReflectHelper.setValueByFieldName(boundSql, "sql", pageSql);
}
}
}
return ivk.proceed();
}
private void setParameters(PreparedStatement ps, MappedStatement mappedStatement, BoundSql boundSql, Object parameterObject) throws SQLException {
ErrorContext.instance().activity("setting parameters").object(mappedStatement.getParameterMap().getId());
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings != null) {
Configuration configuration = mappedStatement.getConfiguration();
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
MetaObject metaObject = parameterObject == null ? null : configuration.newMetaObject(parameterObject);
for (int i = 0; i < parameterMappings.size(); i++) {
ParameterMapping parameterMapping = parameterMappings.get(i);
if (parameterMapping.getMode() != ParameterMode.OUT) {
Object value;
String propertyName = parameterMapping.getProperty();
PropertyTokenizer prop = new PropertyTokenizer(propertyName);
if (parameterObject == null) {
value = null;
} else if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
value = parameterObject;
} else if (boundSql.hasAdditionalParameter(propertyName)) {
value = boundSql.getAdditionalParameter(propertyName);
} else if (propertyName.startsWith(ForEachSqlNode.ITEM_PREFIX) && boundSql.hasAdditionalParameter(prop.getName())) {
value = boundSql.getAdditionalParameter(prop.getName());
if (value != null) {
value = configuration.newMetaObject(value).getValue(propertyName.substring(prop.getName().length()));
}
} else {
value = metaObject == null ? null : metaObject.getValue(propertyName);
}
TypeHandler typeHandler = parameterMapping.getTypeHandler();
if (typeHandler == null) {
throw new ExecutorException("There was no TypeHandler found for parameter " + propertyName + " of statement " + mappedStatement.getId());
}
typeHandler.setParameter(ps, i + 1, value, parameterMapping.getJdbcType());
}
}
}
}
private String generatePageSql(String sql, PageInfo page) {
if (page != null && (dialect != null || !dialect.equals(""))) {
StringBuffer pageSql = new StringBuffer();
if ("mysql".equals(dialect)) {
pageSql.append(sql);
pageSql.append(" limit " + page.getCurRecord() + "," + page.getPageSize());
} else if ("oracle".equals(dialect)) {
pageSql.append("select * from (select tmp_tb.*,ROWNUM row_id from (");
pageSql.append(sql);
pageSql.append(") tmp_tb where ROWNUM<=");
pageSql.append(page.getCurRecord() + page.getPageSize());
pageSql.append(") where row_id>");
pageSql.append(page.getCurRecord());
}
return pageSql.toString();
} else {
return sql;
}
}
public Object plugin(Object arg0) {
// TODO Auto-generated method stub
return Plugin.wrap(arg0, this);
}
}
\ No newline at end of file
package com.yunniu.farming.config;
public class AppParamConfig {
//初始密码
public final static String dfPassWord = "123456";
//微信基本信息
public final static String token = "TOKEN202204201027";//服务器端令牌
//小程序参数
public final static String miniAppId = "wx3e8259265511712a";//小程序appid
public final static String miniAppSecret = "410847c7d14c57255cae5ddd6d457ebd";//小程序appserect
//公众号参数
public final static String mpAppId = "wx6dd6d61685960552";//公众号appid
public final static String mpAppSecret = "8e884d1eeca31c9cd790cb6cd9eb2cf0";//公从号appserect
public final static String welcomeText = "你好,欢迎关注“xxxx”\n";
//微信支付相关
public final static String mchId = "1509684341";
public final static String apiKey = "a24ef44163c38b036718a8btc36985eb";
//菜单创建URL(POST) 限100(次/天)
public final static String menu_create_url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
//获取access_token的接口地址(GET) 限2000(次/天)
public final static String access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
//Jcode换取用户详细信息,包括头像、昵称、openid
public final static String get_wx_openid = "https://api.weixin.qq.com/sns/jscode2session";
//获取用户信息URL
public final static String get_wx_user = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
//内容检测接口URL
public final static String check_content = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN";
// 企业付款到零钱
public final static String wx_transfers_pay = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
public final static String wx_transfers_pay_query = "https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo";
//图片检测接口URL
public final static String check_img = "https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN";
//获取用户列表URL-每次获取10000个,当next_openid为空时,从第一个获取
public final static String get_sub_list = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID";
//无限制生成小程序二维码
public final static String get_mini_qrcode = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
}
package com.yunniu.farming.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
public class ReturnResult {
private int code;
private String msg;
private Object data;
public ReturnResult() {
super();
}
public ReturnResult(int code) {
super();
this.code = code;
}
public ReturnResult(int code, String msg) {
super();
this.code = code;
this.msg = msg;
}
public ReturnResult(int code, String msg, Object data) {
super();
this.code = code;
this.msg = msg;
this.data = data;
}
public static ReturnResult get(){
return getSuccessResult();
}
public static ReturnResult getSuccessResult(){
return new ReturnResult(StatusCode.SUCCESS_CODE, StatusCode.SUCCESS_DESC);
}
public static ReturnResult getSuccessResult(Object data){
return new ReturnResult(StatusCode.SUCCESS_CODE, StatusCode.SUCCESS_DESC, data);
}
public static ReturnResult getErrorResult(){
return new ReturnResult(StatusCode.ERROR_CODE, StatusCode.ERROR_DESC);
}
public static ReturnResult getErrorResult(int errorcode){
return new ReturnResult(StatusCode.ERROR_CODE, StatusCode.ERROR_DESC);
}
public static ReturnResult getErrorResult(String errordesc){
return new ReturnResult(StatusCode.ERROR_CODE, errordesc);
}
public static ReturnResult getEmptyResult(){
return new ReturnResult(StatusCode.EMPTY_CODE, StatusCode.EMPTY_DESC);
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public <T> List<T> getList(Class<T> clazz) {
String json = JSONObject.toJSONString(data);
if(json==null || json=="") return null;
return JSONArray.parseArray(json, clazz);
}
public <T> T getData(Class<T> clazz) {
String json = JSONObject.toJSONString(data);
if(json==null || json=="") return null;
return (T) JSON.parseObject(json, clazz);
}
@Override
public String toString(){
return JSONObject.toJSONString(this);
}
}
package com.yunniu.farming.config;
public class StatusCode {
public static final int SUCCESS_CODE = 0;
public static final String SUCCESS_DESC = "success";
public static final int ERROR_CODE = 1; //不可知的错误
public static final String ERROR_DESC = "error";
public static final int EMPTY_CODE = 400;
public static final String EMPTY_DESC = "empty result";
}
package com.yunniu.farming.exception;
public class TokenException extends RuntimeException {
private static final long serialVersionUID = 1L;
public TokenException() {
super();
}
@Override
public Throwable fillInStackTrace() {
return this;
}
}
package com.yunniu.farming.interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Autowired
LoginInterceptor loginInterceptor;
// /**
// * 解决跨域请求问题
// *
// * @param registry
// */
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOrigins("*")
// .allowCredentials(true)
// .allowedMethods("GET", "POST", "DELETE", "PUT")
// .maxAge(3600);
// }
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*"); // 1
corsConfiguration.addAllowedHeader("*"); // 2
corsConfiguration.addAllowedMethod("*"); // 3
return corsConfiguration;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig()); // 4
return new CorsFilter(source);
}
/**
* 添加token拦截器
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor)
//选择过滤哪些接口
.addPathPatterns("/**")
//选择忽略的接口
.excludePathPatterns("/login", "/wx/**", "/app/**", "/", "/logout", "/js/**", "/images/**");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
/**
* 访问路径:http://localhost:9090/hospital/static/captured/2022-03-09/0e61e0ffdeec41aa9c123ac268b7e11d.jpeg
* "/facereport/static/captured/**" 为前端URL访问路径
* "file:" + uploadPath 是本地磁盘映射
*
*/
// registry.addResourceHandler("/hospital/static/captured/**").addResourceLocations("file:" + "/upload/");
}
}
package com.yunniu.farming.interceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class CrossOriginInteceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String origin = request.getHeader("Origin");
System.out.println(origin);
//当成非跨域请求
if (origin == null || origin.equals("")) {
return true;
}
//非简单请求需要预请求,有json有cookie都是非简单请求
response.setHeader("Access-Control-Allow-Origin", origin);
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", "content-type");
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}
package com.yunniu.farming.interceptor;
import com.yunniu.farming.webadmin.model.Admin;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
@Slf4j
public class LoginInterceptor extends HandlerInterceptorAdapter {
// @Resource
// RedisUtil redisUtil;
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) throws Exception {
}
/**
* 进入controller前
*
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//log.info("############进入用户拦截器");
String uri = request.getRequestURI();
// if (uri.contains("/app/")) {
// String token = request.getHeader("token");
// if (null != token && !token.equals("")) {
// if(redisUtil.get(token)!=null){
// return true;
// }
// }
// throw new TokenException();
//// return true;
// }
log.info(uri);
Admin user = (Admin) SecurityUtils.getSubject().getSession().getAttribute("currentUser");
if (user == null && !"/confirmUser".equals(uri)) {
response.sendRedirect(request.getContextPath() + "/login");
return false;
}
return true;
}
}
package com.yunniu.farming.redis;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
// @Bean
// public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory factory) {
// RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
// template.setConnectionFactory(factory);
// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
// ObjectMapper om = new ObjectMapper();
// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
// jackson2JsonRedisSerializer.setObjectMapper(om);
// StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
// // key采用String的序列化方式
// template.setKeySerializer(stringRedisSerializer);
// // hash的key也采用String的序列化方式
// template.setHashKeySerializer(stringRedisSerializer);
// // value序列化方式采用jackson
// template.setValueSerializer(jackson2JsonRedisSerializer);
// // hash的value序列化方式采用jackson
// template.setHashValueSerializer(jackson2JsonRedisSerializer);
// template.afterPropertiesSet();
// return template;
// }
// @Bean
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory redisConnectionFactory) {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setConnectionFactory(redisConnectionFactory);
return redisTemplate;
}
}
package com.yunniu.farming.redis;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//@Component
//@Transactional
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
/**
* 针对redis数据失效事件,进行数据处理
*
* @param message
* @param pattern
*/
@Override
public void onMessage(Message message, byte[] pattern) {
// 用户做自己的业务处理即可,注意message.toString()可以获取失效的key
String expiredKey = message.toString();
int length = expiredKey.length();
if (expiredKey.startsWith("orderId:")) {//活动商品
String orderId = expiredKey.substring(expiredKey.indexOf(":") + 1, length);
}
}
}
package com.yunniu.farming.redis;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
//@Configuration
public class RedisListenerConfig {
// @Autowired
private RedisTemplate redisTemplate;
/**
* 处理乱码
*
* @return
*/
// @Bean
public RedisTemplate redisTemplateInit() {
// key序列化
redisTemplate.setKeySerializer(new StringRedisSerializer());
//val实例化
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
return redisTemplate;
}
// @Bean
RedisMessageListenerContainer container(RedisConnectionFactory rcf) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(rcf);
return container;
}
}
\ No newline at end of file
package com.yunniu.farming.result;
public interface BaseError {
/**
* 错误码
*/
String getResultCode();
/**
* 错误描述
*/
String getResultMsg();
}
package com.yunniu.farming.result;
public enum CommonEnum implements BaseError {
// 数据操作错误定义
SUCCESS("100", "成功!"),
BODY_NOT_MATCH("400", "错误!"),
Token_NOT_MATCH("101", "token验证错误!"),
Params_ERROR("102", "参数错误!"),
// SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
// NOT_FOUND("404", "未找到该资源!"),
INTERNAL_SERVER_ERROR("103", "发生错误!"),
// SERVER_BUSY("503", "服务器正忙,请稍后再试!"),
REQUEST_METHOD_SUPPORT_ERROR("40001", "当前请求方法不支持");
/**
* 错误码
*/
private String resultCode;
/**
* 错误描述
*/
private String resultMsg;
CommonEnum(String resultCode, String resultMsg) {
this.resultCode = resultCode;
this.resultMsg = resultMsg;
}
@Override
public String getResultCode() {
return resultCode;
}
@Override
public String getResultMsg() {
return resultMsg;
}
}
package com.yunniu.farming.result;
import com.yunniu.farming.exception.TokenException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
@ControllerAdvice
public class GlobalExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
* 处理空指针的异常
*
* @param req
* @param e
* @return
*/
@ExceptionHandler(value = TokenException.class)
@ResponseBody
public ResultBody tokenExceptionHandler(HttpServletRequest req, TokenException e) {
logger.error("token验证异常");
return ResultBody.error(CommonEnum.Token_NOT_MATCH);
}
@ExceptionHandler(value = BindException.class)
@ResponseBody
public ResultBody bindExceptionHandler(HttpServletRequest req, BindException e) {
logger.error("参数错误");
return ResultBody.error(CommonEnum.Params_ERROR, e.getMessage());
}
@ExceptionHandler(value = MissingServletRequestParameterException.class)
@ResponseBody
public ResultBody MissingServletRequestParameterExceptionHandler(HttpServletRequest req, MissingServletRequestParameterException e) {
logger.error("缺少参数");
return ResultBody.error(CommonEnum.Params_ERROR, e.getMessage());
}
/**
* 处理空指针的异常
*
* @param req
* @param e
* @return
*/
@ExceptionHandler(value = NullPointerException.class)
@ResponseBody
public ResultBody exceptionHandler(HttpServletRequest req, NullPointerException e) {
logger.error("发生空指针异常!原因是:", e);
return ResultBody.error(CommonEnum.BODY_NOT_MATCH);
}
/**
* 处理请求方法不支持的异常
*
* @param req
* @param e
* @return
*/
@ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
@ResponseBody
public ResultBody exceptionHandler(HttpServletRequest req, HttpRequestMethodNotSupportedException e) {
logger.error("发生请求方法不支持异常!原因是:", e);
return ResultBody.error(CommonEnum.REQUEST_METHOD_SUPPORT_ERROR);
}
/**
* 处理其他异常
*
* @param req
* @param e
* @return
*/
@ExceptionHandler(value = Exception.class)
@ResponseBody
public ResultBody exceptionHandler(HttpServletRequest req, Exception e) {
logger.error("未知异常!原因是:", e);
return ResultBody.error(CommonEnum.INTERNAL_SERVER_ERROR);
}
}
package com.yunniu.farming.result;
public class LoginException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 错误码
*/
protected String errorCode;
/**
* 错误信息
*/
protected String errorMsg;
public LoginException() {
super();
}
public LoginException(BaseError errorInfoInterface) {
super(errorInfoInterface.getResultCode());
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public LoginException(BaseError errorInfoInterface, Throwable cause) {
super(errorInfoInterface.getResultCode(), cause);
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public LoginException(String errorMsg) {
super(errorMsg);
this.errorMsg = errorMsg;
}
public LoginException(String errorCode, String errorMsg) {
super(errorCode);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public LoginException(String errorCode, String errorMsg, Throwable cause) {
super(errorCode, cause);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getMessage() {
return errorMsg;
}
@Override
public Throwable fillInStackTrace() {
return this;
}
}
package com.yunniu.farming.result;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@Data
public class Result {
/**
* 响应代码
*/
private String code;
/**
* 响应消息
*/
private String msg;
/**
* 响应结果
*/
private Object data;
public Result() {
this.code = CommonEnum.SUCCESS.getResultCode();
this.msg = CommonEnum.SUCCESS.getResultMsg();
}
public Result(BaseError errorInfo) {
this.code = errorInfo.getResultCode();
this.msg = errorInfo.getResultMsg();
}
public Result(Object data) {
this.code = CommonEnum.SUCCESS.getResultCode();
this.msg = CommonEnum.SUCCESS.getResultMsg();
this.data = data;
}
/**
* 成功
*
* @return
*/
public static Result success() {
return success(null);
}
public static Result success(String msg) {
Result rb = new Result();
rb.setCode(CommonEnum.SUCCESS.getResultCode());
rb.setMsg(msg);
return rb;
}
/**
* 成功
*
* @param data
* @return
*/
public static Result success(Object data) {
Result rb = new Result();
rb.setCode(CommonEnum.SUCCESS.getResultCode());
rb.setMsg(CommonEnum.SUCCESS.getResultMsg());
rb.setData(data);
return rb;
}
/**
* 成功
*
* @param data
* @return
*/
public static Result success(String msg, Object data) {
Result rb = new Result();
rb.setCode(CommonEnum.SUCCESS.getResultCode());
rb.setMsg(msg);
rb.setData(data);
return rb;
}
/**
* 失败
*/
public static Result error() {
Result rb = new Result();
rb.setCode("500");
rb.setMsg("发生错误");
rb.setData(null);
return rb;
}
/**
* 失败
*/
public static Result error(BaseError errorInfo) {
Result rb = new Result();
rb.setCode(errorInfo.getResultCode());
rb.setMsg(errorInfo.getResultMsg());
rb.setData(null);
return rb;
}
/**
* 失败
*/
public static Result error(String code, String msg) {
Result rb = new Result();
rb.setCode(code);
rb.setMsg(msg);
rb.setData(null);
return rb;
}
public static Result error(String code, String msg, Object data) {
Result rb = new Result();
rb.setCode(code);
rb.setMsg(msg);
rb.setData(data);
return rb;
}
/**
* 失败
*/
public static Result error(String msg) {
Result rb = new Result();
rb.setCode("-1");
rb.setMsg(msg);
rb.setData(null);
return rb;
}
public static Result error(Object data, String msg) {
Result rb = new Result();
rb.setCode("-1");
rb.setMsg(msg);
rb.setData(data);
return rb;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
package com.yunniu.farming.result;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@Data
public class ResultBody {
/**
* 响应代码
*/
private String code;
/**
* 响应消息
*/
private String msg;
/**
* 响应结果
*/
private Object data;
public ResultBody() {
}
public ResultBody(BaseError errorInfo) {
this.code = errorInfo.getResultCode();
this.msg = errorInfo.getResultMsg();
}
public ResultBody(Object data) {
this.code = CommonEnum.SUCCESS.getResultCode();
this.msg = CommonEnum.SUCCESS.getResultMsg();
this.data = data;
}
/**
* 成功
*
* @return
*/
public static ResultBody success() {
return success(null);
}
/**
* 成功
*
* @param data
* @return
*/
public static ResultBody success(Object data) {
ResultBody rb = new ResultBody();
rb.setCode(CommonEnum.SUCCESS.getResultCode());
rb.setMsg(CommonEnum.SUCCESS.getResultMsg());
rb.setData(data);
return rb;
}
/**
* 失败
*/
public static ResultBody error(BaseError errorInfo) {
ResultBody rb = new ResultBody();
rb.setCode(errorInfo.getResultCode());
rb.setMsg(errorInfo.getResultMsg());
rb.setData(null);
return rb;
}
/**
* 失败
*/
public static ResultBody error(BaseError errorInfo, Object data) {
ResultBody rb = new ResultBody();
rb.setCode(errorInfo.getResultCode());
rb.setMsg(errorInfo.getResultMsg());
rb.setData(data);
return rb;
}
/**
* 失败
*/
public static ResultBody error(String code, String message) {
ResultBody rb = new ResultBody();
rb.setCode(code);
rb.setMsg(message);
rb.setData(null);
return rb;
}
/**
* 失败
*/
public static ResultBody error(String message) {
ResultBody rb = new ResultBody();
rb.setCode("-1");
rb.setMsg(message);
rb.setData(null);
return rb;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
package com.yunniu.farming.shiro;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class MyFormAuthenticationFilter extends FormAuthenticationFilter {
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
if (isLoginRequest(request, response)) {
if (isLoginSubmission(request, response)) {
// 本次用户登陆账号
String account = this.getUsername(request);
Subject subject = this.getSubject(request, response);
// 之前登陆的用户
// Admin user = (Admin) subject.getPrincipal();
// // 如果两次登陆的用户不一样,则先退出之前登陆的用户
// if (account != null && user != null && !account.equals(user.getAdminAccount())) {
// subject.logout();
// }
}
}
return super.isAccessAllowed(request, response, mappedValue);
}
@Override //登录拦截到首页
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
String successUrl = "/index";
WebUtils.issueRedirect(request, response, successUrl);
System.out.println("登录首页拦截");
return false;
}
}
\ No newline at end of file
package com.yunniu.farming.shiro;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import java.util.LinkedHashMap;
@Configuration
public class ShiroConfig {
@Bean//(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
shiroFilterFactoryBean.setLoginUrl("/login");
// shiroFilterFactoryBean.setSuccessUrl("/index");
// shiroFilterFactoryBean.setUnauthorizedUrl("/403");
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/hospital/static/captured/**", "anon");
filterChainDefinitionMap.put("/lib/**", "anon");
filterChainDefinitionMap.put("/images/**", "anon");
filterChainDefinitionMap.put("/confirmUser", "anon");
filterChainDefinitionMap.put("/loginApp", "anon");
filterChainDefinitionMap.put("/wx/**", "anon");
filterChainDefinitionMap.put("/app/**", "anon");
filterChainDefinitionMap.put("/logout", "logout");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(userRealm());
return securityManager;
}
/**
* Shiro生命周期处理器
*/
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public UserRealm userRealm() {
UserRealm userRealm = new UserRealm();
userRealm.setCredentialsMatcher(hashedCredentialsMatcher());
return userRealm;
}
/**
* 凭证匹配器
* (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了
* 所以我们需要修改下doGetAuthenticationInfo中的代码;
* )
* 可以扩展凭证匹配器,实现 输入密码错误次数后锁定等功能,下一次
*/
@Bean(name = "credentialsMatcher")
public HashedCredentialsMatcher hashedCredentialsMatcher() {
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher("MD5") {
@Override
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
return super.doCredentialsMatch(token, info);
}
};
//HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
//散列算法:这里使用MD5算法;
//hashedCredentialsMatcher.setHashAlgorithmName("MD5");
//散列的次数,比如散列两次,相当于 md5(md5(""));
//hashedCredentialsMatcher.setHashIterations(1);
//storedCredentialsHexEncoded默认是true,此时用的是密码加密用的是Hex编码;false时用Base64编码
//hashedCredentialsMatcher.setStoredCredentialsHexEncoded(true);
return hashedCredentialsMatcher;
}
/**
* 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),
* 需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证
* 配置以下两个bean(DefaultAdvisorAutoProxyCreator(可选)和
* AuthorizationAttributeSourceAdvisor)即可实现此功能
*/
@Bean
@DependsOn({"lifecycleBeanPostProcessor"})
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
advisorAutoProxyCreator.setProxyTargetClass(true);
return advisorAutoProxyCreator;
}
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager());
return authorizationAttributeSourceAdvisor;
}
}
\ No newline at end of file
package com.yunniu.farming.shiro;
import com.yunniu.farming.webadmin.model.Admin;
import com.yunniu.farming.webadmin.service.AdminService;
import com.yunniu.farming.webadmin.service.MenuService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import javax.annotation.Resource;
public class UserRealm extends AuthorizingRealm {
@Resource
private MenuService menuService;
@Resource
private AdminService adminService;
/**
* 授权
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
// Admin admin = (Admin) SecurityUtils.getSubject().getSession().getAttribute("currentUser");
// int userId = admin.getId();
// List<String> permsList = new ArrayList<>();
// permsList = adminService.findPermission(userId);
//
// // 用户权限列表
// Set<String> permsSet = new HashSet<String>();
// for (String perm : permsList) {
// if (perm != null && !("".equals(perm))) {
// permsSet.add(perm);
// }
// }
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
// info.setStringPermissions(permsSet);
return info;
}
/**
* 认证
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
// 1. 把 AuthenticationToken 转换为 UsernamePasswordToken
UsernamePasswordToken upToken = (UsernamePasswordToken) token;
// 2. 从 UsernamePasswordToken 中来获取 username
String username = upToken.getUsername();
// 判断用户名是否存在,若存在,返回user对象
Admin admin = adminService.getAdminByAccount((username));
if (admin != null && "1".equals(admin.getAbolishState())) {
admin = null;
}
// 盐值.
ByteSource credentialsSalt = ByteSource.Util.bytes(admin.getAdminSalt());
// 自动完成密码比对 - 密码的比对:
// 通过 AuthenticatingRealm 的 credentialsMatcher 属性来进行的密码的比对!
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(username, admin.getAdminPassword(), credentialsSalt, getName());
SecurityUtils.getSubject().getSession().setAttribute("currentUser", admin);
SecurityUtils.getSubject().getSession().setTimeout(1800000);
return info;
}
}
package com.yunniu.farming.test;
import cn.hutool.core.codec.Base64;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
//import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import java.security.MessageDigest;
/**
* @技术QQ群: 可登录官网https://www.kdniao.com/右侧查看技术群号
* @see: https://kdniao.com/api-follow
* @copyright: 深圳市快金数据技术服务有限公司
* ID和Key请到官网申请:https://kdniao.com/reg
* <p>
* <p>
* <p>
* 轨迹订阅接口
* 此接口用于向快递鸟订阅物流轨迹信息。由轨迹订阅接口(RequestType1008)和轨迹推送接口(RequestType101)组成,接入时需要对接二个接口。该功能支持情况需查看技术文档。
* 正式地址:https://api.kdniao.com/api/dist
* <p>
* <p>
* 系统级参数
* RequestData String R 请求内容为JSON格式 详情可参考接口技术文档:https://www.kdniao.com/documents
* EBusinessID String R 用户ID
* RequestType String R 请求接口指令
* DataSign String R 数据内容签名,加密方法为:把(请求内容(未编码)+ApiKey)进行MD5加密--32位小写,然后Base64编码,最后进行URL(utf-8)编码
* DataType String R DataType=2,请求、返回数据类型均为JSON格式
* <p>
* <p>
* 应用级参数
* R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional)
* Callback String(50) O 用户自定义回传字段
* ShipperCode String(10) R 快递公司编码 详细编码参考《快递鸟接口支持快递公司编码.xlsx》
* LogisticCode String(30) R 快递单号
* CustomerName String(50) C ShipperCode为SF时必填,对应寄件人/收件人手机号后四位;ShipperCode为其他快递时,可不填或保留字段,不可传值
*/
public class KdniaoSubscribeDemo {
//用户ID,快递鸟提供,注意保管,不要泄漏
private String EBusinessID = "1237100";//即用户ID,登录快递鸟官网会员中心获取 https://www.kdniao.com/UserCenter/v4/UserHome.aspx
//API key,快递鸟提供,注意保管,不要泄漏
private String ApiKey = "56da2cf8-c8a2-44b2-b6fa-476cd7d1ba17";//即API key,登录快递鸟官网会员中心获取 https://www.kdniao.com/UserCenter/v4/UserHome.aspx
//请求url, 正式环境地址
private String ReqURL = "https://api.kdniao.com/api/dist";
// private String ReqURL="http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json";
public static void main(String[] args) {
try {
KdniaoSubscribeDemo api = new KdniaoSubscribeDemo();
System.out.println(api.orderOnlineByJson());
} catch (Exception e) {
e.printStackTrace();
}
}
//轨迹订阅接口
public String orderOnlineByJson() throws Exception {
// 组装应用级参数
String RequestData = "{" +
// "'Callback':'CallBack字段是放您希望在推送时回传的参数值,比如订单标识',"+
"'ShipperCode':'SF'," +
"'LogisticCode':'3100707578976'," +
"'CustomerName':'1234'," +
"}";
// 组装系统级参数
Map<String, String> params = new HashMap<String, String>();
params.put("RequestData", urlEncoder(RequestData, "UTF-8"));
params.put("EBusinessID", EBusinessID);
params.put("RequestType", "1008");//免费订阅接口指令1008/在途监控订阅接口指令8008/地图版订阅接口指令8005
String dataSign = encrypt(RequestData, ApiKey, "UTF-8");
params.put("DataSign", urlEncoder(dataSign, "UTF-8"));
params.put("DataType", "2");
// 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数
String result = sendPost(ReqURL, params);
//根据公司业务处理返回的信息......
return result;
}
/**
* MD5加密
* str 内容
* charset 编码方式
*
* @throws Exception
*/
@SuppressWarnings("unused")
private String MD5(String str, String charset) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes(charset));
byte[] result = md.digest();
StringBuffer sb = new StringBuffer(32);
for (int i = 0; i < result.length; i++) {
int val = result[i] & 0xff;
if (val <= 0xf) {
sb.append("0");
}
sb.append(Integer.toHexString(val));
}
return sb.toString().toLowerCase();
}
/**
* base64编码
* str 内容
* charset 编码方式
*
* @throws UnsupportedEncodingException
*/
private String base64(String str, String charset) throws UnsupportedEncodingException {
String encoded = Base64.encode(str.getBytes(charset));
return encoded;
}
@SuppressWarnings("unused")
private String urlEncoder(String str, String charset) throws UnsupportedEncodingException {
String result = URLEncoder.encode(str, charset);
return result;
}
/**
* 电商Sign签名生成
* content 内容
* keyValue ApiKey
* charset 编码方式
*
* @return DataSign签名
* @throws UnsupportedEncodingException ,Exception
*/
@SuppressWarnings("unused")
private String encrypt(String content, String keyValue, String charset) throws UnsupportedEncodingException, Exception {
if (keyValue != null) {
return base64(MD5(content + keyValue, charset), charset);
}
return base64(MD5(content, charset), charset);
}
/**
* 向指定 URL 发送POST方法的请求
* url 发送请求的 URL
* params 请求的参数集合
*
* @return 远程资源的响应结果
*/
@SuppressWarnings("unused")
private String sendPost(String url, Map<String, String> params) {
OutputStreamWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
URL realUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// POST方法
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();
// 获取URLConnection对象对应的输出流
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
// 发送请求参数
if (params != null) {
StringBuilder param = new StringBuilder();
for (Map.Entry<String, String> entry : params.entrySet()) {
if (param.length() > 0) {
param.append("&");
}
param.append(entry.getKey());
param.append("=");
param.append(entry.getValue());
System.out.println(entry.getKey() + ":" + entry.getValue());
}
System.out.println("param:" + param.toString());
out.write(param.toString());
}
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result.toString();
}
}
package com.yunniu.farming.test.wxTest;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
public class WxPayConfigImpl {
private byte[] certData = null;
public WxPayConfigImpl() {
try {
//这个证书的位置不是瞎鸡儿填的,你要在这个路径真的有一个证书
InputStream is = new FileInputStream("/www/wwwroot/minsu/cret/apiclient_cert.p12");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] bs = new byte[1024];
int cnt = -1;
while ((cnt = is.read(bs)) != -1) {
baos.write(bs, 0, cnt);
}
is.close();
certData = baos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
}
public String getAppID() {
return "APPID";
}
public String getMchID() {
return "商户号";
}
public String getKey() {
return "KEY";
}
public InputStream getCertStream() {
ByteArrayInputStream certBis;
certBis = new ByteArrayInputStream(this.certData);
return certBis;
}
public int getHttpConnectTimeoutMs() {
// TODO Auto-generated method stub
return 8000;
}
public int getHttpReadTimeoutMs() {
// TODO Auto-generated method stub
return 10000;
}
}
package com.yunniu.farming.test.wxTest;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
/**
* @Description: 提现
**/
public class WxWithdrawBank {
private Logger logger = LoggerFactory.getLogger(WxWithdrawBank.class);
// public void asd() {
//
//
// SortedMap<String, String> paramMap = new TreeMap<String, String>();
// paramMap.put("mch_appid", config.getAppID());
// paramMap.put("mchid", config.getMchID());
// paramMap.put("nonce_str", WXPayUtil.generateNonceStr());
// paramMap.put("partner_trade_no", "C" + System.currentTimeMillis());
// paramMap.put("openid", openId);
// paramMap.put("check_name", "NO_CHECK");
// paramMap.put("amount", (money * 100) + "");
// paramMap.put("desc", "提现");
// paramMap.put("spbill_create_ip", getIpAddr(request));
// String sign = WXPayUtil.generateSignature(paramMap, config.getKey(), SignType.MD5);
// paramMap.put("sign", sign);
// WXPay pay = new WXPay(config);
// // Map<String,String> resMap = pay.transfer(paramMap);
//
// Map<String, String> resMap;
// resMap = pay.processResponseXml(pay.requestWithCert(url, paramMap, config.getHttpConnectTimeoutMs(),
// config.getHttpReadTimeoutMs()));
// String resultCode = resMap.get("result_code");
// if ("SUCCESS".equalsIgnoreCase(resultCode)) {
////走到这里就是提现操作成功了,可以做你自己的业务逻辑了、
// } else {
// String err_code = resMap.get("err_code");
// if ("SYSTEMERROR".equalsIgnoreCase(err_code)) {
// return R.error().put("msg", err_code);
// } else if ("NOTENOUGH".equalsIgnoreCase(err_code)) {
// return R.error().put("msg", err_code);
// } else {
////在这把两个常见的错提了出来,剩下的统一为未知错误了,如果做个更好一些可以直接传错误信息。
// return R.error().put("msg", "调用微信提现接口未知错误,请联系管理员!");
//
// }
// }
// }
//
//
//
//public Map enterprice2User(String logKey,String orderNumber,String openId,String fee,String body)throws Exception
// {
//
// String url = " https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
//
// //1.参数封装 ,作者qq1023732997
// SortedMap<Object, Object> param = new TreeMap<Object, Object>();
// param.put("mch_appid",weixinPayProperties.getAppid());// 商户账号appid
// param.put("mchid",weixinPayProperties.getMchId());// 商户
//// param.put("mch_id", weixinPayProperties.getMchId());// 商户
// param.put("nonce_str",WXPayUtil.generateNonceStr());// 随机字符串
// param.put("partner_trade_no",orderNumber);// 交易订单号
//// param.put("out_trade_no", orderNumber);// 交易订单号
// param.put("openid",openId); // 用户openid
// param.put("check_name","NO_CHECK"); // 校验用户姓名选项
// param.put("amount",fee); // 金额
//// param.put("total_fee", fee); // 金额
// param.put("desc",body);
//// param.put("body", body); // 商品描述
// param.put("spbill_create_ip",weixinPayProperties.getSpbillCreateIp());
//
// logger.info(logKey+" weixinPayProperties"+weixinPayProperties);
// String sign=WXPayUtil.generateSignature(param,weixinPayProperties.getPartnerkey());
// param.put("sign",sign);
// logger.info(logKey+" weixinService#enterprice2User:"+param);
//
// String requestXML = WxUtil.getRequestXml(param);
//
// String xmlResult=WXHttpCertUtils.doPost(url,requestXML);
// Map<String, String> mapResult=WXPayUtil.xmlToMap(xmlResult);
// logger.info(logKey+" weixinService#enterprice2User.wxpay.mp.result:"+mapResult);
//
// Map<String, String> result=new HashMap<>();
// result.put("code","500");
// result.put("message","系统错误");
//
// // {mchid=1520737191, mch_appid=wx2f030dd8ebda3a63, err_code=NOTENOUGH, return_msg=支付失败, result_code=FAIL, err_code_des=余额不足, return_code=SUCCESS}
// // 转账成功
// if("SUCCESS".equalsIgnoreCase(mapResult.get("result_code")))
// {
// result.put("code","200");
// result.put("message","支付成功");
// }
// // 转帐失败
// else if("FAIL".equalsIgnoreCase(mapResult.get("result_code")))
// {
// result.put("code","500");
// // 系统错误需要重试[请先调用查询接口,查看此次付款结果,如结果为不明确状态(如订单号不存在),请务必使用原商户订单号进行重试。
// if("SYSTEMERROR".equalsIgnoreCase(mapResult.get("err_code")))
// {
//// result.put("message", "支付成功");]
// }
// // 金额超限
// else if("AMOUNT_LIMIT".equalsIgnoreCase(mapResult.get("err_code")))
// {
// result.put("message","金额超限");
// }
// // 余额不足
// else if("NOTENOUGH".equalsIgnoreCase(mapResult.get("err_code")))
// {
//// result.put("message", "支付成功");
// }
// // 超过频率限制,请稍后再试。
// else if("FREQ_LIMIT".equalsIgnoreCase(mapResult.get("err_code")))
// {
// result.put("message","超过频率限制,请稍后再试。");
// }
// // 已经达到今日付款总额上限/已达到付款给此用户额度上限
// else if("MONEY_LIMIT".equalsIgnoreCase(mapResult.get("err_code")))
// {
// result.put("message","已经达到今日付款总额上限");
// }
// // 无法给非实名用户付款
// else if("V2_ACCOUNT_SIMPLE_BAN".equalsIgnoreCase(mapResult.get("err_code")))
// {
// result.put("message","无法给非实名用户付款");
// }
// // 该用户今日付款次数超过限制,如有需要请登录微信支付商户平台更改API安全配置
// else if("SENDNUM_LIMIT".equalsIgnoreCase(mapResult.get("err_code")))
// {
// result.put("message","今日付款次数超过限制");
// }
// }
// else
// {
// // 系统错误
// result.put("code","500");
// result.put("message","系统错误");
// }
//
// return result;
// }
}
package com.yunniu.farming.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.util.Base64Utils;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
import java.util.Map;
public class AESUtil {
public static String AES_KEY = "MTIzNDU2Nzg5MDk4";
//public static String AES_KEY = "MTIzNDU2Nzg5MDk4NzY1NA==";
// 算法
private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding";
private static ObjectMapper objectMapper = new ObjectMapper();
public static Logger logger = Logger.getLogger(AESUtil.class);
/**
* aes解密
*
* @param encrypt
* 内容
* @return
* @throws Exception
*/
public static String aesDecrypt(String encrypt) {
try {
return aesDecrypt(encrypt, AES_KEY);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* aes加密
*
* @param content
* @return
* @throws Exception
*/
public static String aesEncrypt(String content) {
try {
return aesEncrypt(content, AES_KEY);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* 将byte[]转为各种进制的字符串
*
* @param bytes
* byte[]
* @param radix
* 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制
* @return 转换后的字符串
*/
public static String binary(byte[] bytes, int radix) {
return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数
}
/**
* base 64 encode
*
* @param bytes
* 待编码的byte[]
* @return 编码后的base 64 code
*/
public static String base64Encode(byte[] bytes) {
return Base64.encodeBase64String(bytes);
}
/**
* base 64 decode
*
* @param base64Code
* 待解码的base 64 code
* @return 解码后的byte[]
* @throws Exception
*/
public static byte[] base64Decode(String base64Code) throws Exception {
return StringUtils.isEmpty(base64Code) ? null : Base64Utils.decodeFromString(base64Code);
}
/**
* AES加密
*
* @param content
* 待加密的内容
* @param encryptKey
* 加密密钥
* @return 加密后的byte[]
* @throws Exception
*/
public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES"));
return cipher.doFinal(content.getBytes("utf-8"));
}
/**
* AES加密为base 64 code
*
* @param content
* 待加密的内容
* @param encryptKey
* 加密密钥
* @return 加密后的base 64 code
* @throws Exception
*/
public static String aesEncrypt(String content, String encryptKey) throws Exception {
return base64Encode(aesEncryptToBytes(content, encryptKey));
}
/**
* AES解密
*
* @param encryptBytes
* 待解密的byte[]
* @param decryptKey
* 解密密钥
* @return 解密后的String
* @throws Exception
*/
public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
byte[] decryptBytes = cipher.doFinal(encryptBytes);
return new String(decryptBytes);
}
/**
* 将base 64 code AES解密
*
* @param encryptStr
* 待解密的base 64 code
* @param decryptKey
* 解密密钥
* @return 解密后的string
* @throws Exception
*/
public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception {
return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey);
}
@SuppressWarnings("unchecked")
public static Map<String, Object> aesDecrypt2Map(String encryptStr, String decryptKey){
if(StringUtils.isBlank(decryptKey) || decryptKey.length() != 16){
return null;
}
try {
String json = aesDecrypt(encryptStr, decryptKey);
return objectMapper.readValue(json, Map.class);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.yunniu.farming.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 关于判断字符的操作
*
* @author Administrator
*/
public class BooleanString {
/**
* 判断一个字符串是否含有英文
*/
public static boolean isEnglish(String str) {
boolean bool = str.matches("[a-zA-Z]+");
if (bool) {
//含有英文
return true;
} else {
//不含英文
return false;
}
}
/**
* 判断一个字符串是否含有中文
*/
public static boolean isChinese(String str) {
String regEx = "[\\u4e00-\\u9fa5]+";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
if (m.find()) {
//含有汉字
return true;
} else {
//不含汉字
return false;
}
}
/**
* 判断是否含有特殊字符
*/
public static boolean isSpecialChar(String str) {
String regEx = "[ _`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
if (m.find()) {
//包含
return true;
} else {
//不包含
return false;
}
}
/**
* 判断是否含有数字
*
* @param company
* @return
*/
public static boolean isContainNumber(String str) {
Pattern p = Pattern.compile("[0-9]");
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}
/**
* 判断邮箱
*/
public static boolean checkEmail(String email) {
boolean flag = false;
try {
String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
Pattern regex = Pattern.compile(check);
Matcher matcher = regex.matcher(email);
flag = matcher.matches();
} catch (Exception e) {
flag = false;
}
return flag;
}
/**
* 验证手机号码,11位数字,1开通,第二位数必须是3456789这些数字之一
*
* @param mobileNumber
* @return
*/
public static boolean checkMobileNumber(String mobileNumber) {
boolean flag = false;
try {
Pattern regex = Pattern.compile("^1[345789]\\d{9}$");
Matcher matcher = regex.matcher(mobileNumber);
flag = matcher.matches();
} catch (Exception e) {
e.printStackTrace();
flag = false;
}
return flag;
}
/**
* 验证身份证号码,11位数字,1开通,第二位数必须是3456789这些数字之一
*
* @param mobileNumber
* @return
*/
public static boolean checkIdentityNumber(String mobileNumber) {
boolean flag = false;
try {
Pattern regex = Pattern.compile("(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])");
Matcher matcher = regex.matcher(mobileNumber);
flag = matcher.matches();
} catch (Exception e) {
e.printStackTrace();
flag = false;
}
return flag;
}
/**
* 验证手机号格式是否正确
*/
public static boolean checkPhone(String phone) {
boolean flag = false;
if (!phone.matches("^1[3|4|5|7|8][0-9]\\d{4,8}$")) {
flag = false;
} else {
flag = true;
}
return flag;
}
}
package com.yunniu.farming.util;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.client.RestTemplate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Common {
// 生成18位订单号
public static String getDateNumber() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmssSSS");
Date date = new Date();
String str = sdf.format(date).substring(2, 17) + getRandomCode(4);
return str;
}
// sum位数验证码
public static String getRandomCode(int sum) {
String str = "";
for (int i = 0; i < sum; i++) {
int a = (int) (Math.random() * 10);
str = str + a;
}
return str;
}
private static double EARTH_RADIUS = 6378.137;
private static double rad(double d) {
return d * Math.PI / 180.0;
}
/**
* 通过经纬度获取距离(单位:千米)
*
* @param lat1
* @param lng1
* @param lat2
* @param lng2
* @return 距离
*/
public static double getDistance(double lat1, double lng1, double lat2,
double lng2) {
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ Math.cos(radLat1) * Math.cos(radLat2)
* Math.pow(Math.sin(b / 2), 2)));
s = s * EARTH_RADIUS;
s = Math.round(s * 10000d) / 10000d;
return s;
}
public static String setOpenCode(String startTime, String endTime, String eqpId) {
//3770738730
startTime = datePlus(startTime, 10);
endTime = datePlus(endTime, 0);
//3770738730
String str = "{\n" +
"\"access_token\": \"418e0d47f909d0f3366ecc6c949973c49fc7a0054ddc125d\", \n" +
"\"operation\": \"POST\",\n" +
"\"data\":{\n" +
"\t\"dev_sn_list\": [\"" + eqpId + "\"], \n" +
"\t\"pwd_type\": 2,\n" +
"\t\"memo\": \"\",\n" +
"\t\"start_datetime\": \"" + startTime + "\", \n" +
"\t\"end_datetime\": \"" + endTime + "\",\n" +
"\t\"use_count\":0\n" +
"} \n" +
"\t\n" +
"}";
String url = "https://www.doormaster.me:9099/doormaster/server/devices/temp_pwd";
RestTemplate restTemplate = new RestTemplate();
String a = restTemplate.postForObject(url, str, String.class);
System.out.println(a);
System.out.println("设置锁返回结果:" + a);
JSONObject resjo = JSONObject.parseObject(a);
String qrcode_content = (String) resjo.get("qrcode_content");
return qrcode_content;
}
public static String datePlus(String d, int min) {
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmSS");
Date date = null;
try {
date = sf.parse(d);
} catch (ParseException e) {
e.printStackTrace();
}
//五分钟就是300000毫秒
Date nextDate = new Date(date.getTime() + 60000 * min);
return sf.format(nextDate);
}
public static Integer getMinutesFromTo(String fromDate, String endDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
long from = sdf.parse(fromDate).getTime();
long to = sdf.parse(endDate).getTime();
int minutes = (int) ((to - from) / (1000 * 60));
return minutes;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static Integer getMinutesFromNow(String endDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String fromDate = sdf.format(new Date());
System.out.println(fromDate);
try {
long from = sdf.parse(fromDate).getTime();
long to = sdf.parse(endDate).getTime();
int minutes = (int) ((to - from) / (1000 * 60));
return minutes;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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