Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into frx
This commit is contained in:
commit
9f08be6663
@ -68,11 +68,13 @@ public class HandlingGroupUserAmountController {
|
||||
@GetMapping("/getListByMonth")
|
||||
@Operation(summary = "获得搬运组工资记录 按月搜索")
|
||||
@Parameter(name = "time", description = "日期 格式(yyyy-MM) 默认当前月", required = true, example = "1024")
|
||||
@Parameter(name = "type", description = "类型 1按本月初到本月底 2按上月26号到本月25号 默认1", required = true, example = "1024")
|
||||
public CommonResult<HandlingGroupUserAmountMonthVO> getListByMonth(@RequestParam(value = "id", required = false) Long id,
|
||||
@RequestParam(value = "type", defaultValue = "1") Integer type,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "time", required = true) String time,
|
||||
@RequestParam(value = "time") String time,
|
||||
@RequestParam(value = "factoryId", required = false) Long factoryId) {
|
||||
HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(id, factoryId, time, name);
|
||||
HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(id, factoryId, type, time, name);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
|
@ -78,5 +78,5 @@ public interface HandlingGroupUserAmountService {
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, String time, String name);
|
||||
HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, String time, String name);
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
||||
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
|
||||
private static final String NAME = "姓名";
|
||||
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
|
||||
public Long createHandlingGroupUserAmount(HandlingGroupUserAmountSaveReqVO createReqVO) {
|
||||
@ -88,14 +92,21 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, String time, String name) {
|
||||
public HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, String time, String name) {
|
||||
HandlingGroupUserAmountMonthVO vo = new HandlingGroupUserAmountMonthVO();
|
||||
Map<Integer, String> headers = new HashMap<>();
|
||||
// -- 根据yyyy-MM获取到该月第一天时间 - 再获取到最后一天 - 完了后组装表头
|
||||
String[] times = time.split("-");
|
||||
List<String> dateList;
|
||||
if (type == 1) {
|
||||
LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 1, 0, 0, 0);
|
||||
LocalDateTime endTime = startTime.plusMonths(1).minusDays(1);
|
||||
List<String> dateList = DateUtils.betweenDayList(startTime, endTime);
|
||||
dateList = DateUtils.betweenDayList(startTime, endTime);
|
||||
} else {
|
||||
LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 26, 0, 0, 0).minusMonths(1);
|
||||
LocalDateTime endTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 25, 0, 0, 0);
|
||||
dateList = DateUtils.betweenDayList(startTime, endTime);
|
||||
}
|
||||
headers.put(1, NAME);
|
||||
int num = 1;
|
||||
for (String date : dateList) {
|
||||
@ -105,20 +116,19 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
||||
headers.put(num + 1, TOTAL_AMOUNT);
|
||||
// - 插入表头
|
||||
vo.setHeaders(headers);
|
||||
|
||||
List<Map<String, Object>> map = handlingGroupUserAmountMapper.getListByMonth(id, factoryId, dateList, name);
|
||||
List<HandlingGroupUserAmountMonthItemVO> list = new ArrayList<>();
|
||||
for (Map<String, Object> item : map) {
|
||||
HandlingGroupUserAmountMonthItemVO itemVO = new HandlingGroupUserAmountMonthItemVO();
|
||||
itemVO.setUserId((Long) item.get("userId"));
|
||||
itemVO.setUserId((Long) item.get(USER_ID));
|
||||
Map<Integer, String> itemMap = new HashMap<>();
|
||||
itemMap.put(1, item.get("nickName").toString());
|
||||
itemMap.put(1, item.get(NICK_NAME).toString());
|
||||
num = 1;
|
||||
for (String date : dateList) {
|
||||
num++;
|
||||
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);
|
||||
list.add(itemVO);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@
|
||||
and b.id = #{id}
|
||||
</if>
|
||||
<if test="factoryId != null">
|
||||
and a.factory_id = #{factoryId}
|
||||
and b.factory_id = #{factoryId}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and b.nick_name like concat('%', #{name}, '%')
|
||||
|
Loading…
Reference in New Issue
Block a user