Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
Overview
Overview
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
bltdc
dc-cost-system
Commits
61772ac5
Commit
61772ac5
authored
Nov 26, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fb6583a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
38 deletions
+43
-38
SkuController.java
...va/com/blt/other/module/sku/controller/SkuController.java
+43
-38
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/sku/controller/SkuController.java
View file @
61772ac5
package
com
.
blt
.
other
.
module
.
sku
.
controller
;
package
com
.
blt
.
other
.
module
.
sku
.
controller
;
import
com.bailuntec.common.JsonUtilByFsJson
;
import
com.blt.other.common.util.AxiosUtil
;
import
com.blt.other.common.util.AxiosUtil
;
import
com.blt.other.common.util.MyMapperUtil
;
import
com.blt.other.common.util.MyMapperUtil
;
import
com.blt.other.module.database.model.SkuTypeDomain
;
import
com.blt.other.module.database.model.SkuTypeDomain
;
...
@@ -33,61 +34,64 @@ public class SkuController {
...
@@ -33,61 +34,64 @@ public class SkuController {
/**
/**
* 获取所有 sku
* 获取所有 sku
*
* @return
* @return
*/
*/
@GetMapping
(
value
=
"getAllSkuList"
)
@GetMapping
(
value
=
"getAllSkuList"
)
public
List
<
SysProductDomain
>
getAllSkuList
(){
public
List
<
SysProductDomain
>
getAllSkuList
()
{
return
sysProductService
.
getAllSku
();
return
sysProductService
.
getAllSku
();
}
}
/**
/**
* 分页获取所有 sku
* 分页获取所有 sku
*
* @return
* @return
*/
*/
@GetMapping
(
value
=
"getAllSku"
)
@GetMapping
(
value
=
"getAllSku"
)
public
Map
<
String
,
Object
>
getAllSku
(
HttpServletResponse
response
,
HttpServletRequest
request
){
public
Map
<
String
,
Object
>
getAllSku
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
AxiosUtil
.
setCors
(
response
,
request
);
AxiosUtil
.
setCors
(
response
,
request
);
String
pageNum
=
request
.
getParameter
(
"pageNum"
);
String
pageNum
=
request
.
getParameter
(
"pageNum"
);
String
pageSize
=
request
.
getParameter
(
"pageSize"
);
String
pageSize
=
request
.
getParameter
(
"pageSize"
);
Map
<
String
,
Object
>
allSkuByPage
=
sysProductService
.
getAllSkuByPage
(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
Map
<
String
,
Object
>
allSkuByPage
=
sysProductService
.
getAllSkuByPage
(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
allSkuByPage
.
put
(
"success"
,
true
);
allSkuByPage
.
put
(
"success"
,
true
);
return
allSkuByPage
;
return
allSkuByPage
;
}
}
/**
/**
* 根据关键字获取 sku
* 根据关键字获取 sku
*
* @param keyword
* @param keyword
* @return
* @return
*/
*/
@GetMapping
(
value
=
"getSkuListByKeyword/{keyword}"
)
@GetMapping
(
value
=
"getSkuListByKeyword/{keyword}"
)
public
List
<
SysProductDomain
>
getSkuListByKeyword
(
@PathVariable
String
keyword
){
public
List
<
SysProductDomain
>
getSkuListByKeyword
(
@PathVariable
String
keyword
)
{
return
sysProductService
.
getSkuByKeyword
(
keyword
);
return
sysProductService
.
getSkuByKeyword
(
keyword
);
}
}
@PostMapping
(
"/add/save"
)
@PostMapping
(
"/add/save"
)
public
Map
<
String
,
Object
>
save
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
Map
<
String
,
Object
>
save
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AxiosUtil
.
setCors
(
response
,
request
);
AxiosUtil
.
setCors
(
response
,
request
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"success"
,
false
);
result
.
put
(
"success"
,
false
);
result
.
put
(
"msg"
,
"参数为空"
);
result
.
put
(
"msg"
,
"参数为空"
);
Enumeration
<
String
>
parameterNames
=
request
.
getParameterNames
();
Enumeration
<
String
>
parameterNames
=
request
.
getParameterNames
();
if
(
null
!=
parameterNames
){
if
(
null
!=
parameterNames
)
{
String
params
=
parameterNames
.
nextElement
();
String
params
=
parameterNames
.
nextElement
();
System
.
out
.
println
(
params
);
System
.
out
.
println
(
params
);
SkuSaveVo
object
=
null
;
SkuSaveVo
object
=
null
;
try
{
try
{
object
=
(
SkuSaveVo
)
MyMapperUtil
.
getObject
(
params
,
SkuSaveVo
.
class
);
object
=
(
SkuSaveVo
)
MyMapperUtil
.
getObject
(
params
,
SkuSaveVo
.
class
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"msg"
,
"SKU 已保存"
);
result
.
put
(
"msg"
,
"SKU 已保存"
);
}
catch
(
RuntimeException
e
){
}
catch
(
RuntimeException
e
)
{
result
.
put
(
"msg"
,
"格式不正确"
);
result
.
put
(
"msg"
,
"格式不正确"
);
return
result
;
return
result
;
}
}
if
(
null
==
object
.
getSku
().
getSkuTypeNo
()
||
object
.
getSku
().
getSkuTypeNo
().
equals
(
""
)){
if
(
null
==
object
.
getSku
().
getSkuTypeNo
()
||
object
.
getSku
().
getSkuTypeNo
().
equals
(
""
))
{
result
.
put
(
"success"
,
false
);
result
.
put
(
"success"
,
false
);
result
.
put
(
"msg"
,
"请选择 SKU 类型"
);
result
.
put
(
"msg"
,
"请选择 SKU 类型"
);
return
result
;
return
result
;
}
}
// if (null == object.getSku().getSkuKindNo() || object.getSku().getSkuKindNo().equals("")){
// if (null == object.getSku().getSkuKindNo() || object.getSku().getSkuKindNo().equals("")){
...
@@ -95,9 +99,9 @@ public class SkuController {
...
@@ -95,9 +99,9 @@ public class SkuController {
// result.put("msg","请选择 SKU 小类");
// result.put("msg","请选择 SKU 小类");
// return result;
// return result;
// }
// }
if
(
null
==
object
.
getSku
().
getSkuname
()
||
object
.
getSku
().
getSkuname
().
equals
(
""
)){
if
(
null
==
object
.
getSku
().
getSkuname
()
||
object
.
getSku
().
getSkuname
().
equals
(
""
))
{
result
.
put
(
"success"
,
false
);
result
.
put
(
"success"
,
false
);
result
.
put
(
"msg"
,
"请输入 SKU 标题"
);
result
.
put
(
"msg"
,
"请输入 SKU 标题"
);
return
result
;
return
result
;
}
}
// if (null == object.getSku().getSkusize() || object.getSku().getSkusize().equals("")){
// if (null == object.getSku().getSkusize() || object.getSku().getSkusize().equals("")){
...
@@ -105,14 +109,14 @@ public class SkuController {
...
@@ -105,14 +109,14 @@ public class SkuController {
// result.put("msg","请输入 SKU 规格");
// result.put("msg","请输入 SKU 规格");
// return result;
// return result;
// }
// }
if
(
null
==
object
.
getSku
().
getSupplierNo
()
||
object
.
getSku
().
getSupplierNo
().
equals
(
""
)){
if
(
null
==
object
.
getSku
().
getSupplierNo
()
||
object
.
getSku
().
getSupplierNo
().
equals
(
""
))
{
result
.
put
(
"success"
,
false
);
result
.
put
(
"success"
,
false
);
result
.
put
(
"msg"
,
"选择供应商"
);
result
.
put
(
"msg"
,
"选择供应商"
);
return
result
;
return
result
;
}
}
SysProductDomain
sysProductDomain
=
sysProductService
.
save
(
object
.
getSku
());
SysProductDomain
sysProductDomain
=
sysProductService
.
save
(
object
.
getSku
());
result
.
put
(
"sku"
,
sysProductDomain
);
result
.
put
(
"sku"
,
sysProductDomain
);
return
result
;
return
result
;
}
}
...
@@ -120,39 +124,40 @@ public class SkuController {
...
@@ -120,39 +124,40 @@ public class SkuController {
}
}
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
public
Map
<
String
,
Object
>
delete
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
public
Map
<
String
,
Object
>
delete
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
AxiosUtil
.
setCors
(
response
,
request
);
AxiosUtil
.
setCors
(
response
,
request
);
String
skucode
=
request
.
getParameter
(
"skucode"
);
String
skucode
=
request
.
getParameter
(
"skucode"
);
Integer
del
=
sysProductService
.
deleteSku
(
skucode
);
Integer
del
=
sysProductService
.
deleteSku
(
skucode
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"success"
,
true
);
result
.
put
(
"success"
,
true
);
return
result
;
return
result
;
}
}
/**
/**
* 编辑 sku 保存
* 编辑 sku 保存
*
* @param response
* @param response
* @param request
* @param request
* @return
* @return
*/
*/
@PostMapping
(
"/resaveSku"
)
@PostMapping
(
"/resaveSku"
)
public
Map
<
String
,
Object
>
resaveSku
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
public
Map
<
String
,
Object
>
resaveSku
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
AxiosUtil
.
setCors
(
response
,
request
);
AxiosUtil
.
setCors
(
response
,
request
);
Map
<
String
,
Object
>
result
=
null
;
Map
<
String
,
Object
>
result
=
null
;
Enumeration
<
String
>
parameterNames
=
request
.
getParameterNames
();
Enumeration
<
String
>
parameterNames
=
request
.
getParameterNames
();
if
(
null
!=
parameterNames
&&
parameterNames
.
hasMoreElements
()){
if
(
null
!=
parameterNames
&&
parameterNames
.
hasMoreElements
())
{
String
s
=
parameterNames
.
nextElement
();
String
s
=
parameterNames
.
nextElement
();
SysProductDomain
object
=
(
SysProductDomain
)
MyMapperUtil
.
getObject
(
s
,
SysProductDomain
.
class
);
SysProductDomain
object
=
JsonUtilByFsJson
.
jsonToBean
(
s
,
SysProductDomain
.
class
);
SkuTypeDomain
type
=
skuTypeService
.
getBySkuTypeNo
(
object
.
getSkuTypeNo
());
SkuTypeDomain
type
=
skuTypeService
.
getBySkuTypeNo
(
object
.
getSkuTypeNo
());
SupplierDomain
supplier
=
supplierService
.
getSupplierByNo
(
object
.
getSupplierNo
());
SupplierDomain
supplier
=
supplierService
.
getSupplierByNo
(
object
.
getSupplierNo
());
object
.
setSkuTypeName
(
type
.
getSkuTypeName
());
object
.
setSkuTypeName
(
type
.
getSkuTypeName
());
object
.
setSupplierid
(
supplier
.
getSupplierid
());
object
.
setSupplierid
(
supplier
.
getSupplierid
());
object
.
setSuppliername
(
supplier
.
getName
());
object
.
setSuppliername
(
supplier
.
getName
());
Integer
update
=
sysProductService
.
update
(
object
);
Integer
update
=
sysProductService
.
update
(
object
);
if
(
null
!=
update
&&
update
==
1
){
if
(
null
!=
update
&&
update
==
1
)
{
result
=
new
HashMap
<>();
result
=
new
HashMap
<>();
result
.
put
(
"success"
,
true
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"sku"
,
object
);
result
.
put
(
"sku"
,
object
);
}
}
}
}
return
result
;
return
result
;
...
...
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