From 1b9e8898fd237f3e15806854058ee636d3208deb Mon Sep 17 00:00:00 2001 From: wangfs <15029758498@163.com> Date: Mon, 30 Jul 2018 13:48:42 +0800 Subject: [PATCH] 提交 --- src/main/java/com/zteits/oa/api/base/bean/AppBaseRequest.java | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/BaiscDTO.java | 17 +++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/BaseInfo.java | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/BaseRequest.java | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/BizResult.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/ErrorCode.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/PDABaseRequest.java | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/PageBean.java | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/PageUtil.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/bean/ResultBean.java | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/constants/BasicEnum.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/constants/ErrorType.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/constants/PageSizeEnum.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/exception/AppException.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/base/exception/BizException.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java | 271 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/report/dao/AsraOpDao.java | 16 ++++++++++++++++ src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java | 34 ++++++++++++++++++++++++++++++++++ src/main/java/com/zteits/oa/report/mapper/smapper/AsraOpSmapper.java | 17 +++++++++++++++++ src/main/java/com/zteits/oa/report/web/demo/DemoController.java | 15 ++++++++++++--- src/main/java/com/zteits/oa/util/pagepaper/PageBeanUtil.java | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/logback-spring.xml | 11 +++++++++-- src/main/resources/mybatis/smapper/AsraOpSmapper.xml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 26 files changed, 1774 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/zteits/oa/api/base/bean/AppBaseRequest.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/BaiscDTO.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/BaseInfo.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/BaseRequest.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/BizResult.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/ErrorCode.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/PDABaseRequest.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/PageBean.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/PageUtil.java create mode 100644 src/main/java/com/zteits/oa/api/base/bean/ResultBean.java create mode 100644 src/main/java/com/zteits/oa/api/base/constants/BasicEnum.java create mode 100644 src/main/java/com/zteits/oa/api/base/constants/ErrorType.java create mode 100644 src/main/java/com/zteits/oa/api/base/constants/PageSizeEnum.java create mode 100644 src/main/java/com/zteits/oa/api/base/exception/AppException.java create mode 100644 src/main/java/com/zteits/oa/api/base/exception/BizException.java create mode 100644 src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java create mode 100644 src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java create mode 100644 src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java create mode 100644 src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java create mode 100644 src/main/java/com/zteits/oa/report/dao/AsraOpDao.java create mode 100644 src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java create mode 100644 src/main/java/com/zteits/oa/report/mapper/smapper/AsraOpSmapper.java create mode 100644 src/main/java/com/zteits/oa/util/pagepaper/PageBeanUtil.java create mode 100644 src/main/resources/mybatis/smapper/AsraOpSmapper.xml diff --git a/src/main/java/com/zteits/oa/api/base/bean/AppBaseRequest.java b/src/main/java/com/zteits/oa/api/base/bean/AppBaseRequest.java new file mode 100644 index 0000000..74eeecd --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/AppBaseRequest.java @@ -0,0 +1,73 @@ +package com.zteits.oa.api.base.bean; + +/** + * + * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: AppBaseRequest.java + * @Description: + * @version: v1.0.0 + * @author: wangbiao + * @date: 2017年9月14日 下午12:01:36 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年9月14日 wangbiao v1.0.0 创建 + */ +public class AppBaseRequest extends BaseInfo { + + + private String app_id;//平台分配的app_id + private String salt;//随机数生成的盐值 + private String deviceInfo;//设备唯一编号 + private String sign_type;//签名的摘要算法 + private String sign;//签名 + private String token; + private String sysCode; + + + public String getSysCode() { + return sysCode; + } + public void setSysCode(String sysCode) { + this.sysCode = sysCode; + } + public String getApp_id() { + return app_id; + } + public void setApp_id(String app_id) { + this.app_id = app_id; + } + public String getSalt() { + return salt; + } + public void setSalt(String salt) { + this.salt = salt; + } + public String getDeviceInfo() { + return deviceInfo; + } + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + public String getSign_type() { + return sign_type; + } + public void setSign_type(String sign_type) { + this.sign_type = sign_type; + } + public String getSign() { + return sign; + } + public void setSign(String sign) { + this.sign = sign; + } + public String getToken() { + return token; + } + public void setToken(String token) { + this.token = token; + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/BaiscDTO.java b/src/main/java/com/zteits/oa/api/base/bean/BaiscDTO.java new file mode 100644 index 0000000..b386cd4 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/BaiscDTO.java @@ -0,0 +1,17 @@ +package com.zteits.oa.api.base.bean; + +import java.io.Serializable; + +public class BaiscDTO implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 5502485571704282738L; + + + + + + +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/BaseInfo.java b/src/main/java/com/zteits/oa/api/base/bean/BaseInfo.java new file mode 100644 index 0000000..5312b31 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/BaseInfo.java @@ -0,0 +1,71 @@ +package com.zteits.oa.api.base.bean; + +import java.io.Serializable; +import java.util.UUID; + +public class BaseInfo implements Serializable { + + private static final long serialVersionUID = -189054095924156774L; + + /** + * 请求编号,全局唯一,必须给 + */ + private String requestId; + + /** + * 调用本次业务的请求编号,全局唯一,必须给 + */ + private String preRequestId; + + /** + * 当前页. + */ + private int pageNum = 0; + + /** + * 每页的数量. + */ + private int pageSize = 10; + + public BaseInfo() { + super(); + } + + public BaseInfo(int pageNum, int pageSize) { + super(); + this.pageNum = pageNum; + this.pageSize = pageSize; + } + + public String getRequestId() { + if (requestId == null || requestId == "") { + requestId = UUID.randomUUID().toString().toUpperCase().replace("-", ""); + } + return requestId; + + } + + public void setPreRequestId(String preRequestId) { + this.preRequestId = preRequestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public int getPageNum() { + return pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/BaseRequest.java b/src/main/java/com/zteits/oa/api/base/bean/BaseRequest.java new file mode 100644 index 0000000..6eb8fc0 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/BaseRequest.java @@ -0,0 +1,106 @@ +package com.zteits.oa.api.base.bean; + +import java.io.Serializable; + +/** + * 所有入参数父类.
+ * + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: BaseQuery.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2017年4月21日 上午10:56:03 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2017年4月21日 wangfs v1.0.0 创建 + */ +public class BaseRequest implements Serializable { + + private static final long serialVersionUID = -189054095924156774L; + /** + * 基本信息,baseRequest中需要存放的公共基础信息全部放到BaseInfo中 + */ + private BaseInfo baseRequest = new BaseInfo(); + + /**系统编码,必须给 */ + protected String sysCode; + /** + * 操作人ID + */ + protected Long sOpId; + /** + * 操作人名称 + */ + protected String sOpName; + + + + public BaseRequest() { + super(); + } + + + public BaseRequest(String sysCode) { + super(); + this.sysCode = sysCode; + } + + + public BaseRequest(BaseInfo baseRequest, String sysCode) { + super(); + this.baseRequest = baseRequest; + this.sysCode = sysCode; + } + + public BaseRequest(BaseInfo baseRequest) { + super(); + this.baseRequest = baseRequest; + } + + public String getSysCode() { + return sysCode; + } + + public void setSysCode(String sysCode) { + this.sysCode = sysCode; + } + + public Long getsOpId() { + return sOpId; + } + + public void setsOpId(Long sOpId) { + this.sOpId = sOpId; + } + + public BaseInfo getBaseRequest() { + if (baseRequest == null) { + baseRequest = new BaseInfo(); + } + return baseRequest; + } + + public void setBaseRequest(BaseInfo baseRequest) { + this.baseRequest = baseRequest; + } + + public String getsOpName() { + return sOpName; + } + + public void setsOpName(String sOpName) { + this.sOpName = sOpName; + } + + @Override + public String toString() { + return "BaseRequest{" + + "baseRequest=" + baseRequest + + ", sysCode='" + sysCode + '\'' + + ", " + + '}'; + } +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/BizResult.java b/src/main/java/com/zteits/oa/api/base/bean/BizResult.java new file mode 100644 index 0000000..ee53a1f --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/BizResult.java @@ -0,0 +1,57 @@ +package com.zteits.oa.api.base.bean; + +import com.zteits.oa.api.base.constants.ErrorType; + +/** + * 统一返回结果集 + * + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: BizResult.java + * @Description: + * @version: v1.0.0 + * @author: liuzl + * @date: 2017年4月24日 下午6:17:24 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年4月24日 liuzl v1.0.0 创建 + */ +public class BizResult extends ResultBean{ + + private static final long serialVersionUID = 1L; + + public BizResult() { + super(); + } + + public BizResult(ErrorCode errType, String errMsg) { + super(errType, errMsg); + } + + public BizResult(ErrorType errType, String errMsg) { + super(errType, errMsg); + } + + public BizResult(ErrorType errType) { + super(errType); + } + + public BizResult(T data) { + super(data); + this.errCode=ErrorType.BIZ_SUCCESS; + this.errMsg = ErrorType.BIZ_SUCCESS.getMsg(); + + } + + public BizResult(ErrorType errType, String errMsg, T data) { + super(errType, errMsg, data); + } + + public void setErrorInfo(ErrorType errType, String errMsg){ + this.errCode = errType; + this.errMsg = errMsg; + this.success = false; + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/ErrorCode.java b/src/main/java/com/zteits/oa/api/base/bean/ErrorCode.java new file mode 100644 index 0000000..576c607 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/ErrorCode.java @@ -0,0 +1,31 @@ +package com.zteits.oa.api.base.bean; + +import java.io.Serializable; + +/** + * 错误编码公共接口 + * + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: ErrorCode.java + * @Description: + * @version: v1.0.0 + * @author: liuzl + * @date: 2017年4月24日 下午6:30:43 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年4月24日 liuzl v1.0.0 创建 + */ +public interface ErrorCode extends Serializable{ + /** + * 错误码 + * @return + */ + String getCode(); + /** + * 错误信息 + * @return + */ + String getMsg(); +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/PDABaseRequest.java b/src/main/java/com/zteits/oa/api/base/bean/PDABaseRequest.java new file mode 100644 index 0000000..37efc4b --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/PDABaseRequest.java @@ -0,0 +1,73 @@ +package com.zteits.oa.api.base.bean; + +/** + * PDA请求头 + * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: PDABaseRequest.java + * @version: v1.0.0 + * @author: wangfei + * @date: 2017年9月18日 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年9月18日 wangfei v1.0.0 创建 + */ +public class PDABaseRequest extends BaseInfo { + + private static final long serialVersionUID = -189054095924156774L; + + private String app_id;//平台分配的app_id + private String salt;//随机数生成的盐值 + private String deviceInfo;//设备唯一编号 + private String sign_type;//签名的摘要算法 + private String sign;//签名 + private String token; + private String sysCode; + + + public String getSysCode() { + return sysCode; + } + public void setSysCode(String sysCode) { + this.sysCode = sysCode; + } + public String getApp_id() { + return app_id; + } + public void setApp_id(String app_id) { + this.app_id = app_id; + } + public String getSalt() { + return salt; + } + public void setSalt(String salt) { + this.salt = salt; + } + public String getDeviceInfo() { + return deviceInfo; + } + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + public String getSign_type() { + return sign_type; + } + public void setSign_type(String sign_type) { + this.sign_type = sign_type; + } + public String getSign() { + return sign; + } + public void setSign(String sign) { + this.sign = sign; + } + public String getToken() { + return token; + } + public void setToken(String token) { + this.token = token; + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/PageBean.java b/src/main/java/com/zteits/oa/api/base/bean/PageBean.java new file mode 100644 index 0000000..356514a --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/PageBean.java @@ -0,0 +1,152 @@ +package com.zteits.oa.api.base.bean; + + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 分页查询结果分装PageInfo.
+ * + * @author wangfs + * @param + */ +public class PageBean implements Serializable { + + + + /** + * + */ + private static final long serialVersionUID = -8295317993394764660L; + /** 数据. */ + private List dataList; + /** 当前页. */ + private Integer pageNum; + /** 每页显示条数. */ + private Integer pageSize; + /** 总条数. */ + private Integer pageTotals; + /** 总页页数. */ + private Integer pages; + /** 排序. */ + private String orderBy; + /** 是否查询总条数 true:查询,false:不查询. */ + private boolean isCount; + /** 当设置为true的时候,如果pagesize设置为0,就不执行分页,返回全部结果. */ + private boolean pageSizeZero; + /** 是否查询成功. */ + private boolean success; + + public PageBean() { + + } + + /** + * + * @param pageNo + * @param pageSize + */ + public PageBean(Integer pageNum, Integer pageSize) { + if (pageNum == 1 && pageSize.equals(Integer.MAX_VALUE)) { + pageSize = 0; + } + this.pageNum = pageNum; + this.pageSize = pageSize; + } + + public boolean getPageSizeZero() { + return pageSizeZero; + } + + public void setPageSizeZero(boolean pageSizeZero) { + this.pageSizeZero = pageSizeZero; + } + + public boolean getSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public List getDataList() { + if(null == dataList){ + dataList = new ArrayList<>(); + } + return dataList; + } + + public void setDataList(List dataList) { + this.dataList = dataList; + } + + public boolean getIsCount() { + return isCount; + } + + public void setIsCount(boolean isCount) { + this.isCount = isCount; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + if (pageNum < 0 || pageNum > Integer.MAX_VALUE) { + this.pageNum = 1; + } + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Integer getPageTotals() { + return pageTotals; + } + + public void setPageTotals(Integer pageTotals) { + this.pageTotals = pageTotals; + if (pageTotals == -1) { + this.pages = 1; + return; + } + if (this.pageSize > 0) { + this.pages = (int) (pageTotals / this.pageSize + ((pageTotals % this.pageSize == 0) ? 0 : 1)); + } else { + this.pages = 0; + } + } + + public Integer getPages() { + return pages; + } + + public void setPages(Integer pages) { + this.pages = pages; + } + + public String getOrderBy() { + return orderBy; + } + + public void setOrderBy(String orderBy) { + this.orderBy = orderBy; + } + + @Override + public String toString() { + return "PageBean [dataList=" + dataList + ", pageNum=" + pageNum + ", pageSize=" + pageSize + ", pageTotals=" + + pageTotals + ", pages=" + pages + ", orderBy=" + orderBy + ", isCount=" + isCount + ", pageSizeZero=" + + pageSizeZero + ", success=" + success + "]"; + } + +} \ No newline at end of file diff --git a/src/main/java/com/zteits/oa/api/base/bean/PageUtil.java b/src/main/java/com/zteits/oa/api/base/bean/PageUtil.java new file mode 100644 index 0000000..862cda0 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/PageUtil.java @@ -0,0 +1,63 @@ +package com.zteits.oa.api.base.bean; + +import com.zteits.oa.api.base.constants.PageSizeEnum; + +/** + * Copyright: Copyright (c) 2018 zteits + * + * @ClassName: com.clouds.common.utils.page + * @Description: 分页工具类 + * @version: v1.0.0 + * @author: atao + * @date: 2018/2/28 下午5:31 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2018/2/28 atao v1.0.0 创建 + */ +public class PageUtil { + + /** + * 校验pageSize,如不符合条件,将pageSize 重新赋值 + * + * @param sizeEnum 进行校验的 sizeEnum 枚举值 + * @param req 基础分页请求 + * @return 正确的pageSize + * @Author: atao + * @Date: 2018/2/28 下午5:34 + */ + public static int pageSizeValidate(PageSizeEnum sizeEnum, BaseRequest req) { + + int pageSize = req.getBaseRequest().getPageSize(); + //校验分页条数最小值 + pageSize = pageSize < sizeEnum.getMinValue() ? sizeEnum.getMinValue() + : pageSize; + //校验分页条数最大值 + pageSize = pageSize > sizeEnum.getMaxValue() ? sizeEnum.getMaxValue() + : pageSize; + + req.getBaseRequest().setPageSize(pageSize); + return pageSize; + } + + /** + * 校验pageSize,如不符合条件,将pageSize 重新赋值 + * + * @param sizeEnum 进行校验的 sizeEnum 枚举值 + * @param pageSize 待校验的pageSize + * @return + * @Author: atao + * @Date: 2018/2/28 下午5:34 + */ + public static int pageSizeValidate(PageSizeEnum sizeEnum, int pageSize) { + + //校验分页条数最小值 + pageSize = pageSize < sizeEnum.getMinValue() ? sizeEnum.getMinValue() + : pageSize; + //校验分页条数最大值 + pageSize = pageSize > sizeEnum.getMaxValue() ? sizeEnum.getMaxValue() + : pageSize; + + return pageSize; + } +} diff --git a/src/main/java/com/zteits/oa/api/base/bean/ResultBean.java b/src/main/java/com/zteits/oa/api/base/bean/ResultBean.java new file mode 100644 index 0000000..2a06668 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/bean/ResultBean.java @@ -0,0 +1,146 @@ +package com.zteits.oa.api.base.bean; + +import java.io.Serializable; + + +public class ResultBean implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + boolean success; + String errMsg; + DATA data; + CODE errCode; + String helpMsg; + + public ResultBean() { + success = true; + } + public ResultBean(DATA data) { + this.data = data; + success = true; + } + public ResultBean(boolean success, DATA data) { + this.data = data; + this.success = success; + } + public ResultBean(CODE errCode) { + this.errCode = errCode; + this.success = false; + } + public ResultBean(CODE errCode,String errMsg) { + this.errCode = errCode; + this.errMsg = errMsg; + this.success = false; + } + + public ResultBean(CODE errCode,String errMsg, DATA data) { + this.errCode = errCode; + this.errMsg = errMsg; + this.data = data; + this.success = false; + } + + public ResultBean(boolean success, CODE errCode,String errMsg, DATA data) { + this.errCode = errCode; + this.errMsg = errMsg; + this.data = data; + this.success = success; + } + + /** + * 重新初始化bean的所有属性 + */ + public void initSuccess(DATA data) { + init(true, null, null, data); + } + /** + * 重新初始化bean的所有属性 + */ + public void initError(CODE errCode) { + init(false, errCode, null, null); + } + /** + * 重新初始化bean的所有属性 + */ + public void initError(CODE errCode,String errMsg) { + init(false, errCode, errMsg, null); + } + + /** + * 重新初始化bean的所有属性 + */ + public void initError(String errMsg) { + init(false, null, errMsg, null); + } + + /** + * 重新初始化bean的所有属性 + */ + public void initError(CODE errCode,String errMsg, DATA data) { + init(false, errCode, errMsg, data); + } + + /** + * 重新初始化bean的所有属性 + */ + public void init(boolean success, CODE errCode,String errMsg, DATA data) { + this.errCode = errCode; + this.errMsg = errMsg; + this.data = data; + this.success = success; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + public DATA getData() { + return data; + } + + public void setData(DATA user) { + this.data = user; + + + } + public ErrorCode getErrCode() { + return errCode; + } + public void setErrCode(CODE errCode) { + this.errCode = errCode; + } + /** + * @return the helpMsg + */ + public String getHelpMsg() { + return helpMsg; + } + /** + * @param helpMsg the helpMsg to set + */ + public void setHelpMsg(String helpMsg) { + this.helpMsg = helpMsg; + } + @Override + public String toString() { + return "ResultBean [success=" + success + ", errMsg=" + errMsg + ", data=" + data + ", errCode=" + errCode + + ", helpMsg=" + helpMsg + "]"; + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/constants/BasicEnum.java b/src/main/java/com/zteits/oa/api/base/constants/BasicEnum.java new file mode 100644 index 0000000..0485235 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/constants/BasicEnum.java @@ -0,0 +1,33 @@ +package com.zteits.oa.api.base.constants; + +public enum BasicEnum { + + /**系统编码定义*/ + SYS_CODE("0001_SYS", "系统编码"); + + private String value; + private String desc; + + BasicEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + +} diff --git a/src/main/java/com/zteits/oa/api/base/constants/ErrorType.java b/src/main/java/com/zteits/oa/api/base/constants/ErrorType.java new file mode 100644 index 0000000..1b73694 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/constants/ErrorType.java @@ -0,0 +1,114 @@ +package com.zteits.oa.api.base.constants; + +import com.zteits.oa.api.base.bean.ErrorCode; + +public enum ErrorType implements ErrorCode { + + AUTH_PASS_ERROR("2000", "账号密码不匹配"), + AUTH_ROLE_EMPTY("2001", "账号无有效角色"), + AUTH_IMGCODE_ERROR("2002", "验证码错误"), + AUTH_TOKEN_NOT_EXISTS("2003", "授权令牌不存在或已失效"), + AUTH_TOKEN_ILLEGAL("2004", "授权令牌不合法"), + AUTH_TOKEN_AUTH_FAIL("2005", "无此权限"), + AUTH_PASS_WRONG_NUM_OVER("2006","密码输错次数超限,"), + AUTH_RES_EMPTY("2007","账号无有效资源"), + AUTH_ORG_EMPTY("2008","账号无有效在组织"), + AUTH_PL_NOS_EMPTY("2010","用户没有关联停车场"), + AUTH_STATE_ILLEGALITY("2009","账号状态异常"), + SYSTEM_ERROR("1000", "抱歉,服务暂时不可用,请稍后重试。"), + APP_ERROR("1001", "应用错误"), + BIZ_ERROR("1002", "业务错误:%s"), + PARAMM_NULL("1003", "入参不能为空:[%s]"), + OBJECT_NOT_EXISTS("1004", "对象不存在:[%s]"), + OBJECT_BELONG_ERROR("1005", "对象归属错误:[%s]"), + RESOURCE_NOT_EXISTS("1006", "访问的资源不存在"), + PARAM_NOT_VALID("1007", "参数校验失败:%s"), + CREATE_PAY_ORDER_FAIL("1008","生成支付单信息失败"), + CREATE_SIGIN_FAIL("1009","支付单签名失败"), + CACHE_NOT_EXISTS("1010","在缓存中不存在[%s]"), + SEND_MESSAGE_ERROR("1011","发送验证码失败"), + /***验证码不匹配*/ + SEND_VERIFI_CODE_ERROR("1012","验证码不匹配"), + /**验证码失效*/ + SEND_VERIFI_CODE_LESS("1013","验证码失效"), + PARK_LOT_NOT_EXISTS("1014","停车场记录不存在:%s"), + PARK_SEND_FAIL("1015","通知失败"), + PASS_NOT_MATCH("1016","两次密码不一致"), + CUST_INFO_HAS_EXISTS("1017","客户已存在"), + UPDATE_ROLE_ORGID_ERROR("1017","跟新角色组织Id失败"), + ADD_ROLE_ORG("1018","请在用户菜单 为用户分配组织,然后为用户分配角色"), + ONLY_UPLOAD_EXCLE("1019","只能上传xlsx或者lsx格式文件"), + NO_DATA_FOR_EXCLE("1020","请在excle添加数据后上传"), + SAVE_EXCLE_FAIL("1021","批量导入excle失败"), + EXCLE_COLM_ERROR("1022","excle模板错误"), + SYSTEM_UPDATING("1023","抱歉,服务正在升级,请稍后重试!"), + INTERFACE_NOT_SUPPORT("1024","抱歉,该功能已经更新,请升级至最新版本。"), + CALL_THIRD_SERVICE_EXCEPTION("1025","调用第三方服务异常"), + /*********PARK域**********/ + SAVE_PARK_ERROR("3000","保存停车场信息错误!"), + ALREADY_EXISTS("3001","当前编号[%s]在该停车场中已存在"), + EQPNO_EXISTS("3002","当前地磁编号已存在"), + PDANO_EXISTS("3003","当前PDA编号已存在"), + CHARGER_CODE_EXISTS("3004","该收费员账号已经存在,请重新输入"), + NOT_ALLOW_DEL_BERTH("3005","泊位已经关联地磁或有在停车辆,不允许删除"), + NOT_ALLOW_DEL_BERTH_AREA("3006","泊位区间下已经有泊位,请先删除泊位"), + NOT_ALLOW_DEL_AREA_BLOCK("3007","该办事处下面有停车场,不允许删除"), + NOT_ALLOW_DEL_PARK("3008","停车场下面已经有泊位区间,请先删除泊位区间"), + NOT_ALLOW_DEL_EMPLOYEE_GROUP("3009","收费组下面有收费员,不允许删除"), + BERTHS_ALREADY_RENT("3010","该车位已经被租用"), + NOT_ALLOW_CANCEL("3011","该车位不允许取消"), + GREATER_THEN_MAX_CANCEL_TIME("3012","超过最大取消次数"), + DATA_ALREADY_MODIFYED("3013","数据已经被其他业务修改,请重新查询"), + /***********PARK域********/ + /*********PAY域**********/ + ACCOUNT_NO_RECRET_NOT("4000","个人账户没有开通免密支付!"), + ACCOUNT_NO_MONEY("4001","个人账户余额不足!"), + NOTFUND_CUSTID_BY_CARNO("4002","该车牌暂未被绑定,无法找到对应客户"), + REFUND_FEE_FAIL("4003","退款失败"), + ACCOUNT_NO_FIND("4004","未找到个人账户信息!"), + NOTFUND_PAY_ORDER("4005","没有找到支付单信息"), + CUST_SIGN_ERROR("4006","签到失败"), + SYS_COMMON_ERROR("4007","码表查询失败"), + NOTFOUND_COUPON("4008","根据卡劵编码[%s]没有获取到响应的卡劵信息!"), + COUPON_NOTREST("4009","当前卡劵[%s]剩余数量不足!"), + UPDATE_COUPON_FAIL("4010","修改卡劵[%s]信息失败!"), + SAVE_COUPON_PERSON("4011","保存个人卡劵失败!"), + CUST_CARD_NO_NUM("4012","卡券已经售完!"), + PAY_ORDER_BACK("4013","补缴的单子为空!"), + THIRDPART_APPID_NOT_EXISTS("4014","appId不存在"), + PAY_TYPE_ERROR("4015","支付方式不正确"), + CREAT_PAYORDER_ERROR("4016","支付方式不正确"), + INVOICE_FEE_ERROR("4017","手机端开票金额计算有误"), + NOT_PAYED_ORDER("4018","有未支付单"), + ALREADY_OUT_PARK("4019","已经出场,无需重复操作"), + /***********PAY域********/ + /***********ORDER域*************/ + NOT_FOUND_PAY_ORDER("5000","未找到支付单"), + + + /**********Bill域***************/ + NOT_FOUND_VIP_CARD("6000","未根据个人卡券编码找到卡信息"), + VIP_CARD_NO_MONEY("6001","卡余额不足"), + /**********Bill域****************/ + + BIZ_SUCCESS("8888", "成功"); + + private String code; + private String msg; + + private ErrorType(String code, String msg) { + this.code = code; + this.msg = msg; + } + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getMsg() { + return this.msg; + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/constants/PageSizeEnum.java b/src/main/java/com/zteits/oa/api/base/constants/PageSizeEnum.java new file mode 100644 index 0000000..345221c --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/constants/PageSizeEnum.java @@ -0,0 +1,48 @@ +package com.zteits.oa.api.base.constants; + +/** + * Copyright: Copyright (c) 2018 zteits + * + * @ClassName: com.clouds.common.constants.pagequery + * @Description: 分页查询最大查询的值 + * @version: v1.0.0 + * @author: atao + * @date: 2018/2/27 下午2:39 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2018/2/27 atao v1.0.0 创建 + */ +public enum PageSizeEnum { + + PAGE_SIZE_BASE(1, 1000, "分页查询每页最小数量值"); + + /** + * 最小值 + */ + Integer minValue; + + /** + * 最大值 + */ + Integer maxValue; + String desc; + + PageSizeEnum(Integer minValue, Integer maxValue, String desc) { + this.minValue = minValue; + this.maxValue = maxValue; + this.desc = desc; + } + + public Integer getMinValue() { + return minValue; + } + + public Integer getMaxValue() { + return maxValue; + } + + public String getDesc() { + return desc; + } +} diff --git a/src/main/java/com/zteits/oa/api/base/exception/AppException.java b/src/main/java/com/zteits/oa/api/base/exception/AppException.java new file mode 100644 index 0000000..346b8c8 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/exception/AppException.java @@ -0,0 +1,108 @@ +package com.zteits.oa.api.base.exception; + +import com.zteits.oa.api.base.bean.ErrorCode; +import com.zteits.oa.api.base.constants.ErrorType; + +/** + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: AppException.java + * @Description: + * @version: v1.0.0 + * @author: liuzl + * @date: 2017年4月24日 下午4:51:41 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2017年4月24日 liuzl v1.0.0 创建 + * + * + * 应用级异常 + */ +public class AppException extends RuntimeException { + + private static final long serialVersionUID = 1L; + /** + * 错误编码 + */ + protected ErrorCode errCode; + + /** + * 错误信息 + */ + protected String errMsg; + + /** + * 无参构造函数 + */ + public AppException() { + super(); + } + + public AppException(ErrorCode errCode, String... errMsg) { + super(errCode.getMsg()); + this.errCode = errCode; + setErrMsg(errMsg,true); + } + + public AppException(ErrorCode errCode, String errMsg,Boolean isTransfer) { + super(errMsg); + this.errCode = errCode; + setErrMsg(new String[]{errMsg},isTransfer); + } + + public AppException(Throwable cause) { + super(cause); + this.errCode = ErrorType.SYSTEM_ERROR; + this.errMsg = cause.getMessage(); + } + + /** + * 构造函数 + * + * @param cause 异常 + */ + public AppException(ErrorCode errCode, Throwable cause, String... errMsg) { + super(errCode.getCode() + errCode.getMsg(), cause); + this.errCode = errCode; + setErrMsg(errMsg,true); + } + + public ErrorCode getErrCode() { + return errCode; + } + + public void setErrCode(ErrorCode errCode) { + this.errCode = errCode; + } + + public String getErrMsg() { + return this.errMsg; + } + + public void setErrMsg(String[] errMsg,Boolean isTransfer) { + + if (null != errMsg &&errMsg.length>0) { + if(errCode.getMsg().contains("%s") && isTransfer){ + this.errMsg = String.format(errCode.getMsg(), errMsg); + }else{ + StringBuffer sf = new StringBuffer(); + for (String msg : errMsg) { + sf.append(msg+";"); + } + this.errMsg = sf.toString(); + } + }else{ + this.errMsg = errCode.getMsg(); + } + + } + + public static void main(String[] args) { + String str = "ERRCode:1004--对象不存在:[%s]"; + if (str.contains("%s")){ + System.out.println("包含"); + } + } + +} diff --git a/src/main/java/com/zteits/oa/api/base/exception/BizException.java b/src/main/java/com/zteits/oa/api/base/exception/BizException.java new file mode 100644 index 0000000..3498463 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/base/exception/BizException.java @@ -0,0 +1,60 @@ +package com.zteits.oa.api.base.exception; + +import com.zteits.oa.api.base.bean.ErrorCode; +import com.zteits.oa.api.base.constants.ErrorType; + +/** + * + * + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: BizException.java + * @Description: + * @version: v1.0.0 + * @author: liuzl + * @date: 2017年4月24日 下午4:54:54 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年4月24日 liuzl v1.0.0 创建 + * + * 业务异常 + */ +public class BizException extends AppException{ + + private static final long serialVersionUID = 1L; + + + /** + * 无参构造函数 + */ + public BizException() { + super(); + } + + public BizException(ErrorType errorType) { + super(errorType); + } + + public BizException(ErrorCode errorCode, String ... errMsg) { + super(errorCode, errMsg); + } + /** + * 封装异常 + * @param errorCode + * @param errMsg + * @param isTransfer 是否转换异常信息,如果为false,则直接使用errMsg信息 + */ + public BizException(ErrorCode errorCode, String errMsg,Boolean isTransfer) { + super(errorCode, errMsg,isTransfer); + } + + public BizException(ErrorType errorType, String ... errMsg) { + super(errorType, errMsg); + } + + public BizException(ErrorType errCode, Throwable cause,String ... errMsg) { + super(errCode,cause, errMsg); + } + +} diff --git a/src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java b/src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java new file mode 100644 index 0000000..ac1566f --- /dev/null +++ b/src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java @@ -0,0 +1,271 @@ +package com.zteits.oa.api.dto.asraop; + +import java.util.Date; + +import com.zteits.oa.api.base.bean.BaiscDTO; +/** + * 工时系统操作员DTO.
+ * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: AmountUtils.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2018年7月30日 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2018年7月30日 wangfs v1.0.0 创建 + */ +public class AsraOpDTO extends BaiscDTO{ + /** + * + */ + private static final long serialVersionUID = -1744089914187990069L; + + /**主键*/ + private Long id; + + /**登录工号*/ + private String loginCode; + + /**登录密码*/ + private String loginPassword; + + /**操作员姓名*/ + private String opName; + + /**员工邮箱*/ + private String email; + + /**角色ID*/ + private Long roleId; + + /**地市ID*/ + private Long cityId; + + /**地市名称*/ + private String cityName; + + /**上级领导id 领导:-1*/ + private Long parentId; + + /**是否邮件提醒 1:是,0:否*/ + private Integer isRemindEmail; + + /**数据状态:1有效,0无效,2:锁定*/ + private Integer dataState; + + /**创建人ID*/ + private String createEmpid; + + /**创建人*/ + private String createEmpName; + + /**创建时间*/ + private Date createDate; + + /**修改人*/ + private String modfiyEmpid; + + /**修改人*/ + private String modfiyEmpName; + + /**修改时间*/ + private Date modfiyDate; + + /**描述*/ + private String remark; + + /**获取主键*/ + public Long getId() { + return id; + } + + /**设置主键*/ + public void setId(Long id) { + this.id = id; + } + + /**获取登录工号*/ + public String getLoginCode() { + return loginCode; + } + + /**设置登录工号*/ + public void setLoginCode(String loginCode) { + this.loginCode = loginCode == null ? null : loginCode.trim(); + } + + /**获取登录密码*/ + public String getLoginPassword() { + return loginPassword; + } + + /**设置登录密码*/ + public void setLoginPassword(String loginPassword) { + this.loginPassword = loginPassword == null ? null : loginPassword.trim(); + } + + /**获取操作员姓名*/ + public String getOpName() { + return opName; + } + + /**设置操作员姓名*/ + public void setOpName(String opName) { + this.opName = opName == null ? null : opName.trim(); + } + + /**获取员工邮箱*/ + public String getEmail() { + return email; + } + + /**设置员工邮箱*/ + public void setEmail(String email) { + this.email = email == null ? null : email.trim(); + } + + /**获取角色ID*/ + public Long getRoleId() { + return roleId; + } + + /**设置角色ID*/ + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + /**获取地市ID*/ + public Long getCityId() { + return cityId; + } + + /**设置地市ID*/ + public void setCityId(Long cityId) { + this.cityId = cityId; + } + + /**获取地市名称*/ + public String getCityName() { + return cityName; + } + + /**设置地市名称*/ + public void setCityName(String cityName) { + this.cityName = cityName == null ? null : cityName.trim(); + } + + /**获取上级领导id 领导:-1*/ + public Long getParentId() { + return parentId; + } + + /**设置上级领导id 领导:-1*/ + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + /**获取是否邮件提醒 1:是,0:否*/ + public Integer getIsRemindEmail() { + return isRemindEmail; + } + + /**设置是否邮件提醒 1:是,0:否*/ + public void setIsRemindEmail(Integer isRemindEmail) { + this.isRemindEmail = isRemindEmail; + } + + /**获取数据状态:1有效,0无效,2:锁定*/ + public Integer getDataState() { + return dataState; + } + + /**设置数据状态:1有效,0无效,2:锁定*/ + public void setDataState(Integer dataState) { + this.dataState = dataState; + } + + /**获取创建人ID*/ + public String getCreateEmpid() { + return createEmpid; + } + + /**设置创建人ID*/ + public void setCreateEmpid(String createEmpid) { + this.createEmpid = createEmpid == null ? null : createEmpid.trim(); + } + + /**获取创建人*/ + public String getCreateEmpName() { + return createEmpName; + } + + /**设置创建人*/ + public void setCreateEmpName(String createEmpName) { + this.createEmpName = createEmpName == null ? null : createEmpName.trim(); + } + + /**获取创建时间*/ + public Date getCreateDate() { + return createDate; + } + + /**设置创建时间*/ + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + /**获取修改人*/ + public String getModfiyEmpid() { + return modfiyEmpid; + } + + /**设置修改人*/ + public void setModfiyEmpid(String modfiyEmpid) { + this.modfiyEmpid = modfiyEmpid == null ? null : modfiyEmpid.trim(); + } + + /**获取修改人*/ + public String getModfiyEmpName() { + return modfiyEmpName; + } + + /**设置修改人*/ + public void setModfiyEmpName(String modfiyEmpName) { + this.modfiyEmpName = modfiyEmpName == null ? null : modfiyEmpName.trim(); + } + + /**获取修改时间*/ + public Date getModfiyDate() { + return modfiyDate; + } + + /**设置修改时间*/ + public void setModfiyDate(Date modfiyDate) { + this.modfiyDate = modfiyDate; + } + + /**获取描述*/ + public String getRemark() { + return remark; + } + + /**设置描述*/ + public void setRemark(String remark) { + this.remark = remark == null ? null : remark.trim(); + } + + @Override + public String toString() { + return "AsraOpDTO [id=" + id + ", loginCode=" + loginCode + ", loginPassword=" + loginPassword + ", opName=" + + opName + ", email=" + email + ", roleId=" + roleId + ", cityId=" + cityId + ", cityName=" + cityName + + ", parentId=" + parentId + ", isRemindEmail=" + isRemindEmail + ", dataState=" + dataState + + ", createEmpid=" + createEmpid + ", createEmpName=" + createEmpName + ", createDate=" + createDate + + ", modfiyEmpid=" + modfiyEmpid + ", modfiyEmpName=" + modfiyEmpName + ", modfiyDate=" + modfiyDate + + ", remark=" + remark + "]"; + } + +} diff --git a/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java b/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java new file mode 100644 index 0000000..e6f69c4 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java @@ -0,0 +1,51 @@ +package com.zteits.oa.api.dto.asraop.param; + +import com.zteits.oa.api.base.bean.BaseRequest; + +public class AsraOpQueryReq extends BaseRequest{ + + /** + * + */ + private static final long serialVersionUID = 7249746348000980054L; + + /**登录工号*/ + private String loginCode; + + /**操作员姓名*/ + private String opName; + + /**员工邮箱*/ + private String email; + + public String getLoginCode() { + return loginCode; + } + + public void setLoginCode(String loginCode) { + this.loginCode = loginCode; + } + + public String getOpName() { + return opName; + } + + public void setOpName(String opName) { + this.opName = opName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "AsraOpQueryReq [loginCode=" + loginCode + ", opName=" + opName + ", email=" + email + "]"; + } + + +} diff --git a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java new file mode 100644 index 0000000..15912b7 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java @@ -0,0 +1,35 @@ +package com.zteits.oa.api.service.report.query; + +import com.zteits.oa.api.base.bean.BizResult; +import com.zteits.oa.api.base.bean.PageBean; +import com.zteits.oa.api.dto.asraop.AsraOpDTO; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; + +/** + * 员工查询service.
+ * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: AmountUtils.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2018年7月30日 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2018年7月30日 wangfs v1.0.0 创建 + */ + + + +public interface AsraOpRueryService { + + /** + * 分页查询工时系统员工信息.
+ * @param asraOpQueryReq + * @return + * 2018年7月30日 wangfs.
+ */ + BizResult> queryAsraOpForPage(AsraOpQueryReq asraOpQueryReq); +} diff --git a/src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java b/src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java new file mode 100644 index 0000000..f23c7fc --- /dev/null +++ b/src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java @@ -0,0 +1,55 @@ +package com.zteits.oa.report.biz; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.zteits.oa.api.base.bean.BizResult; +import com.zteits.oa.api.base.bean.PageBean; +import com.zteits.oa.api.dto.asraop.AsraOpDTO; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.api.service.report.query.AsraOpRueryService; +import com.zteits.oa.report.dao.AsraOpDao; +import com.zteits.oa.report.domain.AsraOp; +import com.zteits.oa.util.pagepaper.PageBeanUtil; +/** + * 工时系统操作员实现类.
+ * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: AmountUtils.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2018年7月30日 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2018年7月30日 wangfs v1.0.0 创建 + */ +@Service("") +public class AsraOpRueryServiceImpl implements AsraOpRueryService { + + private static final Logger logger = LoggerFactory.getLogger(AsraOpRueryServiceImpl.class); + @Autowired + private AsraOpDao asraOpDao; + /** + * 分页查询工时系统员工信息.
+ * @param asraOpQueryReq + * @return + * 2018年7月30日 wangfs.
+ */ + @Override + public BizResult> queryAsraOpForPage(AsraOpQueryReq asraOpQueryReq) { + logger.info("---begin查询分页员工信息..入参={}",JSONObject.toJSON(asraOpQueryReq)); + PageBean pageBean = new PageBean(); + PageInfo pageInfo = asraOpDao.queryAsraOpForPage(asraOpQueryReq); + PageBeanUtil.copyProperties(pageInfo, pageBean, AsraOpDTO.class); + logger.info("---end查询分页员工信息.."); + return new BizResult>(pageBean); + } + +} diff --git a/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java b/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java new file mode 100644 index 0000000..5f4ca0c --- /dev/null +++ b/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java @@ -0,0 +1,16 @@ +package com.zteits.oa.report.dao; + +import com.github.pagehelper.PageInfo; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.report.domain.AsraOp; + +public interface AsraOpDao { + + /** + * 分页查询工时系统员工信息.
+ * @param asraOpQueryReq + * @return + * 2018年7月30日 wangfs.
+ */ + PageInfo queryAsraOpForPage(AsraOpQueryReq asraOpQueryReq); +} diff --git a/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java new file mode 100644 index 0000000..5d4e883 --- /dev/null +++ b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java @@ -0,0 +1,34 @@ +package com.zteits.oa.report.dao.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.report.dao.AsraOpDao; +import com.zteits.oa.report.domain.AsraOp; +import com.zteits.oa.report.mapper.smapper.AsraOpSmapper; +@Component +public class AsraOpDaoImpl implements AsraOpDao { + + @Autowired + private AsraOpSmapper asraOpSmapper; + /** + * 分页查询工时系统员工信息.
+ * @param asraOpQueryReq + * @return + * 2018年7月30日 wangfs.
+ */ + @Override + public PageInfo queryAsraOpForPage(AsraOpQueryReq asraOpQueryReq) { + //1.设置分页 + PageHelper.startPage(asraOpQueryReq.getBaseRequest().getPageNum(), asraOpQueryReq.getBaseRequest().getPageSize()); + //2.查询数据 + List list = asraOpSmapper.queryAsraOpForList(asraOpQueryReq); + return new PageInfo(list); + } + +} diff --git a/src/main/java/com/zteits/oa/report/mapper/smapper/AsraOpSmapper.java b/src/main/java/com/zteits/oa/report/mapper/smapper/AsraOpSmapper.java new file mode 100644 index 0000000..7439fd3 --- /dev/null +++ b/src/main/java/com/zteits/oa/report/mapper/smapper/AsraOpSmapper.java @@ -0,0 +1,17 @@ +package com.zteits.oa.report.mapper.smapper; + +import java.util.List; + +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.report.domain.AsraOp; + +public interface AsraOpSmapper { + + /** + * 查询操作员list.
+ * @param asraOpQueryReq + * @return + * 2018年7月30日 wangfs.
+ */ + List queryAsraOpForList(AsraOpQueryReq asraOpQueryReq); +} diff --git a/src/main/java/com/zteits/oa/report/web/demo/DemoController.java b/src/main/java/com/zteits/oa/report/web/demo/DemoController.java index db20fbc..90af109 100644 --- a/src/main/java/com/zteits/oa/report/web/demo/DemoController.java +++ b/src/main/java/com/zteits/oa/report/web/demo/DemoController.java @@ -2,22 +2,31 @@ package com.zteits.oa.report.web.demo; import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.zteits.oa.api.base.bean.BizResult; +import com.zteits.oa.api.base.bean.PageBean; +import com.zteits.oa.api.dto.asraop.AsraOpDTO; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.api.service.report.query.AsraOpRueryService; + import io.swagger.annotations.Api; @Api(value = "swagger测试", description = "swagger测") @RestController @RequestMapping("/demo") public class DemoController { + @Autowired + private AsraOpRueryService asraOpRueryService; @RequestMapping(value="/demo",method = RequestMethod.POST) - public String test(@RequestBody String param, HttpServletRequest request){ - - return param; + public BizResult> test(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request){ + BizResult> result = asraOpRueryService.queryAsraOpForPage(asraOpQueryReq); + return result; } } diff --git a/src/main/java/com/zteits/oa/util/pagepaper/PageBeanUtil.java b/src/main/java/com/zteits/oa/util/pagepaper/PageBeanUtil.java new file mode 100644 index 0000000..8cfa1a5 --- /dev/null +++ b/src/main/java/com/zteits/oa/util/pagepaper/PageBeanUtil.java @@ -0,0 +1,76 @@ +package com.zteits.oa.util.pagepaper; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.BeanUtils; + +import com.github.pagehelper.PageInfo; +import com.zteits.oa.api.base.bean.PageBean; + +/** + * 分页插件结果转换工具类.
+ * + * Copyright: Copyright (c) 2017 zteits + * + * @ClassName: PageBeanUtil.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2017年4月19日 下午4:03:33 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2017年4月19日 wangfs v1.0.0 创建 + */ +public class PageBeanUtil { + + /** + * 将PageInfo 转换成PageBean.
+ * @param form PageInfo 对象.
+ * @param to PageBean 对象.
+ * @param clazz + */ + public static void copyProperties(PageInfo form,PageBean to,Class clazz){ + if(form != null && to != null && clazz != null){ + List list = new ArrayList(); + if(!org.springframework.util.CollectionUtils.isEmpty(form.getList())){ + for(R source:form.getList()){ + if(source == null){ + continue; + } + try { + L target = clazz.newInstance(); + BeanUtils.copyProperties(source, target); + list.add(target); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + to.setDataList(list); + to.setPageNum(form.getPageNum()); + to.setPageSize(form.getPageSize()); + to.setPages(form.getPages()); + to.setPageTotals(Integer.valueOf(String.valueOf(form.getTotal()))); + }else{ + to.setDataList(list); + to.setPageNum(form.getPageNum()); + to.setPageSize(form.getPageSize()); + to.setPages(form.getPages()); + to.setPageTotals(Integer.valueOf(String.valueOf(form.getTotal()))); + } + }else{ + try { + throw new Exception("源对象,目标对象,clazz 不能为空!"); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + + +} diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 1ee1460..0f29eaa 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,9 +1,16 @@ + + + + + + + ${LOG_PATH}/${LOG_FILE} - ${logging.path}${logging.file}-%d{yyyy-MM-dd}.%i.log + ${LOG_FILE}-%d{yyyy-MM-dd}.%i.log 1GB 60 @@ -27,7 +34,7 @@ UTF-8 - + diff --git a/src/main/resources/mybatis/smapper/AsraOpSmapper.xml b/src/main/resources/mybatis/smapper/AsraOpSmapper.xml new file mode 100644 index 0000000..64ff195 --- /dev/null +++ b/src/main/resources/mybatis/smapper/AsraOpSmapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id, login_code, login_password, op_name, email, role_id, city_id, city_name, parent_id, + is_remind_email, data_state, create_empid, create_emp_name, create_date, modfiy_empid, + modfiy_emp_name, modfiy_date, remark + + + + + \ No newline at end of file -- libgit2 0.21.4