Commit 4804a48079711c064b5328f13d288593c9f7a2a3

Authored by xiejianpeng
1 parent ece77815

工时填报管理

src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java 0 → 100644
  1 +package com.zteits.oa.api.dto.asradaily.param;
  2 +
  3 +import com.zteits.oa.api.base.bean.BaiscDTO;
  4 +
  5 +import java.util.Date;
  6 +
  7 +public class AsraDailySaveOrUpdateReq extends BaiscDTO{
  8 + /**主键*/
  9 + private Long id;
  10 +
  11 + /**所属项目ID*/
  12 + private Long projectId;
  13 +
  14 + /**所属员工ID*/
  15 + private Long asarOpId;
  16 +
  17 + /**操作员姓名*/
  18 + private String asarOpName;
  19 +
  20 + /**年:2018*/
  21 + private Integer years;
  22 +
  23 + /**周:1-54周*/
  24 + private Integer weeks;
  25 +
  26 + /**星期:1-7*/
  27 + private Integer weeksNum;
  28 +
  29 + /**工时填写日期*/
  30 + private String dailyDate;
  31 +
  32 + /**数据状态:1有效,0无效,2:锁定*/
  33 + private Integer dataState;
  34 +
  35 + /**创建人ID*/
  36 + private String createEmpid;
  37 +
  38 + /**创建人*/
  39 + private String createEmpName;
  40 +
  41 + /**创建时间*/
  42 + private Date createDate;
  43 +
  44 + /**修改人*/
  45 + private String modfiyEmpid;
  46 +
  47 + /**修改人*/
  48 + private String modfiyEmpName;
  49 +
  50 + /**修改时间*/
  51 + private Date modfiyDate;
  52 +
  53 + /**工时内容*/
  54 + private String dailyContent;
  55 +
  56 + /**获取主键*/
  57 + public Long getId() {
  58 + return id;
  59 + }
  60 +
  61 + /**设置主键*/
  62 + public void setId(Long id) {
  63 + this.id = id;
  64 + }
  65 +
  66 + /**获取所属项目ID*/
  67 + public Long getProjectId() {
  68 + return projectId;
  69 + }
  70 +
  71 + /**设置所属项目ID*/
  72 + public void setProjectId(Long projectId) {
  73 + this.projectId = projectId;
  74 + }
  75 +
  76 + /**获取所属员工ID*/
  77 + public Long getAsarOpId() {
  78 + return asarOpId;
  79 + }
  80 +
  81 + /**设置所属员工ID*/
  82 + public void setAsarOpId(Long asarOpId) {
  83 + this.asarOpId = asarOpId;
  84 + }
  85 +
  86 + /**获取操作员姓名*/
  87 + public String getAsarOpName() {
  88 + return asarOpName;
  89 + }
  90 +
  91 + /**设置操作员姓名*/
  92 + public void setAsarOpName(String asarOpName) {
  93 + this.asarOpName = asarOpName == null ? null : asarOpName.trim();
  94 + }
  95 +
  96 + /**获取年:2018*/
  97 + public Integer getYears() {
  98 + return years;
  99 + }
  100 +
  101 + /**设置年:2018*/
  102 + public void setYears(Integer years) {
  103 + this.years = years;
  104 + }
  105 +
  106 + /**获取周:1-54周*/
  107 + public Integer getWeeks() {
  108 + return weeks;
  109 + }
  110 +
  111 + /**设置周:1-54周*/
  112 + public void setWeeks(Integer weeks) {
  113 + this.weeks = weeks;
  114 + }
  115 +
  116 + /**获取星期:1-7*/
  117 + public Integer getWeeksNum() {
  118 + return weeksNum;
  119 + }
  120 +
  121 + /**设置星期:1-7*/
  122 + public void setWeeksNum(Integer weeksNum) {
  123 + this.weeksNum = weeksNum;
  124 + }
  125 +
  126 + /**获取工时填写日期*/
  127 + public String getDailyDate() {
  128 + return dailyDate;
  129 + }
  130 +
  131 + /**设置工时填写日期*/
  132 + public void setDailyDate(String dailyDate) {
  133 + this.dailyDate = dailyDate;
  134 + }
  135 +
  136 + /**获取数据状态:1有效,0无效,2:锁定*/
  137 + public Integer getDataState() {
  138 + return dataState;
  139 + }
  140 +
  141 + /**设置数据状态:1有效,0无效,2:锁定*/
  142 + public void setDataState(Integer dataState) {
  143 + this.dataState = dataState;
  144 + }
  145 +
  146 + /**获取创建人ID*/
  147 + public String getCreateEmpid() {
  148 + return createEmpid;
  149 + }
  150 +
  151 + /**设置创建人ID*/
  152 + public void setCreateEmpid(String createEmpid) {
  153 + this.createEmpid = createEmpid == null ? null : createEmpid.trim();
  154 + }
  155 +
  156 + /**获取创建人*/
  157 + public String getCreateEmpName() {
  158 + return createEmpName;
  159 + }
  160 +
  161 + /**设置创建人*/
  162 + public void setCreateEmpName(String createEmpName) {
  163 + this.createEmpName = createEmpName == null ? null : createEmpName.trim();
  164 + }
  165 +
  166 + /**获取创建时间*/
  167 + public Date getCreateDate() {
  168 + return createDate;
  169 + }
  170 +
  171 + /**设置创建时间*/
  172 + public void setCreateDate(Date createDate) {
  173 + this.createDate = createDate;
  174 + }
  175 +
  176 + /**获取修改人*/
  177 + public String getModfiyEmpid() {
  178 + return modfiyEmpid;
  179 + }
  180 +
  181 + /**设置修改人*/
  182 + public void setModfiyEmpid(String modfiyEmpid) {
  183 + this.modfiyEmpid = modfiyEmpid == null ? null : modfiyEmpid.trim();
  184 + }
  185 +
  186 + /**获取修改人*/
  187 + public String getModfiyEmpName() {
  188 + return modfiyEmpName;
  189 + }
  190 +
  191 + /**设置修改人*/
  192 + public void setModfiyEmpName(String modfiyEmpName) {
  193 + this.modfiyEmpName = modfiyEmpName == null ? null : modfiyEmpName.trim();
  194 + }
  195 +
  196 + /**获取修改时间*/
  197 + public Date getModfiyDate() {
  198 + return modfiyDate;
  199 + }
  200 +
  201 + /**设置修改时间*/
  202 + public void setModfiyDate(Date modfiyDate) {
  203 + this.modfiyDate = modfiyDate;
  204 + }
  205 +
  206 + /**获取工时内容*/
  207 + public String getDailyContent() {
  208 + return dailyContent;
  209 + }
  210 +
  211 + /**设置工时内容*/
  212 + public void setDailyContent(String dailyContent) {
  213 + this.dailyContent = dailyContent == null ? null : dailyContent.trim();
  214 + }
  215 +}
