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")
|
@GetMapping("/getListByMonth")
|
||||||
@Operation(summary = "获得搬运组工资记录 按月搜索")
|
@Operation(summary = "获得搬运组工资记录 按月搜索")
|
||||||
@Parameter(name = "time", description = "日期 格式(yyyy-MM) 默认当前月", required = true, example = "1024")
|
@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,
|
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 = "name", required = false) String name,
|
||||||
@RequestParam(value = "time", required = true) String time,
|
@RequestParam(value = "time") String time,
|
||||||
@RequestParam(value = "factoryId", required = false) Long factoryId) {
|
@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);
|
return success(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,5 +78,5 @@ public interface HandlingGroupUserAmountService {
|
|||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @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 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) {
|
||||||
@ -88,14 +92,21 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
HandlingGroupUserAmountMonthVO vo = new HandlingGroupUserAmountMonthVO();
|
||||||
Map<Integer, String> headers = new HashMap<>();
|
Map<Integer, String> headers = new HashMap<>();
|
||||||
// -- 根据yyyy-MM获取到该月第一天时间 - 再获取到最后一天 - 完了后组装表头
|
// -- 根据yyyy-MM获取到该月第一天时间 - 再获取到最后一天 - 完了后组装表头
|
||||||
String[] times = time.split("-");
|
String[] times = time.split("-");
|
||||||
LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 1, 0, 0, 0);
|
List<String> dateList;
|
||||||
LocalDateTime endTime = startTime.plusMonths(1).minusDays(1);
|
if (type == 1) {
|
||||||
List<String> dateList = DateUtils.betweenDayList(startTime, endTime);
|
LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 1, 0, 0, 0);
|
||||||
|
LocalDateTime endTime = startTime.plusMonths(1).minusDays(1);
|
||||||
|
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);
|
headers.put(1, NAME);
|
||||||
int num = 1;
|
int num = 1;
|
||||||
for (String date : dateList) {
|
for (String date : dateList) {
|
||||||
@ -105,20 +116,19 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
|
|||||||
headers.put(num + 1, TOTAL_AMOUNT);
|
headers.put(num + 1, TOTAL_AMOUNT);
|
||||||
// - 插入表头
|
// - 插入表头
|
||||||
vo.setHeaders(headers);
|
vo.setHeaders(headers);
|
||||||
|
|
||||||
List<Map<String, Object>> map = handlingGroupUserAmountMapper.getListByMonth(id, factoryId, dateList, name);
|
List<Map<String, Object>> map = handlingGroupUserAmountMapper.getListByMonth(id, factoryId, dateList, name);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
and b.id = #{id}
|
and b.id = #{id}
|
||||||
</if>
|
</if>
|
||||||
<if test="factoryId != null">
|
<if test="factoryId != null">
|
||||||
and a.factory_id = #{factoryId}
|
and b.factory_id = #{factoryId}
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
and b.nick_name like concat('%', #{name}, '%')
|
and b.nick_name like concat('%', #{name}, '%')
|
||||||
|
Loading…
Reference in New Issue
Block a user