Commit 7260d2ebac394d0cccd1d276b581bf67bf6d637a
Merge branch 'branch0730' of
http://192.168.1.195:9998/ZTEITS-Developers/zteits-oa.git into branch0730 Conflicts: src/main/java/com/zteits/oa/api/service/report/query/AsraDailyQueryService.java src/main/java/com/zteits/oa/report/biz/AsraDailyQueryServiceImpl.java src/main/java/com/zteits/oa/report/dao/AsraDailyDao.java src/main/java/com/zteits/oa/report/web/AsraDailyController.java
Showing
12 changed files
with
745 additions
and
62 deletions
src/main/java/com/zteits/oa/api/dto/asradaily/AsraDailyDateChangeDTO.java
0 → 100644
| 1 | +package com.zteits.oa.api.dto.asradaily; | ||
| 2 | + | ||
| 3 | +import com.zteits.oa.api.base.bean.BaiscDTO; | ||
| 4 | + | ||
| 5 | +import java.util.Date; | ||
| 6 | + | ||
| 7 | +public class AsraDailyDateChangeDTO extends BaiscDTO{ | ||
| 8 | + | ||
| 9 | + /**年:2018*/ | ||
| 10 | + private Integer years; | ||
| 11 | + | ||
| 12 | + /**周:1-54周*/ | ||
| 13 | + private Integer weeks; | ||
| 14 | + | ||
| 15 | + /**星期:1-7*/ | ||
| 16 | + private Integer weeksNum; | ||
| 17 | + | ||
| 18 | + public Integer getYears() { | ||
| 19 | + return years; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setYears(Integer years) { | ||
| 23 | + this.years = years; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public Integer getWeeks() { | ||
| 27 | + return weeks; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setWeeks(Integer weeks) { | ||
| 31 | + this.weeks = weeks; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public Integer getWeeksNum() { | ||
| 35 | + return weeksNum; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setWeeksNum(Integer weeksNum) { | ||
| 39 | + this.weeksNum = weeksNum; | ||
| 40 | + } | ||
| 41 | +} | ||
| 0 | \ No newline at end of file | 42 | \ No newline at end of file |
src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyQueryReq.java
| 1 | package com.zteits.oa.api.dto.asradaily.param; | 1 | package com.zteits.oa.api.dto.asradaily.param; |
| 2 | 2 | ||
| 3 | +import com.sun.istack.internal.NotNull; | ||
| 3 | import com.zteits.oa.api.base.bean.BaseRequest; | 4 | import com.zteits.oa.api.base.bean.BaseRequest; |
| 4 | 5 | ||
| 5 | import java.util.Date; | 6 | import java.util.Date; |
| 6 | 7 | ||
| 7 | public class AsraDailyQueryReq extends BaseRequest{ | 8 | public class AsraDailyQueryReq extends BaseRequest{ |
| 8 | 9 | ||
| 10 | + /**工时填写日期*/ | ||
| 11 | + @NotNull | ||
| 12 | + private String dailyDate; | ||
| 9 | 13 | ||
| 10 | /**所属员工ID*/ | 14 | /**所属员工ID*/ |
| 11 | private Long asarOpId; | 15 | private Long asarOpId; |
| 12 | 16 | ||
| 13 | - /**工时填写日期*/ | ||
| 14 | - private Date dailyDate; | ||
| 15 | 17 | ||
| 16 | /**年:2018*/ | 18 | /**年:2018*/ |
| 17 | private Integer years; | 19 | private Integer years; |
| @@ -27,11 +29,11 @@ public class AsraDailyQueryReq extends BaseRequest{ | @@ -27,11 +29,11 @@ public class AsraDailyQueryReq extends BaseRequest{ | ||
| 27 | this.asarOpId = asarOpId; | 29 | this.asarOpId = asarOpId; |
| 28 | } | 30 | } |
| 29 | 31 | ||
| 30 | - public Date getDailyDate() { | 32 | + public String getDailyDate() { |
| 31 | return dailyDate; | 33 | return dailyDate; |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | - public void setDailyDate(Date dailyDate) { | 36 | + public void setDailyDate(String dailyDate) { |
| 35 | this.dailyDate = dailyDate; | 37 | this.dailyDate = dailyDate; |
| 36 | } | 38 | } |
| 37 | 39 |
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 | \ No newline at end of file | 216 | \ No newline at end of file |
src/main/java/com/zteits/oa/api/service/report/query/AsraDailyQueryService.java
| 1 | package com.zteits.oa.api.service.report.query; | 1 | package com.zteits.oa.api.service.report.query; |
| 2 | 2 | ||
| 3 | +import com.zteits.oa.api.base.bean.BizResult; | ||
| 4 | +import com.zteits.oa.api.base.bean.PageBean; | ||
| 5 | +import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; | ||
| 6 | +import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; | ||
| 7 | +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq; | ||
| 8 | +import com.zteits.oa.api.dto.asraop.AsraOpDTO; | ||
| 9 | +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; | ||
| 10 | + | ||
| 11 | +import javax.servlet.http.HttpServletRequest; | ||
| 3 | import java.util.List; | 12 | import java.util.List; |
| 4 | 13 | ||
| 5 | import com.zteits.oa.api.base.bean.BizResult; | 14 | import com.zteits.oa.api.base.bean.BizResult; |
| @@ -49,6 +58,14 @@ public interface AsraDailyQueryService { | @@ -49,6 +58,14 @@ public interface AsraDailyQueryService { | ||
| 49 | * 2018年8月1日 wangfs.<br/> | 58 | * 2018年8月1日 wangfs.<br/> |
| 50 | */ | 59 | */ |
| 51 | BizResult<QueryAsraDailyAllForListReqDTO> queryAsraDailyAllForList(AsraDailyForTotalNumAndDetailReq request); | 60 | BizResult<QueryAsraDailyAllForListReqDTO> queryAsraDailyAllForList(AsraDailyForTotalNumAndDetailReq request); |
| 52 | - | ||
| 53 | - | 61 | + |
| 62 | + /** | ||
| 63 | + * 提交工时日报 | ||
| 64 | + * @param | ||
| 65 | + * @return | ||
| 66 | + * @Author: xiejianpeng | ||
| 67 | + * @Date: 2018/8/1 17:02 | ||
| 68 | + * | ||
| 69 | + */ | ||
| 70 | + BizResult<Integer> saveOrUpdateAsraDaily(AsraDailySaveOrUpdateReq request); | ||
| 54 | } | 71 | } |
src/main/java/com/zteits/oa/report/biz/AsraDailyQueryServiceImpl.java
| @@ -4,25 +4,28 @@ import java.util.ArrayList; | @@ -4,25 +4,28 @@ import java.util.ArrayList; | ||
| 4 | import java.util.Iterator; | 4 | import java.util.Iterator; |
| 5 | import java.util.List; | 5 | import java.util.List; |
| 6 | 6 | ||
| 7 | -import org.springframework.beans.BeanUtils; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.stereotype.Service; | ||
| 10 | - | 7 | +import com.alibaba.fastjson.JSONObject; |
| 11 | import com.xiaoleilu.hutool.date.DateUtil; | 8 | import com.xiaoleilu.hutool.date.DateUtil; |
| 12 | import com.xiaoleilu.hutool.util.CollectionUtil; | 9 | import com.xiaoleilu.hutool.util.CollectionUtil; |
| 13 | import com.zteits.oa.api.base.bean.BizResult; | 10 | import com.zteits.oa.api.base.bean.BizResult; |
| 14 | import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; | 11 | import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; |
| 12 | +import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; | ||
| 13 | +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq; | ||
| 14 | +import com.zteits.oa.api.service.report.query.AsraDailyQueryService; | ||
| 15 | +import com.zteits.oa.report.dao.AsraDailyDao; | ||
| 16 | +import com.zteits.oa.report.domain.AsraDaily; | ||
| 17 | +import org.springframework.beans.BeanUtils; | ||
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | +import org.springframework.stereotype.Service; | ||
| 20 | + | ||
| 15 | import com.zteits.oa.api.dto.asradaily.AsraDailyOpNumForCurrentDayDTO; | 21 | import com.zteits.oa.api.dto.asradaily.AsraDailyOpNumForCurrentDayDTO; |
| 16 | import com.zteits.oa.api.dto.asradaily.AsraProjectAndPersonNumDTO; | 22 | import com.zteits.oa.api.dto.asradaily.AsraProjectAndPersonNumDTO; |
| 17 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllDetailForListReqDTO; | 23 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllDetailForListReqDTO; |
| 18 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllForListReqDTO; | 24 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllForListReqDTO; |
| 19 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq; | 25 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq; |
| 20 | -import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; | ||
| 21 | -import com.zteits.oa.api.service.report.query.AsraDailyQueryService; | ||
| 22 | -import com.zteits.oa.report.dao.AsraDailyDao; | ||
| 23 | -import com.zteits.oa.report.domain.AsraDaily; | ||
| 24 | import com.zteits.oa.report.domain.sdo.AsraDailyDO; | 26 | import com.zteits.oa.report.domain.sdo.AsraDailyDO; |
| 25 | import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; | 27 | import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; |
| 28 | +import java.util.Date; | ||
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| 28 | * Copyright: Copyright (c) 2018 zteits | 31 | * Copyright: Copyright (c) 2018 zteits |
| @@ -47,7 +50,11 @@ public class AsraDailyQueryServiceImpl implements AsraDailyQueryService { | @@ -47,7 +50,11 @@ public class AsraDailyQueryServiceImpl implements AsraDailyQueryService { | ||
| 47 | List<AsraDailyDTO> asraDailyDTOs = new ArrayList<>(); | 50 | List<AsraDailyDTO> asraDailyDTOs = new ArrayList<>(); |
| 48 | List<AsraDaily> asraDailies = asraDailyDao.queryAsraDailyList(asraDailyQueryReq); | 51 | List<AsraDaily> asraDailies = asraDailyDao.queryAsraDailyList(asraDailyQueryReq); |
| 49 | if(CollectionUtil.isNotEmpty(asraDailies)){ | 52 | if(CollectionUtil.isNotEmpty(asraDailies)){ |
| 50 | - BeanUtils.copyProperties(asraDailies,asraDailyDTOs,AsraDailyDTO.class); | 53 | + for(AsraDaily asraDaily:asraDailies){ |
| 54 | + AsraDailyDTO asraDailyDTO = new AsraDailyDTO(); | ||
| 55 | + BeanUtils.copyProperties(asraDaily,asraDailyDTO); | ||
| 56 | + asraDailyDTOs.add(asraDailyDTO); | ||
| 57 | + } | ||
| 51 | } | 58 | } |
| 52 | return new BizResult<>(asraDailyDTOs); | 59 | return new BizResult<>(asraDailyDTOs); |
| 53 | } | 60 | } |
| @@ -123,4 +130,30 @@ public class AsraDailyQueryServiceImpl implements AsraDailyQueryService { | @@ -123,4 +130,30 @@ public class AsraDailyQueryServiceImpl implements AsraDailyQueryService { | ||
| 123 | } | 130 | } |
| 124 | 131 | ||
| 125 | 132 | ||
| 133 | + @Override | ||
| 134 | + public BizResult<Integer> saveOrUpdateAsraDaily(AsraDailySaveOrUpdateReq request) { | ||
| 135 | + AsraDaily asraDaily = new AsraDaily(); | ||
| 136 | + BeanUtils.copyProperties(request, asraDaily); | ||
| 137 | + asraDaily.setModfiyDate(new Date()); | ||
| 138 | + asraDaily.setModfiyEmpid(request.getAsarOpId() + ""); | ||
| 139 | + asraDaily.setModfiyEmpName(request.getAsarOpName() + ""); | ||
| 140 | + Date dailyDate = DateUtil.parseDate(request.getDailyDate()); | ||
| 141 | + asraDaily.setDailyDate(dailyDate); | ||
| 142 | + | ||
| 143 | + int num; | ||
| 144 | + if (null == request.getId()) { | ||
| 145 | + //新增 | ||
| 146 | + asraDaily.setDataState(1); | ||
| 147 | + asraDaily.setCreateDate(new Date()); | ||
| 148 | + asraDaily.setCreateEmpid(request.getAsarOpId()+""); | ||
| 149 | + asraDaily.setCreateEmpName(request.getAsarOpName() + ""); | ||
| 150 | + num = asraDailyDao.saveAsraDaily(asraDaily); | ||
| 151 | + } else { | ||
| 152 | + //更新 | ||
| 153 | + num = asraDailyDao.updateAsraDaily(asraDaily); | ||
| 154 | + | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + return new BizResult<>(num); | ||
| 158 | + } | ||
| 126 | } | 159 | } |
src/main/java/com/zteits/oa/report/dao/AsraDailyDao.java
| @@ -46,4 +46,24 @@ public interface AsraDailyDao { | @@ -46,4 +46,24 @@ public interface AsraDailyDao { | ||
| 46 | * 2018年8月1日 wangfs.<br/> | 46 | * 2018年8月1日 wangfs.<br/> |
| 47 | */ | 47 | */ |
| 48 | List<AsraDailyDO> queryAsraDailyAllForList(AsraDailyForTotalNumAndDetailReq request); | 48 | List<AsraDailyDO> queryAsraDailyAllForList(AsraDailyForTotalNumAndDetailReq request); |
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 保存日报信息 | ||
| 52 | + * @param | ||
| 53 | + * @return | ||
| 54 | + * @Author: xiejianpeng | ||
| 55 | + * @Date: 2018/8/1 17:11 | ||
| 56 | + * | ||
| 57 | + */ | ||
| 58 | + int saveAsraDaily(AsraDaily asraDaily); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 修改日报信息 | ||
| 62 | + * @param | ||
| 63 | + * @return | ||
| 64 | + * @Author: xiejianpeng | ||
| 65 | + * @Date: 2018/8/1 17:11 | ||
| 66 | + * | ||
| 67 | + */ | ||
| 68 | + int updateAsraDaily(AsraDaily asraDaily); | ||
| 49 | } | 69 | } |
src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java
| @@ -50,7 +50,17 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ | @@ -50,7 +50,17 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ | ||
| 50 | example.createCriteria().andAsarOpIdEqualTo(asraDailyQueryReq.getAsarOpId()) | 50 | example.createCriteria().andAsarOpIdEqualTo(asraDailyQueryReq.getAsarOpId()) |
| 51 | .andYearsEqualTo(asraDailyQueryReq.getYears()) | 51 | .andYearsEqualTo(asraDailyQueryReq.getYears()) |
| 52 | .andWeeksEqualTo(asraDailyQueryReq.getWeeks()); | 52 | .andWeeksEqualTo(asraDailyQueryReq.getWeeks()); |
| 53 | - return asraDailyMapper.selectByExample(example); | 53 | + return asraDailyMapper.selectByExampleWithBLOBs(example); |
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public int saveAsraDaily(AsraDaily asraDaily) { | ||
| 58 | + return asraDailyMapper.insertSelective(asraDaily); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public int updateAsraDaily(AsraDaily asraDaily) { | ||
| 63 | + return asraDailyMapper.updateByPrimaryKeySelective(asraDaily); | ||
| 54 | } | 64 | } |
| 55 | 65 | ||
| 56 | /** | 66 | /** |
src/main/java/com/zteits/oa/report/web/AsraDailyController.java
| @@ -12,29 +12,21 @@ import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; | @@ -12,29 +12,21 @@ import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; | ||
| 12 | import com.zteits.oa.api.dto.asradaily.AsraDailyOpNumForCurrentDayDTO; | 12 | import com.zteits.oa.api.dto.asradaily.AsraDailyOpNumForCurrentDayDTO; |
| 13 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllForListReqDTO; | 13 | import com.zteits.oa.api.dto.asradaily.QueryAsraDailyAllForListReqDTO; |
| 14 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq; | 14 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq; |
| 15 | +import com.zteits.oa.api.dto.asradaily.AsraDailyDateChangeDTO; | ||
| 15 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; | 16 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; |
| 17 | +import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq; | ||
| 16 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; | 18 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
| 17 | -import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; | ||
| 18 | -import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | ||
| 19 | -import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; | ||
| 20 | import com.zteits.oa.api.service.report.query.AsraDailyQueryService; | 19 | import com.zteits.oa.api.service.report.query.AsraDailyQueryService; |
| 21 | -import com.zteits.oa.api.service.report.query.AsraOpQueryService; | ||
| 22 | -import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; | ||
| 23 | -import com.zteits.oa.report.domain.AsraDaily; | 20 | +import com.zteits.oa.util.pagepaper.DateForObjectUtil; |
| 24 | import io.swagger.annotations.Api; | 21 | import io.swagger.annotations.Api; |
| 25 | import io.swagger.annotations.ApiOperation; | 22 | import io.swagger.annotations.ApiOperation; |
| 26 | - | ||
| 27 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; | 24 | import org.slf4j.LoggerFactory; |
| 25 | +import org.springframework.beans.BeanUtils; | ||
| 29 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 30 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 31 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 32 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 33 | -import org.springframework.web.bind.annotation.RestController; | 27 | +import org.springframework.web.bind.annotation.*; |
| 34 | 28 | ||
| 35 | import javax.servlet.http.HttpServletRequest; | 29 | import javax.servlet.http.HttpServletRequest; |
| 36 | -import javax.servlet.http.HttpSession; | ||
| 37 | -import java.util.ArrayList; | ||
| 38 | import java.util.Date; | 30 | import java.util.Date; |
| 39 | import java.util.List; | 31 | import java.util.List; |
| 40 | 32 | ||
| @@ -46,27 +38,23 @@ public class AsraDailyController { | @@ -46,27 +38,23 @@ public class AsraDailyController { | ||
| 46 | private static final Logger logger = LoggerFactory.getLogger(AsraDailyController.class); | 38 | private static final Logger logger = LoggerFactory.getLogger(AsraDailyController.class); |
| 47 | 39 | ||
| 48 | @Autowired | 40 | @Autowired |
| 49 | - private AsraOpQueryService asraOpQueryService; | ||
| 50 | - | ||
| 51 | - @Autowired | ||
| 52 | private AsraDailyQueryService asraDailyQueryService; | 41 | private AsraDailyQueryService asraDailyQueryService; |
| 53 | 42 | ||
| 54 | 43 | ||
| 55 | @RequestMapping(value="/queryAsraDailyList",method = RequestMethod.POST) | 44 | @RequestMapping(value="/queryAsraDailyList",method = RequestMethod.POST) |
| 56 | public BizResult<List<AsraDailyDTO>> queryAsraDailyList(@RequestBody AsraDailyQueryReq asraDailyQueryReq, HttpServletRequest request){ | 45 | public BizResult<List<AsraDailyDTO>> queryAsraDailyList(@RequestBody AsraDailyQueryReq asraDailyQueryReq, HttpServletRequest request){ |
| 57 | - logger.info("日报系统-日报管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraDailyQueryReq)); | 46 | + logger.info("日报系统-日报管理-根据登录人查询日报信息入参:{}", JSONObject.toJSON(asraDailyQueryReq)); |
| 58 | /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ | 47 | /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ |
| 59 | AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); | 48 | AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); |
| 60 | 49 | ||
| 61 | /**2.判断登录人和时间查询日报*/ | 50 | /**2.判断登录人和时间查询日报*/ |
| 62 | - Date dailyDate = asraDailyQueryReq.getDailyDate(); | ||
| 63 | - Integer week = DateUtil.weekOfYear(dailyDate);//第N周 | ||
| 64 | - Integer year = DateUtil.year(dailyDate);//第N周 | 51 | + Date dailyDate = DateUtil.parseDate(asraDailyQueryReq.getDailyDate()); |
| 52 | + AsraDailyDateChangeDTO asraDailyDateChangeDTO = DateForObjectUtil.getAsraDailyDTO(dailyDate); | ||
| 65 | asraDailyQueryReq.setAsarOpId(asraOpDTO.getId()); | 53 | asraDailyQueryReq.setAsarOpId(asraOpDTO.getId()); |
| 66 | - asraDailyQueryReq.setWeeks(week); | ||
| 67 | - asraDailyQueryReq.setYears(year); | 54 | + BeanUtils.copyProperties(asraDailyDateChangeDTO,asraDailyQueryReq); |
| 55 | + logger.info("日报系统-日报管理-根据登录人查询日报信息入参:{}", JSONObject.toJSON(asraDailyDateChangeDTO)); | ||
| 68 | BizResult<List<AsraDailyDTO>> result = asraDailyQueryService.queryAsraDailyList(asraDailyQueryReq); | 56 | BizResult<List<AsraDailyDTO>> result = asraDailyQueryService.queryAsraDailyList(asraDailyQueryReq); |
| 69 | - logger.info("日报系统-日报管理-根据登录人分页查询员工信息结束"); | 57 | + logger.info("日报系统-日报管理-根据登录人查询日报信息结束"); |
| 70 | return result; | 58 | return result; |
| 71 | } | 59 | } |
| 72 | 60 | ||
| @@ -112,4 +100,23 @@ public class AsraDailyController { | @@ -112,4 +100,23 @@ public class AsraDailyController { | ||
| 112 | } | 100 | } |
| 113 | 101 | ||
| 114 | 102 | ||
| 103 | + @ApiOperation("保存或者修改工时日报") | ||
| 104 | + @PostMapping("/saveOrUpdateAsraDaily") | ||
| 105 | + public BizResult<Integer> saveOrUpdateAsraDaily(@RequestBody AsraDailySaveOrUpdateReq asraDailySaveOrUpdateReq,HttpServletRequest request) { | ||
| 106 | + logger.info("日报系统-日报管理-根据登录人提交日报信息入参:{}", JSONObject.toJSON(asraDailySaveOrUpdateReq)); | ||
| 107 | + /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ | ||
| 108 | + AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); | ||
| 109 | + | ||
| 110 | + /**2.判断登录人和时间查询日报*/ | ||
| 111 | + Date dailyDate = DateUtil.parseDate(asraDailySaveOrUpdateReq.getDailyDate()); | ||
| 112 | + AsraDailyDateChangeDTO asraDailyDateChangeDTO = DateForObjectUtil.getAsraDailyDTO(dailyDate); | ||
| 113 | + asraDailySaveOrUpdateReq.setAsarOpId(asraOpDTO.getId()); | ||
| 114 | + asraDailySaveOrUpdateReq.setAsarOpName(asraOpDTO.getOpName()); | ||
| 115 | + asraDailySaveOrUpdateReq.setDataState(1); | ||
| 116 | + BeanUtils.copyProperties(asraDailyDateChangeDTO,asraDailySaveOrUpdateReq); | ||
| 117 | + | ||
| 118 | + BizResult<Integer> bizResult = asraDailyQueryService.saveOrUpdateAsraDaily(asraDailySaveOrUpdateReq); | ||
| 119 | + return bizResult; | ||
| 120 | + } | ||
| 121 | + | ||
| 115 | } | 122 | } |
src/main/java/com/zteits/oa/report/web/AsraOpController.java
| @@ -11,6 +11,7 @@ import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | @@ -11,6 +11,7 @@ import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | ||
| 11 | import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; | 11 | import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; |
| 12 | import com.zteits.oa.api.service.report.query.AsraOpQueryService; | 12 | import com.zteits.oa.api.service.report.query.AsraOpQueryService; |
| 13 | import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; | 13 | import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; |
| 14 | +import com.zteits.oa.report.web.vo.EasyUIDataGridVO; | ||
| 14 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
| 15 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 16 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| @@ -29,45 +30,26 @@ import java.util.List; | @@ -29,45 +30,26 @@ import java.util.List; | ||
| 29 | @Api(value = "日报系统-员工管理", description = "日报系统-员工管理") | 30 | @Api(value = "日报系统-员工管理", description = "日报系统-员工管理") |
| 30 | @RestController | 31 | @RestController |
| 31 | @RequestMapping("/asraOp") | 32 | @RequestMapping("/asraOp") |
| 32 | -public class AsraOpController { | 33 | +public class AsraOpController extends BizController { |
| 33 | 34 | ||
| 34 | private static final Logger logger = LoggerFactory.getLogger(AsraOpController.class); | 35 | private static final Logger logger = LoggerFactory.getLogger(AsraOpController.class); |
| 35 | 36 | ||
| 36 | @Autowired | 37 | @Autowired |
| 37 | private AsraOpQueryService asraOpQueryService; | 38 | private AsraOpQueryService asraOpQueryService; |
| 38 | 39 | ||
| 39 | - @Autowired | ||
| 40 | - private AsraOpRelationsQueryService asraOpRelationsQueryService; | ||
| 41 | - | ||
| 42 | 40 | ||
| 43 | 41 | ||
| 44 | 42 | ||
| 45 | 43 | ||
| 46 | @RequestMapping(value="/queryAsraOpPage",method = RequestMethod.POST) | 44 | @RequestMapping(value="/queryAsraOpPage",method = RequestMethod.POST) |
| 47 | - public BizResult<PageBean<AsraOpDTO>> queryAsraOpPage(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request){ | 45 | + public BizResult<EasyUIDataGridVO<AsraOpDTO>> queryAsraOpPage(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request) throws IllegalAccessException, InstantiationException { |
| 48 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraOpQueryReq)); | 46 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraOpQueryReq)); |
| 49 | /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ | 47 | /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ |
| 50 | AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); | 48 | AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); |
| 51 | - | ||
| 52 | -// /**2.判断登录人是领导还是员工 ,2:员工,1:领导*/ | ||
| 53 | -// List<Long> opIdLists = new ArrayList<>(); | ||
| 54 | -// opIdLists.add(asraOpDTO.getId()); | ||
| 55 | -// if(asraOpDTO.getRoleId() == 1){ | ||
| 56 | -// /**如果是领导,获取领导下面的员工信息*/ | ||
| 57 | -// AsraOpRelationsQueryReq asraOpRelationsQueryReq = new AsraOpRelationsQueryReq(); | ||
| 58 | -// asraOpRelationsQueryReq.setParentId(asraOpDTO.getId()); | ||
| 59 | -// BizResult<List<AsraOpRelationsDTO>> listBizResult = asraOpRelationsQueryService.queryAsraOpRelations(asraOpRelationsQueryReq); | ||
| 60 | -// if(listBizResult.isSuccess() && CollectionUtil.isNotEmpty(listBizResult.getData())){ | ||
| 61 | -// for(AsraOpRelationsDTO asraOpRelationsDTO : listBizResult.getData()){ | ||
| 62 | -// opIdLists.add(asraOpRelationsDTO.getOpId()); | ||
| 63 | -// } | ||
| 64 | -// } | ||
| 65 | -// } | ||
| 66 | -// asraOpQueryReq.setOpIdLists(opIdLists); | ||
| 67 | asraOpQueryReq.setId(asraOpDTO.getId()); | 49 | asraOpQueryReq.setId(asraOpDTO.getId()); |
| 68 | BizResult<PageBean<AsraOpDTO>> result = asraOpQueryService.queryAsraOpForPage(asraOpQueryReq); | 50 | BizResult<PageBean<AsraOpDTO>> result = asraOpQueryService.queryAsraOpForPage(asraOpQueryReq); |
| 69 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息结果:{}", JSONObject.toJSON(result)); | 51 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息结果:{}", JSONObject.toJSON(result)); |
| 70 | - return result; | 52 | + return returnJqGridData(result, AsraOpDTO.class); |
| 71 | } | 53 | } |
| 72 | 54 | ||
| 73 | } | 55 | } |
src/main/java/com/zteits/oa/report/web/BizController.java
0 → 100644
| 1 | +package com.zteits.oa.report.web; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.zteits.oa.api.base.bean.BizResult; | ||
| 5 | +import com.zteits.oa.api.base.bean.PageBean; | ||
| 6 | +import com.zteits.oa.api.base.constants.ErrorType; | ||
| 7 | +import com.zteits.oa.api.base.exception.BizException; | ||
| 8 | +import com.zteits.oa.report.web.vo.EasyUIDataGridVO; | ||
| 9 | +import org.springframework.beans.BeanUtils; | ||
| 10 | +import org.springframework.util.CollectionUtils; | ||
| 11 | + | ||
| 12 | +import javax.servlet.http.HttpServletResponse; | ||
| 13 | +import java.io.IOException; | ||
| 14 | +import java.io.InputStream; | ||
| 15 | +import java.io.OutputStream; | ||
| 16 | +import java.io.UnsupportedEncodingException; | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * @描述: | ||
| 24 | + * Copyright: Copyright (c) 2017 Alibb | ||
| 25 | + * | ||
| 26 | + * @ClassName: BizController.java | ||
| 27 | + * @Description: 所有基于Spring MVC的Web控制器类(Action)的统一父类,提供一些便利的请求处理方法,如返回Json、文本数据等 | ||
| 28 | + * @version: v1.0.0 | ||
| 29 | + * @author: wangbiao | ||
| 30 | + * @date: 2017年2月23日 下午1:26:50 | ||
| 31 | + * | ||
| 32 | + * Modification History: | ||
| 33 | + * Date Author Version Description | ||
| 34 | + *---------------------------------------------------------* | ||
| 35 | + * 2017年2月23日 wangbiao v1.0.0 创建 | ||
| 36 | + */ | ||
| 37 | +public class BizController { | ||
| 38 | + private static final String MIME_JSON = "application/json;charset=UTF-8"; | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 返回jqgrid格式数据 | ||
| 43 | + * @param bizResult | ||
| 44 | + * @param voClass | ||
| 45 | + * @return | ||
| 46 | + * @throws InstantiationException | ||
| 47 | + * @throws IllegalAccessException | ||
| 48 | + * 2017年5月12日 zhaowg | ||
| 49 | + */ | ||
| 50 | + protected <DTO,VO> BizResult<EasyUIDataGridVO<VO>> returnJqGridData(BizResult<PageBean<DTO>> bizResult, Class<VO> voClass) throws InstantiationException, IllegalAccessException { | ||
| 51 | + PageBean<DTO> pageBean = getBizResultData(bizResult); | ||
| 52 | + //将DTO转换为VO | ||
| 53 | + List<VO> vos = new ArrayList<>(); | ||
| 54 | + if(!CollectionUtils.isEmpty(pageBean.getDataList())){ | ||
| 55 | + for (DTO dto : pageBean.getDataList()) { | ||
| 56 | + VO vo = voClass.newInstance(); | ||
| 57 | + BeanUtils.copyProperties(dto, vo); | ||
| 58 | + vos.add(vo); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + //返回jqGrid数据 | ||
| 62 | + EasyUIDataGridVO<VO> jqGridDatas = new EasyUIDataGridVO<>(); | ||
| 63 | + jqGridDatas.setTotal(pageBean.getPageTotals()==null?0:pageBean.getPageTotals()); | ||
| 64 | + jqGridDatas.setRows(vos); | ||
| 65 | + | ||
| 66 | + BizResult<EasyUIDataGridVO<VO>> bizResultVO = new BizResult<>(); | ||
| 67 | + bizResultVO.setCode(bizResult.getCode()); | ||
| 68 | + bizResultVO.setErrMsg(bizResult.getErrMsg()); | ||
| 69 | + bizResultVO.setData(jqGridDatas); | ||
| 70 | + | ||
| 71 | + return bizResultVO; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 返回jqgrid格式数据 | ||
| 76 | + * @param bizResult | ||
| 77 | + * @return | ||
| 78 | + * 2017年5月12日 zhaowg | ||
| 79 | + */ | ||
| 80 | + protected <DTO> BizResult<EasyUIDataGridVO<DTO>> returnJqGridData(BizResult<PageBean<DTO>> bizResult) { | ||
| 81 | + PageBean<DTO> pageBean = getBizResultData(bizResult); | ||
| 82 | + //返回jqGrid数据 | ||
| 83 | + EasyUIDataGridVO<DTO> jqGridDatas = new EasyUIDataGridVO<>(); | ||
| 84 | + jqGridDatas.setTotal(pageBean.getPageTotals()==null?0:pageBean.getPageTotals()); | ||
| 85 | + jqGridDatas.setRows(pageBean.getDataList()); | ||
| 86 | + | ||
| 87 | + BizResult<EasyUIDataGridVO<DTO>> bizResultVO = new BizResult<>(); | ||
| 88 | + bizResultVO.setCode(bizResult.getCode()); | ||
| 89 | + bizResultVO.setErrMsg(bizResult.getErrMsg()); | ||
| 90 | + bizResultVO.setData(jqGridDatas); | ||
| 91 | + | ||
| 92 | + return bizResultVO; | ||
| 93 | + } | ||
| 94 | + /** | ||
| 95 | + * 分页结果封装后返回标准格式JSON串.<br/> | ||
| 96 | + * @param response | ||
| 97 | + * @param result | ||
| 98 | + */ | ||
| 99 | + @SuppressWarnings("unused") | ||
| 100 | + public void returnJsonDataGrid(HttpServletResponse response,BizResult<?> result){ | ||
| 101 | + Map<String,Object> resultMap = new HashMap<String,Object>(); | ||
| 102 | + | ||
| 103 | + if(result == null){ | ||
| 104 | + throw new NullPointerException("result 为空,不能进行封装!"); | ||
| 105 | + }else if(result.getData() == null){ | ||
| 106 | + throw new NullPointerException("pageBean 为空,不能进行封装!"); | ||
| 107 | + }else{ | ||
| 108 | + if(result.getData() instanceof PageBean<?>) { | ||
| 109 | + PageBean<?> pageBean = (PageBean<?>)result.getData(); | ||
| 110 | + Map<String,Object> map = new HashMap<String,Object>(); | ||
| 111 | + map.put("total", (null ==pageBean.getPageTotals()? 0 :pageBean.getPageTotals())); | ||
| 112 | + map.put("rows", pageBean.getDataList() != null ? pageBean.getDataList() :new ArrayList<Object>() ); | ||
| 113 | + resultMap.put("code", result.getCode()); | ||
| 114 | + resultMap.put("msg", result.getErrMsg()); | ||
| 115 | + resultMap.put("data", map); | ||
| 116 | + | ||
| 117 | + }else{ | ||
| 118 | + throw new ClassCastException("result.getData() 类型转换异常"); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + } | ||
| 122 | + this.returnJson(response, resultMap); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * | ||
| 127 | + * @param data | ||
| 128 | + * @param totalCount | ||
| 129 | + * @return | ||
| 130 | + * 2017年5月12日 zhaowg | ||
| 131 | + */ | ||
| 132 | + public <VO> BizResult<EasyUIDataGridVO<VO>> returnGridData4JqGrid(List<VO> data,Integer totalCount) { | ||
| 133 | + //返回jqGrid数据 | ||
| 134 | + EasyUIDataGridVO<VO> jqGridDatas = new EasyUIDataGridVO<>(); | ||
| 135 | + jqGridDatas.setTotal(totalCount==null?0:totalCount); | ||
| 136 | + jqGridDatas.setRows(data); | ||
| 137 | + | ||
| 138 | + BizResult<EasyUIDataGridVO<VO>> bizResultVO = new BizResult<>(); | ||
| 139 | + bizResultVO.setCode(ErrorType.BIZ_SUCCESS.getCode()); | ||
| 140 | + bizResultVO.setErrMsg(ErrorType.BIZ_SUCCESS.getMsg()); | ||
| 141 | + bizResultVO.setData(jqGridDatas); | ||
| 142 | + return bizResultVO; | ||
| 143 | + } | ||
| 144 | + /** | ||
| 145 | + * 获取返回的数据 | ||
| 146 | + * @param bizResult | ||
| 147 | + * @return | ||
| 148 | + * 2017年5月16日 zhaowg | ||
| 149 | + */ | ||
| 150 | + public <T> T getBizResultData(BizResult<T> bizResult){ | ||
| 151 | + //有异常,抛出 | ||
| 152 | + if(!bizResult.isSuccess() || !bizResult.getCode().equals(ErrorType.BIZ_SUCCESS.getCode())){ | ||
| 153 | + | ||
| 154 | + throw new BizException(ErrorType.BIZ_ERROR,bizResult.getErrMsg()); | ||
| 155 | + } | ||
| 156 | + return bizResult.getData(); | ||
| 157 | + } | ||
| 158 | + /** | ||
| 159 | + * 返回JSon格式的数据 | ||
| 160 | + * | ||
| 161 | + * @param response | ||
| 162 | + * @param data | ||
| 163 | + * @throws Exception | ||
| 164 | + */ | ||
| 165 | + public String returnJson(HttpServletResponse response, Object data) { | ||
| 166 | + | ||
| 167 | + return returnText(response, JSONObject.toJSONString(data), MIME_JSON); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 返回xml格式的数据 | ||
| 172 | + * | ||
| 173 | + * @param response | ||
| 174 | + * @param text | ||
| 175 | + * @throws Exception | ||
| 176 | + */ | ||
| 177 | + public String returnXml(HttpServletResponse response, CharSequence text) { | ||
| 178 | + return returnText(response, text, "text/xml;charset=UTF-8"); | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * 返回文本数据 | ||
| 183 | + * @param response | ||
| 184 | + * @param text | ||
| 185 | + * @param contenttype 内容类型,如:text/plain、text/xml、application/json、text/json、text/javascript、application/javascript(不支持旧浏览器) | ||
| 186 | + * @param encoding 字符集编码,如:GB18030、UTF-8,不建议使用GB2312和GBK | ||
| 187 | + * @throws Exception | ||
| 188 | + */ | ||
| 189 | + public String returnText(HttpServletResponse response, CharSequence text,final String contenttype,final String encoding) { | ||
| 190 | + return returnText(response, text, contenttype+";charset="+encoding); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 返回文本数据 | ||
| 195 | + * | ||
| 196 | + * @param response | ||
| 197 | + * @param text | ||
| 198 | + * @param contenttype | ||
| 199 | + * @throws IOException | ||
| 200 | + * @author lihl2 2011-3-25 | ||
| 201 | + */ | ||
| 202 | + public String returnText(HttpServletResponse response, CharSequence text,final String contenttype) { | ||
| 203 | + response.setContentType(contenttype); | ||
| 204 | + if (text != null) { | ||
| 205 | + try { | ||
| 206 | + response.getWriter().write(text.toString()); | ||
| 207 | + } catch (IOException e) { | ||
| 208 | + throw new BizException(ErrorType.BIZ_ERROR,e); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + return null; | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + /** | ||
| 215 | + * 设置文件头格式 | ||
| 216 | + * @param response | ||
| 217 | + * @param mimeType | ||
| 218 | + * @param fileName | ||
| 219 | + * @param size | ||
| 220 | + */ | ||
| 221 | + public void setFileHeader(HttpServletResponse response, CharSequence mimeType, | ||
| 222 | + final CharSequence fileName, int size) { | ||
| 223 | + response.reset(); | ||
| 224 | + // 设置response的Header | ||
| 225 | + if(mimeType != null){ | ||
| 226 | + response.setContentType(mimeType.toString()) ; | ||
| 227 | + } | ||
| 228 | + try { | ||
| 229 | + response.addHeader("Content-Disposition","attachment;filename=" + new String(fileName.toString().getBytes("GB18030"),"ISO-8859-1")) ; | ||
| 230 | + } catch (UnsupportedEncodingException e) { | ||
| 231 | + throw new BizException(ErrorType.BIZ_ERROR,"文件名编码转换失败") ; | ||
| 232 | + } | ||
| 233 | + if(size > 0){ | ||
| 234 | + response.addIntHeader("Content-Length", size) ; | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + /** | ||
| 239 | + * 设置浏览器返回类型为Excel文件 | ||
| 240 | + * @param response | ||
| 241 | + * @param mimeType | ||
| 242 | + * @param fileName | ||
| 243 | + * @param size | ||
| 244 | + */ | ||
| 245 | + public void setExcelFileHeader(HttpServletResponse response, CharSequence mimeType, | ||
| 246 | + final CharSequence fileName, int size) { | ||
| 247 | + setFileHeader(response, "application/vnd.ms-excel", fileName, size); | ||
| 248 | + } | ||
| 249 | + /** | ||
| 250 | + * 文件下载 | ||
| 251 | + * @param response | ||
| 252 | + * @param mimeType | ||
| 253 | + * @param fileName | ||
| 254 | + * @param file | ||
| 255 | + * @param size | ||
| 256 | + */ | ||
| 257 | + public void downloadFile(HttpServletResponse response, CharSequence mimeType, | ||
| 258 | + final CharSequence fileName, InputStream file, int size) { | ||
| 259 | + setFileHeader(response, mimeType, fileName, size) ; | ||
| 260 | + try { | ||
| 261 | + OutputStream out = response.getOutputStream() ; | ||
| 262 | + int l ; | ||
| 263 | + while((l=file.read()) >= 0){ | ||
| 264 | + out.write(l) ; | ||
| 265 | + } | ||
| 266 | + out.flush() ; | ||
| 267 | + } catch (IOException e) { | ||
| 268 | + throw new BizException(ErrorType.BIZ_ERROR,"下载文件失败") ; | ||
| 269 | + }finally { | ||
| 270 | + if (null != file) { | ||
| 271 | + try { | ||
| 272 | + file.close(); | ||
| 273 | + } catch (IOException e) { | ||
| 274 | + e.printStackTrace(); | ||
| 275 | + } | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + } | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + | ||
| 285 | + /** | ||
| 286 | + * 返回jqgrid格式数据 | ||
| 287 | + * @param bizResult | ||
| 288 | + * @param voClass | ||
| 289 | + * @return | ||
| 290 | + * @throws InstantiationException | ||
| 291 | + * @throws IllegalAccessException | ||
| 292 | + * 2017年5月12日 zhaowg | ||
| 293 | + */ | ||
| 294 | + protected <DTO,VO> BizResult<EasyUIDataGridVO<VO>> returnJqGridDataByList(BizResult<List<DTO>> bizResult,int total,Class<VO> voClass) throws InstantiationException, IllegalAccessException { | ||
| 295 | + //List<DTO> pageBean = getBizResultData(bizResult); | ||
| 296 | + //将DTO转换为VO | ||
| 297 | + List<VO> vos = new ArrayList<>(); | ||
| 298 | + if(!CollectionUtils.isEmpty(bizResult.getData())){ | ||
| 299 | + for (DTO dto : bizResult.getData()) { | ||
| 300 | + VO vo = voClass.newInstance(); | ||
| 301 | + BeanUtils.copyProperties(dto, vo); | ||
| 302 | + vos.add(vo); | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + //返回jqGrid数据 | ||
| 306 | + EasyUIDataGridVO<VO> jqGridDatas = new EasyUIDataGridVO<>(); | ||
| 307 | + | ||
| 308 | + jqGridDatas.setTotal(total); | ||
| 309 | + jqGridDatas.setRows(vos); | ||
| 310 | + | ||
| 311 | + BizResult<EasyUIDataGridVO<VO>> bizResultVO = new BizResult<>(); | ||
| 312 | + bizResultVO.setCode(bizResult.getCode()); | ||
| 313 | + bizResultVO.setErrMsg(bizResult.getErrMsg()); | ||
| 314 | + bizResultVO.setData(jqGridDatas); | ||
| 315 | + | ||
| 316 | + return bizResultVO; | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + | ||
| 320 | + | ||
| 321 | +} |
src/main/java/com/zteits/oa/util/pagepaper/DateForObjectUtil.java
0 → 100644
| 1 | +package com.zteits.oa.util.pagepaper; | ||
| 2 | + | ||
| 3 | +import com.xiaoleilu.hutool.date.DateUtil; | ||
| 4 | +import com.zteits.oa.api.dto.asradaily.AsraDailyDTO; | ||
| 5 | +import com.zteits.oa.api.dto.asradaily.AsraDailyDateChangeDTO; | ||
| 6 | + | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Copyright: Copyright (c) 2018 zteits | ||
| 11 | + * | ||
| 12 | + * @Description: | ||
| 13 | + * @version: v1.0.0 | ||
| 14 | + * @author: xiejianpeng | ||
| 15 | + * @date: 2018/8/1 10 | ||
| 16 | + * Modification History: | ||
| 17 | + * Date Author Version Description | ||
| 18 | + * ---------------------------------------------------------* | ||
| 19 | + * 2018/8/1 xiejianpeng v1.0.0 创建 | ||
| 20 | + */ | ||
| 21 | +public class DateForObjectUtil { | ||
| 22 | + | ||
| 23 | + public static AsraDailyDateChangeDTO getAsraDailyDTO(Date dailyDate){ | ||
| 24 | + AsraDailyDateChangeDTO asraDailyDTO = new AsraDailyDateChangeDTO(); | ||
| 25 | + Integer week = DateUtil.weekOfYear(dailyDate);//第N周 | ||
| 26 | + Integer year = DateUtil.year(dailyDate);//年 | ||
| 27 | + Integer weekNum = DateUtil.dayOfWeek(DateUtil.offsetDay(dailyDate,-1));//星期 | ||
| 28 | + | ||
| 29 | + asraDailyDTO.setYears(year); | ||
| 30 | + asraDailyDTO.setWeeks(week); | ||
| 31 | + asraDailyDTO.setWeeksNum(weekNum); | ||
| 32 | + | ||
| 33 | + return asraDailyDTO; | ||
| 34 | + } | ||
| 35 | +} |
src/main/resources/mybatis/smapper/AsraOpSmapper.xml
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | modfiy_emp_name, modfiy_date, remark | 26 | modfiy_emp_name, modfiy_date, remark |
| 27 | </sql> | 27 | </sql> |
| 28 | 28 | ||
| 29 | - <select id="queryAsraOpForList" parameterType="com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq" resultMap="BaseResultMap"> | 29 | + <select id="queryAsraOpForList" parameterType="com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq" resultType="com.zteits.oa.api.dto.asraop.AsraOpDTO"> |
| 30 | select | 30 | select |
| 31 | ap.id id, | 31 | ap.id id, |
| 32 | ap.login_code loginCode, | 32 | ap.login_code loginCode, |