refactor(zn-module-smartfactory): 重构 HandlingGroupUserAmountServiceImpl 类
- 提取常量:将 userId、nickName 和 totalAmount 提取为类常量 - 优化代码可读性:使用常量替换硬编码字符串
This commit is contained in:
parent
663518e00a
commit
ac246bd6c2
@ -37,6 +37,10 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
|||||||
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
|
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
|
||||||
private static final String NAME = "姓名";
|
private static final String NAME = "姓名";
|
||||||
private static final String TOTAL_AMOUNT = "总金额";
|
private static final String TOTAL_AMOUNT = "总金额";
|
||||||
|
// 提取常量
|
||||||
|
private static final String USER_ID = "userId";
|
||||||
|
private static final String NICK_NAME = "nickName";
|
||||||
|
private static final String TOTAL_AMOUNT_EN = "totalAmount";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createHandlingGroupUserAmount(HandlingGroupUserAmountSaveReqVO createReqVO) {
|
public Long createHandlingGroupUserAmount(HandlingGroupUserAmountSaveReqVO createReqVO) {
|
||||||
@ -116,15 +120,15 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
|||||||
List<HandlingGroupUserAmountMonthItemVO> list = new ArrayList<>();
|
List<HandlingGroupUserAmountMonthItemVO> list = new ArrayList<>();
|
||||||
for (Map<String, Object> item : map) {
|
for (Map<String, Object> item : map) {
|
||||||
HandlingGroupUserAmountMonthItemVO itemVO = new HandlingGroupUserAmountMonthItemVO();
|
HandlingGroupUserAmountMonthItemVO itemVO = new HandlingGroupUserAmountMonthItemVO();
|
||||||
itemVO.setUserId((Long) item.get("userId"));
|
itemVO.setUserId((Long) item.get(USER_ID));
|
||||||
Map<Integer, String> itemMap = new HashMap<>();
|
Map<Integer, String> itemMap = new HashMap<>();
|
||||||
itemMap.put(1, item.get("nickName").toString());
|
itemMap.put(1, item.get(NICK_NAME).toString());
|
||||||
num = 1;
|
num = 1;
|
||||||
for (String date : dateList) {
|
for (String date : dateList) {
|
||||||
num++;
|
num++;
|
||||||
itemMap.put(num, item.get(date).toString());
|
itemMap.put(num, item.get(date).toString());
|
||||||
}
|
}
|
||||||
itemMap.put(num + 1, item.get("totalAmount").toString());
|
itemMap.put(num + 1, item.get(TOTAL_AMOUNT_EN).toString());
|
||||||
itemVO.setContentList(itemMap);
|
itemVO.setContentList(itemMap);
|
||||||
list.add(itemVO);
|
list.add(itemVO);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user