Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cneeds-server
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
zhangzr
cneeds-server
Commits
617718e5
Commit
617718e5
authored
May 12, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.渠道号模块完成
parent
eb4daa0e
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
187 additions
and
16 deletions
+187
-16
DeviceChannelEntity.java
...java/com/mx/cneeds/server/entity/DeviceChannelEntity.java
+2
-0
DeviceInfoChannelEntity.java
.../com/mx/cneeds/server/entity/DeviceInfoChannelEntity.java
+2
-0
DeviceChannelDao.xml
...ommon-data/src/main/resources/mapper/DeviceChannelDao.xml
+15
-0
DeviceInfoChannelDao.xml
...n-data/src/main/resources/mapper/DeviceInfoChannelDao.xml
+14
-0
ChannelVo.java
...pojo/src/main/java/com/mx/cneeds/common/vo/ChannelVo.java
+31
-0
DeviceClient.java
...va/com/mx/cneeds/server/datashow/client/DeviceClient.java
+24
-4
DeviceController.java
...x/cneeds/server/datashow/web/device/DeviceController.java
+64
-0
application.yml
cneeds-server-datashow/src/main/resources/application.yml
+1
-1
DeviceChannelService.java
...mx/cneeds/server/device/service/DeviceChannelService.java
+2
-0
DeviceChannelServiceImpl.java
.../server/device/service/impl/DeviceChannelServiceImpl.java
+7
-0
DeviceChannelController.java
.../mx/cneeds/server/device/web/DeviceChannelController.java
+23
-9
application.yml
cneeds-server-device/src/main/resources/application.yml
+1
-1
application.yml
cneeds-server-logupload/src/main/resources/application.yml
+1
-1
No files found.
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceChannelEntity.java
View file @
617718e5
package
com
.
mx
.
cneeds
.
server
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -13,6 +14,7 @@ import java.util.Date;
* @Description TODO
**/
@Data
@TableName
(
"device_channel"
)
public
class
DeviceChannelEntity
implements
Serializable
{
/**
...
...
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceInfoChannelEntity.java
View file @
617718e5
package
com
.
mx
.
cneeds
.
server
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -12,6 +13,7 @@ import java.io.Serializable;
* @Description TODO
**/
@Data
@TableName
(
"device_info_channel"
)
public
class
DeviceInfoChannelEntity
implements
Serializable
{
@TableId
...
...
cneeds-common-data/src/main/resources/mapper/DeviceChannelDao.xml
0 → 100644
View file @
617718e5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mx.cneeds.server.dao.DeviceChannelDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.mx.cneeds.server.entity.DeviceChannelEntity"
id=
"deviceChannelMap"
>
<result
property=
"channelId"
column=
"channel_id"
/>
<result
property=
"channelNum"
column=
"channel_num"
/>
<result
property=
"brand"
column=
"brand"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
cneeds-common-data/src/main/resources/mapper/DeviceInfoChannelDao.xml
0 → 100644
View file @
617718e5
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mx.cneeds.server.dao.DeviceInfoChannelDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.mx.cneeds.server.entity.DeviceInfoChannelEntity"
id=
"deviceInfoChannelMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"deviceId"
column=
"device_id"
/>
<result
property=
"channelId"
column=
"channel_id"
/>
</resultMap>
</mapper>
\ No newline at end of file
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/ChannelVo.java
0 → 100644
View file @
617718e5
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @ClassName DeviceChannelEntity
* @Author zzrdark
* @Date 2020-05-09 15:28
* @Description TODO
**/
@Data
public
class
ChannelVo
implements
Serializable
{
/**
* 渠道号Id
*/
private
Long
channelId
;
/**
* 渠道号
*/
private
String
channelNum
;
/**
* 品牌
*/
private
String
brand
;
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/DeviceClient.java
View file @
617718e5
package
com
.
mx
.
cneeds
.
server
.
datashow
.
client
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.DevicesDto
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.dto.SeriesDto
;
import
com.mx.cneeds.common.dto.*
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -67,4 +64,27 @@ public interface DeviceClient {
@PostMapping
(
"/device/info/delete"
)
void
deleteDevice
(
@RequestBody
List
<
Long
>
ids
);
@PostMapping
(
"/device/devicechannel/list"
)
PageDto
deviceChannelList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
/**
* 增加一个渠道号
* @param dto
*/
@PostMapping
(
"/device/devicechannel/save"
)
void
addDeviceChannel
(
@RequestBody
DeviceChannelDto
dto
);
@PostMapping
(
"/device/devicechannel/queryDeviceChannel"
)
DeviceChannelDto
queryDeviceChannel
(
@RequestBody
String
channelNum
);
@PostMapping
(
"/device/devicechannel/update"
)
void
updateDeviceChannel
(
@RequestBody
DeviceChannelDto
dto
);
@PostMapping
(
"/device/devicechannel/delete"
)
void
deleteDeviceChannels
(
@RequestBody
List
<
Long
>
ids
);
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/DeviceController.java
View file @
617718e5
...
...
@@ -4,6 +4,7 @@ import com.mx.cneeds.common.constant.ResultCode;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.ChannelVo
;
import
com.mx.cneeds.common.vo.DeviceChannelVo
;
import
com.mx.cneeds.common.vo.DevicesVo
;
import
com.mx.cneeds.common.vo.SeriesVo
;
...
...
@@ -209,4 +210,67 @@ public class DeviceController {
}
@PostMapping
(
"/deviceChannel/list"
)
public
R
deivceChannelList
(
@RequestParam
(
required
=
false
)
Integer
page
,
@RequestParam
(
required
=
false
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
sort
){
String
orderField
=
null
;
String
order
=
null
;
if
(
page
==
null
||
page
==
0
){
page
=
new
Integer
(
1
);
}
if
(
pageSize
==
null
||
pageSize
==
0
){
pageSize
=
new
Integer
(
10
);
}
if
(
StringUtils
.
isNotEmpty
(
sort
)
&&
StringUtils
.
isNotBlank
(
sort
.
trim
())){
if
(
sort
.
contains
(
"+"
)){
order
=
new
String
(
"asc"
);
}
if
(
sort
.
contains
(
"-"
)){
order
=
new
String
(
"desc"
);
}
orderField
=
sort
.
substring
(
1
);
orderField
=
RequestParamterConverter
.
toLine
(
orderField
);
}
PageDto
pageDto
=
deviceClient
.
deviceChannelList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
@PostMapping
(
"/deviceChannel/add"
)
public
R
addDeviceChannel
(
ChannelVo
vo
){
DeviceChannelDto
dto
=
deviceClient
.
queryDeviceChannel
(
vo
.
getChannelNum
());
if
(
dto
!=
null
){
return
R
.
error
(
ResultCode
.
DATA_REPEATITION
,
"渠道号重复"
);
}
DeviceChannelDto
deviceChannelDto
=
new
DeviceChannelDto
();
BeanUtils
.
copyProperties
(
vo
,
deviceChannelDto
);
deviceClient
.
addDeviceChannel
(
deviceChannelDto
);
return
R
.
ok
();
}
@PostMapping
(
"/deviceChannel/edit"
)
public
R
editSeries
(
ChannelVo
vo
){
DeviceChannelDto
deviceChannelDto
=
new
DeviceChannelDto
();
BeanUtils
.
copyProperties
(
vo
,
deviceChannelDto
);
deviceClient
.
updateDeviceChannel
(
deviceChannelDto
);
return
R
.
ok
();
}
@PostMapping
(
"/deviceChannel/delete"
)
public
R
deleteDeviceChannel
(
@RequestParam
(
value
=
"ids"
,
required
=
false
)
List
<
Long
>
ids
){
deviceClient
.
deleteDeviceChannels
(
ids
);
return
R
.
ok
();
}
}
cneeds-server-datashow/src/main/resources/application.yml
View file @
617718e5
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-datashow
server
:
...
...
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceChannelService.java
View file @
617718e5
...
...
@@ -20,5 +20,7 @@ public interface DeviceChannelService extends IService<DeviceChannelEntity> {
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
DeviceChannelEntity
queryDeviceChannel
(
String
channelNum
);
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceChannelServiceImpl.java
View file @
617718e5
...
...
@@ -26,4 +26,11 @@ public class DeviceChannelServiceImpl extends ServiceImpl<DeviceChannelDao, Devi
return
new
PageUtils
(
page
);
}
@Override
public
DeviceChannelEntity
queryDeviceChannel
(
String
channelNum
){
DeviceChannelEntity
channelEntity
=
getOne
(
new
QueryWrapper
<
DeviceChannelEntity
>().
eq
(
"channel_num"
,
channelNum
));
return
channelEntity
;
}
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceChannelController.java
View file @
617718e5
...
...
@@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @ClassName DeviceChannelController
...
...
@@ -30,7 +27,7 @@ import java.util.Map;
**/
@RestController
@RequestMapping
(
"/devicechannel"
)
@RequestMapping
(
"
device
/devicechannel"
)
public
class
DeviceChannelController
{
@Autowired
...
...
@@ -46,11 +43,11 @@ public class DeviceChannelController {
@RequestMapping
(
"/list"
)
public
PageUtils
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
deviceChannelService
.
queryPage
(
params
);
List
<
SeriesDto
>
list
=
new
ArrayList
<
Series
Dto
>();
List
<
DeviceChannelDto
>
list
=
new
ArrayList
<
DeviceChannel
Dto
>();
for
(
Object
entity
:
page
.
getList
()){
SeriesDto
dto
=
new
Series
Dto
();
ProductSeriesEntity
seriesEntity
=
(
ProductSeries
Entity
)
entity
;
BeanUtils
.
copyProperties
(
series
Entity
,
dto
);
DeviceChannelDto
dto
=
new
DeviceChannel
Dto
();
DeviceChannelEntity
deviceChannelEntity
=
(
DeviceChannel
Entity
)
entity
;
BeanUtils
.
copyProperties
(
deviceChannel
Entity
,
dto
);
list
.
add
(
dto
);
}
return
page
;
...
...
@@ -65,6 +62,8 @@ public class DeviceChannelController {
DeviceChannelEntity
deviceChannelEntity
=
new
DeviceChannelEntity
();
BeanUtils
.
copyProperties
(
deviceChannelDto
,
deviceChannelEntity
);
deviceChannelEntity
.
setUpdateTime
(
new
Date
());
deviceChannelService
.
save
(
deviceChannelEntity
);
return
R
.
ok
();
...
...
@@ -78,6 +77,8 @@ public class DeviceChannelController {
ValidatorUtils
.
validateEntity
(
deviceChannelDto
);
DeviceChannelEntity
deviceChannelEntity
=
new
DeviceChannelEntity
();
BeanUtils
.
copyProperties
(
deviceChannelDto
,
deviceChannelEntity
);
deviceChannelEntity
.
setUpdateTime
(
new
Date
());
deviceChannelService
.
updateById
(
deviceChannelEntity
);
return
R
.
ok
();
...
...
@@ -92,4 +93,17 @@ public class DeviceChannelController {
return
R
.
ok
();
}
@RequestMapping
(
"/queryDeviceChannel"
)
public
DeviceChannelDto
queryDeviceChannel
(
String
channelNum
){
DeviceChannelEntity
deviceChannelEntity
=
deviceChannelService
.
queryDeviceChannel
(
channelNum
);
DeviceChannelDto
dto
=
new
DeviceChannelDto
();
if
(
deviceChannelEntity
==
null
)
{
return
null
;
}
BeanUtils
.
copyProperties
(
deviceChannelEntity
,
dto
);
return
dto
;
}
}
cneeds-server-device/src/main/resources/application.yml
View file @
617718e5
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-device
...
...
cneeds-server-logupload/src/main/resources/application.yml
View file @
617718e5
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-logupload
...
...
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