Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
7dc766a3
Commit
7dc766a3
authored
Aug 22, 2023
by
杨阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发货单
新增/编辑/详情接口 更新发货单状态接口
parent
7b82037b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
18 deletions
+119
-18
MobileLoginParamDto.java
...in/amos/boot/module/hygf/api/dto/MobileLoginParamDto.java
+6
-0
IWxService.java
...yeejoin/amos/boot/module/hygf/api/service/IWxService.java
+1
-1
PeasantHouseholdWxController.java
...ule/hygf/biz/controller/PeasantHouseholdWxController.java
+50
-0
PeasantHouseholdServiceImpl.java
...le/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
+44
-12
WxServiceImpl.java
...amos/boot/module/hygf/biz/service/impl/WxServiceImpl.java
+18
-5
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/MobileLoginParamDto.java
View file @
7dc766a3
...
@@ -12,6 +12,12 @@ import lombok.Data;
...
@@ -12,6 +12,12 @@ import lombok.Data;
@Data
@Data
public
class
MobileLoginParamDto
{
public
class
MobileLoginParamDto
{
@ApiModelProperty
(
"用户userid"
)
private
String
userId
;
@ApiModelProperty
(
"二维码类型:region, personal"
)
private
String
qrCodeType
;
/**
/**
* 注册类型:1-微信授权快捷登录;2-手机验证登录
* 注册类型:1-微信授权快捷登录;2-手机验证登录
*/
*/
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IWxService.java
View file @
7dc766a3
...
@@ -75,7 +75,7 @@ public interface IWxService {
...
@@ -75,7 +75,7 @@ public interface IWxService {
* @param fileName
* @param fileName
* @param fileType
* @param fileType
*/
*/
void
getSmallProQrCodeResponse
(
String
access_token
,
String
scene
,
String
page
,
Long
width
,
Boolean
auto_color
,
String
getSmallProQrCodeResponse
(
String
access_token
,
String
scene
,
String
page
,
Long
width
,
Boolean
auto_color
,
JSONObject
line_color
,
Boolean
is_hyaline
,
HttpServletResponse
response
,
String
fileName
,
String
fileType
);
JSONObject
line_color
,
Boolean
is_hyaline
,
HttpServletResponse
response
,
String
fileName
,
String
fileType
);
/**
/**
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdWxController.java
View file @
7dc766a3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
...
@@ -10,9 +11,12 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdWxDto;
...
@@ -10,9 +11,12 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdWxDto;
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IWxService
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Project
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
...
@@ -25,6 +29,7 @@ import io.swagger.annotations.Api;
...
@@ -25,6 +29,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -43,6 +48,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...
@@ -43,6 +48,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -78,6 +84,11 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -78,6 +84,11 @@ public class PeasantHouseholdWxController extends BaseController {
@Autowired
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
HouseholdContractServiceImpl
householdContractServiceImpl
;
@Autowired
private
IWxService
wxService
;
@Value
(
"${hygfProgram.loginPage:view/mine/minepage/LoginPhone}"
)
private
String
miniprogramLoginPage
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
...
@@ -189,4 +200,43 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -189,4 +200,43 @@ public class PeasantHouseholdWxController extends BaseController {
return
jsonArray
;
return
jsonArray
;
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
"/getRegionQrCode"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 获取区域经销商二维码"
,
notes
=
" 获取区域经销商二维码"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegionQrCode
(
@RequestParam
(
value
=
"fileType"
,
required
=
false
,
defaultValue
=
"png"
)
String
fileType
,
@RequestParam
(
value
=
"width"
,
required
=
false
,
defaultValue
=
"350"
)
String
width
,
HttpServletResponse
response
)
{
AgencyUserModel
userInfo
=
getUserInfo
();
String
accessToken
=
wxService
.
getAccessToken
();
// 生成二维码
String
page
=
miniprogramLoginPage
;
String
scene
=
"userId="
+
userInfo
.
getUserId
()
+
"&qrCodeType=region"
;
// 返回当前用户ID
String
picStr
=
wxService
.
getSmallProQrCodeResponse
(
accessToken
,
scene
,
page
,
Long
.
valueOf
(
width
),
null
,
null
,
null
,
response
,
"二维码_"
+
userInfo
.
getUserId
(),
fileType
);
PeasantHouseholdDto
peasantHouseholdDto
=
peasantHouseholdServiceImpl
.
buildDefaultPeasantHouseholdDto
(
"region"
,
userInfo
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"qrCodePic"
,
picStr
);
resultMap
.
put
(
"peasantHousehold"
,
peasantHouseholdDto
);
return
ResponseHelper
.
buildResponse
(
resultMap
);
}
@GetMapping
(
"/getPersonalQrCode"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 获取个人经销商二维码"
,
notes
=
" 获取个人经销商二维码"
)
public
void
getPersonalQrCode
(
@RequestParam
(
value
=
"fileType"
,
required
=
false
,
defaultValue
=
"png"
)
String
fileType
,
@RequestParam
(
value
=
"width"
,
required
=
false
,
defaultValue
=
"350"
)
String
width
,
HttpServletResponse
response
)
{
AgencyUserModel
userInfo
=
getUserInfo
();
String
accessToken
=
wxService
.
getAccessToken
();
String
page
=
"view/mine/minepage/Login"
+
"?userId="
+
userInfo
.
getUserId
()
+
"&qrCodeType=personal"
;
wxService
.
getSmallProQrCodeResponse
(
accessToken
,
null
,
page
,
Long
.
valueOf
(
width
),
null
,
null
,
null
,
response
,
page
,
fileType
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
View file @
7dc766a3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PhoneRegisterTypeEum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PhoneRegisterTypeEum
;
...
@@ -13,9 +14,12 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract;
...
@@ -13,9 +14,12 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Information
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Information
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.SurveyDetails
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.SurveyDetails
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IPeasantHouseholdService
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IPeasantHouseholdService
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IUnitInfoService
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IWxService
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.HttpUtil
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.HttpUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
@@ -106,7 +110,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -106,7 +110,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
@Autowired
@Autowired
private
WxServiceImpl
wxService
;
private
IWxService
wxService
;
@Autowired
@Autowired
SurveyInformationServiceImpl
surveyInformationService
;
SurveyInformationServiceImpl
surveyInformationService
;
...
@@ -129,6 +133,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -129,6 +133,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
HouseholdContractServiceImpl
householdContractServiceImpl
;
@Autowired
UnitInfoServiceImpl
unitInfoServiceImpl
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
PeasantHouseholdDto
savePeasantHousehold
(
PeasantHouseholdDto
model
)
{
public
PeasantHouseholdDto
savePeasantHousehold
(
PeasantHouseholdDto
model
)
{
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
...
@@ -244,8 +251,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -244,8 +251,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
public
PeasantHouseholdWxDto
wxUserLogin
(
MobileLoginParamDto
wxDTO
)
{
public
PeasantHouseholdWxDto
wxUserLogin
(
MobileLoginParamDto
wxDTO
)
{
// 通过手机号和验证码调用平台接口进行验证
// 通过手机号和验证码调用平台接口进行验证
//
String phoneNo = this.parsePhoneNo(wxDTO);
String
phoneNo
=
this
.
parsePhoneNo
(
wxDTO
);
String
phoneNo
=
"13022982292"
;
//
String phoneNo = "13022982292";
if
(
phoneNo
==
null
)
{
if
(
phoneNo
==
null
)
{
throw
new
BadRequest
(
"获取手机号失败!"
);
throw
new
BadRequest
(
"获取手机号失败!"
);
}
}
...
@@ -264,7 +271,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -264,7 +271,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
// 没有注册过农户信息
// 没有注册过农户信息
if
(
null
==
peasantHousehold
)
{
if
(
null
==
peasantHousehold
)
{
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
new
PeasantHouseholdWxDto
();
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
new
PeasantHouseholdWxDto
();
PeasantHouseholdDto
peasantHouseholdDto
=
buildDefaultPeasantHouseholdDto
(
phoneNo
);
PeasantHouseholdDto
peasantHouseholdDto
=
buildDefaultPeasantHouseholdDto
(
wxDTO
.
getUserId
(),
wxDTO
.
getQrCodeType
(),
phoneNo
);
peasantHousehold
=
new
PeasantHousehold
();
peasantHousehold
=
new
PeasantHousehold
();
BeanUtils
.
copyProperties
(
peasantHouseholdDto
,
peasantHousehold
);
BeanUtils
.
copyProperties
(
peasantHouseholdDto
,
peasantHousehold
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
...
@@ -385,20 +392,42 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -385,20 +392,42 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return
peasantHouseholdWxDto
;
return
peasantHouseholdWxDto
;
}
}
private
PeasantHouseholdDto
buildDefaultPeasantHouseholdDto
(
String
phoneNo
)
{
public
PeasantHouseholdDto
buildDefaultPeasantHouseholdDto
(
String
qrCodeType
,
AgencyUserModel
userInfo
)
{
Long
sequenceNbr
=
userInfo
.
getCompanys
().
get
(
0
).
getSequenceNbr
();
Integer
companyOrgCode
=
userInfo
.
getCompanys
().
get
(
0
).
getCompanyOrgCode
();
String
companyName
=
userInfo
.
getCompanys
().
get
(
0
).
getCompanyName
();
// unitInfoServiceImpl.createCompanyAndUser 创建经销商的时候绑定的平台用户
List
<
UnitInfo
>
unitInfos
=
unitInfoServiceImpl
.
list
(
new
LambdaQueryWrapper
<
UnitInfo
>().
eq
(
UnitInfo:
:
getAmosCompanySeq
,
sequenceNbr
));
Long
regionalCompaniesSeq
=
unitInfos
.
get
(
0
).
getRegionalCompaniesSeq
();
String
regionalCompaniesCode
=
unitInfos
.
get
(
0
).
getRegionalCompaniesCode
();
String
regionalCompaniesName
=
unitInfos
.
get
(
0
).
getRegionalCompaniesName
();
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
dto
.
setPeasantHouseholdNo
(
this
.
getPeasantHouseholdNo
());
dto
.
setIsCertified
(
0
);
// 未认证
dto
.
setIsCertified
(
0
);
// 未认证
dto
.
setSurveyOrNot
(
0
);
dto
.
setSurveyOrNot
(
0
);
dto
.
setReview
(
0
);
dto
.
setReview
(
0
);
// 先在后台创建一个角色和公司,微信农户新建的用户使用统一的
// 先在后台创建一个角色和公司,微信农户新建的用户使用统一的
// 用户光伏-微信农户
// 用户光伏-微信农户
dto
.
setDeveloperCode
(
orgCode
);
// 非扫码进入注册页面,默认
dto
.
setDeveloperId
(
orgSequenceNbr
);
dto
.
setDeveloperCode
(
companyOrgCode
.
toString
());
// 开发方code
dto
.
setDeveloperName
(
orgNamesWithoutRole
);
dto
.
setDeveloperId
(
sequenceNbr
);
// 开发方id
dto
.
setDeveloper
(
phoneNo
);
dto
.
setDeveloperName
(
companyName
);
// 开发方名称
dto
.
setRegionalCompaniesSeq
(
orgSequenceNbr
);
dto
.
setDeveloper
(
userInfo
.
getRealName
());
// 开发人
dto
.
setRegionalCompaniesCode
(
orgCode
);
dto
.
setRegionalCompaniesSeq
(
regionalCompaniesSeq
);
dto
.
setRegionalCompaniesName
(
orgNamesWithoutRole
);
dto
.
setRegionalCompaniesCode
(
regionalCompaniesCode
);
dto
.
setRegionalCompaniesName
(
regionalCompaniesName
);
return
dto
;
}
private
PeasantHouseholdDto
buildDefaultPeasantHouseholdDto
(
String
userId
,
String
qrCodeType
,
String
phoneNo
)
{
// 获取区域
FeignClientResult
<
AgencyUserModel
>
userInfoResult
=
Privilege
.
agencyUserClient
.
queryByUserId
(
userId
);
// 获取用户
if
(
userInfoResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"userId错误"
);
}
AgencyUserModel
userInfo
=
userInfoResult
.
getResult
();
PeasantHouseholdDto
dto
=
buildDefaultPeasantHouseholdDto
(
qrCodeType
,
userInfo
);
dto
.
setTelephone
(
phoneNo
);
dto
.
setTelephone
(
phoneNo
);
return
dto
;
return
dto
;
}
}
...
@@ -457,6 +486,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -457,6 +486,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
/*IdPasswordAuthModel authModel = new IdPasswordAuthModel();
/*IdPasswordAuthModel authModel = new IdPasswordAuthModel();
authModel.setLoginId(platfromAccessLoginId);
authModel.setLoginId(platfromAccessLoginId);
authModel.setPassword(DesUtil.encode(,"qaz"));*/
/* IdPasswordAuthModel authModel = new IdPasswordAuthModel();
authModel.setLoginId(platfromAccessLoginId);
authModel.setPassword(platfromAccessPassword);*/
authModel.setPassword(platfromAccessPassword);*/
FeignClientResult
<
Map
<
String
,
String
>>
authResult
=
Privilege
.
authClient
.
idpassword
(
authModel
);
FeignClientResult
<
Map
<
String
,
String
>>
authResult
=
Privilege
.
authClient
.
idpassword
(
authModel
);
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/WxServiceImpl.java
View file @
7dc766a3
...
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
...
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.Base64
;
/**
/**
* 农户微信小程序
* 农户微信小程序
...
@@ -94,7 +95,7 @@ public class WxServiceImpl implements IWxService {
...
@@ -94,7 +95,7 @@ public class WxServiceImpl implements IWxService {
try
{
try
{
String
resultStr
=
HttpUtils
.
doGet
(
buildUrl
.
toString
());
String
resultStr
=
HttpUtils
.
doGet
(
buildUrl
.
toString
());
AccessTokenDto
accessToken
=
JSON
.
parseObject
(
resultStr
,
AccessTokenDto
.
class
);
AccessTokenDto
accessToken
=
JSON
.
parseObject
(
resultStr
,
AccessTokenDto
.
class
);
if
(
0
!=
accessToken
.
getErrcode
())
{
if
(
accessToken
.
getErrcode
()
!=
null
&&
0
!=
accessToken
.
getErrcode
())
{
throw
new
RuntimeException
(
accessToken
.
getErrmsg
());
throw
new
RuntimeException
(
accessToken
.
getErrmsg
());
}
}
return
accessToken
;
return
accessToken
;
...
@@ -182,7 +183,7 @@ public class WxServiceImpl implements IWxService {
...
@@ -182,7 +183,7 @@ public class WxServiceImpl implements IWxService {
}
}
@Override
@Override
public
void
getSmallProQrCodeResponse
(
String
access_token
,
String
scene
,
String
page
,
Long
width
,
Boolean
auto_color
,
JSONObject
line_color
,
Boolean
is_hyaline
,
HttpServletResponse
response
,
String
fileName
,
String
fileType
)
{
public
String
getSmallProQrCodeResponse
(
String
access_token
,
String
scene
,
String
page
,
Long
width
,
Boolean
auto_color
,
JSONObject
line_color
,
Boolean
is_hyaline
,
HttpServletResponse
response
,
String
fileName
,
String
fileType
)
{
WechatQrCodeDTO
smallProQrCodeVo
=
buildQrParam
(
SMALL_PRO_QRCODE_URL
,
access_token
,
scene
,
page
,
width
,
WechatQrCodeDTO
smallProQrCodeVo
=
buildQrParam
(
SMALL_PRO_QRCODE_URL
,
access_token
,
scene
,
page
,
width
,
auto_color
,
line_color
,
is_hyaline
);
auto_color
,
line_color
,
is_hyaline
);
byte
[]
smallProQrCode
=
smallProQrCodeVo
.
getBuffer
();
byte
[]
smallProQrCode
=
smallProQrCodeVo
.
getBuffer
();
...
@@ -191,15 +192,27 @@ public class WxServiceImpl implements IWxService {
...
@@ -191,15 +192,27 @@ public class WxServiceImpl implements IWxService {
response
.
addHeader
(
"Access-Control-Allow-Headers"
,
"Content-Disposition"
);
response
.
addHeader
(
"Access-Control-Allow-Headers"
,
"Content-Disposition"
);
response
.
addHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
addHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
OutputStream
os
;
String
picStr
=
Base64
.
getEncoder
().
encodeToString
(
smallProQrCode
);
return
picStr
;
/*OutputStream os = null;
try {
try {
os = response.getOutputStream();
os = response.getOutputStream();
os.write(smallProQrCode);
os.write(smallProQrCode);
os
.
flush
();
os
.
close
();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (os != null) os.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (os != null) os.close();
} catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
e.printStackTrace();
}
}
}*/
}
}
@Override
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment