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
1c48a7a3
Commit
1c48a7a3
authored
Apr 24, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
承运商接口:查询所有承运商列表
parent
3d6a4c38
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
0 deletions
+134
-0
CarrierAccountController.java
...r/module/carrier/controller/CarrierAccountController.java
+32
-0
CarrierAccountDao.java
...reight/customer/module/carrier/dao/CarrierAccountDao.java
+9
-0
CarrierAccountService.java
...ustomer/module/carrier/service/CarrierAccountService.java
+11
-0
CarrierAccountServiceImpl.java
...odule/carrier/service/impl/CarrierAccountServiceImpl.java
+5
-0
CarrierInfoBriefVO.java
...reight/customer/module/carrier/vo/CarrierInfoBriefVO.java
+44
-0
CarrierAccountDao.xml
src/main/resources/mapper/carrier/CarrierAccountDao.xml
+9
-0
CarrierAccountControllerTest.java
...dule/carrier/controller/CarrierAccountControllerTest.java
+24
-0
No files found.
src/main/java/com/esv/freight/customer/module/carrier/controller/CarrierAccountController.java
View file @
1c48a7a3
...
...
@@ -12,6 +12,7 @@ import com.esv.freight.customer.module.carrier.dto.CarrierInfoDto;
import
com.esv.freight.customer.module.carrier.form.CarrierInfoForm
;
import
com.esv.freight.customer.module.carrier.form.CarrierQueryForm
;
import
com.esv.freight.customer.module.carrier.service.CarrierAccountService
;
import
com.esv.freight.customer.module.carrier.vo.CarrierInfoBriefVO
;
import
com.esv.freight.customer.module.carrier.vo.CarrierInfoDetailVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -21,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @description: 承运商帐号Controller
* @project: freight-customer-service
...
...
@@ -106,4 +110,32 @@ public class CarrierAccountController {
return
EResponse
.
ok
(
vo
);
}
/**
* description 查询所有承运商列表
* param []
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/24 17:44
**/
@PostMapping
(
"/all"
)
public
EResponse
all
()
throws
EException
{
// 查询
List
<
CarrierInfoDto
>
dtoList
=
carrierAccountService
.
getAllCarrierBrief
();
// 数据转换
List
<
CarrierInfoBriefVO
>
voList
=
new
ArrayList
<>();
dtoList
.
forEach
(
dto
->
{
CarrierInfoBriefVO
vo
=
new
CarrierInfoBriefVO
();
BeanUtils
.
copyProperties
(
dto
,
vo
);
if
(
CarrierConstants
.
CARRIER_TYPE_COMPANY
.
equals
(
dto
.
getCarrierType
()))
{
vo
.
setCarrierName
(
dto
.
getCarrierFullName
());
}
else
{
vo
.
setCarrierName
(
dto
.
getContactor
());
}
voList
.
add
(
vo
);
});
return
EResponse
.
ok
(
voList
);
}
}
src/main/java/com/esv/freight/customer/module/carrier/dao/CarrierAccountDao.java
View file @
1c48a7a3
...
...
@@ -36,4 +36,13 @@ public interface CarrierAccountDao extends BaseMapper<CarrierAccountEntity> {
**/
CarrierInfoDto
selectCarrierDetail
(
CarrierQueryForm
queryObj
);
/**
* description 查询所有帐号简要信息
* param []
* return java.util.List<com.esv.freight.customer.module.carrier.dto.CarrierInfoDto>
* author Administrator
* createTime 2020/04/24 17:36
**/
List
<
CarrierInfoDto
>
selectAllCarrierBrief
();
}
src/main/java/com/esv/freight/customer/module/carrier/service/CarrierAccountService.java
View file @
1c48a7a3
...
...
@@ -6,6 +6,8 @@ import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import
com.esv.freight.customer.module.carrier.form.CarrierInfoForm
;
import
com.esv.freight.customer.module.carrier.form.CarrierQueryForm
;
import
java.util.List
;
/**
* 承运商帐号表
*
...
...
@@ -51,5 +53,14 @@ public interface CarrierAccountService extends IService<CarrierAccountEntity> {
**/
CarrierInfoDto
getCarrierDetail
(
CarrierQueryForm
form
);
/**
* description 查询所有帐号简要信息
* param []
* return java.util.List<com.esv.freight.customer.module.carrier.dto.CarrierInfoDto>
* author Administrator
* createTime 2020/04/24 17:37
**/
List
<
CarrierInfoDto
>
getAllCarrierBrief
();
}
src/main/java/com/esv/freight/customer/module/carrier/service/impl/CarrierAccountServiceImpl.java
View file @
1c48a7a3
...
...
@@ -186,4 +186,9 @@ public class CarrierAccountServiceImpl extends ServiceImpl<CarrierAccountDao, Ca
return
this
.
baseMapper
.
selectCarrierDetail
(
form
);
}
@Override
public
List
<
CarrierInfoDto
>
getAllCarrierBrief
()
{
return
this
.
baseMapper
.
selectAllCarrierBrief
();
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/carrier/vo/CarrierInfoBriefVO.java
0 → 100644
View file @
1c48a7a3
package
com
.
esv
.
freight
.
customer
.
module
.
carrier
.
vo
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* @description: 承运商简要信息VO
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.vo.CarrierInfoBriefVO
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/24 16:58
* @version:1.0
*/
@Data
public
class
CarrierInfoBriefVO
{
/**
*
*/
private
Long
id
;
/**
* 登录帐号,承运商联系人电话
*/
private
String
account
;
/**
* 帐号状态:1-正常、2-停用
*/
private
String
accountStatus
;
/**
* 客户编码
*/
private
String
carrierNumber
;
/**
* 承运商名称
*/
private
String
carrierName
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/resources/mapper/carrier/CarrierAccountDao.xml
View file @
1c48a7a3
...
...
@@ -73,5 +73,14 @@
</if>
</select>
<!-- 查询所有帐号简要信息 -->
<select
id=
"selectAllCarrierBrief"
resultType=
"com.esv.freight.customer.module.carrier.dto.CarrierInfoDto"
>
select a.id, a.account, a.account_status,
b.carrier_number, b.carrier_full_name, b.carrier_type, b.contactor
from carrier_account a, carrier_info b
where a.id = b.account_id
ORDER BY b.carrier_type ASC, b.carrier_full_name ASC, b.contactor ASC
</select>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/carrier/controller/CarrierAccountControllerTest.java
View file @
1c48a7a3
...
...
@@ -636,4 +636,28 @@ public class CarrierAccountControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1001
,
result
.
getIntValue
(
"code"
));
}
/**
* 查询所有承运商列表
**/
@Test
@Rollback
public
void
d1_detail_success_test
()
throws
Exception
{
String
url
=
"/carrier/account/all"
;
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
new
JSONObject
().
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
.
assertFalse
(
result
.
getJSONArray
(
"data"
).
isEmpty
());
}
}
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