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
f346fa0d
Commit
f346fa0d
authored
Aug 18, 2023
by
3533457856@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发货单
新增/编辑/详情接口 更新发货单状态接口
parent
4d2f63b6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
374 additions
and
19 deletions
+374
-19
PreparationMoneyEnum.java
.../amos/boot/module/hygf/api/Enum/PreparationMoneyEnum.java
+111
-0
PreparationMoneyDto.java
...in/amos/boot/module/hygf/api/dto/PreparationMoneyDto.java
+27
-4
PreparationMoney.java
...in/amos/boot/module/hygf/api/entity/PreparationMoney.java
+13
-7
IDocumentBomService.java
...mos/boot/module/hygf/api/service/IDocumentBomService.java
+16
-0
IPreparationMoneyService.java
...oot/module/hygf/api/service/IPreparationMoneyService.java
+25
-0
DocumentBomController.java
...oot/module/hygf/biz/controller/DocumentBomController.java
+17
-0
PeasantHouseholdController.java
...odule/hygf/biz/controller/PeasantHouseholdController.java
+3
-2
PreparationMoneyController.java
...odule/hygf/biz/controller/PreparationMoneyController.java
+59
-4
DocumentBomServiceImpl.java
.../module/hygf/biz/service/impl/DocumentBomServiceImpl.java
+101
-0
PeasantHouseholdServiceImpl.java
...le/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
+2
-2
PreparationMoneyServiceImpl.java
...le/hygf/biz/service/impl/PreparationMoneyServiceImpl.java
+0
-0
No files found.
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 @
f346fa0d
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
;
}
/**
* 发货状态
*
*/
@Getter
@AllArgsConstructor
public
enum
SHIPMENT_STATUS
{
未发货
(
"未发货"
,
"0"
,
"未发货"
),
// 订单状态0未完成1已完成2作废
已发货
(
"已发货"
,
"1"
,
"已发货"
);
//发货状态 0 未发货1已发货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
}
/**
* 到货状态
*
*/
@Getter
@AllArgsConstructor
public
enum
RECEIVING_STATUS
{
未到货
(
"未到货"
,
"0"
,
"未到货"
),
// 订单状态0未完成1已完成2作废
已到货
(
"已到货"
,
"1"
,
"已到货"
);
//发货状态 0 未发货1已发货
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
describe
;
}
/**
* 业主类型
*
*/
@Getter
@AllArgsConstructor
enum
OWNER_TYPE
{
document_state
(
"未完成"
,
"0"
,
"未完成"
),
// 订单状态0未完成1已完成2作废
shipment_status
(
"已完成"
,
"1"
,
"0"
),
//发货状态 0 未发货1已发货
receiving_status
(
"作废"
,
"2"
,
"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/PreparationMoneyDto.java
View file @
f346fa0d
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
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
javax.validation.constraints.NotEmpty
;
import
java.util.Date
;
import
java.util.List
;
/**
* 发货单
...
...
@@ -16,6 +23,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PreparationMoneyDto"
,
description
=
"发货单"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
PreparationMoneyDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -34,6 +42,7 @@ public class PreparationMoneyDto extends BaseDto {
private
String
orderUser
;
@ApiModelProperty
(
value
=
"下单时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
orderTime
;
@ApiModelProperty
(
value
=
"经销商id"
)
...
...
@@ -43,7 +52,8 @@ public class PreparationMoneyDto extends BaseDto {
private
String
dealerName
;
@ApiModelProperty
(
value
=
" 发货地址"
)
private
String
sendAddress
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
sendAddress
;
@ApiModelProperty
(
value
=
" 业主类型"
)
private
String
ownerType
;
...
...
@@ -64,16 +74,19 @@ public class PreparationMoneyDto extends BaseDto {
private
String
consigneePhone
;
@ApiModelProperty
(
value
=
"收货人地址"
)
private
String
consigneeAddress
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
consigneeAddress
;
@ApiModelProperty
(
value
=
"收货人详细地址"
)
private
String
consigneeDetailAddress
;
@ApiModelProperty
(
value
=
"发货单"
)
private
String
invoice
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
invoice
;
@ApiModelProperty
(
value
=
"收货单"
)
private
String
receipt
;
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
receipt
;
@ApiModelProperty
(
value
=
"订单状态0未完成1已完成2作废"
)
private
String
documentState
;
...
...
@@ -99,4 +112,14 @@ public class PreparationMoneyDto extends BaseDto {
@ApiModelProperty
(
value
=
"总价"
)
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
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/PreparationMoney.java
View file @
f346fa0d
...
...
@@ -20,7 +20,7 @@ import java.util.List;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"hygf_preparation_money"
)
@TableName
(
value
=
"hygf_preparation_money"
,
autoResultMap
=
true
)
public
class
PreparationMoney
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -70,8 +70,8 @@ public class PreparationMoney extends BaseEntity {
/**
* 发货地址
*/
@TableField
(
"send_address"
)
private
String
sendAddress
;
@TableField
(
value
=
"send_address"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
private
List
<
Object
>
sendAddress
;
/**
* 业主类型
...
...
@@ -112,8 +112,8 @@ public class PreparationMoney extends BaseEntity {
/**
* 收货人地址
*/
@TableField
(
"consignee_address"
)
private
String
consigneeAddress
;
@TableField
(
value
=
"consignee_address"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
Object
>
consigneeAddress
;
/**
* 收货人详细地址
...
...
@@ -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
;
/**
* 收货单
*/
@TableField
(
value
=
"receipt"
,
typeHandler
=
FastjsonTypeHandler
.
class
,
updateStrategy
=
FieldStrategy
.
IGNORED
)
private
String
receipt
;
private
List
<
Object
>
receipt
;
/**
* 订单状态0未完成1已完成2已作废
...
...
@@ -182,4 +182,10 @@ public class PreparationMoney extends BaseEntity {
@TableField
(
"total_price"
)
private
Double
totalPrice
;
/**
* 到货时间
*/
@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/service/IDocumentBomService.java
View file @
f346fa0d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto
;
import
java.util.List
;
/**
* 发货单bom接口类
*
...
...
@@ -9,4 +13,16 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
*/
public
interface
IDocumentBomService
{
/**
* 根据货单id查询BOM清单
*
*
* @param preparationMoneyId preparationMoneyId
* @return {@link java.util.List<com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto>}
* @author Provence
* @throws
* @date 2023/8/17 20:35
*/
List
<
DocumentBomDto
>
listByPreparationMoneyId
(
Long
preparationMoneyId
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IPreparationMoneyService.java
View file @
f346fa0d
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;
*/
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 @
f346fa0d
...
...
@@ -113,4 +113,21 @@ public class DocumentBomController extends BaseController {
public
ResponseModel
<
List
<
DocumentBomDto
>>
selectForList
()
{
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
<
List
<
DocumentBomDto
>>
listByPreparationMoneyId
(
@RequestParam
Long
preparationMoneyId
)
{
return
ResponseHelper
.
buildResponse
(
documentBomServiceImpl
.
listByPreparationMoneyId
(
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 @
f346fa0d
...
...
@@ -201,13 +201,14 @@ public class PeasantHouseholdController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"农户信息分页查询"
,
notes
=
"农户信息分页查询"
)
public
ResponseModel
<
Page
<
PeasantHouseholdDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@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
.
setCurrent
(
current
);
page
.
setSize
(
size
);
AgencyUserModel
userInfo
=
getUserInfo
();
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/PreparationMoneyController.java
View file @
f346fa0d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
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.entity.PreparationMoney
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
...
...
@@ -12,11 +13,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
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.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.hygf.api.dto.PreparationMoneyDto
;
...
...
@@ -45,8 +49,8 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增发货单"
,
notes
=
"新增发货单"
)
public
ResponseModel
<
PreparationMoneyDto
>
save
(
@RequestBody
PreparationMoneyDto
model
)
{
model
=
preparationMoneyServiceImpl
.
createWithModel
(
model
);
public
ResponseModel
<
PreparationMoneyDto
>
save
(
@
Validated
@
RequestBody
PreparationMoneyDto
model
)
{
model
=
preparationMoneyServiceImpl
.
saveOrUpdateObject
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
...
...
@@ -61,7 +65,7 @@ public class PreparationMoneyController extends BaseController {
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新发货单"
,
notes
=
"根据sequenceNbr更新发货单"
)
public
ResponseModel
<
PreparationMoneyDto
>
updateBySequenceNbrPreparationMoney
(
@RequestBody
PreparationMoneyDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
updateWithModel
(
model
));
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
saveOrUpdateObject
(
model
));
}
/**
...
...
@@ -120,4 +124,55 @@ public class PreparationMoneyController extends BaseController {
public
ResponseModel
<
List
<
PreparationMoneyDto
>>
selectForList
()
{
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
)
@PostMapping
(
value
=
"/getShippingPricev"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"发货价格数据查询-for test"
,
notes
=
"发货价格数据查询2"
)
public
ResponseModel
<
Double
>
getShippingPricev
(
@RequestBody
List
<
PeasantHouseholdDto
>
dtos
)
{
List
<
Long
>
powerHouseholdIds
=
dtos
.
stream
().
map
(
PeasantHouseholdDto:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
return
ResponseHelper
.
buildResponse
(
preparationMoneyServiceImpl
.
caculateShippingPriceByPowerHouseHoldIds
(
powerHouseholdIds
).
getInventoryPrice
());
}
@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 @
f346fa0d
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.mapper.DocumentBomMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IDocumentBomService
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DocumentBomDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
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.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* 发货单bom服务实现类
...
...
@@ -17,6 +30,15 @@ import java.util.List;
*/
@Service
public
class
DocumentBomServiceImpl
extends
BaseService
<
DocumentBomDto
,
DocumentBom
,
DocumentBomMapper
>
implements
IDocumentBomService
{
/**
* 折扣率
*/
private
final
static
double
DISCOUNT_RATE
=
1
;
@Autowired
DesignInformationServiceImpl
designInformationService
;
/**
* 分页查询
*/
...
...
@@ -30,4 +52,82 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
public
List
<
DocumentBomDto
>
queryForDocumentBomList
()
{
return
this
.
queryForList
(
""
,
false
);
}
@Override
public
List
<
DocumentBomDto
>
listByPreparationMoneyId
(
Long
preparationMoneyId
)
{
return
this
.
queryForList
(
""
,
false
,
preparationMoneyId
);
}
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
++)
{
DocumentBom
documentBom
=
new
DocumentBom
();
JSONObject
json
=
jsonArray
.
getJSONObject
(
i
);
Integer
demandNumber
=
json
.
getInteger
(
"pzsl"
);
//配置数量
String
materialNum
=
json
.
getString
(
"wlbm"
);
//物料编码
String
materialName
=
json
.
getString
(
"wlmc"
);
//物料名称
Double
power
=
Double
.
valueOf
(
Optional
.
ofNullable
(
json
.
getString
(
"gl"
)).
orElse
(
"0"
).
replace
(
"W"
,
""
));
// 去掉功率的单位
Double
price
=
json
.
getDouble
(
"price"
);
//价格
documentBom
.
setMaterialNum
(
materialNum
);
//物料编码
documentBom
.
setMaterialName
(
materialName
);
//物料名称
documentBom
.
setUnitPrice
(
price
);
documentBom
.
setDemandNumber
(
demandNumber
);
documentBom
.
setPower
(
power
);
/*
类型和分组目前没有该字段
documentBom.setMaterialType(materialType);
documentBom.setMaterialGroup();*/
documentBoms
.
add
(
documentBom
);
}
return
documentBoms
;
}
}
\ 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 @
f346fa0d
...
...
@@ -73,8 +73,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
/**
* 分页查询
*/
public
Page
<
PeasantHouseholdDto
>
queryForPeasantHouseholdPage
(
Page
<
PeasantHouseholdDto
>
page
,
String
developerCode
,
@Condition
(
Operator
.
like
)
String
ownersName
)
{
Page
<
PeasantHouseholdDto
>
peasantHouseholdDtoPage
=
this
.
queryForPage
(
page
,
"rec_date"
,
false
,
developerCode
,
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
,
developerId
);
List
<
PeasantHouseholdDto
>
records
=
peasantHouseholdDtoPage
.
getRecords
();
List
<
PeasantHouseholdDto
>
newRecords
=
records
.
stream
().
map
(
item
->
{
if
(
item
.
getSurveyOrNot
()
!=
null
){
...
...
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 @
f346fa0d
This diff is collapsed.
Click to expand it.
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