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
4f0a7c3f
Commit
4f0a7c3f
authored
Aug 22, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
fd265250
b2aba94d
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1619 additions
and
35 deletions
+1619
-35
PhoneRegisterTypeEum.java
.../amos/boot/module/hygf/api/Enum/PhoneRegisterTypeEum.java
+38
-0
PreparationMoneyEnum.java
.../amos/boot/module/hygf/api/Enum/PreparationMoneyEnum.java
+137
-0
MobileLoginParamDto.java
...in/amos/boot/module/hygf/api/dto/MobileLoginParamDto.java
+59
-0
PeasantHouseholdDto.java
...in/amos/boot/module/hygf/api/dto/PeasantHouseholdDto.java
+26
-0
PeasantHouseholdWxDto.java
.../amos/boot/module/hygf/api/dto/PeasantHouseholdWxDto.java
+43
-0
PreparationMoneyDto.java
...in/amos/boot/module/hygf/api/dto/PreparationMoneyDto.java
+31
-4
PreparationMoneyLogDto.java
...amos/boot/module/hygf/api/dto/PreparationMoneyLogDto.java
+30
-0
PeasantHousehold.java
...in/amos/boot/module/hygf/api/entity/PeasantHousehold.java
+40
-0
PreparationMoney.java
...in/amos/boot/module/hygf/api/entity/PreparationMoney.java
+13
-7
PreparationMoneyLog.java
...amos/boot/module/hygf/api/entity/PreparationMoneyLog.java
+29
-0
PreparationMoneyLogMapper.java
...oot/module/hygf/api/mapper/PreparationMoneyLogMapper.java
+16
-0
IDocumentBomService.java
...mos/boot/module/hygf/api/service/IDocumentBomService.java
+4
-0
IPreparationMoneyLogService.java
.../module/hygf/api/service/IPreparationMoneyLogService.java
+14
-0
IPreparationMoneyService.java
...oot/module/hygf/api/service/IPreparationMoneyService.java
+25
-0
DocumentBomController.java
...oot/module/hygf/biz/controller/DocumentBomController.java
+21
-0
PeasantHouseholdController.java
...odule/hygf/biz/controller/PeasantHouseholdController.java
+3
-2
PeasantHouseholdWxController.java
...ule/hygf/biz/controller/PeasantHouseholdWxController.java
+197
-0
PreparationMoneyController.java
...odule/hygf/biz/controller/PreparationMoneyController.java
+51
-4
DocumentBomServiceImpl.java
.../module/hygf/biz/service/impl/DocumentBomServiceImpl.java
+130
-0
PeasantHouseholdServiceImpl.java
...le/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
+341
-2
PreparationMoneyLogServiceImpl.java
...hygf/biz/service/impl/PreparationMoneyLogServiceImpl.java
+21
-0
PreparationMoneyServiceImpl.java
...le/hygf/biz/service/impl/PreparationMoneyServiceImpl.java
+245
-4
WxServiceImpl.java
...amos/boot/module/hygf/biz/service/impl/WxServiceImpl.java
+76
-0
application-dev.properties
...le-hygf-biz/src/main/resources/application-dev.properties
+29
-12
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/Enum/PhoneRegisterTypeEum.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
Enum
;
/**
* @author DELL
* 手机登录类型: 2020年底 驻场开发
*/
public
enum
PhoneRegisterTypeEum
{
WX
(
"微信授权快捷登录"
,
1
),
PHONE_VERIFY
(
"手机验证登录"
,
2
);
private
String
name
;
private
int
code
;
PhoneRegisterTypeEum
(
String
name
,
int
code
){
this
.
name
=
name
;
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/Enum/PreparationMoneyEnum.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 发货单枚举
*
* @author Provence
* @version v1.0
* @date 2023/8/18 16:49
*/
public
class
PreparationMoneyEnum
{
/**
* 订单状态
*
*/
@Getter
@AllArgsConstructor
public
enum
DOCUMENT_STATE
{
未完成
(
"未完成"
,
"0"
,
"未完成"
),
// 订单状态0未完成1已完成2作废
已完成
(
"已完成"
,
"1"
,
"0"
),
//发货状态 0 未发货1已发货
作废
(
"已作废"
,
"2"
,
"1"
);
//到货状态0未到货1已到货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
public
static
String
getName
(
String
code
)
{
for
(
DOCUMENT_STATE
type:
DOCUMENT_STATE
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
return
type
.
getName
();
}
}
return
null
;
}
}
/**
* 发货状态
*
*/
@Getter
@AllArgsConstructor
public
enum
SHIPMENT_STATUS
{
未发货
(
"未发货"
,
"0"
,
"未发货"
),
// 订单状态0未完成1已完成2作废
已发货
(
"已发货"
,
"1"
,
"已发货"
);
//发货状态 0 未发货1已发货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
public
static
String
getName
(
String
code
)
{
for
(
SHIPMENT_STATUS
type:
SHIPMENT_STATUS
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
return
type
.
getName
();
}
}
return
null
;
}
}
/**
* 到货状态
*
*/
@Getter
@AllArgsConstructor
public
enum
RECEIVING_STATUS
{
未到货
(
"未到货"
,
"0"
,
"未到货"
),
// 订单状态0未完成1已完成2作废
已到货
(
"已到货"
,
"1"
,
"已到货"
);
//发货状态 0 未发货1已发货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
public
static
String
getName
(
String
code
)
{
for
(
RECEIVING_STATUS
type:
RECEIVING_STATUS
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
))
{
return
type
.
getName
();
}
}
return
null
;
}
}
/**
* 业主类型
*
*/
@Getter
@AllArgsConstructor
enum
OWNER_TYPE
{
非居民
(
"非居民"
,
"0"
,
"非居民"
),
居民
(
"居民"
,
"1"
,
"居民"
);
//到货状态0未到货1已到货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/MobileLoginParamDto.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
*
* @author Provence
* @version v1.0
* @date 2023/8/21 15:15
*/
@Data
public
class
MobileLoginParamDto
{
/**
* 注册类型:1-微信授权快捷登录;2-手机验证登录
*/
@ApiModelProperty
(
"注册类型:1-微信授权快捷登录;2-手机验证登录"
)
private
int
registerType
;
/**
* 是否需要需要短信验证: true-验证; false-不验证
*/
@ApiModelProperty
(
"是否需要需要短信验证: true-验证; false-不验证"
)
private
Boolean
isNeedVerify
;
/**
* 注册类型为1时使用:微信用户数据字段1,根据1、2进行数据解密,计算出手机号
*/
@ApiModelProperty
(
"注册类型为1时使用:微信用户数据字段1,根据1、2进行数据解密,计算出手机号"
)
private
String
encryptedData
;
/**
* 注册类型为1时使用:微信用户数据字段2,根据1、2进行数据解密,计算出手机号
*/
@ApiModelProperty
(
"注册类型为1时使用:微信用户数据字段1,根据1、2进行数据解密,计算出手机号"
)
private
String
iv
;
/**
*注册类型为1时使用:微信用户数据字段3,根据1、2、3进行数据解密,计算出手机号
*/
@ApiModelProperty
(
"注册类型为1时使用:微信用户数据字段3,根据1、2、3进行数据解密,计算出手机号"
)
private
String
code
;
/**
* 注册类型为2-手机验证登录时使用:手机号
*/
@ApiModelProperty
(
"注册类型为2-手机验证登录时使用:手机号"
)
private
String
phoneNo
;
/**
* 注册类型为2-手机验证登录时使用:验证码
*/
@ApiModelProperty
(
"注册类型为2-手机验证登录时使用:验证码"
)
private
String
verifyCode
;
@ApiModelProperty
(
"农户信息"
)
private
PeasantHouseholdDto
peasantHouseholdDto
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/PeasantHouseholdDto.java
View file @
4f0a7c3f
...
@@ -103,4 +103,30 @@ public class PeasantHouseholdDto extends BaseDto {
...
@@ -103,4 +103,30 @@ public class PeasantHouseholdDto extends BaseDto {
@ApiModelProperty
(
value
=
"常住地址文字"
)
@ApiModelProperty
(
value
=
"常住地址文字"
)
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
permanentAddressText
;
private
List
<
String
>
permanentAddressText
;
@ApiModelProperty
(
value
=
"区域公司id"
)
private
Long
regionalCompaniesSeq
;
@ApiModelProperty
(
value
=
"区域公司code"
)
private
String
regionalCompaniesCode
;
@ApiModelProperty
(
value
=
"区域公司名称"
)
private
String
regionalCompaniesName
;
@ApiModelProperty
(
value
=
"身份证正面"
)
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
idCardFront
;
@ApiModelProperty
(
value
=
"身份证反面"
)
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
idCardOpposite
;
@ApiModelProperty
(
value
=
"微信唯一id"
)
private
String
openId
;
@ApiModelProperty
(
value
=
"是否已认证(0-未认证,1-已认证)"
)
private
Integer
isCertified
;
@ApiModelProperty
(
value
=
"平台userId"
)
private
String
userId
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/PeasantHouseholdWxDto.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
* @author Provence
* @version v1.0
* @date 2023/8/21 13:16
*/
@Data
@ApiModel
(
value
=
"PeasantHouseholdWxDto"
,
description
=
"微信农户登录信息"
)
public
class
PeasantHouseholdWxDto
{
@ApiModelProperty
(
value
=
"token有效期"
)
private
Long
expire
;
@ApiModelProperty
(
value
=
"token"
)
private
String
token
;
@ApiModelProperty
(
value
=
"userId"
)
private
String
userId
;
@ApiModelProperty
private
String
userState
;
@ApiModelProperty
(
value
=
"农户信息"
)
private
PeasantHousehold
peasantHousehold
;
@ApiModelProperty
private
Map
<
String
,
Object
>
userInfo
;
@ApiModelProperty
private
Map
<
String
,
Object
>
authInfo
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/PreparationMoneyDto.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoneyLog
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 发货单
* 发货单
...
@@ -16,6 +24,7 @@ import java.util.Date;
...
@@ -16,6 +24,7 @@ import java.util.Date;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PreparationMoneyDto"
,
description
=
"发货单"
)
@ApiModel
(
value
=
"PreparationMoneyDto"
,
description
=
"发货单"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
PreparationMoneyDto
extends
BaseDto
{
public
class
PreparationMoneyDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -34,6 +43,7 @@ public class PreparationMoneyDto extends BaseDto {
...
@@ -34,6 +43,7 @@ public class PreparationMoneyDto extends BaseDto {
private
String
orderUser
;
private
String
orderUser
;
@ApiModelProperty
(
value
=
"下单时间"
)
@ApiModelProperty
(
value
=
"下单时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
orderTime
;
private
Date
orderTime
;
@ApiModelProperty
(
value
=
"经销商id"
)
@ApiModelProperty
(
value
=
"经销商id"
)
...
@@ -43,7 +53,8 @@ public class PreparationMoneyDto extends BaseDto {
...
@@ -43,7 +53,8 @@ public class PreparationMoneyDto extends BaseDto {
private
String
dealerName
;
private
String
dealerName
;
@ApiModelProperty
(
value
=
" 发货地址"
)
@ApiModelProperty
(
value
=
" 发货地址"
)
private
String
sendAddress
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
sendAddress
;
@ApiModelProperty
(
value
=
" 业主类型"
)
@ApiModelProperty
(
value
=
" 业主类型"
)
private
String
ownerType
;
private
String
ownerType
;
...
@@ -64,16 +75,19 @@ public class PreparationMoneyDto extends BaseDto {
...
@@ -64,16 +75,19 @@ public class PreparationMoneyDto extends BaseDto {
private
String
consigneePhone
;
private
String
consigneePhone
;
@ApiModelProperty
(
value
=
"收货人地址"
)
@ApiModelProperty
(
value
=
"收货人地址"
)
private
String
consigneeAddress
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
consigneeAddress
;
@ApiModelProperty
(
value
=
"收货人详细地址"
)
@ApiModelProperty
(
value
=
"收货人详细地址"
)
private
String
consigneeDetailAddress
;
private
String
consigneeDetailAddress
;
@ApiModelProperty
(
value
=
"发货单"
)
@ApiModelProperty
(
value
=
"发货单"
)
private
String
invoice
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
invoice
;
@ApiModelProperty
(
value
=
"收货单"
)
@ApiModelProperty
(
value
=
"收货单"
)
private
String
receipt
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
receipt
;
@ApiModelProperty
(
value
=
"订单状态0未完成1已完成2作废"
)
@ApiModelProperty
(
value
=
"订单状态0未完成1已完成2作废"
)
private
String
documentState
;
private
String
documentState
;
...
@@ -99,4 +113,17 @@ public class PreparationMoneyDto extends BaseDto {
...
@@ -99,4 +113,17 @@ public class PreparationMoneyDto extends BaseDto {
@ApiModelProperty
(
value
=
"总价"
)
@ApiModelProperty
(
value
=
"总价"
)
private
Double
totalPrice
;
private
Double
totalPrice
;
@ApiModelProperty
(
value
=
"到货时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
deliveryTime
;
@ApiModelProperty
(
value
=
"发货电站列表"
)
@NotEmpty
(
message
=
"请选择发货电站"
)
private
List
<
PeasantHouseholdDto
>
powerStations
;
@ApiModelProperty
(
value
=
"BOM清单"
)
private
List
<
DocumentBomDto
>
documentBoms
;
@ApiModelProperty
(
value
=
"单据追踪"
)
private
List
<
PreparationMoneyLogDto
>
preparationMoneyLogs
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/PreparationMoneyLogDto.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 发货单
*
* @author system_generator
* @date 2023-08-17
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PreparationMoneyLogDto"
,
description
=
"发货单追踪记录"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
PreparationMoneyLogDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"货单id"
)
private
Long
preparationMoneyId
;
@ApiModelProperty
(
value
=
"货单id"
)
private
String
operationContent
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/PeasantHousehold.java
View file @
4f0a7c3f
...
@@ -140,4 +140,44 @@ public class PeasantHousehold extends BaseEntity {
...
@@ -140,4 +140,44 @@ public class PeasantHousehold extends BaseEntity {
* */
* */
@TableField
(
"developer"
)
@TableField
(
"developer"
)
private
String
developer
;
private
String
developer
;
/*
* 区域公司id
* */
@TableField
(
"regional_companies_seq"
)
private
Long
regionalCompaniesSeq
;
/*
* 区域公司code
* */
@TableField
(
"regional_companies_code"
)
private
String
regionalCompaniesCode
;
/*
* 区域公司名称
* */
@TableField
(
"regional_companies_name"
)
private
String
regionalCompaniesName
;
/*
* 身份证正面
* */
@TableField
(
value
=
"id_card_front"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
idCardFront
;
/*
* 身份证反面
* */
@TableField
(
value
=
"id_card_opposite"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
idCardOpposite
;
/*
* 微信唯一id
* */
@TableField
(
"open_id"
)
private
String
openId
;
/*
* 是否已认证(0-未认证,1-已认证)
* */
@TableField
(
"is_certified"
)
private
Integer
isCertified
;
/*
* 平台userId
* */
@TableField
(
"user_id"
)
private
String
userId
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/PreparationMoney.java
View file @
4f0a7c3f
...
@@ -20,7 +20,7 @@ import java.util.List;
...
@@ -20,7 +20,7 @@ import java.util.List;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"hygf_preparation_money"
)
@TableName
(
value
=
"hygf_preparation_money"
,
autoResultMap
=
true
)
public
class
PreparationMoney
extends
BaseEntity
{
public
class
PreparationMoney
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -70,8 +70,8 @@ public class PreparationMoney extends BaseEntity {
...
@@ -70,8 +70,8 @@ public class PreparationMoney extends BaseEntity {
/**
/**
* 发货地址
* 发货地址
*/
*/
@TableField
(
"send_address"
)
@TableField
(
value
=
"send_address"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
private
String
sendAddress
;
private
List
<
Object
>
sendAddress
;
/**
/**
* 业主类型
* 业主类型
...
@@ -112,8 +112,8 @@ public class PreparationMoney extends BaseEntity {
...
@@ -112,8 +112,8 @@ public class PreparationMoney extends BaseEntity {
/**
/**
* 收货人地址
* 收货人地址
*/
*/
@TableField
(
"consignee_address"
)
@TableField
(
value
=
"consignee_address"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
String
consigneeAddress
;
private
List
<
Object
>
consigneeAddress
;
/**
/**
* 收货人详细地址
* 收货人详细地址
...
@@ -125,14 +125,14 @@ public class PreparationMoney extends BaseEntity {
...
@@ -125,14 +125,14 @@ public class PreparationMoney extends BaseEntity {
* 发货单
* 发货单
*/
*/
@TableField
(
value
=
"invoice"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
@TableField
(
value
=
"invoice"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
invoice
;
private
List
<
Object
>
invoice
;
/**
/**
* 收货单
* 收货单
*/
*/
@TableField
(
value
=
"receipt"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
@TableField
(
value
=
"receipt"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
private
String
receipt
;
private
List
<
Object
>
receipt
;
/**
/**
* 订单状态0未完成1已完成2已作废
* 订单状态0未完成1已完成2已作废
...
@@ -188,4 +188,10 @@ public class PreparationMoney extends BaseEntity {
...
@@ -188,4 +188,10 @@ public class PreparationMoney extends BaseEntity {
@TableField
(
"validating"
)
@TableField
(
"validating"
)
private
String
validating
;
private
String
validating
;
/**
* 到货时间
*/
@TableField
(
"delivery_time"
)
private
Date
deliveryTime
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/PreparationMoneyLog.java
0 → 100644
View file @
4f0a7c3f
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.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* 发货单日志记录
*
* @author system_generator
* @date 2023-08-17
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"hygf_preparation_money_log"
)
public
class
PreparationMoneyLog
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@TableField
(
"preparation_money_id"
)
private
Long
preparationMoneyId
;
@TableField
(
"operation_content"
)
private
String
operationContent
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/PreparationMoneyLogMapper.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoneyLog
;
/**
* 发货单 Mapper 接口
*
* @author system_generator
* @date 2023-08-17
*/
public
interface
PreparationMoneyLogMapper
extends
BaseMapper
<
PreparationMoneyLog
>
{
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IDocumentBomService.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto
;
import
java.util.List
;
/**
/**
* 发货单bom接口类
* 发货单bom接口类
*
*
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IPreparationMoneyLogService.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
/**
* 发货单接口类
*
* @author system_generator
* @date 2023-08-17
*/
public
interface
IPreparationMoneyLogService
{
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IPreparationMoneyService.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
/**
/**
* 发货单接口类
* 发货单接口类
*
*
...
@@ -9,4 +11,27 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
...
@@ -9,4 +11,27 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
*/
*/
public
interface
IPreparationMoneyService
{
public
interface
IPreparationMoneyService
{
/**
* 新增/更新发货单
*
*
* @param model dto
* @return {@link PreparationMoneyDto}
* @author Provence
* @throws
*/
PreparationMoneyDto
saveOrUpdateObject
(
PreparationMoneyDto
model
);
/**
* 更新发货单状态
*
*
* @param sequenceNbr 发货单ID
* @param operationType 操作类型(RECEIPT-确认收货, DELIVERY-发货, DISCARD-废弃)
* @return {@link Boolean}
* @author Provence
* @throws
*/
Boolean
updatePreparationMoneyStatus
(
Long
sequenceNbr
,
String
operationType
);
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/DocumentBomController.java
View file @
4f0a7c3f
...
@@ -113,4 +113,25 @@ public class DocumentBomController extends BaseController {
...
@@ -113,4 +113,25 @@ public class DocumentBomController extends BaseController {
public
ResponseModel
<
List
<
DocumentBomDto
>>
selectForList
()
{
public
ResponseModel
<
List
<
DocumentBomDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
documentBomServiceImpl
.
queryForDocumentBomList
());
return
ResponseHelper
.
buildResponse
(
documentBomServiceImpl
.
queryForDocumentBomList
());
}
}
/**
* 根据货单id查询BOM清单
*
*
* @param preparationMoneyId preparationMoneyId
* @return {@link ResponseModel< List< DocumentBomDto>>}
* @author Provence
* @throws
* @date 2023/8/17 20:33
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据货单id查询BOM清单"
,
notes
=
"根据货单id查询BOM清单"
)
@GetMapping
(
value
=
"/listByPreparationMoneyId"
)
public
ResponseModel
<
Page
<
DocumentBomDto
>>
listByPreparationMoneyId
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
Long
preparationMoneyId
)
{
Page
<
DocumentBomDto
>
page
=
new
Page
<
DocumentBomDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
documentBomServiceImpl
.
queryForDocumentBomPage
(
page
,
preparationMoneyId
));
}
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdController.java
View file @
4f0a7c3f
...
@@ -201,13 +201,14 @@ public class PeasantHouseholdController extends BaseController {
...
@@ -201,13 +201,14 @@ public class PeasantHouseholdController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"农户信息分页查询"
,
notes
=
"农户信息分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"农户信息分页查询"
,
notes
=
"农户信息分页查询"
)
public
ResponseModel
<
Page
<
PeasantHouseholdDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
public
ResponseModel
<
Page
<
PeasantHouseholdDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"ownersName"
,
required
=
false
)
String
ownersName
)
{
@RequestParam
(
value
=
"ownersName"
,
required
=
false
)
String
ownersName
,
@RequestParam
(
value
=
"developerId"
,
required
=
false
)
Long
developerId
)
{
Page
<
PeasantHouseholdDto
>
page
=
new
Page
<
PeasantHouseholdDto
>();
Page
<
PeasantHouseholdDto
>
page
=
new
Page
<
PeasantHouseholdDto
>();
page
.
setCurrent
(
current
);
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
page
.
setSize
(
size
);
AgencyUserModel
userInfo
=
getUserInfo
();
AgencyUserModel
userInfo
=
getUserInfo
();
String
orgCode
=
userInfo
.
getCompanys
().
get
(
0
).
getOrgCode
();
String
orgCode
=
userInfo
.
getCompanys
().
get
(
0
).
getOrgCode
();
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
queryForPeasantHouseholdPage
(
page
,
orgCode
,
ownersName
));
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
queryForPeasantHouseholdPage
(
page
,
orgCode
,
ownersName
,
developerId
));
}
}
/**
/**
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdWxController.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.MobileLoginParamDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
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.entity.PeasantHousehold
;
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.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
com.yeejoin.amos.feign.systemctl.model.SmsRecordModel
;
import
com.yeejoin.precontrol.common.utils.DesUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
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.Calendar
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.logging.SimpleFormatter
;
/**
* 农户信息
*
* @author system_generator
* @date 2023-07-07
*/
@RestController
@Api
(
tags
=
"农户信息Api for mobile端"
)
@RequestMapping
(
value
=
"/peasant-household/mobile"
)
@Slf4j
public
class
PeasantHouseholdWxController
extends
BaseController
{
@Autowired
RedisUtils
redisUtil
;
@Autowired
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
@Autowired
PeasantHouseholdServiceImpl
peasantHouseholdServiceImpl
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
/*@TycloudOperation (ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping (value = "/authenticate", method = RequestMethod.POST)
@ApiOperation (httpMethod = "POST", value = "微信农户认证", notes = "微信农户认证")
public ResponseModel<Boolean> authenticate(@ApiParam(name = "农户信息id") @RequestParam Long sequenceNbr) {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.doAuthenticate(sequenceNbr));
}*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
"获取验证码"
)
@GetMapping
(
"/getAuthCode"
)
public
ResponseModel
<
Boolean
>
getAuthCode
(
@RequestParam
String
phoneNo
)
{
HashMap
<
String
,
String
>
sendMap
=
new
HashMap
<>();
sendMap
.
put
(
"mobile"
,
phoneNo
);
sendMap
.
put
(
"smsType"
,
"MOBILE_LOGIN"
);
FeignClientResult
<
SmsRecordModel
>
sendVerifyCodeResult
=
Systemctl
.
smsClient
.
sendVerifyCode
(
sendMap
);
if
(
sendVerifyCodeResult
.
getStatus
()
!=
200
)
{
if
(
log
.
isErrorEnabled
())
{
log
.
error
(
"调用平台发送验证码失败:{}"
,
sendVerifyCodeResult
.
getDevMessage
());
}
throw
new
BadRequest
(
sendVerifyCodeResult
.
getMessage
());
}
return
ResponseHelper
.
buildResponse
(
true
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信授权登陆"
,
notes
=
"微信授权登陆"
)
public
ResponseModel
<
PeasantHouseholdWxDto
>
wxUserLogin
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
peasantHouseholdServiceImpl
.
setPlatFormAccess
();
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
wxUserLogin
(
mobileLoginParam
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信农户注册"
,
notes
=
"微信农户注册"
)
public
ResponseModel
<
PeasantHouseholdDto
>
wxUserRegister
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
log
.
info
(
"微信农户注册, 入参 => {}"
,
JSONObject
.
toJSONString
(
mobileLoginParam
));
if
(
null
==
mobileLoginParam
.
getPeasantHouseholdDto
())
{
throw
new
BadRequest
(
"农户信息不能为空"
);
}
AgencyUserModel
userInfo
=
getUserInfo
();
PeasantHouseholdDto
model
=
mobileLoginParam
.
getPeasantHouseholdDto
();
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
surveyInformationServiceImpl
.
createWithModel
(
surveyInformationDto
);
JSONArray
regionName
=
getRegionName
();
List
<
RegionModel
>
list
=
JSONArray
.
parseArray
(
regionName
.
toJSONString
(),
RegionModel
.
class
);
// 处理项目地址
String
area
=
""
;
if
(
model
.
getProjectAddress
().
size
()
!=
0
)
{
for
(
Integer
reg
:
model
.
getProjectAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
area
=
area
+
re
.
getRegionName
()
+
"/"
;
}
}
model
.
setProjectAddressName
(
area
.
length
()
>
2
?
area
.
substring
(
0
,
area
.
length
()
-
2
)
:
area
);
if
(
"1"
.
equals
(
model
.
getIsPermanent
()))
{
model
.
setPermanentAddress
(
model
.
getProjectAddress
());
model
.
setPermanentAddressDetail
(
model
.
getProjectAddressDetail
());
model
.
setPermanentAddressName
(
area
.
length
()
>
2
?
area
.
substring
(
0
,
area
.
length
()
-
2
)
:
area
);
}
else
{
// 处理常住地址
String
permanent
=
""
;
if
(
model
.
getPermanentAddress
().
size
()
!=
0
)
{
for
(
Integer
reg
:
model
.
getPermanentAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
permanent
=
permanent
+
re
.
getRegionName
()
+
"/"
;
}
}
model
.
setPermanentAddressName
(
permanent
.
length
()
>
2
?
permanent
.
substring
(
0
,
permanent
.
length
()
-
2
)
:
permanent
);
}
}
}
model
.
setSurveyInformationId
(
surveyInformationDto
.
getSequenceNbr
());
model
.
setSurveyOrNot
(
0
);
model
.
setReview
(
0
);
if
(
model
.
getCreationTime
()
==
null
)
{
model
.
setCreationTime
(
new
Date
());
}
model
.
setPeasantHouseholdNo
(
peasantHouseholdServiceImpl
.
getPeasantHouseholdNo
());
model
.
setIsCertified
(
model
.
getIsCertified
()
==
null
?
0
:
model
.
getIsCertified
());
// 未认证
model
.
setUserId
(
userInfo
.
getUserId
());
// 绑定平台userId
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
createWithModel
(
model
));
}
public
JSONArray
getRegionName
()
{
JSONArray
jsonArray
=
new
JSONArray
();
if
(
redisUtil
.
hasKey
(
regionRedis
))
{
jsonArray
=
JSONArray
.
parseArray
(
redisUtil
.
get
(
regionRedis
).
toString
());
}
else
{
Collection
<
RegionModel
>
regionChild
=
new
ArrayList
<>();
RegionModel
regionModel1
=
new
RegionModel
();
regionChild
.
add
(
regionModel1
);
FeignClientResult
<
Collection
<
RegionModel
>>
collectionFeignClientResult
=
Systemctl
.
regionClient
.
queryForTreeParent
(
610000L
);
Collection
<
RegionModel
>
result
=
collectionFeignClientResult
.
getResult
();
for
(
RegionModel
regionModel
:
result
)
{
if
(
null
!=
regionModel
&&
null
!=
regionModel
.
getChildren
())
{
for
(
RegionModel
child
:
regionModel
.
getChildren
())
{
if
(
null
!=
child
&&
null
!=
child
.
getChildren
())
{
for
(
RegionModel
childChild
:
child
.
getChildren
())
{
jsonArray
.
add
(
childChild
);
}
child
.
setChildren
(
regionChild
);
jsonArray
.
add
(
child
);
}
}
regionModel
.
setChildren
(
regionChild
);
jsonArray
.
add
(
regionModel
);
}
}
redisUtil
.
set
(
regionRedis
,
jsonArray
);
}
return
jsonArray
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PreparationMoneyController.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationPageDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationPageDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -12,11 +13,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...
@@ -12,11 +13,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PreparationMoneyServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PreparationMoneyServiceImpl
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
...
@@ -45,8 +49,8 @@ public class PreparationMoneyController extends BaseController {
...
@@ -45,8 +49,8 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增发货单"
,
notes
=
"新增发货单"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增发货单"
,
notes
=
"新增发货单"
)
public
ResponseModel
<
PreparationMoneyDto
>
save
(
@RequestBody
PreparationMoneyDto
model
)
{
public
ResponseModel
<
PreparationMoneyDto
>
save
(
@
Validated
@
RequestBody
PreparationMoneyDto
model
)
{
model
=
preparationMoneyServiceImpl
.
createWithModel
(
model
);
model
=
preparationMoneyServiceImpl
.
saveOrUpdateObject
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
}
...
@@ -61,7 +65,7 @@ public class PreparationMoneyController extends BaseController {
...
@@ -61,7 +65,7 @@ public class PreparationMoneyController extends BaseController {
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新发货单"
,
notes
=
"根据sequenceNbr更新发货单"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新发货单"
,
notes
=
"根据sequenceNbr更新发货单"
)
public
ResponseModel
<
PreparationMoneyDto
>
updateBySequenceNbrPreparationMoney
(
@RequestBody
PreparationMoneyDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<
PreparationMoneyDto
>
updateBySequenceNbrPreparationMoney
(
@RequestBody
PreparationMoneyDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
updateWithModel
(
model
));
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
saveOrUpdateObject
(
model
));
}
}
/**
/**
...
@@ -120,4 +124,47 @@ public class PreparationMoneyController extends BaseController {
...
@@ -120,4 +124,47 @@ public class PreparationMoneyController extends BaseController {
public
ResponseModel
<
List
<
PreparationMoneyDto
>>
selectForList
()
{
public
ResponseModel
<
List
<
PreparationMoneyDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
queryForPreparationMoneyList
());
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
queryForPreparationMoneyList
());
}
}
/**
* 发货价格中金额列联动接口
*
* -根据发货电站表单传入的场站ID 查询数据然后计算相应的金额
*
*
* @param
* @return {@link ResponseModel< List< PreparationMoneyDto>>}
* @author Provence
* @throws
* @date 2023/8/17 18:23
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/getShippingPrice"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"发货价格数据查询"
,
notes
=
"发货价格数据查询"
)
public
ResponseModel
<
PreparationMoneyDto
>
getShippingPrice
(
@RequestBody
List
<
PeasantHouseholdDto
>
dtos
)
{
List
<
Long
>
powerHouseholdIds
=
dtos
.
stream
().
map
(
PeasantHouseholdDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
caculateShippingPriceByPowerHouseHoldIds
(
powerHouseholdIds
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/detail"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个发货单详情"
,
notes
=
"根据sequenceNbr查询单个发货单详情"
)
public
ResponseModel
<
PreparationMoneyDto
>
getObject
(
@RequestParam
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
getObjectBySequenceNbr
(
sequenceNbr
));
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/updatePreparationMoneyStatus"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr更新发货单"
,
notes
=
"根据sequenceNbr更新发货单"
)
public
ResponseModel
<
Boolean
>
updateBySequenceNbr
(
@RequestParam
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
,
@RequestParam
(
value
=
"operationType"
)
String
operationType
)
{
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
updatePreparationMoneyStatus
(
sequenceNbr
,
operationType
));
}
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/DocumentBomServiceImpl.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.DesignInformation
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.DocumentBom
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.DocumentBom
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.DocumentBomMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.DocumentBomMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IDocumentBomService
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IDocumentBomService
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* 发货单bom服务实现类
* 发货单bom服务实现类
...
@@ -17,6 +31,15 @@ import java.util.List;
...
@@ -17,6 +31,15 @@ import java.util.List;
*/
*/
@Service
@Service
public
class
DocumentBomServiceImpl
extends
BaseService
<
DocumentBomDto
,
DocumentBom
,
DocumentBomMapper
>
implements
IDocumentBomService
{
public
class
DocumentBomServiceImpl
extends
BaseService
<
DocumentBomDto
,
DocumentBom
,
DocumentBomMapper
>
implements
IDocumentBomService
{
/**
* 折扣率
*/
private
final
static
double
DISCOUNT_RATE
=
1
;
@Autowired
DesignInformationServiceImpl
designInformationService
;
/**
/**
* 分页查询
* 分页查询
*/
*/
...
@@ -30,4 +53,110 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
...
@@ -30,4 +53,110 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
public
List
<
DocumentBomDto
>
queryForDocumentBomList
()
{
public
List
<
DocumentBomDto
>
queryForDocumentBomList
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
}
/**
* 分页查询 By preparationMoneyId
*/
public
Page
<
DocumentBomDto
>
queryForDocumentBomPage
(
Page
<
DocumentBomDto
>
page
,
Long
preparationMoneyId
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
preparationMoneyId
);
}
/**
* 查询 By preparationMoneyId
*/
public
List
<
DocumentBomDto
>
listByPreparationMoneyId
(
Long
preparationMoneyId
)
{
return
this
.
queryForList
(
null
,
false
,
preparationMoneyId
);
}
/**
* 根据发货电站组装BOM清单数据
*
*
* @param powerHouseholdIds powerHouseholdIds
* @return {@link List< DocumentBom>}
* @author Provence
* @throws
*/
public
List
<
DocumentBom
>
assembleDocumentBom
(
List
<
Long
>
powerHouseholdIds
)
{
// hygf_design_information
List
<
DesignInformation
>
designInformations
=
designInformationService
.
query
().
in
(
"peasant_household_id"
,
powerHouseholdIds
).
list
();
// [{"wlbm":"1","Symbol_key":"B1F7FEE3-9377-4A42-81FB-DEB8775EF67C","wlmc":"1","dcpgg":"1"}]
// 组件-assembly, 逆变器-inverter,电表箱-electricity_meter 根据物料编码 分组
List
<
DocumentBom
>
documentBoms
=
new
ArrayList
<>();
for
(
DesignInformation
designInformation
:
designInformations
)
{
documentBoms
.
addAll
(
convertBom
(
designInformation
.
getAssembly
(),
"assembly"
));
documentBoms
.
addAll
(
convertBom
(
designInformation
.
getInverter
(),
"inverter"
));
documentBoms
.
addAll
(
convertBom
(
designInformation
.
getElectricityMeter
(),
"electricityMeter"
));
}
// 根据物料编码 分组
return
documentBoms
.
stream
().
collect
(
Collectors
.
groupingBy
(
DocumentBom:
:
getMaterialNum
)).
values
().
stream
()
.
flatMap
(
list
->
Stream
.
of
(
list
.
stream
().
reduce
((
o1
,
o2
)
->
{
o1
.
setDemandNumber
(
o1
.
getDemandNumber
()
+
o2
.
getDemandNumber
());
o1
.
setDiscountTotal
(
caculateDiscountTotal
(
o1
).
add
(
caculateDiscountTotal
(
o2
)).
doubleValue
());
o1
.
setDiscountUnitPrice
(
caculateDiscountUnitPrice
(
o1
).
add
(
caculateDiscountUnitPrice
(
o2
)).
doubleValue
());
return
o1
;
}).
orElse
(
null
)).
filter
(
Objects:
:
nonNull
)).
collect
(
Collectors
.
toList
());
}
private
BigDecimal
caculateTotal
(
DocumentBom
o1
)
{
return
new
BigDecimal
(
o1
.
getDemandNumber
()).
multiply
(
new
BigDecimal
(
o1
.
getUnitPrice
()));
}
private
BigDecimal
caculateDiscountTotal
(
DocumentBom
o1
)
{
// 折扣总额 = 总价 - 折扣总价
return
caculateTotal
(
o1
).
subtract
(
new
BigDecimal
(
o1
.
getDemandNumber
()).
multiply
(
caculateDiscountUnitPrice
(
o1
)));
}
private
BigDecimal
caculateDiscountUnitPrice
(
DocumentBom
o1
)
{
// 折扣后单价 = 单价 * 折扣率
return
new
BigDecimal
(
o1
.
getUnitPrice
()).
multiply
(
new
BigDecimal
(
DISCOUNT_RATE
));
}
/**
* 设计信息内的组件-assembly, 逆变器-inverter,电表箱-electricity_meter json转成bom清单对象
*
*
* @param objects objects
* @param materialType materialType
* @return {@link List< DocumentBom>}
* @author Provence
* @throws
*/
private
List
<
DocumentBom
>
convertBom
(
List
<
Object
>
objects
,
String
materialType
)
{
if
(
CollectionUtils
.
isEmpty
(
objects
))
{
return
Collections
.
EMPTY_LIST
;
}
List
<
DocumentBom
>
documentBoms
=
new
ArrayList
<>();
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
objects
.
toString
());
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
json
=
jsonArray
.
getJSONObject
(
i
);
documentBoms
.
add
(
parseDocumentBom
(
json
));
}
return
documentBoms
;
}
private
DocumentBom
parseDocumentBom
(
JSONObject
json
)
{
DocumentBom
documentBom
=
new
DocumentBom
();
String
materialNum
=
json
.
getString
(
"wlbm"
);
//物料编码
String
materialName
=
json
.
getString
(
"wlmc"
);
//物料名称
Integer
demandNumber
=
json
.
getInteger
(
"pzsl"
);
//配置数量
Double
price
=
json
.
getDouble
(
"price"
);
//价格
if
(
StringUtils
.
isAnyBlank
(
materialNum
,
materialName
))
{
throw
new
RuntimeException
(
"物料编码和物料名称不能为空"
);
}
if
(
null
==
demandNumber
||
null
==
price
)
{
throw
new
RuntimeException
(
"价格和配置数量不能为空"
);
}
Double
power
=
Double
.
valueOf
(
Optional
.
ofNullable
(
json
.
getString
(
"gl"
)).
orElse
(
"0"
).
replace
(
"W"
,
""
));
// 去掉功率的单位
documentBom
.
setMaterialNum
(
materialNum
);
//物料编码
documentBom
.
setMaterialName
(
materialName
);
//物料名称
documentBom
.
setUnitPrice
(
price
);
documentBom
.
setDemandNumber
(
demandNumber
);
documentBom
.
setPower
(
power
);
/*
类型和分组目前没有该字段
documentBom.setMaterialType(materialType);
documentBom.setMaterialGroup();*/
return
documentBom
;
}
}
}
\ No newline at end of file
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 @
4f0a7c3f
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.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.module.hygf.api.Enum.PhoneRegisterTypeEum
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.MobileLoginParamDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdWxDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Commercial
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Commercial
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.ExtendedInformation
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.ExtendedInformation
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Information
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Information
;
...
@@ -9,16 +14,47 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.SurveyDetails;
...
@@ -9,16 +14,47 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.SurveyDetails;
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.jxiop.api.util.HttpUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.model.LoginInfoModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
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.web.bind.annotation.PathVariable
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.annotation.Condition
;
import
org.typroject.tyboot.core.rdbms.annotation.Condition
;
import
org.typroject.tyboot.core.rdbms.annotation.Operator
;
import
org.typroject.tyboot.core.rdbms.annotation.Operator
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.io.InputStream
;
import
java.security.spec.AlgorithmParameterSpec
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -30,6 +66,44 @@ import java.util.stream.Collectors;
...
@@ -30,6 +66,44 @@ import java.util.stream.Collectors;
@Service
@Service
public
class
PeasantHouseholdServiceImpl
extends
BaseService
<
PeasantHouseholdDto
,
PeasantHousehold
,
PeasantHouseholdMapper
>
implements
IPeasantHouseholdService
{
public
class
PeasantHouseholdServiceImpl
extends
BaseService
<
PeasantHouseholdDto
,
PeasantHousehold
,
PeasantHouseholdMapper
>
implements
IPeasantHouseholdService
{
private
Long
TOKEN_TIME
=
1209600
l
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${login.environment}"
)
private
String
loginEnvironment
;
@Value
(
"${farmer.orgCode}"
)
private
String
orgCode
;
@Value
(
"${farmer.sequenceNbr}"
)
private
Long
orgSequenceNbr
;
@Value
(
"${farmer.orgNamesWithoutRole:智信能源科技有限公司}"
)
private
String
orgNamesWithoutRole
;
@Value
(
"${dealer.appcode}"
)
private
String
appCodes
;
@Value
(
"${platform.access.loginId}"
)
private
String
platfromAccessLoginId
;
@Value
(
"${platform.access.password}"
)
private
String
platfromAccessPassword
;
@Value
(
"${farmer.roleId:1678211468450885633}"
)
private
String
farmerRoleId
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
WxServiceImpl
wxService
;
@Autowired
@Autowired
SurveyInformationServiceImpl
surveyInformationService
;
SurveyInformationServiceImpl
surveyInformationService
;
...
@@ -73,8 +147,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -73,8 +147,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
/**
/**
* 分页查询
* 分页查询
*/
*/
public
Page
<
PeasantHouseholdDto
>
queryForPeasantHouseholdPage
(
Page
<
PeasantHouseholdDto
>
page
,
String
developerCode
,
@Condition
(
Operator
.
like
)
String
ownersName
)
{
public
Page
<
PeasantHouseholdDto
>
queryForPeasantHouseholdPage
(
Page
<
PeasantHouseholdDto
>
page
,
String
developerCode
,
@Condition
(
Operator
.
like
)
String
ownersName
,
Long
developerId
)
{
Page
<
PeasantHouseholdDto
>
peasantHouseholdDtoPage
=
this
.
queryForPage
(
page
,
"rec_date"
,
false
,
developerCode
,
ownersName
);
Page
<
PeasantHouseholdDto
>
peasantHouseholdDtoPage
=
this
.
queryForPage
(
page
,
"rec_date"
,
false
,
developerCode
,
ownersName
,
developerId
);
List
<
PeasantHouseholdDto
>
records
=
peasantHouseholdDtoPage
.
getRecords
();
List
<
PeasantHouseholdDto
>
records
=
peasantHouseholdDtoPage
.
getRecords
();
List
<
PeasantHouseholdDto
>
newRecords
=
records
.
stream
().
map
(
item
->
{
List
<
PeasantHouseholdDto
>
newRecords
=
records
.
stream
().
map
(
item
->
{
if
(
item
.
getSurveyOrNot
()
!=
null
){
if
(
item
.
getSurveyOrNot
()
!=
null
){
...
@@ -109,4 +183,268 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -109,4 +183,268 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
public
List
<
PeasantHouseholdDto
>
queryForPeasantHouseholdList
()
{
public
List
<
PeasantHouseholdDto
>
queryForPeasantHouseholdList
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
}
public
Boolean
doAuthenticate
(
Long
sequenceNbr
)
{
// 判断是否注册过
PeasantHousehold
peasantHousehold
=
this
.
getById
(
sequenceNbr
);
if
(
null
==
peasantHousehold
)
{
throw
new
BadRequest
(
"认证失败, 农户信息不存在"
);
}
peasantHousehold
.
setIsCertified
(
1
);
// 认证
return
this
.
updateById
(
peasantHousehold
);
}
public
PeasantHouseholdWxDto
wxUserLogin
(
MobileLoginParamDto
wxDTO
)
{
// 通过手机号和验证码调用平台接口进行验证
// String phoneNo = this.parsePhoneNo(wxDTO);
String
phoneNo
=
"13022982292"
;
if
(
phoneNo
==
null
)
{
throw
new
BadRequest
(
"获取手机号失败!"
);
}
wxDTO
.
setPhoneNo
(
phoneNo
);
// 在平台里注册过但是没有农户信息
FeignClientResult
<
LoginInfoModel
>
loginInfo
=
Privilege
.
agencyUserClient
.
getLoginInfo
(
phoneNo
);
if
(
200
==
loginInfo
.
getStatus
())
{
LoginInfoModel
loginInfoModel
=
loginInfo
.
getResult
();
if
(
loginInfoModel
==
null
||
!
StringUtils
.
isNotBlank
(
loginInfoModel
.
getLoginId
()))
{
doRegister
(
wxDTO
);
}
}
// 判断是否注册过
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
query
().
eq
(
"telephone"
,
phoneNo
).
list
();
PeasantHousehold
peasantHousehold
=
peasantHouseholds
.
size
()
>
0
?
peasantHouseholds
.
get
(
0
)
:
null
;
// 没有注册过农户信息
if
(
null
==
peasantHousehold
)
{
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
new
PeasantHouseholdWxDto
();
PeasantHouseholdDto
peasantHouseholdDto
=
buildDefaultPeasantHouseholdDto
(
phoneNo
);
peasantHousehold
=
new
PeasantHousehold
();
BeanUtils
.
copyProperties
(
peasantHouseholdDto
,
peasantHousehold
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
}
PeasantHouseholdWxDto
loginResult
=
doLogin
(
wxDTO
);
// 装载农户信息
loginResult
.
setPeasantHousehold
(
peasantHousehold
);
return
loginResult
;
}
/**
* 农户微信注册
*
*
* @param mobileLoginParamDto mobileLoginParamDto
* @return {@link AgencyUserModel}
* @author Provence
* @throws
* @date 2023/8/21 18:05
*/
public
AgencyUserModel
doRegister
(
MobileLoginParamDto
mobileLoginParamDto
)
{
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
List
<
String
>
split
=
Arrays
.
asList
(
StringUtils
.
split
(
appCodes
,
','
));
Map
<
Long
,
List
<
Long
>>
roleSeqMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
// 提前建立好一个默认角色
List
<
Long
>
roleIds
=
new
ArrayList
<>();
roleIds
.
add
(
Long
.
valueOf
(
farmerRoleId
));
roleSeqMap
.
put
(
orgSequenceNbr
,
roleIds
);
orgRoles
.
put
(
orgSequenceNbr
,
userRoleList
);
//
String
custPassword
=
com
.
yeejoin
.
precontrol
.
common
.
utils
.
DesUtil
.
encode
(
mobileLoginParamDto
.
getPhoneNo
(),
mobileLoginParamDto
.
getPhoneNo
());
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
agencyUserModel
.
setUserName
(
mobileLoginParamDto
.
getPhoneNo
());
agencyUserModel
.
setRealName
(
mobileLoginParamDto
.
getPhoneNo
());
agencyUserModel
.
setPassword
(
custPassword
);
agencyUserModel
.
setRePassword
(
custPassword
);
agencyUserModel
.
setLockStatus
(
"UNLOCK"
);
agencyUserModel
.
setAgencyCode
(
"JXIOP"
);
agencyUserModel
.
setMobile
(
mobileLoginParamDto
.
getPhoneNo
());
agencyUserModel
.
setAppCodes
(
split
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
);
if
(
userResult
.
getStatus
()
!=
200
)
{
log
.
error
(
"调用平台创建用户信息失败:{}"
+
userResult
.
getDevMessage
());
throw
new
BadRequest
(
userResult
.
getMessage
());
}
return
userResult
.
getResult
();
}
/**
* 农户微信登录
*
*
* @param param param
* @return {@link PeasantHouseholdWxDto}
* @author Provence
* @throws
* @date 2023/8/21 18:05
*/
public
PeasantHouseholdWxDto
doLogin
(
MobileLoginParamDto
param
)
{
RequestContext
.
setToken
(
""
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
String
phoneNo
=
param
.
getPhoneNo
();
if
(
phoneNo
==
null
)
{
throw
new
BadRequest
(
"获取手机号失败!"
);
}
FeignClientResult
loginResult
;
if
(!
param
.
getIsNeedVerify
()
||
(
"dev"
.
equals
(
loginEnvironment
)
&&
"666666"
.
equals
(
param
.
getVerifyCode
())))
{
IdPasswordAuthModel
authModel
=
new
IdPasswordAuthModel
();
authModel
.
setLoginId
(
phoneNo
);
authModel
.
setPassword
(
com
.
yeejoin
.
precontrol
.
common
.
utils
.
DesUtil
.
encode
(
phoneNo
,
phoneNo
));
loginResult
=
Privilege
.
authClient
.
idpassword
(
authModel
);
}
else
{
VerifyCodeAuthModel
model
=
new
VerifyCodeAuthModel
();
model
.
setLoginId
(
phoneNo
);
model
.
setVerifyCode
(
param
.
getVerifyCode
());
loginResult
=
Privilege
.
authClient
.
mobileVerifyCode
(
model
);
}
if
(
loginResult
.
getStatus
()
!=
200
)
{
log
.
error
(
"远程调用Privilege服务失败: "
+
loginResult
.
getDevMessage
());
String
message
=
StringUtils
.
isEmpty
(
loginResult
.
getMessage
())
?
"账号或密码错误"
:
loginResult
.
getMessage
();
throw
new
BadRequest
(
message
);
}
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
String
token
=
resultMap
.
get
(
"token"
).
toString
();
RequestContext
.
setToken
(
token
);
// redisUtils.set(model.getPhone() + "_token", token, TOKEN_TIME);
// 设置登录信息
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
new
PeasantHouseholdWxDto
();
peasantHouseholdWxDto
.
setToken
(
token
);
peasantHouseholdWxDto
.
setExpire
(
Long
.
valueOf
((
String
)
resultMap
.
get
(
"expire"
)));
peasantHouseholdWxDto
.
setUserId
((
String
)
resultMap
.
get
(
"userId"
));
// 查询用户信息
FeignClientResult
<
AgencyUserModel
>
getme
=
Privilege
.
agencyUserClient
.
getme
();
getme
.
getResult
().
setPassword
(
""
);
getme
.
getResult
().
setAppCodes
(
new
ArrayList
());
AgencyUserModel
userModel
=
(
AgencyUserModel
)
getme
.
getResult
();
Map
<
String
,
Object
>
userInfo
=
Bean
.
BeantoMap
(
userModel
);
userInfo
.
put
(
"phoneNo"
,
phoneNo
);
userInfo
.
put
(
"companyId"
,
userModel
.
getCompanys
().
get
(
0
).
getCompanyOrgCode
());
peasantHouseholdWxDto
.
setUserInfo
(
userInfo
);
Map
<
String
,
Object
>
authInfo
=
new
HashMap
<>();
authInfo
.
put
(
"token"
,
resultMap
.
get
(
"token"
));
authInfo
.
put
(
"personId"
,
resultMap
.
get
(
"userId"
));
authInfo
.
put
(
"appKey"
,
appKey
);
authInfo
.
put
(
"product"
,
product
);
peasantHouseholdWxDto
.
setAuthInfo
(
authInfo
);
return
peasantHouseholdWxDto
;
}
private
PeasantHouseholdDto
buildDefaultPeasantHouseholdDto
(
String
phoneNo
)
{
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
dto
.
setIsCertified
(
0
);
// 未认证
dto
.
setSurveyOrNot
(
0
);
dto
.
setReview
(
0
);
// 先在后台创建一个角色和公司,微信农户新建的用户使用统一的
// 用户光伏-微信农户
dto
.
setDeveloperCode
(
orgCode
);
dto
.
setDeveloperId
(
orgSequenceNbr
);
dto
.
setDeveloperName
(
orgNamesWithoutRole
);
dto
.
setDeveloper
(
phoneNo
);
dto
.
setRegionalCompaniesSeq
(
orgSequenceNbr
);
dto
.
setRegionalCompaniesCode
(
orgCode
);
dto
.
setRegionalCompaniesName
(
orgNamesWithoutRole
);
dto
.
setTelephone
(
phoneNo
);
return
dto
;
}
/**
* 手机号解析
*
* @param param MobileLoginParam.class
* @return String phoneNo
*/
private
String
parsePhoneNo
(
MobileLoginParamDto
param
)
{
if
(
param
.
getRegisterType
()
==
PhoneRegisterTypeEum
.
WX
.
getCode
())
{
// 进行验证码解析
String
encryptedData
=
param
.
getEncryptedData
();
String
iv
=
param
.
getIv
();
String
code
=
param
.
getCode
();
return
getPhoneNumber
(
wxService
.
getSessionKey
(
code
),
encryptedData
,
iv
);
}
else
{
return
param
.
getPhoneNo
();
}
}
public
String
getPhoneNumber
(
String
sessionkey
,
String
encryptedData
,
String
iv
)
{
byte
[]
encrypData
=
java
.
util
.
Base64
.
getDecoder
().
decode
(
encryptedData
);
byte
[]
ivData
=
java
.
util
.
Base64
.
getDecoder
().
decode
(
iv
);
byte
[]
sessionKey
=
java
.
util
.
Base64
.
getDecoder
().
decode
(
sessionkey
);
String
resultString
=
null
;
AlgorithmParameterSpec
ivSpec
=
new
IvParameterSpec
(
ivData
);
SecretKeySpec
keySpec
=
new
SecretKeySpec
(
sessionKey
,
"AES"
);
try
{
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/CBC/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
keySpec
,
ivSpec
);
resultString
=
new
String
(
cipher
.
doFinal
(
encrypData
),
"UTF-8"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
if
(
object
!=
null
)
{
// 拿到手机号码
String
phone
=
object
.
getString
(
"phoneNumber"
);
return
phone
;
}
return
null
;
}
/**
* 设置平台接口调用权限
*/
public
void
setPlatFormAccess
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
IdPasswordAuthModel
authModel
=
new
IdPasswordAuthModel
();
authModel
.
setLoginId
(
"admin_jxiop"
);
authModel
.
setPassword
(
"AC286A35E74D2DD281EB979789DECF3A"
);
/*IdPasswordAuthModel authModel = new IdPasswordAuthModel();
authModel.setLoginId(platfromAccessLoginId);
authModel.setPassword(platfromAccessPassword);*/
FeignClientResult
<
Map
<
String
,
String
>>
authResult
=
Privilege
.
authClient
.
idpassword
(
authModel
);
String
token
=
authResult
.
getResult
().
get
(
"token"
);
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
// 正常情况下,这里应该做缓存
}
/**
* 生成一个农户信息编号
*
*
* @param
* @return {@link String}
* @author Provence
* @throws
*/
public
String
getPeasantHouseholdNo
()
{
String
redisKey
=
"getPeasantHouseholdNo"
;
String
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
new
Date
());
long
increment
=
redisUtils
.
incr
(
redisKey
,
1
);
if
(
increment
==
0
)
{
redisUtils
.
expire
(
redisKey
,
nextDay
());
}
return
"N"
+
sdf
+
String
.
format
(
"%05d"
,
increment
);
}
private
long
nextDay
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
1
);
return
(
calendar
.
getTimeInMillis
()
-
System
.
currentTimeMillis
())
/
1000
;
}
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PreparationMoneyLogServiceImpl.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyLogDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoneyLog
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyLogMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IPreparationMoneyLogService
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
/**
* 发货单日志记录服务实现类
*
* @author system_generator
* @date 2023-08-17
*/
@Service
public
class
PreparationMoneyLogServiceImpl
extends
BaseService
<
PreparationMoneyLogDto
,
PreparationMoneyLog
,
PreparationMoneyLogMapper
>
implements
IPreparationMoneyLogService
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PreparationMoneyServiceImpl.java
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
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.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PreparationMoneyEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyLogDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationPageDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationPageDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.DocumentBom
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.DocumentStation
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoneyLog
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IPreparationMoneyService
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IPreparationMoneyService
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.apache.commons.lang.BooleanUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
/**
* 发货单服务实现类
* 发货单服务实现类
...
@@ -27,9 +48,20 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
...
@@ -27,9 +48,20 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
@Autowired
@Autowired
private
PreparationMoneyMapper
preparationMoneyMapper
;
private
PreparationMoneyMapper
preparationMoneyMapper
;
@Autowired
private
PowerStationServiceImpl
powerStationService
;
@Autowired
private
PeasantHouseholdServiceImpl
peasantHouseholdService
;
@Autowired
private
DocumentBomServiceImpl
documentBomService
;
@Autowired
private
DocumentStationServiceImpl
documentStationService
;
@Autowired
private
AmosRequestContext
amosRequestContext
;
@Autowired
private
UnitInfoServiceImpl
unitInfoService
;
@Autowired
private
PreparationMoneyLogServiceImpl
preparationMoneyLogService
;
/**
/**
* 分页查询
* 分页查询
*/
*/
...
@@ -66,4 +98,212 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
...
@@ -66,4 +98,212 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
public
List
<
PreparationMoneyDto
>
queryForPreparationMoneyList
()
{
public
List
<
PreparationMoneyDto
>
queryForPreparationMoneyList
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
}
/**
* 获取发货单详情 by sequenceNbr
*
*
* @param sequenceNbr sequenceNbr
* @return {@link PreparationMoneyDto}
* @author Provence
* @throws
*/
public
PreparationMoneyDto
getObjectBySequenceNbr
(
Long
sequenceNbr
)
{
PreparationMoneyDto
preparationMoneyDto
=
this
.
queryBySeq
(
sequenceNbr
);
// 加载BOM清单数据
preparationMoneyDto
.
setDocumentBoms
(
documentBomService
.
listByPreparationMoneyId
(
sequenceNbr
));
// 加载发货电站数据
List
<
Long
>
peasantHouseholdIds
=
documentStationService
.
list
(
new
LambdaQueryWrapper
<
DocumentStation
>()
.
select
(
DocumentStation:
:
getStationId
)
.
eq
(
DocumentStation:
:
getPreparationMoneyId
,
sequenceNbr
))
.
stream
().
map
(
DocumentStation:
:
getStationId
).
collect
(
Collectors
.
toList
());
List
<
PeasantHousehold
>
peasantHouseholds
=
(
List
<
PeasantHousehold
>)
peasantHouseholdService
.
listByIds
(
peasantHouseholdIds
);
preparationMoneyDto
.
setPowerStations
(
peasantHouseholds
.
stream
().
map
(
o
->
entityToDto
(
o
)).
collect
(
Collectors
.
toList
()));
// 加载单据追踪数据
List
<
PreparationMoneyLog
>
preparationMoneyLogDtos
=
preparationMoneyLogService
.
list
(
new
LambdaQueryWrapper
<
PreparationMoneyLog
>().
eq
(
PreparationMoneyLog:
:
getPreparationMoneyId
,
sequenceNbr
));
preparationMoneyDto
.
setPreparationMoneyLogs
(
preparationMoneyLogDtos
.
stream
().
map
(
o
->
entityToDto
(
o
)).
collect
(
Collectors
.
toList
()));
return
preparationMoneyDto
;
}
private
PeasantHouseholdDto
entityToDto
(
PeasantHousehold
o
)
{
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
BeanUtils
.
copyProperties
(
o
,
dto
);
return
dto
;
}
private
PreparationMoneyLogDto
entityToDto
(
PreparationMoneyLog
o
)
{
PreparationMoneyLogDto
dto
=
new
PreparationMoneyLogDto
();
BeanUtils
.
copyProperties
(
o
,
dto
);
return
dto
;
}
/**
* 保存或更新发货单
*
*
* @param model model
* @return {@link PreparationMoneyDto}
* @author Provence
* @throws
*/
@Transactional
@Override
public
PreparationMoneyDto
saveOrUpdateObject
(
PreparationMoneyDto
model
)
{
boolean
isUpdate
=
false
;
if
(
model
.
getSequenceNbr
()
!=
null
)
{
// update
PreparationMoney
entity
=
this
.
getById
(
model
);
if
(
entity
==
null
)
{
throw
new
RuntimeException
(
"发货单不存在"
);
}
isUpdate
=
true
;
}
// BOM 清单 后台查询数据库整合数据
List
<
PeasantHouseholdDto
>
powerStations
=
model
.
getPowerStations
();
List
<
Long
>
powerHouseholdIds
=
powerStations
.
stream
().
map
(
PeasantHouseholdDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
// 后台组装BOM清单
List
<
DocumentBom
>
documentBoms
=
documentBomService
.
assembleDocumentBom
(
powerHouseholdIds
);
if
(
CollectionUtils
.
isEmpty
(
documentBoms
))
{
// throw new BaseException("BOM清单为空", "400", "BOM清单为空");// 这里阻塞前端接口
// 根据发货电站信息无法组装成BOM清单
throw
new
RuntimeException
(
"BOM清单为空"
);
}
// 根据BOM清单计算当前发货单的价格
PreparationMoneyDto
pmd
=
caculateShippingPrice
(
documentBoms
);
model
.
setInventoryPrice
(
pmd
.
getInventoryPrice
());
//清单价格
model
.
setDiscount
(
pmd
.
getDiscount
());
//折扣
model
.
setPromotion
(
pmd
.
getPromotion
());
//促销
model
.
setTotalPrice
(
pmd
.
getTotalPrice
());
//总价
// 前端传值改动太大, 从数据库获取dealerName
String
dealerName
=
Optional
.
ofNullable
(
unitInfoService
.
query
().
eq
(
"amos_company_seq"
,
model
.
getDealerId
()).
one
()).
map
(
UnitInfo:
:
getName
).
orElse
(
null
);
model
.
setDealerName
(
dealerName
);
// model.setContractPrice(pmd.getContractPrice());//合同价格
if
(!
isUpdate
)
{
// 初始化状态
model
.
setReceivingStatus
(
PreparationMoneyEnum
.
RECEIVING_STATUS
.
未到货
.
getName
());
model
.
setShipmentStatus
(
PreparationMoneyEnum
.
SHIPMENT_STATUS
.
未发货
.
getName
());
model
.
setDocumentState
(
PreparationMoneyEnum
.
DOCUMENT_STATE
.
未完成
.
getName
());
}
PreparationMoney
entity
=
new
PreparationMoney
();
BeanUtils
.
copyProperties
(
model
,
entity
);
this
.
saveOrUpdate
(
entity
);
documentBoms
.
stream
().
forEach
(
d
->
d
.
setPreparationMoneyId
(
entity
.
getSequenceNbr
()));
List
<
DocumentStation
>
documentStations
=
powerStations
.
stream
().
map
(
o
->
buildDocumentStations
(
entity
.
getSequenceNbr
(),
o
)).
collect
(
Collectors
.
toList
());
if
(
isUpdate
)
{
documentBomService
.
remove
(
new
LambdaQueryWrapper
<
DocumentBom
>().
select
(
DocumentBom:
:
getSequenceNbr
).
eq
(
DocumentBom:
:
getPreparationMoneyId
,
entity
.
getSequenceNbr
()));
documentStationService
.
remove
(
new
LambdaQueryWrapper
<
DocumentStation
>().
select
(
DocumentStation:
:
getSequenceNbr
).
eq
(
DocumentStation:
:
getPreparationMoneyId
,
entity
.
getSequenceNbr
()));
}
documentBomService
.
saveOrUpdateBatch
(
documentBoms
);
documentStationService
.
saveOrUpdateBatch
(
documentStations
);
// 记录操作日志
PreparationMoneyLog
preparationMoneyLog
=
new
PreparationMoneyLog
();
preparationMoneyLog
.
setPreparationMoneyId
(
entity
.
getSequenceNbr
());
preparationMoneyLog
.
setOperationContent
(
String
.
format
(
"备货单保存【备货单号:%s】"
,
entity
.
getOddNumbers
()));
preparationMoneyLogService
.
save
(
preparationMoneyLog
);
return
model
;
}
private
DocumentStation
buildDocumentStations
(
Long
sequenceNbr
,
PeasantHouseholdDto
dto
)
{
String
recUserId
=
amosRequestContext
.
getUserId
();
String
recUserName
=
amosRequestContext
.
getUserName
();
DocumentStation
documentStation
=
new
DocumentStation
();
documentStation
.
setPreparationMoneyId
(
sequenceNbr
);
documentStation
.
setStationId
(
dto
.
getSequenceNbr
());
documentStation
.
setRecUserId
(
recUserId
);
documentStation
.
setRecUserName
(
recUserName
);
return
documentStation
;
}
/**
* 更新发货单状态
*
*
* @param sequenceNbr 发货单ID
* @param operationType 操作类型(RECEIPT-确认收货, DELIVERY-发货, DISCARD-废弃)
* @return {@link Boolean}
* @author Provence
* @throws
*/
@Override
public
Boolean
updatePreparationMoneyStatus
(
Long
sequenceNbr
,
String
operationType
)
{
PreparationMoney
preparationMoney
=
preparationMoneyMapper
.
selectById
(
sequenceNbr
);
if
(
preparationMoney
==
null
)
{
throw
new
RuntimeException
(
"订单不存在"
);
}
PreparationMoneyLog
preparationMoneyLog
=
new
PreparationMoneyLog
();
preparationMoneyLog
.
setPreparationMoneyId
(
preparationMoney
.
getSequenceNbr
());
switch
(
operationType
)
{
case
"RECEIPT"
:
// 确认收货 -> 到货状态 -> 已到货 -> 订单状态改为 已完成
if
(!
PreparationMoneyEnum
.
SHIPMENT_STATUS
.
已发货
.
getName
().
equals
(
preparationMoney
.
getShipmentStatus
()))
{
throw
new
RuntimeException
(
"订单未发货, 无法确认收货"
);
}
preparationMoney
.
setReceivingStatus
(
PreparationMoneyEnum
.
RECEIVING_STATUS
.
已到货
.
getName
());
preparationMoney
.
setDocumentState
(
PreparationMoneyEnum
.
DOCUMENT_STATE
.
已完成
.
getName
());
preparationMoney
.
setDeliveryTime
(
new
Date
());
preparationMoneyLog
.
setOperationContent
(
String
.
format
(
"备货单确认收货【备货单号:%s】"
,
preparationMoney
.
getOddNumbers
()));
break
;
case
"DELIVERY"
:
// 发货 -> 发货状态 -> 已发货
preparationMoney
.
setShipmentStatus
(
PreparationMoneyEnum
.
SHIPMENT_STATUS
.
已发货
.
getName
());
preparationMoneyLog
.
setOperationContent
(
String
.
format
(
"备货单发货【备货单号:%s】"
,
preparationMoney
.
getOddNumbers
()));
break
;
case
"DISCARD"
:
// 作废
// 订单状态 -> 已废弃
if
(
PreparationMoneyEnum
.
RECEIVING_STATUS
.
已到货
.
getName
().
equals
(
preparationMoney
.
getReceivingStatus
()))
{
throw
new
RuntimeException
(
"订单已到货, 无法作废"
);
}
preparationMoney
.
setDocumentState
(
PreparationMoneyEnum
.
DOCUMENT_STATE
.
作废
.
getName
());
preparationMoneyLog
.
setOperationContent
(
String
.
format
(
"备货单作废【备货单号:%s】"
,
preparationMoney
.
getOddNumbers
()));
break
;
default
:
break
;
}
preparationMoneyLogService
.
save
(
preparationMoneyLog
);
return
preparationMoneyMapper
.
updateById
(
preparationMoney
)
>
0
;
}
/**
* 根据前端选择的发货电站ID列表计算BOM清单价格
*
*
* @param powerHouseholdIds 发货电站ID
* @return {@link PreparationMoneyDto}
* @author Provence
* @throws
*/
public
PreparationMoneyDto
caculateShippingPriceByPowerHouseHoldIds
(
List
<
Long
>
powerHouseholdIds
)
{
List
<
DocumentBom
>
documentBoms
=
documentBomService
.
assembleDocumentBom
(
powerHouseholdIds
);
return
caculateShippingPrice
(
documentBoms
);
}
/**
* 根据前端选择的发货电站ID列表计算BOM清单价格
*
*
* @param documentBoms BOM清单
* @return {@link PreparationMoneyDto}
* @author Provence
* @throws
*/
public
PreparationMoneyDto
caculateShippingPrice
(
List
<
DocumentBom
>
documentBoms
)
{
// 获取BOM清单数据
// 单价 * 经销商折扣 * 促销 * 需求数量
BigDecimal
totalPrice
=
new
BigDecimal
(
0
);
BigDecimal
totaldemandNumber
=
new
BigDecimal
(
0
);
for
(
DocumentBom
documentBom
:
documentBoms
)
{
BigDecimal
unitPrice
=
new
BigDecimal
(
documentBom
.
getUnitPrice
()
==
null
?
0
:
documentBom
.
getUnitPrice
());
//单价
BigDecimal
demandNumber
=
new
BigDecimal
(
documentBom
.
getDemandNumber
());
//需求数量
totalPrice
=
totalPrice
.
add
(
unitPrice
.
multiply
(
demandNumber
));
totaldemandNumber
=
totaldemandNumber
.
add
(
demandNumber
);
}
PreparationMoneyDto
preparationMoneyDto
=
new
PreparationMoneyDto
();
preparationMoneyDto
.
setInventoryPrice
(
totalPrice
.
divide
(
totaldemandNumber
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
//清单价格
preparationMoneyDto
.
setDiscount
(
0
D
);
//折扣
preparationMoneyDto
.
setPromotion
(
0
D
);
//促销
preparationMoneyDto
.
setContractPrice
(
0
D
);
//合同价格 == 确认
preparationMoneyDto
.
setTotalPrice
(
totalPrice
.
doubleValue
());
return
preparationMoneyDto
;
}
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/WxServiceImpl.java
0 → 100644
View file @
4f0a7c3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.HttpUtil
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.io.InputStream
;
/**
* 农户微信小程序
*
* @author Provence
* @version v1.0
* @date 2023/8/21 16:21
*/
@Slf4j
@Component
public
class
WxServiceImpl
{
@Value
(
"${hygfProgram.appid}"
)
private
String
appId
;
@Value
(
"${hygfProgram.secret}"
)
private
String
secret
;
public
String
getSessionKey
(
String
code
)
{
JSONObject
jsonObject
=
getCode2Session
(
code
);
String
sessionKey
=
null
;
if
(
jsonObject
!=
null
)
{
sessionKey
=
jsonObject
.
getString
(
"session_key"
);
}
return
sessionKey
;
}
public
JSONObject
getCode2Session
(
String
code
)
{
String
url
=
buildOpenIdUrl
(
appId
,
secret
,
code
);
String
resultStr
=
HttpUtil
.
sendHttpGet
(
url
);
// resultStr => {"session_key":"Mj5xbDhcZU73DtUduI1xKg==","openid":"oRraY5aYJkxkDJiG4rBaaw4MSmPA"}
log
.
info
(
"微信 Code2Session, code =>{}, 结果 => {}"
,
code
,
resultStr
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resultStr
);
if
(
jsonObject
==
null
||
jsonObject
.
getIntValue
(
"errcode"
)
!=
0
)
{
throw
new
BadRequest
(
jsonObject
.
getString
(
"errmsg"
));
}
return
jsonObject
;
}
private
String
buildOpenIdUrl
(
String
appId
,
String
secret
,
String
code
)
{
String
url
=
"https://api.weixin.qq.com/sns/jscode2session?appid="
+
appId
+
"&secret="
+
secret
+
"&js_code="
+
code
+
"&grant_type=authorization_code"
;
return
url
;
}
@Data
public
static
class
ResponeVo
{
int
code
;
CloseableHttpResponse
response
;
String
content
;
byte
[]
inStream
;
InputStream
inputStream
;
}
public
String
getOpenId
(
String
code
)
{
JSONObject
jsonObject
=
getCode2Session
(
code
);
String
openId
=
null
;
if
(
jsonObject
!=
null
)
{
openId
=
jsonObject
.
getString
(
"openid"
);
}
return
openId
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/application-dev.properties
View file @
4f0a7c3f
...
@@ -85,27 +85,27 @@ spring.jms.pub-sub-domain=false
...
@@ -85,27 +85,27 @@ spring.jms.pub-sub-domain=false
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
regulator.unit.code
=
86*258
regulator.unit.code
=
86*258
#
经销商应用
code
#
������Ӧ��code
dealer.appcode
=
studio_normalapp_5133538
dealer.appcode
=
studio_normalapp_5133538
hygf.sms.tempCode
=
SMS_HYGF_0001
hygf.sms.tempCode
=
SMS_HYGF_0001
#
华为短信相关配置
#
�������������
sms.huawei.url
=
https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1
sms.huawei.url
=
https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1
sms.huawei.appKey
=
n3FYPWO7Heo1ze212QRBvF4VA2E2
sms.huawei.appKey
=
n3FYPWO7Heo1ze212QRBvF4VA2E2
sms.huawei.appSecret
=
IFhiMpWROi7w4Ei21ZbfIjKyt97b
sms.huawei.appSecret
=
IFhiMpWROi7w4Ei21ZbfIjKyt97b
# 模
板
id
# ģ
��i
d
sms.huawei.templateId
=
6aaeb4bf916d4db0a1942c598912519e
sms.huawei.templateId
=
6aaeb4bf916d4db0a1942c598912519e
# 签
名通道号
# ǩ
��ͨ����
sms.huawei.sender
=
1069368924410006092
sms.huawei.sender
=
1069368924410006092
#
签名名称
#
签名名称
sms.huawei.signature
=
华为云短信测试
sms.huawei.signature
=
华为云短信测试
#
审核pageId确认
#
���pageIdȷ��
power.station.examine.pageId
=
1680853427061551106
power.station.examine.pageId
=
1680853427061551106
#
电站审核计划i
d
#
��վ��˼ƻ�id
power.station.examine.planId
=
c4ed1873-0dc6-4518-a7a9-dbc588ef35e5
power.station.examine.planId
=
c4ed1873-0dc6-4518-a7a9-dbc588ef35e5
#
用户组
userGroupId
#
�û���us
erGroupId
hygf.user.group.id
=
1679755750924120066
hygf.user.group.id
=
1679755750924120066
...
@@ -121,8 +121,24 @@ qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
...
@@ -121,8 +121,24 @@ qiyuesuo.serverUrl = https://openapi.qiyuesuo.cn
qiyuesuo.accessKey
=
TdBmNkjAYd
qiyuesuo.accessKey
=
TdBmNkjAYd
qiyuesuo.accessSecret
=
y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z
qiyuesuo.accessSecret
=
y8KiDFKKDdC9Ld9Cm5zuy2rpXjxP5Z
qiyuesuo.category
=
智信能源科技有限公司光伏合同
qiyuesuo.category
=
������Դ�Ƽ�����˾�����ͬ
qiyuesuo.companyTenantName
=
智信能源科技有限公
司
qiyuesuo.companyTenantName
=
������Դ�Ƽ�����˾
qiyuesuo.companyUsername
=
吴文宝
qiyuesuo.companyUsername
=
���ı�
qiyuesuo.companyContact
=
13870935656
qiyuesuo.companyContact
=
13870935656
# ============================================= v20230821 add properties =============================================
security.productWeb
=
AMOS_STUDIO_WEB
security.appKey
=
AMOS_STUDIO
login.environment
=
dev
# 光伏农户微信小程序信息
hygfProgram.appid
=
wx2188769349b1ddeb
hygfProgram.secret
=
3bfd098cfdac002126e728d2dbf83c0d
# 默认微信小程序农户经销商
farmer.orgCode
=
86
farmer.sequenceNbr
=
1620981815542046722
farmer.orgNamesWithoutRole
=
farmer.roleId
=
1678211468450885633
# 配置接口授权用户
platform.access.loginId
=
hygf_platform
platform.access.password
=
23F8A9AE5E9CF343B0AFD49A9C44947
\ 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