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
461b64dc
Commit
461b64dc
authored
May 20, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线下文本合同:货主合同-删除
parent
77b116e5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
2 deletions
+94
-2
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+3
-0
ContractOfflineGoodsOwnerController.java
...tract/controller/ContractOfflineGoodsOwnerController.java
+13
-0
ContractOfflineGoodsOwnerForm.java
...r/module/contract/form/ContractOfflineGoodsOwnerForm.java
+2
-1
ContractOfflineGoodsOwnerService.java
...le/contract/service/ContractOfflineGoodsOwnerService.java
+9
-0
ContractOfflineGoodsOwnerServiceImpl.java
...ct/service/impl/ContractOfflineGoodsOwnerServiceImpl.java
+10
-0
application-dev.yml
src/main/resources/application-dev.yml
+3
-1
ContractOfflineGoodsOwnerControllerTest.java
...t/controller/ContractOfflineGoodsOwnerControllerTest.java
+54
-0
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
461b64dc
...
...
@@ -281,4 +281,7 @@ public class ErrorMessageComponent {
private
String
contractOfflineGoodsOwnerEdit1001
;
@Value
(
"${error-message.contract.offline.goods-owner.edit.1002}"
)
private
String
contractOfflineGoodsOwnerEdit1002
;
@Value
(
"${error-message.contract.offline.goods-owner.delete.1001}"
)
private
String
contractOfflineGoodsOwnerDelete1001
;
}
src/main/java/com/esv/freight/customer/module/contract/controller/ContractOfflineGoodsOwnerController.java
View file @
461b64dc
...
...
@@ -64,4 +64,17 @@ public class ContractOfflineGoodsOwnerController {
contractOfflineGoodsOwnerService
.
editOfflineContract
(
form
);
return
EResponse
.
ok
();
}
/**
* description 删除合同
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/05/20 9:26
**/
@PostMapping
(
"/delete"
)
public
EResponse
delete
(
@RequestBody
@Validated
(
ValidatorUpdate
.
class
)
ContractOfflineGoodsOwnerForm
form
)
throws
EException
{
contractOfflineGoodsOwnerService
.
deleteOfflineContract
(
form
);
return
EResponse
.
ok
();
}
}
src/main/java/com/esv/freight/customer/module/contract/form/ContractOfflineGoodsOwnerForm.java
View file @
461b64dc
package
com
.
esv
.
freight
.
customer
.
module
.
contract
.
form
;
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.ValidatorUpdate
;
import
lombok.Data
;
...
...
@@ -26,7 +27,7 @@ public class ContractOfflineGoodsOwnerForm {
/**
*
*/
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorUpdate
.
class
})
@NotNull
(
message
=
"参数id不能为空"
,
groups
=
{
ValidatorUpdate
.
class
,
ValidatorDelete
.
class
})
private
Long
id
;
/**
* 货主帐号ID
...
...
src/main/java/com/esv/freight/customer/module/contract/service/ContractOfflineGoodsOwnerService.java
View file @
461b64dc
...
...
@@ -31,5 +31,14 @@ public interface ContractOfflineGoodsOwnerService extends IService<ContractOffli
**/
Integer
editOfflineContract
(
ContractOfflineGoodsOwnerForm
form
);
/**
* description 删除线下文本合同(货主)
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/05/20 9:24
**/
Integer
deleteOfflineContract
(
ContractOfflineGoodsOwnerForm
form
);
}
src/main/java/com/esv/freight/customer/module/contract/service/impl/ContractOfflineGoodsOwnerServiceImpl.java
View file @
461b64dc
...
...
@@ -79,4 +79,14 @@ public class ContractOfflineGoodsOwnerServiceImpl extends ServiceImpl<ContractOf
return
this
.
baseMapper
.
updateById
(
contractOfflineGoodsOwnerEntity
);
}
@Override
public
Integer
deleteOfflineContract
(
ContractOfflineGoodsOwnerForm
form
)
{
ContractOfflineGoodsOwnerEntity
dbEntity
=
this
.
baseMapper
.
selectById
(
form
.
getId
());
if
(
null
==
dbEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getContractOfflineGoodsOwnerDelete1001
());
}
return
this
.
baseMapper
.
deleteById
(
form
.
getId
());
}
}
\ No newline at end of file
src/main/resources/application-dev.yml
View file @
461b64dc
...
...
@@ -227,3 +227,5 @@ error-message:
edit
:
1001
:
无效的合同ID
1002
:
合同编号已存在
delete
:
1001
:
无效的合同ID
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/contract/controller/ContractOfflineGoodsOwnerControllerTest.java
View file @
461b64dc
...
...
@@ -244,4 +244,58 @@ public class ContractOfflineGoodsOwnerControllerTest extends BaseTestController
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1002
,
result
.
getIntValue
(
"code"
));
}
/**
* 删除合同
**/
@Test
@Rollback
public
void
c1_delete_success_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/delete"
;
// 构造数据
ContractOfflineGoodsOwnerForm
form
=
new
ContractOfflineGoodsOwnerForm
();
form
.
setId
(
1L
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
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"
));
}
/**
* 删除合同:无效的合同ID
**/
@Test
@Rollback
public
void
c2_delete_success_test
()
throws
Exception
{
String
url
=
"/contract/offline/goodsowner/delete"
;
// 构造数据
ContractOfflineGoodsOwnerForm
form
=
new
ContractOfflineGoodsOwnerForm
();
form
.
setId
(
99999L
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
}
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