Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
customer-service
Commits
2943bdf5
Commit
2943bdf5
authored
Apr 22, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增货主接口:删除常跑路线
parent
5c1cc31a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
0 deletions
+66
-0
RegularlyRouteController.java
...odule/goodsowner/controller/RegularlyRouteController.java
+17
-0
RegularlyRouteService.java
...omer/module/goodsowner/service/RegularlyRouteService.java
+10
-0
RegularlyRouteServiceImpl.java
...le/goodsowner/service/impl/RegularlyRouteServiceImpl.java
+9
-0
RegularlyRouteControllerTest.java
...e/goodsowner/controller/RegularlyRouteControllerTest.java
+30
-0
No files found.
src/main/java/com/esv/freight/customer/module/goodsowner/controller/RegularlyRouteController.java
View file @
2943bdf5
...
@@ -3,8 +3,10 @@ package com.esv.freight.customer.module.goodsowner.controller;
...
@@ -3,8 +3,10 @@ package com.esv.freight.customer.module.goodsowner.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.validator.groups.ValidatorDelete
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.common.validator.groups.ValidatorUpdate
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.service.RegularlyRouteService
;
import
com.esv.freight.customer.module.goodsowner.service.RegularlyRouteService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -66,4 +68,19 @@ public class RegularlyRouteController {
...
@@ -66,4 +68,19 @@ public class RegularlyRouteController {
return
EResponse
.
ok
();
return
EResponse
.
ok
();
}
}
/**
* description 删除常跑路线
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/22 14:58
**/
@PostMapping
(
"/delete"
)
public
EResponse
delete
(
@RequestBody
@Validated
(
ValidatorDelete
.
class
)
DeleteAddressForm
form
)
throws
EException
{
int
count
=
regularlyRouteService
.
delete
(
form
);
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"count"
,
count
);
return
EResponse
.
ok
(
data
);
}
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/RegularlyRouteService.java
View file @
2943bdf5
...
@@ -2,6 +2,7 @@ package com.esv.freight.customer.module.goodsowner.service;
...
@@ -2,6 +2,7 @@ package com.esv.freight.customer.module.goodsowner.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
java.util.List
;
import
java.util.List
;
...
@@ -42,5 +43,14 @@ public interface RegularlyRouteService extends IService<RegularlyRouteEntity> {
...
@@ -42,5 +43,14 @@ public interface RegularlyRouteService extends IService<RegularlyRouteEntity> {
**/
**/
Integer
edit
(
RegularlyRouteForm
form
);
Integer
edit
(
RegularlyRouteForm
form
);
/**
* description 删除常跑路线
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/04/22 14:57
**/
Integer
delete
(
DeleteAddressForm
form
);
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/RegularlyRouteServiceImpl.java
View file @
2943bdf5
...
@@ -9,6 +9,7 @@ import com.esv.freight.customer.common.util.FeignUtils;
...
@@ -9,6 +9,7 @@ import com.esv.freight.customer.common.util.FeignUtils;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.module.goodsowner.dao.RegularlyRouteDao
;
import
com.esv.freight.customer.module.goodsowner.dao.RegularlyRouteDao
;
import
com.esv.freight.customer.module.goodsowner.entity.*
;
import
com.esv.freight.customer.module.goodsowner.entity.*
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.service.AccountService
;
import
com.esv.freight.customer.module.goodsowner.service.AccountService
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
...
@@ -138,6 +140,13 @@ public class RegularlyRouteServiceImpl extends ServiceImpl<RegularlyRouteDao, Re
...
@@ -138,6 +140,13 @@ public class RegularlyRouteServiceImpl extends ServiceImpl<RegularlyRouteDao, Re
return
count
;
return
count
;
}
}
@Override
public
Integer
delete
(
DeleteAddressForm
form
)
{
String
[]
ids
=
form
.
getId
().
split
(
","
);
int
count
=
this
.
baseMapper
.
deleteBatchIds
(
Arrays
.
asList
(
ids
));
return
count
;
}
@Override
@Override
public
List
<
RegularlyRouteEntity
>
getOwnerRouteByName
(
RegularlyRouteForm
form
)
{
public
List
<
RegularlyRouteEntity
>
getOwnerRouteByName
(
RegularlyRouteForm
form
)
{
QueryWrapper
<
RegularlyRouteEntity
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
RegularlyRouteEntity
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
src/test/java/com/esv/freight/customer/module/goodsowner/controller/RegularlyRouteControllerTest.java
View file @
2943bdf5
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.goodsowner.controller;
...
@@ -3,6 +3,7 @@ package com.esv.freight.customer.module.goodsowner.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.BaseTestController
;
import
com.esv.freight.customer.BaseTestController
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.module.goodsowner.form.DeleteAddressForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
com.esv.freight.customer.module.goodsowner.form.RegularlyRouteForm
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.Assert
;
...
@@ -383,4 +384,33 @@ public class RegularlyRouteControllerTest extends BaseTestController {
...
@@ -383,4 +384,33 @@ public class RegularlyRouteControllerTest extends BaseTestController {
Assert
.
assertEquals
(
1005
,
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
1005
,
result
.
getIntValue
(
"code"
));
}
}
/**
* 删除常跑路线
**/
@Test
@Rollback
public
void
c1_delete_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/regularly/route/delete"
;
// 构造数据
DeleteAddressForm
form
=
new
DeleteAddressForm
();
form
.
setId
(
"1,2,3,4,5,6,7"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSONString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertTrue
(
result
.
getJSONObject
(
"data"
).
containsKey
(
"count"
));
}
}
}
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