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
cd20bcd6
Commit
cd20bcd6
authored
Aug 19, 2023
by
3533457856@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发货单
新增/编辑/详情接口 更新发货单状态接口
parent
14605fd5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
34 deletions
+84
-34
PreparationMoneyEnum.java
.../amos/boot/module/hygf/api/Enum/PreparationMoneyEnum.java
+29
-3
DocumentBomController.java
...oot/module/hygf/biz/controller/DocumentBomController.java
+1
-1
PreparationMoneyController.java
...odule/hygf/biz/controller/PreparationMoneyController.java
+0
-8
DocumentBomServiceImpl.java
.../module/hygf/biz/service/impl/DocumentBomServiceImpl.java
+47
-16
PreparationMoneyServiceImpl.java
...le/hygf/biz/service/impl/PreparationMoneyServiceImpl.java
+7
-6
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
View file @
cd20bcd6
...
...
@@ -35,6 +35,15 @@ public class PreparationMoneyEnum {
* 编码
*/
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
;
}
}
/**
...
...
@@ -59,6 +68,15 @@ public class PreparationMoneyEnum {
* 编码
*/
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
;
}
}
/**
* 到货状态
...
...
@@ -82,6 +100,15 @@ public class PreparationMoneyEnum {
* 编码
*/
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
;
}
}
/**
* 业主类型
...
...
@@ -90,9 +117,8 @@ public class PreparationMoneyEnum {
@Getter
@AllArgsConstructor
enum
OWNER_TYPE
{
document_state
(
"未完成"
,
"0"
,
"未完成"
),
// 订单状态0未完成1已完成2作废
shipment_status
(
"已完成"
,
"1"
,
"0"
),
//发货状态 0 未发货1已发货
receiving_status
(
"作废"
,
"2"
,
"1"
);
//到货状态0未到货1已到货
非居民
(
"非居民"
,
"0"
,
"非居民"
),
居民
(
"居民"
,
"1"
,
"居民"
);
//到货状态0未到货1已到货
/**
* 名称,描述
*/
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/DocumentBomController.java
View file @
cd20bcd6
...
...
@@ -132,6 +132,6 @@ public class DocumentBomController extends BaseController {
Page
<
DocumentBomDto
>
page
=
new
Page
<
DocumentBomDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
documentBomServiceImpl
.
listByPreparationMoneyId
(
page
,
preparationMoneyId
));
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/PreparationMoneyController.java
View file @
cd20bcd6
...
...
@@ -146,14 +146,6 @@ public class PreparationMoneyController extends BaseController {
}
@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
)
{
...
...
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 @
cd20bcd6
...
...
@@ -7,6 +7,7 @@ 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.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -53,10 +54,29 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
return
this
.
queryForList
(
""
,
false
);
}
public
Page
<
DocumentBomDto
>
listByPreparationMoneyId
(
Page
<
DocumentBomDto
>
page
,
Long
preparationMoneyId
)
{
/**
* 分页查询 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
();
...
...
@@ -109,24 +129,34 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
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
);
/*
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();*/
documentBoms
.
add
(
documentBom
);
}
return
documentBoms
;
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/PreparationMoneyServiceImpl.java
View file @
cd20bcd6
...
...
@@ -30,6 +30,7 @@ import java.math.BigDecimal;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
...
...
@@ -139,32 +140,32 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
isUpdate
=
true
;
}
// BOM 清单 后台查询数据库整合数据
List
<
PeasantHouseholdDto
>
powerStations
=
Optional
.
ofNullable
(
model
.
getPowerStations
()).
orElseGet
(
ArrayList:
:
new
);
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
());
model
.
setTotalPrice
(
pmd
.
getTotalPrice
());
//总价
// 前端传值改动太大, 从数据库获取dealerName
LambdaQueryWrapper
<
UnitInfo
>
unitInfoque
=
new
LambdaQueryWrapper
<>();
unitInfoque
.
eq
(
UnitInfo:
:
getAmosCompanySeq
,
model
.
getDealerId
());
String
dealerName
=
Optional
.
ofNullable
(
unitInfoService
.
query
().
getBaseMapper
().
selectOne
(
unitInfoque
)).
map
(
UnitInfo:
:
getName
).
orElse
(
null
);
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());//合同价格
PreparationMoney
entity
=
new
PreparationMoney
()
;
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
()));
...
...
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