Blame view

src/main/java/com/zteits/oa/report/web/AsraDailyController.java 6.07 KB
7deb21f3   xiejianpeng   员工管理
1
2
3
4
5
6
7
  package com.zteits.oa.report.web;
  
  import com.alibaba.fastjson.JSONObject;
  import com.xiaoleilu.hutool.date.DateUtil;
  import com.xiaoleilu.hutool.util.CollectionUtil;
  import com.zteits.oa.api.base.bean.BizResult;
  import com.zteits.oa.api.base.bean.PageBean;
237a75b5   王富生   提交
8
  import com.zteits.oa.api.base.constants.ErrorType;
7deb21f3   xiejianpeng   员工管理
9
  import com.zteits.oa.api.base.constants.SessionEnum;
237a75b5   王富生   提交
10
  import com.zteits.oa.api.base.exception.BizException;
7deb21f3   xiejianpeng   员工管理
11
  import com.zteits.oa.api.dto.asradaily.AsraDailyDTO;
237a75b5   王富生   提交
12
13
14
  import com.zteits.oa.api.dto.asradaily.AsraDailyOpNumForCurrentDayDTO;
  import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllForListReqDTO;
  import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq;
ece77815   xiejianpeng   工时填报管理
15
  import com.zteits.oa.api.dto.asradaily.AsraDailyDateChangeDTO;
7deb21f3   xiejianpeng   员工管理
16
  import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq;
4804a480   xiejianpeng   工时填报管理
17
  import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq;
7deb21f3   xiejianpeng   员工管理
18
  import com.zteits.oa.api.dto.asraop.AsraOpDTO;
7deb21f3   xiejianpeng   员工管理
19
  import com.zteits.oa.api.service.report.query.AsraDailyQueryService;
b1704d7c   王富生   提交
20
  import com.zteits.oa.report.domain.AsraDaily;
ece77815   xiejianpeng   工时填报管理
21
  import com.zteits.oa.util.pagepaper.DateForObjectUtil;
7deb21f3   xiejianpeng   员工管理
22
  import io.swagger.annotations.Api;
237a75b5   王富生   提交
23
  import io.swagger.annotations.ApiOperation;
7deb21f3   xiejianpeng   员工管理
24
25
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
ece77815   xiejianpeng   工时填报管理
26
  import org.springframework.beans.BeanUtils;
7deb21f3   xiejianpeng   员工管理
27
  import org.springframework.beans.factory.annotation.Autowired;
4804a480   xiejianpeng   工时填报管理
28
  import org.springframework.web.bind.annotation.*;
7deb21f3   xiejianpeng   员工管理
29
30
  
  import javax.servlet.http.HttpServletRequest;
