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
489cbdb8
Commit
489cbdb8
authored
Aug 21, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加合同
parent
e0ff2f16
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
823 additions
and
0 deletions
+823
-0
HouseholdContractDto.java
...n/amos/boot/module/hygf/api/dto/HouseholdContractDto.java
+123
-0
HouseholdContract.java
...n/amos/boot/module/hygf/api/entity/HouseholdContract.java
+224
-0
HouseholdContractMapper.java
.../boot/module/hygf/api/mapper/HouseholdContractMapper.java
+14
-0
IHouseholdContractService.java
...ot/module/hygf/api/service/IHouseholdContractService.java
+12
-0
HouseholdContractMapper.xml
...api/src/main/resources/mapper/HouseholdContractMapper.xml
+5
-0
HouseholdContractController.java
...dule/hygf/biz/controller/HouseholdContractController.java
+116
-0
test.java
...om/yeejoin/amos/boot/module/hygf/biz/controller/test.java
+295
-0
HouseholdContractServiceImpl.java
...e/hygf/biz/service/impl/HouseholdContractServiceImpl.java
+34
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/HouseholdContractDto.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
*
*
* @author system_generator
* @date 2023-08-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"HouseholdContractDto"
,
description
=
""
)
public
class
HouseholdContractDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"勘察状态"
)
private
String
surveyStatus
;
@ApiModelProperty
(
value
=
"合同状态"
)
private
String
status
;
@ApiModelProperty
(
value
=
"签字状态"
)
private
String
signStatus
;
@ApiModelProperty
(
value
=
"盖章状态"
)
private
String
stampStatus
;
@ApiModelProperty
(
value
=
"甲方"
)
private
String
partyA
;
@ApiModelProperty
(
value
=
"乙方"
)
private
String
partyB
;
@ApiModelProperty
(
value
=
"合同编号"
)
private
String
contractNumber
;
@ApiModelProperty
(
value
=
"农户编号"
)
private
String
peasantHouseholdNumber
;
@ApiModelProperty
(
value
=
"农户身份证"
)
private
String
peasantHouseholdCard
;
@ApiModelProperty
(
value
=
"经销商id"
)
private
Long
dealerId
;
@ApiModelProperty
(
value
=
"经销商code"
)
private
String
dealerCode
;
@ApiModelProperty
(
value
=
"经销商名称"
)
private
String
dealerName
;
@ApiModelProperty
(
value
=
"合同名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"模板id"
)
private
Long
contractTemplateId
;
@ApiModelProperty
(
value
=
"合同文件地址"
)
private
String
contractUrl
;
@ApiModelProperty
(
value
=
"办理人"
)
private
String
sealedUser
;
@ApiModelProperty
(
value
=
"农户id"
)
private
Long
peasantHouseholdId
;
@ApiModelProperty
(
value
=
"所属区域公司id"
)
private
Long
regionalCompaniesSeq
;
@ApiModelProperty
(
value
=
"所属区域公司名称"
)
private
String
regionalCompaniesName
;
@ApiModelProperty
(
value
=
"所属区域公司code"
)
private
String
regionalCompaniesCode
;
@ApiModelProperty
(
value
=
"农户手机号"
)
private
String
peasantHouseholdPhone
;
@ApiModelProperty
(
value
=
"项目详细地址"
)
private
String
projectAddressDetail
;
@ApiModelProperty
(
value
=
"常住详细地址"
)
private
String
permanentAddressDetail
;
@ApiModelProperty
(
value
=
"常住地址"
)
private
String
permanentAddressName
;
@ApiModelProperty
(
value
=
"项目地址"
)
private
String
projectAddressName
;
@ApiModelProperty
(
value
=
"免租期免租期"
)
private
String
rentFree
;
@ApiModelProperty
(
value
=
"租金计算日期"
)
private
Date
rentCalculationDate
;
@ApiModelProperty
(
value
=
"租期结束日期"
)
private
Date
leaseEndDate
;
@ApiModelProperty
(
value
=
"建设规模"
)
private
Double
constructionScale
;
@ApiModelProperty
(
value
=
"组件数量块"
)
private
Integer
componentQuantityBlock
;
@ApiModelProperty
(
value
=
"总投资"
)
private
Double
totalInvestment
;
@ApiModelProperty
(
value
=
"组件功率"
)
private
Double
componentPower
;
@ApiModelProperty
(
value
=
"电站功率"
)
private
Double
stationPower
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/HouseholdContract.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
*
*
* @author system_generator
* @date 2023-08-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"hygf_household_contract"
)
public
class
HouseholdContract
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 勘察状态
*/
@TableField
(
"survey_status"
)
private
String
surveyStatus
;
/**
* 合同状态
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 签字状态
*/
@TableField
(
"sign_status"
)
private
String
signStatus
;
/**
* 盖章状态
*/
@TableField
(
"stamp_status"
)
private
String
stampStatus
;
/**
* 甲方
*/
@TableField
(
"party_a"
)
private
String
partyA
;
/**
* 乙方
*/
@TableField
(
"party_b"
)
private
String
partyB
;
/**
* 合同编号
*/
@TableField
(
"contract_number"
)
private
String
contractNumber
;
/**
* 农户编号
*/
@TableField
(
"peasant_household_number"
)
private
String
peasantHouseholdNumber
;
/**
* 农户身份证
*/
@TableField
(
"peasant_household_card"
)
private
String
peasantHouseholdCard
;
/**
* 经销商id
*/
@TableField
(
"dealer_id"
)
private
Long
dealerId
;
/**
* 经销商code
*/
@TableField
(
"dealer_code"
)
private
String
dealerCode
;
/**
* 经销商名称
*/
@TableField
(
"dealer_name"
)
private
String
dealerName
;
/**
* 合同名称
*/
@TableField
(
"name"
)
private
String
name
;
/**
* 模板id
*/
@TableField
(
"contract_template_id"
)
private
Long
contractTemplateId
;
/**
* 合同文件地址
*/
@TableField
(
"contract_url"
)
private
String
contractUrl
;
/**
* 办理人
*/
@TableField
(
"sealed_user"
)
private
String
sealedUser
;
/**
* 农户id
*/
@TableField
(
"peasant_household_id"
)
private
Long
peasantHouseholdId
;
/**
* 所属区域公司id
*/
@TableField
(
"regional_companies_seq"
)
private
Long
regionalCompaniesSeq
;
/**
* 所属区域公司名称
*/
@TableField
(
"regional_companies_name"
)
private
String
regionalCompaniesName
;
/**
* 所属区域公司code
*/
@TableField
(
"regional_companies_code"
)
private
String
regionalCompaniesCode
;
/**
* 农户手机号
*/
@TableField
(
"peasant_household_phone"
)
private
String
peasantHouseholdPhone
;
/**
* 项目详细地址
*/
@TableField
(
"project_address_detail"
)
private
String
projectAddressDetail
;
/**
* 常住详细地址
*/
@TableField
(
"permanent_address_detail"
)
private
String
permanentAddressDetail
;
/**
* 常住地址
*/
@TableField
(
"permanent_address_name"
)
private
String
permanentAddressName
;
/**
* 项目地址
*/
@TableField
(
"project_address_name"
)
private
String
projectAddressName
;
/**
* 免租期
免租期
*/
@TableField
(
"rent_free"
)
private
String
rentFree
;
/**
* 租金计算日期
*/
@TableField
(
"rent_calculation_date"
)
private
Date
rentCalculationDate
;
/**
* 租期结束日期
*/
@TableField
(
"lease_end_date"
)
private
Date
leaseEndDate
;
/**
* 建设规模
*/
@TableField
(
"construction_scale"
)
private
Double
constructionScale
;
/**
* 组件数量块
*/
@TableField
(
"component_quantity_block"
)
private
Integer
componentQuantityBlock
;
/**
* 总投资
*/
@TableField
(
"total_investment"
)
private
Double
totalInvestment
;
/**
* 组件功率
*/
@TableField
(
"component_power"
)
private
Double
componentPower
;
/**
* 电站功率
*/
@TableField
(
"station_power"
)
private
Double
stationPower
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/HouseholdContractMapper.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-08-21
*/
public
interface
HouseholdContractMapper
extends
BaseMapper
<
HouseholdContract
>
{
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IHouseholdContractService.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
/**
* 接口类
*
* @author system_generator
* @date 2023-08-21
*/
public
interface
IHouseholdContractService
{
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/HouseholdContractMapper.xml
0 → 100644
View file @
489cbdb8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdContractMapper"
>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/HouseholdContractController.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdContractDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
*
*
* @author system_generator
* @date 2023-08-21
*/
@RestController
@Api
(
tags
=
"Api"
)
@RequestMapping
(
value
=
"/household-contract"
)
public
class
HouseholdContractController
extends
BaseController
{
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
/**
* 新增
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
ResponseModel
<
HouseholdContractDto
>
save
(
@RequestBody
HouseholdContractDto
model
)
{
model
=
householdContractServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
public
ResponseModel
<
HouseholdContractDto
>
updateBySequenceNbrHouseholdContract
(
@RequestBody
HouseholdContractDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
householdContractServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除"
,
notes
=
"根据sequenceNbr删除"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
householdContractServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个"
,
notes
=
"根据sequenceNbr查询单个"
)
public
ResponseModel
<
HouseholdContractDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
householdContractServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<
HouseholdContractDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
HouseholdContractDto
>
page
=
new
Page
<
HouseholdContractDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
householdContractServiceImpl
.
queryForHouseholdContractPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
HouseholdContractDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
householdContractServiceImpl
.
queryForHouseholdContractList
());
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/test.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.qiyuesuo.sdk.v2.SdkClient
;
import
com.qiyuesuo.sdk.v2.bean.*
;
import
com.qiyuesuo.sdk.v2.exception.BaseSdkException
;
import
com.qiyuesuo.sdk.v2.json.JSONUtils
;
import
com.qiyuesuo.sdk.v2.request.*
;
import
com.qiyuesuo.sdk.v2.response.ContractListResult
;
import
com.qiyuesuo.sdk.v2.response.DocumentAddResult
;
import
com.qiyuesuo.sdk.v2.response.MiniappTicketResult
;
import
com.qiyuesuo.sdk.v2.response.SdkResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description:
* @author: tw
* @createDate: 2023/8/18
*/
@RestController
@Api
(
tags
=
"经销商单位信息Api"
)
@RequestMapping
(
value
=
"/test"
)
public
class
test
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
test
.
class
);
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"post"
,
value
=
"获取经销商单位"
,
notes
=
"获取经销商单位"
)
@PostMapping
(
value
=
"/getUnit888"
)
public
ResponseModel
<
Object
>
getUnit
(
@RequestBody
UserAuthMiniappTicketRequest
request
)
{
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
String
response
=
null
;
try
{
response
=
sdkClient
.
service
(
request
);
}
catch
(
Exception
e
)
{
throw
new
BaseSdkException
(
"调用接口错误,错误原因:"
+
e
.
getMessage
());
}
SdkResponse
<
MiniappTicketResult
>
result
=
JSONUtils
.
toQysResponse
(
response
,
MiniappTicketResult
.
class
);
if
(!
result
.
getCode
().
equals
(
0
))
{
throw
new
BaseSdkException
(
"获取个人认证Ticket失败,失败原因:"
+
result
.
getCode
()+
","
+
result
.
getMessage
());
}
System
.
out
.
println
(
"获取个人认证Ticket成功,Ticket:"
+
result
.
getResult
().
getTicket
());
return
ResponseHelper
.
buildResponse
(
result
.
getResult
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"post"
,
value
=
"获取经销商单位"
,
notes
=
"获取经销商单位"
)
@PostMapping
(
value
=
"/getUnit999"
)
public
ResponseModel
<
Object
>
getUnit999
(
@RequestBody
ContractMiniappTicketRequest
request
)
{
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
String
response
=
null
;
try
{
response
=
sdkClient
.
service
(
request
);
}
catch
(
Exception
e
)
{
throw
new
BaseSdkException
(
"调用接口错误,错误原因:"
+
e
.
getMessage
());
}
SdkResponse
<
MiniappTicketResult
>
result
=
JSONUtils
.
toQysResponse
(
response
,
MiniappTicketResult
.
class
);
if
(!
result
.
getCode
().
equals
(
0
))
{
throw
new
BaseSdkException
(
"获取合同签署Ticket失败,失败原因:"
+
result
.
getCode
()
+
","
+
result
.
getMessage
());
}
return
ResponseHelper
.
buildResponse
(
result
.
getResult
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"post"
,
value
=
"获取经销商单位"
,
notes
=
"获取经销商单位"
)
@PostMapping
(
value
=
"/getUnit1000"
)
public
ResponseModel
<
ContractListResult
>
getUnit1000
(
@RequestBody
ContractListRequest
request
)
{
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
ContractListResult
contractListResult
=
null
;
// 解析请求结果
String
response
=
sdkClient
.
service
(
request
);
SdkResponse
<
ContractListResult
>
qysResponse
=
JSONUtils
.
toQysResponse
(
response
,
ContractListResult
.
class
);
if
(
qysResponse
.
getCode
()
==
0
)
{
contractListResult
=
qysResponse
.
getResult
();
}
else
{
throw
new
BaseSdkException
(
"请求失败,错误码:{},错误信息:{}"
);
}
return
ResponseHelper
.
buildResponse
(
qysResponse
.
getResult
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"post"
,
value
=
"创建合同"
,
notes
=
"创建合同"
)
@PostMapping
(
value
=
"/getUnit2000"
)
public
ResponseModel
<
SdkResponse
<
Object
>>
getUnit2000
(
@RequestBody
Map
<
String
,
String
>
map
)
{
String
username
=
map
.
get
(
"username"
);
String
contact
=
map
.
get
(
"contact"
);
String
IDCard
=
map
.
get
(
"IDCard"
);
// 初始化sdkClient
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
// 合同基本参数
//进行日期格式化
Contract
contract
=
new
Contract
();
contract
.
setSubject
(
"户用光伏测试合同-"
+
username
+
new
Date
().
getTime
());
contract
.
setDescription
(
"户用光伏测试合同-"
+
username
+
new
Date
().
getTime
());
contract
.
setExpireTime
(
"2024-04-24 23:59:59"
);
contract
.
setEndTime
(
"2024-08-24 23:59:59"
);
contract
.
setCategory
(
new
Category
(
"智信能源合同"
));
// contract.setBizId("");
contract
.
setSend
(
false
);
// 个人
Signatory
signatory1
=
new
Signatory
();
signatory1
.
setTenantName
(
username
);
signatory1
.
setTenantType
(
"PERSONAL"
);
signatory1
.
setReceiver
(
new
User
(
username
,
contact
,
"MOBILE"
));
signatory1
.
setSerialNo
(
1
);
// 对接方
Signatory
signatory2
=
new
Signatory
();
signatory2
.
setTenantName
(
"智信能源科技有限公司-测试"
);
signatory2
.
setTenantType
(
"COMPANY"
);
signatory2
.
setReceiver
(
new
User
(
"唐伟"
,
"18291879708"
,
"MOBILE"
));
signatory2
.
setSerialNo
(
2
);
Action
action
=
new
Action
(
"COMPANY"
,
0
);
signatory2
.
addAction
(
action
);
// 设置签署方
contract
.
addSignatory
(
signatory1
);
contract
.
addSignatory
(
signatory2
);
// 创建合同
ContractDraftRequest
request
=
new
ContractDraftRequest
(
contract
);
String
response
=
sdkClient
.
service
(
request
);
SdkResponse
<
Contract
>
responseObj
=
JSONUtils
.
toQysResponse
(
response
,
Contract
.
class
);
// 返回结果
Contract
result
=
new
Contract
();
if
(
responseObj
.
getCode
()
==
0
)
{
result
=
responseObj
.
getResult
();
logger
.
info
(
JSON
.
toJSONString
(
responseObj
));
}
else
{
logger
.
info
(
"请求失败,错误码:{},错误信息:{}"
,
responseObj
.
getCode
(),
responseObj
.
getMessage
());
}
DocumentAddResult
documentAddResult
=
this
.
getDocumentAddResult
(
result
.
getId
(),
username
,
contact
,
IDCard
);
List
<
Signatory
>
list
=
result
.
getSignatories
();
Long
ActionId
=
null
;
Long
SignatoryId
=
null
;
for
(
Signatory
signatory
:
list
)
{
if
(
signatory
.
getTenantType
().
equals
(
"COMPANY"
)){
ActionId
=
signatory
.
getActions
().
get
(
0
).
getId
();
}
else
{
SignatoryId
=
signatory
.
getId
();
}
}
SdkResponse
<
Object
>
data
=
this
.
getSdkResponse
(
result
.
getId
(),
ActionId
,
documentAddResult
.
getDocumentId
(),
SignatoryId
);
return
ResponseHelper
.
buildResponse
(
data
);
}
public
DocumentAddResult
getDocumentAddResult
(
Long
contractId
,
String
username
,
String
contact
,
String
IDCard
)
{
// 初始化sdkClient
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
// 添加合同文档
List
<
TemplateParam
>
params
=
new
ArrayList
<>();
params
.
add
(
new
TemplateParam
(
"name"
,
username
));
params
.
add
(
new
TemplateParam
(
"IDCard"
,
IDCard
));
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
//进行日期格式化
String
date
=
format
.
format
(
new
Date
());
params
.
add
(
new
TemplateParam
(
"Date"
,
date
));
DocumentAddByTemplateRequest
request
=
new
DocumentAddByTemplateRequest
(
contractId
,
3130034494367662891L
,
params
,
"签署合同,"
);
String
response
=
sdkClient
.
service
(
request
);
SdkResponse
<
DocumentAddResult
>
responseObj
=
JSONUtils
.
toQysResponse
(
response
,
DocumentAddResult
.
class
);
DocumentAddResult
result
=
null
;
if
(
responseObj
.
getCode
()
==
0
)
{
result
=
responseObj
.
getResult
();
logger
.
info
(
"添加合同文档成功,文档ID:{}"
,
JSON
.
toJSONString
(
result
));
}
else
{
logger
.
info
(
"请求失败,错误码:{},错误信息:{}"
,
responseObj
.
getCode
(),
responseObj
.
getMessage
());
}
return
result
;
}
public
SdkResponse
<
Object
>
getSdkResponse
(
Long
contractId
,
Long
ActionId
,
Long
documentId
,
Long
SignatoryId
){
String
serverUrl
=
"https://openapi.qiyuesuo.cn"
;
String
accessKey
=
"TdBmNkjAYd"
;
String
accessSecret
=
"y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z"
;
SdkClient
sdkClient
=
new
SdkClient
(
serverUrl
,
accessKey
,
accessSecret
);
// 发起时可以设置签署位置
Stamper
stamper
=
new
Stamper
();
stamper
.
setActionId
(
ActionId
);
stamper
.
setDocumentId
(
documentId
);
stamper
.
setKeyword
(
"单位名称"
);
stamper
.
setType
(
"COMPANY"
);
stamper
.
setPage
(
1
);
stamper
.
setOffsetX
(
0.3
);
stamper
.
setOffsetY
(
0.0
);
Stamper
stamper2
=
new
Stamper
();
stamper2
.
setSignatoryId
(
SignatoryId
);
stamper2
.
setDocumentId
(
documentId
);
stamper
.
setKeyword
(
"签署方"
);
stamper2
.
setType
(
"PERSONAL"
);
stamper2
.
setPage
(
1
);
stamper2
.
setOffsetX
(
0.0
);
stamper2
.
setOffsetY
(
0.0
);
List
<
Stamper
>
stampers
=
new
ArrayList
<>();
stampers
.
add
(
stamper
);
stampers
.
add
(
stamper2
);
// 发起合同
SdkResponse
<
Object
>
responseObj
=
null
;
ContractSendRequest
request
=
new
ContractSendRequest
(
contractId
,
stampers
);
String
response
=
sdkClient
.
service
(
request
);
responseObj
=
JSONUtils
.
toQysResponse
(
response
);
if
(
responseObj
.
getCode
()
==
0
)
{
logger
.
info
(
"合同发起成功"
);
}
else
{
logger
.
info
(
"请求失败,错误码:{},错误信息:{}"
,
responseObj
.
getCode
(),
responseObj
.
getMessage
());
}
return
responseObj
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/HouseholdContractServiceImpl.java
0 → 100644
View file @
489cbdb8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IHouseholdContractService
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdContractDto
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 服务实现类
*
* @author system_generator
* @date 2023-08-21
*/
@Service
public
class
HouseholdContractServiceImpl
extends
BaseService
<
HouseholdContractDto
,
HouseholdContract
,
HouseholdContractMapper
>
implements
IHouseholdContractService
{
/**
* 分页查询
*/
public
Page
<
HouseholdContractDto
>
queryForHouseholdContractPage
(
Page
<
HouseholdContractDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
HouseholdContractDto
>
queryForHouseholdContractList
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
\ No newline at end of file
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