|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.asrs.controller.statistics; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.TaskDetlFieldLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkIn; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkInMapper; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.TaskDetlFieldLogService; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.PageParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.ExcelUtil; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/api") | 
|---|
|  |  |  | public class ViewWorkInController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ViewWorkInMapper viewWorkInMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TaskDetlFieldLogService taskDetlFieldLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") | 
|---|
|  |  |  | @PostMapping("/viewWorkIn/page") | 
|---|
|  |  |  | public R page(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<ViewWorkIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkIn.class); | 
|---|
|  |  |  | QueryWrapper<ViewWorkIn> queryWrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | PageParam<ViewWorkIn, BaseParam> page = viewWorkInMapper.selectPage(pageParam, queryWrapper); | 
|---|
|  |  |  | List<ViewWorkIn> records = page.getRecords(); | 
|---|
|  |  |  | for (ViewWorkIn record : records) { | 
|---|
|  |  |  | List<TaskDetlFieldLog> list = taskDetlFieldLogService.list(new LambdaQueryWrapper<TaskDetlFieldLog>().eq(TaskDetlFieldLog::getDetlId, record.getId())); | 
|---|
|  |  |  | record.syncField(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") | 
|---|
|  |  |  | @PostMapping("/viewWorkIn/export") | 
|---|
|  |  |  | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | QueryWrapper<ViewWorkIn> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | ExcelUtil.build(ExcelUtil.create(viewWorkInMapper.selectList(wrapper), ViewWorkIn.class), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | package com.zy.asrs.wms.asrs.controller.statistics; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.TaskDetlFieldLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.statistics.ViewWorkIn; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.mapper.statistics.ViewWorkInMapper; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.TaskDetlFieldLogService; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.annotation.CacheData; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.PageParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.ExcelUtil; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/api") | 
|---|
|  |  |  | public class ViewWorkInController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ViewWorkInMapper viewWorkInMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TaskDetlFieldLogService taskDetlFieldLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") | 
|---|
|  |  |  | @PostMapping("/viewWorkIn/page") | 
|---|
|  |  |  | @CacheData(tableName = {"view_work_in", "man_task_log", "man_task_detl_log", "man_task_detl_field_log"}) | 
|---|
|  |  |  | public R page(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<ViewWorkIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkIn.class); | 
|---|
|  |  |  | QueryWrapper<ViewWorkIn> queryWrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | PageParam<ViewWorkIn, BaseParam> page = viewWorkInMapper.selectPage(pageParam, queryWrapper); | 
|---|
|  |  |  | List<ViewWorkIn> records = page.getRecords(); | 
|---|
|  |  |  | for (ViewWorkIn record : records) { | 
|---|
|  |  |  | List<TaskDetlFieldLog> list = taskDetlFieldLogService.list(new LambdaQueryWrapper<TaskDetlFieldLog>().eq(TaskDetlFieldLog::getDetlId, record.getId())); | 
|---|
|  |  |  | record.syncField(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:viewWorkIn:list')") | 
|---|
|  |  |  | @PostMapping("/viewWorkIn/export") | 
|---|
|  |  |  | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<ViewWorkIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkIn.class); | 
|---|
|  |  |  | QueryWrapper<ViewWorkIn> queryWrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | ExcelUtil.build(ExcelUtil.create(viewWorkInMapper.selectList(queryWrapper), ViewWorkIn.class), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|