0 216 \ No newline at end of file
... ...
src/main/java/com/zteits/oa/api/service/report/query/AsraDailyQueryService.java
... ... @@ -4,9 +4,11 @@ import com.zteits.oa.api.base.bean.BizResult;
4 4 import com.zteits.oa.api.base.bean.PageBean;
5 5 import com.zteits.oa.api.dto.asradaily.AsraDailyDTO;
6 6 import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq;
  7 +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq;
7 8 import com.zteits.oa.api.dto.asraop.AsraOpDTO;
8 9 import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq;
9 10  
  11 +import javax.servlet.http.HttpServletRequest;
10 12 import java.util.List;
11 13  
12 14 /**
... ... @@ -34,4 +36,14 @@ public interface AsraDailyQueryService {
34 36 *
35 37 */
36 38 BizResult<List<AsraDailyDTO>> queryAsraDailyList(AsraDailyQueryReq asraDailyQueryReq);
  39 +
  40 + /**
  41 + * 提交工时日报
  42 + * @param
  43 + * @return
  44 + * @Author: xiejianpeng
  45 + * @Date: 2018/8/1 17:02
  46 + *
  47 + */
  48 + BizResult<Integer> saveOrUpdateAsraDaily(AsraDailySaveOrUpdateReq request);
37 49 }
... ...
src/main/java/com/zteits/oa/report/biz/AsraDailyQueryServiceImpl.java
1 1 package com.zteits.oa.report.biz;
2 2  
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.xiaoleilu.hutool.date.DateUtil;
3 5 import com.xiaoleilu.hutool.util.CollectionUtil;
4 6 import com.zteits.oa.api.base.bean.BizResult;
5 7 import com.zteits.oa.api.dto.asradaily.AsraDailyDTO;
6 8 import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq;
  9 +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq;
