Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
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
曲欣亮
shop
Commits
e732219a
Commit
e732219a
authored
Aug 28, 2018
by
chang20170705
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
brand
parent
bf007f76
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
0 deletions
+111
-0
BrandController.java
src/main/java/com/egolm/shop/controller/BrandController.java
+65
-0
GoodsController.java
src/main/java/com/egolm/shop/controller/GoodsController.java
+16
-0
GoodsService.java
src/main/java/com/egolm/shop/service/GoodsService.java
+2
-0
GoodsServiceImpl.java
...in/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
+28
-0
No files found.
src/main/java/com/egolm/shop/controller/BrandController.java
View file @
e732219a
package
com
.
egolm
.
shop
.
controller
;
package
com
.
egolm
.
shop
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -63,4 +66,66 @@ public class BrandController {
...
@@ -63,4 +66,66 @@ public class BrandController {
return
Rjx
.
jsonOk
().
set
(
"list"
,
detailList
).
setPage
(
page
).
toString
();
return
Rjx
.
jsonOk
().
set
(
"list"
,
detailList
).
setPage
(
page
).
toString
();
}
}
@ApiOperation
(
"品牌列表接口按首字母"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"OrgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"区域编号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"ShopNO"
,
dataType
=
"String"
,
required
=
false
,
value
=
"店铺编号"
,
defaultValue
=
""
),
})
@RequestMapping
(
value
=
"/getBrandList"
,
method
=
RequestMethod
.
GET
)
public
String
getBrandList
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
listMap
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"OrgNO"
,
request
.
getParameter
(
"OrgNO"
));
params
.
put
(
"ShopNO"
,
request
.
getParameter
(
"ShopNO"
));
listMap
=
brandService
.
getBrandList
(
params
);
String
reg
=
"[A-Z]"
;
//用map把相同首字母放到同一个list中
Map
<
String
,
List
>
pinMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
item:
listMap
)
{
String
first
=((
String
)
item
.
get
(
"PinyinCode"
)).
substring
(
0
,
1
).
toUpperCase
();
Map
<
String
,
String
>
BrandList
=
new
HashMap
<>();
BrandList
.
put
(
"BrandNO"
,
(
String
)
item
.
get
(
"BrandNO"
));
BrandList
.
put
(
"BrandName"
,
(
String
)
item
.
get
(
"BrandName"
));
BrandList
.
put
(
"ImgPath"
,
(
String
)
item
.
get
(
"ImgPath"
));
if
(
first
.
matches
(
reg
))
{
if
(
pinMap
.
containsKey
(
first
))
{
pinMap
.
get
(
first
).
add
(
BrandList
);
}
else
{
pinMap
.
put
(
first
,
new
ArrayList
()
{{
add
(
BrandList
);}});
}
}
else
{
if
(
pinMap
.
containsKey
(
"#"
))
{
pinMap
.
get
(
"#"
).
add
(
BrandList
);
}
else
{
pinMap
.
put
(
"#"
,
new
ArrayList
()
{{
add
(
BrandList
);}});
}
}
}
//转换输出结果
List
<
Map
<
String
,
Object
>>
returnList
=
new
ArrayList
<>();
for
(
Entry
<
String
,
List
>
entry
:
pinMap
.
entrySet
())
{
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
returnMap
.
put
(
"PyCode"
,
entry
.
getKey
());
returnMap
.
put
(
"BrandList"
,
entry
.
getValue
());
}
return
Rjx
.
jsonOk
().
set
(
"list"
,
returnList
).
toJson
();
}
@ApiOperation
(
"热销品牌列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"OrgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"区域编号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"CompNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"组件编号"
,
defaultValue
=
""
),
})
@RequestMapping
(
value
=
"/getHotSaleBrands"
,
method
=
RequestMethod
.
GET
)
public
String
getHotSaleBrands
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
listMap
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"OrgNO"
,
request
.
getParameter
(
"OrgNO"
));
params
.
put
(
"CompNO"
,
request
.
getParameter
(
"CompNO"
));
listMap
=
brandService
.
getHotSaleBrands
(
params
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
toJson
();
}
}
}
src/main/java/com/egolm/shop/controller/GoodsController.java
View file @
e732219a
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -72,4 +73,19 @@ public class GoodsController {
...
@@ -72,4 +73,19 @@ public class GoodsController {
List
<
Map
<
String
,
Object
>>
detailList
=
goodsService
.
listThinkLike
(
param
,
page
);
List
<
Map
<
String
,
Object
>>
detailList
=
goodsService
.
listThinkLike
(
param
,
page
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
detailList
).
setPage
(
page
).
toString
();
return
Rjx
.
jsonOk
().
set
(
"list"
,
detailList
).
setPage
(
page
).
toString
();
}
}
@ApiOperation
(
"热销商品列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"OrgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"区域编号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"CompNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"组件编号"
,
defaultValue
=
""
),
})
@RequestMapping
(
value
=
"/getHotSaleGoods"
,
method
=
RequestMethod
.
GET
)
public
String
getHotSaleGoods
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
listMap
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"OrgNO"
,
request
.
getParameter
(
"OrgNO"
));
params
.
put
(
"CompNO"
,
request
.
getParameter
(
"CompNO"
));
listMap
=
goodsService
.
getHotSaleGoods
(
params
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
toJson
();
}
}
}
src/main/java/com/egolm/shop/service/GoodsService.java
View file @
e732219a
...
@@ -8,4 +8,6 @@ import com.egolm.common.jdbc.Page;
...
@@ -8,4 +8,6 @@ import com.egolm.common.jdbc.Page;
public
interface
GoodsService
{
public
interface
GoodsService
{
public
List
<
Map
<
String
,
Object
>>
listThinkLike
(
Map
<
String
,
Object
>
params
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
listThinkLike
(
Map
<
String
,
Object
>
params
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
getHotSaleGoods
(
Map
<
String
,
Object
>
map
);
}
}
src/main/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
View file @
e732219a
package
com
.
egolm
.
shop
.
service
.
impl
;
package
com
.
egolm
.
shop
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -48,4 +49,31 @@ public class GoodsServiceImpl implements GoodsService {
...
@@ -48,4 +49,31 @@ public class GoodsServiceImpl implements GoodsService {
return
jdbcTemplate
.
limit
(
sql
,
page
);
return
jdbcTemplate
.
limit
(
sql
,
page
);
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
getHotSaleGoods
(
Map
<
String
,
Object
>
map
)
{
List
<
Map
<
String
,
Object
>>
listMap
=
new
ArrayList
<
Map
<
String
,
Object
>>();
String
sql
=
"SELECT TOP 20 "
+
"GoodsID = a.nGoodsID, "
+
"GoodsNO = g.sGoodsNO, "
+
"GoodsName = g.sGoodsDesc, "
+
"Price = acg.nSalePrice, "
+
"MinQty = acg.nMinSaleQty, "
+
"SaleUnit = acg.nSaleUnits, "
+
"MarketPrice = acg.nMarketPrice, "
+
"MarketUnit = acg.sMarketUnit, "
+
"SaleQty = sum(a.nSaleQty) "
+
"FROM tAgentGoodsDailyOnline a "
+
"JOIN tGoods g ON a.nGoodsID = g.nGoodsID "
+
"JOIN tAgentContractGoods acg ON a.sAgentContractNO = acg.sAgentContractNO "
+
"and a.nGoodsID = acg.nGoodsID "
+
"WHERE acg.sOrgNO = ? "
+
"GROUP BY a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, "
+
"acg.nSalePrice, acg.nMinSaleQty, acg.nSaleUnits, acg.nMarketPrice, acg.sMarketUnit "
+
"ORDER BY sum(a.nSaleQty) DESC "
;
String
OrgNO
=(
String
)
map
.
get
(
"OrgNO"
);
listMap
=
jdbcTemplate
.
queryForList
(
sql
,
OrgNO
);
return
listMap
;
}
}
}
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