7deb21f3   xiejianpeng   员工管理
31
32
33
34
35
36
37
38
39
40
41
  import java.util.Date;
  import java.util.List;
  
  @Api(value = "日报系统-日报管理", description = "日报系统-日报管理")
  @RestController
  @RequestMapping("/asraDaily")
  public class AsraDailyController {
  
  	private static final Logger logger = LoggerFactory.getLogger(AsraDailyController.class);
  
  	@Autowired
7deb21f3   xiejianpeng   员工管理
42
43
44
45
46
  	private AsraDailyQueryService asraDailyQueryService;
  
  
  	@RequestMapping(value="/queryAsraDailyList",method = RequestMethod.POST)
  	public BizResult<List<AsraDailyDTO>> queryAsraDailyList(@RequestBody AsraDailyQueryReq asraDailyQueryReq, HttpServletRequest request){
ece77815   xiejianpeng   工时填报管理
47
  		logger.info("日报系统-日报管理-根据登录人查询日报信息入参:{}", JSONObject.toJSON(asraDailyQueryReq));
7deb21f3   xiejianpeng   员工管理
48
49
50
51
  		/**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/
  		AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key());
  
  		/**2.判断登录人和时间查询日报*/
ece77815   xiejianpeng   工时填报管理
52
53
  		Date dailyDate = DateUtil.parseDate(asraDailyQueryReq.getDailyDate());
  		AsraDailyDateChangeDTO asraDailyDateChangeDTO = DateForObjectUtil.getAsraDailyDTO(dailyDate);
7deb21f3   xiejianpeng   员工管理
54
  		asraDailyQueryReq.setAsarOpId(asraOpDTO.getId());
ece77815   xiejianpeng   工时填报管理
55
56
  		BeanUtils.copyProperties(asraDailyDateChangeDTO,asraDailyQueryReq);
  		logger.info("日报系统-日报管理-根据登录人查询日报信息入参:{}", JSONObject.toJSON(asraDailyDateChangeDTO));
7deb21f3   xiejianpeng   员工管理
57
  		BizResult<List<AsraDailyDTO>> result = asraDailyQueryService.queryAsraDailyList(asraDailyQueryReq);
ece77815   xiejianpeng   工时填报管理
58
  		logger.info("日报系统-日报管理-根据登录人查询日报信息结束");
7deb21f3   xiejianpeng   员工管理
59
60
  		return result;
  	}
237a75b5   王富生   提交
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  	
  	/**
  	 * 工时查询-当天提交及未提交人数汇总.<br/>
  	 * @param request
  	 * @return
  	 * 201881  wangfs.<br/>
  	 */
  	@RequestMapping("/queryAsraDailyOpNumForCurrentDay")
  	@ApiOperation("工时查询-当天填报人数统计(汇总)")
  	public BizResult<AsraDailyOpNumForCurrentDayDTO> queryAsraDailyOpNumForCurrentDay(@RequestBody AsraDailyForTotalNumAndDetailReq request,HttpServletRequest  servletRequest){
  		logger.info("--begin工时查询-当天填报人数统计(汇总),入参={}",JSONObject.toJSON(request));
  		AsraOpDTO asraOpDTO = (AsraOpDTO)servletRequest.getSession().getAttribute(SessionEnum.USER_INFO.key());
  		if(asraOpDTO == null ){
  			throw new BizException(ErrorType.PARAMM_NULL,"获取session为空");
  		}
b1704d7c   王富生   提交
76
  		request.setOpIds(asraOpDTO.getOpIds());
237a75b5   王富生   提交
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  		BizResult<AsraDailyOpNumForCurrentDayDTO> result = asraDailyQueryService.queryAsraDailyOpNumForCurrentDay(request);
  		logger.info("--end工时查询-当天填报人数统计(汇总),结果={}",JSONObject.toJSON(result));
  		return result;
  	}
  	
  	
  	/**
  	 * 工时查询-所有员工及自己或者自己日报.<br/>
  	 * @param request
  	 * @return
  	 * 201881  wangfs.<br/>
  	 */
  	@RequestMapping("/queryAsraDailyAllForList")
  	@ApiOperation("工时查询-所有员工及自己或者自己日报")
  	public BizResult<QueryAsraDailyAllForListReqDTO> queryAsraDailyAllForList(@RequestBody AsraDailyForTotalNumAndDetailReq request,HttpServletRequest  servletRequest){
  		logger.info("--begin工时查询-所有员工及自己或者自己日报,入参={}",JSONObject.toJSON(request));
  		AsraOpDTO asraOpDTO = (AsraOpDTO)servletRequest.getSession().getAttribute(SessionEnum.USER_INFO.key());
  		if(asraOpDTO == null ){
  			throw new BizException(ErrorType.PARAMM_NULL,"获取session为空");
  		}
b1704d7c   王富生   提交
97
  		request.setOpIds(asraOpDTO.getOpIds());
237a75b5   王富生   提交
98
99
100
101
102
  		BizResult<QueryAsraDailyAllForListReqDTO> result = asraDailyQueryService.queryAsraDailyAllForList(request);
  		logger.info("--end工时查询-所有员工及自己或者自己日报,结果={}",JSONObject.toJSON(result));
  		return result;
  	}
  
7deb21f3   xiejianpeng   员工管理
103
  
4804a480   xiejianpeng   工时填报管理
104
105
  	@ApiOperation("保存或者修改工时日报")
  	@PostMapping("/saveOrUpdateAsraDaily")
101bbdd6   xiejianpeng   日报提交
106
  	public BizResult<Long> saveOrUpdateAsraDaily(@RequestBody AsraDailySaveOrUpdateReq asraDailySaveOrUpdateReq,HttpServletRequest request) {
4804a480   xiejianpeng   工时填报管理
107
108
109
110
111
112
113
114
115
116
117
118
  		logger.info("日报系统-日报管理-根据登录人提交日报信息入参:{}", JSONObject.toJSON(asraDailySaveOrUpdateReq));
  		/**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/
  		AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key());
  
  		/**2.判断登录人和时间查询日报*/
  		Date dailyDate = DateUtil.parseDate(asraDailySaveOrUpdateReq.getDailyDate());
  		AsraDailyDateChangeDTO asraDailyDateChangeDTO = DateForObjectUtil.getAsraDailyDTO(dailyDate);
  		asraDailySaveOrUpdateReq.setAsarOpId(asraOpDTO.getId());
  		asraDailySaveOrUpdateReq.setAsarOpName(asraOpDTO.getOpName());
  		asraDailySaveOrUpdateReq.setDataState(1);
  		BeanUtils.copyProperties(asraDailyDateChangeDTO,asraDailySaveOrUpdateReq);
  
101bbdd6   xiejianpeng   日报提交
119
  		BizResult<Long> bizResult = asraDailyQueryService.saveOrUpdateAsraDaily(asraDailySaveOrUpdateReq);
4804a480   xiejianpeng   工时填报管理
120
121
122
  		return bizResult;
  	}
  
7deb21f3   xiejianpeng   员工管理
123
  }