7 10 import com.zteits.oa.api.service.report.query.AsraDailyQueryService;
8 11 import com.zteits.oa.report.dao.AsraDailyDao;
9 12 import com.zteits.oa.report.domain.AsraDaily;
... ... @@ -12,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
12 15 import org.springframework.stereotype.Service;
13 16  
14 17 import java.util.ArrayList;
  18 +import java.util.Date;
15 19 import java.util.List;
16 20  
17 21 /**
... ... @@ -45,4 +49,31 @@ public class AsraDailyQueryServiceImpl implements AsraDailyQueryService {
45 49 }
46 50 return new BizResult<>(asraDailyDTOs);
47 51 }
  52 +
  53 + @Override
  54 + public BizResult<Integer> saveOrUpdateAsraDaily(AsraDailySaveOrUpdateReq request) {
  55 + AsraDaily asraDaily = new AsraDaily();
  56 + BeanUtils.copyProperties(request, asraDaily);
  57 + asraDaily.setModfiyDate(new Date());
  58 + asraDaily.setModfiyEmpid(request.getAsarOpId() + "");
  59 + asraDaily.setModfiyEmpName(request.getAsarOpName() + "");
  60 + Date dailyDate = DateUtil.parseDate(request.getDailyDate());
  61 + asraDaily.setDailyDate(dailyDate);
  62 +
  63 + int num;
  64 + if (null == request.getId()) {
  65 + //新增
  66 + asraDaily.setDataState(1);
  67 + asraDaily.setCreateDate(new Date());
  68 + asraDaily.setCreateEmpid(request.getAsarOpId()+"");
  69 + asraDaily.setCreateEmpName(request.getAsarOpName() + "");
  70 + num = asraDailyDao.saveAsraDaily(asraDaily);
  71 + } else {
  72 + //更新
  73 + num = asraDailyDao.updateAsraDaily(asraDaily);
  74 +
  75 + }
  76 +
  77 + return new BizResult<>(num);
  78 + }
48 79 }
... ...
src/main/java/com/zteits/oa/report/dao/AsraDailyDao.java
... ... @@ -28,4 +28,24 @@ public interface AsraDailyDao {
28 28 *
29 29 */
30 30 List<AsraDaily> queryAsraDailyList(AsraDailyQueryReq asraDailyQueryReq);
  31 +
  32 + /**
  33 + * 保存日报信息
  34 + * @param
  35 + * @return
  36 + * @Author: xiejianpeng
  37 + * @Date: 2018/8/1 17:11
  38 + *
  39 + */
  40 + int saveAsraDaily(AsraDaily asraDaily);
  41 +
  42 + /**
  43 + * 修改日报信息
  44 + * @param
  45 + * @return
  46 + * @Author: xiejianpeng
  47 + * @Date: 2018/8/1 17:11
  48 + *
  49 + */
  50 + int updateAsraDaily(AsraDaily asraDaily);
31 51 }
... ...
src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java
... ... @@ -37,4 +37,14 @@ public class AsraDailyDaoImpl implements AsraDailyDao{
37 37 .andWeeksEqualTo(asraDailyQueryReq.getWeeks());
38 38 return asraDailyMapper.selectByExampleWithBLOBs(example);
39 39 }
  40 +
  41 + @Override
  42 + public int saveAsraDaily(AsraDaily asraDaily) {
  43 + return asraDailyMapper.insertSelective(asraDaily);
  44 + }
  45 +
  46 + @Override
  47 + public int updateAsraDaily(AsraDaily asraDaily) {
  48 + return asraDailyMapper.updateByPrimaryKeySelective(asraDaily);
  49 + }
40 50 }
... ...
src/main/java/com/zteits/oa/report/web/AsraDailyController.java
... ... @@ -9,6 +9,7 @@ import com.zteits.oa.api.base.constants.SessionEnum;
9 9 import com.zteits.oa.api.dto.asradaily.AsraDailyDTO;
10 10 import com.zteits.oa.api.dto.asradaily.AsraDailyDateChangeDTO;
11 11 import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq;
  12 +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq;
12 13 import com.zteits.oa.api.dto.asraop.AsraOpDTO;
13 14 import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq;
14 15 import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO;
... ... @@ -19,14 +20,12 @@ import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService;
19 20 import com.zteits.oa.report.domain.AsraDaily;
20 21 import com.zteits.oa.util.pagepaper.DateForObjectUtil;
21 22 import io.swagger.annotations.Api;
  23 +import io.swagger.annotations.ApiOperation;
22 24 import org.slf4j.Logger;
23 25 import org.slf4j.LoggerFactory;
24 26 import org.springframework.beans.BeanUtils;
25 27 import org.springframework.beans.factory.annotation.Autowired;
26   -import org.springframework.web.bind.annotation.RequestBody;
27   -import org.springframework.web.bind.annotation.RequestMapping;
28   -import org.springframework.web.bind.annotation.RequestMethod;
29   -import org.springframework.web.bind.annotation.RestController;
  28 +import org.springframework.web.bind.annotation.*;
30 29  
31 30 import javax.servlet.http.HttpServletRequest;
32 31 import javax.servlet.http.HttpSession;
... ... @@ -62,4 +61,23 @@ public class AsraDailyController {
62 61 return result;
63 62 }
64 63  
  64 + @ApiOperation("保存或者修改工时日报")
  65 + @PostMapping("/saveOrUpdateAsraDaily")
  66 + public BizResult<Integer> saveOrUpdateAsraDaily(@RequestBody AsraDailySaveOrUpdateReq asraDailySaveOrUpdateReq,HttpServletRequest request) {
  67 + logger.info("日报系统-日报管理-根据登录人提交日报信息入参:{}", JSONObject.toJSON(asraDailySaveOrUpdateReq));
  68 + /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/
  69 + AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key());
  70 +
  71 + /**2.判断登录人和时间查询日报*/
  72 + Date dailyDate = DateUtil.parseDate(asraDailySaveOrUpdateReq.getDailyDate());
  73 + AsraDailyDateChangeDTO asraDailyDateChangeDTO = DateForObjectUtil.getAsraDailyDTO(dailyDate);
  74 + asraDailySaveOrUpdateReq.setAsarOpId(asraOpDTO.getId());
  75 + asraDailySaveOrUpdateReq.setAsarOpName(asraOpDTO.getOpName());
  76 + asraDailySaveOrUpdateReq.setDataState(1);
  77 + BeanUtils.copyProperties(asraDailyDateChangeDTO,asraDailySaveOrUpdateReq);
  78 +
  79 + BizResult<Integer> bizResult = asraDailyQueryService.saveOrUpdateAsraDaily(asraDailySaveOrUpdateReq);
  80 + return bizResult;
  81 + }
  82 +
65 83 }
... ...
src/main/java/com/zteits/oa/util/pagepaper/DateForObjectUtil.java
... ... @@ -24,7 +24,7 @@ public class DateForObjectUtil {
24 24 AsraDailyDateChangeDTO asraDailyDTO = new AsraDailyDateChangeDTO();
25 25 Integer week = DateUtil.weekOfYear(dailyDate);//第N周
26 26 Integer year = DateUtil.year(dailyDate);//年
27   - Integer weekNum = DateUtil.dayOfWeek(dailyDate);//星期
  27 + Integer weekNum = DateUtil.dayOfWeek(DateUtil.offsetDay(dailyDate,-1));//星期
28 28  
29 29 asraDailyDTO.setYears(year);
30 30 asraDailyDTO.setWeeks(week);
... ...