From 12f6e2c14b19a230422d9e8e4e5c7eba96f058f7 Mon Sep 17 00:00:00 2001 From: wangjie Date: Mon, 26 Aug 2019 19:04:08 +0800 Subject: [PATCH 01/26] =?UTF-8?q?mes-pcn=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=A1=A8=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java | 75 ++++++++++++++++++++++ .../cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java | 75 ++++++++++++++++++++++ .../pojo/mes/repository/MesPcnTaskRepository.java | 16 +++++ .../estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java | 19 ++++++ 4 files changed, 185 insertions(+) create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesPcnTaskRepository.java diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java new file mode 100644 index 0000000..0ccb531 --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java @@ -0,0 +1,75 @@ +package cn.estsh.i3plus.pojo.mes.pcn.bean; + + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description :mes-pcn定时任务工作清单 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-26 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name="MES_PCN_TASK") +@Api("mes-pcn定时任务工作清单") +public class MesPcnTask extends BaseBean { + + @Column(name="TASK_CODE") + @ApiParam("任务代码") + private String taskCode; + + @Column(name="TASK_NAME") + @ApiParam("任务名称") + private String taskName; + + @Column(name="TASK_DESCRIPTION") + @ApiParam("任务描述") + private String taskDescription; + + @Column(name="TASK_TYPE") + @ApiParam("任务类型") + private Integer taskType; + + @Column(name="TASK_MODULE") + @ApiParam("任务模块") + private String taskModule; + + @Column(name="TASK_CLASS") + @ApiParam("任务类名") + private String taskClass; + + @Column(name="TASK_PACKAGE") + @ApiParam("任务包名") + private String taskPackage; + + @Column(name="PCN_NAME") + @ApiParam("PCN节点名称") + private String pcnName; + + @Column(name="TASK_CYCLE_EXPS") + @ApiParam("任务周期表达式") + private String taskCycleExps; + + @Column(name="TASK_CYCLE_DESCRIPTION") + @ApiParam("任务周期描述") + private String taskCycleDescription; + + public int getTaskTypeVal() { + return this.taskType == null ? 0 : this.taskType; + } +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java new file mode 100644 index 0000000..27daf23 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java @@ -0,0 +1,75 @@ +package cn.estsh.i3plus.pojo.mes.bean; + + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description :mes-pcn定时任务工作清单 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-26 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name="MES_PCN_TASK") +@Api("mes-pcn定时任务工作清单") +public class MesPcnTask extends BaseBean { + + @Column(name="TASK_CODE") + @ApiParam("任务代码") + private String taskCode; + + @Column(name="TASK_NAME") + @ApiParam("任务名称") + private String taskName; + + @Column(name="TASK_DESCRIPTION") + @ApiParam("任务描述") + private String taskDescription; + + @Column(name="TASK_TYPE") + @ApiParam("任务类型") + private Integer taskType; + + @Column(name="TASK_MODULE") + @ApiParam("任务模块") + private String taskModule; + + @Column(name="TASK_CLASS") + @ApiParam("任务类名") + private String taskClass; + + @Column(name="TASK_PACKAGE") + @ApiParam("任务包名") + private String taskPackage; + + @Column(name="PCN_NAME") + @ApiParam("PCN节点名称") + private String pcnName; + + @Column(name="TASK_CYCLE_EXPS") + @ApiParam("任务周期表达式") + private String taskCycleExps; + + @Column(name="TASK_CYCLE_DESCRIPTION") + @ApiParam("任务周期描述") + private String taskCycleDescription; + + public int getTaskTypeVal() { + return this.taskType == null ? 0 : this.taskType; + } +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesPcnTaskRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesPcnTaskRepository.java new file mode 100644 index 0000000..cd51761 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesPcnTaskRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.bean.MesPcnTask; +import org.springframework.stereotype.Repository; + +/** + * @Description :mes-pcn定时任务清单 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-26 + * @Modify: + **/ +@Repository +public interface MesPcnTaskRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java index b509989..511125e 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java @@ -1103,4 +1103,23 @@ public class MesHqlPack { packBean.setOrderByStr(numberRule.orderBy()); return packBean; } + + /** + * mes-pcn定时任务清单 + * @param mesPcnTask + * @param organizeCode + * @return + */ + public static DdlPackBean getMesPcnTask(MesPcnTask mesPcnTask, String organizeCode) { + DdlPackBean packBean = getAllBaseDataByNormalPro(mesPcnTask, organizeCode); + if (StringUtils.isNotEmpty(mesPcnTask.getTaskCode())) { + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean); + } + if (StringUtils.isNotEmpty(mesPcnTask.getTaskName())) { + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); + } + + packBean.setOrderByStr(mesPcnTask.orderBy()); + return packBean; + } } From d2036fd8410488c6b7ae3ee9f7ecab8df5929b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=BF=83=E6=B4=81?= Date: Tue, 27 Aug 2019 18:50:43 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E4=BB=BB=E5=8A=A1961=EF=BC=8C962?= =?UTF-8?q?=EF=BC=8C966=EF=BC=8C973?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/model/wms}/WmsActionResponseBean.java | 71 ++++++++-------------- .../pojo/model/wms/WmsMessageStyleModel.java | 43 +++++++++++++ .../i3plus/pojo/model/wms/WmsTaskInfoModel.java | 3 + .../pojo/wms/bean/WmsActionGroupDetails.java | 26 ++++++-- 4 files changed, 94 insertions(+), 49 deletions(-) rename modules/{i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean => i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms}/WmsActionResponseBean.java (72%) create mode 100644 modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionResponseBean.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsActionResponseBean.java similarity index 72% rename from modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionResponseBean.java rename to modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsActionResponseBean.java index 11a2cf3..9ef9648 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionResponseBean.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsActionResponseBean.java @@ -1,5 +1,7 @@ -package cn.estsh.i3plus.pojo.wms.bean; +package cn.estsh.i3plus.pojo.model.wms; +import cn.estsh.i3plus.pojo.wms.bean.WmsOptionModel; +import cn.estsh.i3plus.pojo.wms.bean.WmsTransType; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.Api; @@ -43,19 +45,7 @@ public class WmsActionResponseBean implements Serializable { public String message; @ApiParam("列表信息") - public List informations; - public List getInformations(){ - if(informations == null){ - informations= new ArrayList<>(); - } - return informations; - } - public void setInformation(List list){ - if(list == null){ - list = new ArrayList<>(); - } - informations = list; - } + public List informations; @ApiParam("可选项") public List options; @@ -88,50 +78,42 @@ public class WmsActionResponseBean implements Serializable { */ @ApiParam(value = "是否需要选择单号") public Boolean toSelected = false; - - /** - * 默认为true,如果这个值为true就禁用按钮否则可用, - */ - @ApiParam(value = "按钮是否禁用") - public Boolean isBtnDisabled = true; - - /** - * 默认为true,如果这个值为true就禁用按钮否则可用, - */ - @ApiParam(value = "按钮是否禁用") - public Boolean isDetailsBtnDisabled = true; - /** - * 默认为true,如果这个值为true就禁用按钮否则可用, + * 与 toSelected 属性配合使用, + * 选择数据后把选中行的 keyColumn 字段的值写入界面输入框并触发回车事件 */ - @ApiParam(value = "按钮是否禁用") - public Boolean isCommitBtnDisabled = true; - + @ApiParam(value = "关键字段列名") + public String keyColumn; /** * 默认为true,如果这个值为true就禁用按钮否则可用, */ @ApiParam(value = "输入框是否禁用") public Boolean isInputBtnDisabled = false; - /** - * 与 toSelected 属性配合使用, - * 选择数据后把选中行的 keyColumn 字段的值写入界面输入框并触发回车事件 - */ - @ApiParam(value = "关键字段列名") - public String keyColumn; - - @ApiParam(value = "是否完成流程操作") - public Boolean isComplete = false; - @ApiParam(value = "交易类型信息") public WmsTransType wmsTransType; + @ApiParam(value = "是否自动开窗") + public Boolean isAutoOpenWindow = false; + + @ApiParam(value = "正则校验") + private String regularCheck; + + @ApiParam(value = "正则校验失败提示") + private String regularCheckFailMsg; + + @ApiParam(value = "搜索KEY") + public String searchKey; + + @ApiParam(value = "分组KEY") + public String groupKey; + public WmsActionResponseBean(Boolean codeStatus, String message) { this.codeStatus = codeStatus; this.message = message; } - public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus, Map barCode) { + public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus, Map barCode) { this.percent = percent; this.message = message; this.informations = informations; @@ -140,7 +122,7 @@ public class WmsActionResponseBean implements Serializable { this.barCode = barCode; } - public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus) { + public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus) { this.percent = percent; this.message = message; this.informations = informations; @@ -148,8 +130,7 @@ public class WmsActionResponseBean implements Serializable { this.codeStatus = codeStatus; } - public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus, Boolean isBtnDisabled) { - this.isBtnDisabled = isBtnDisabled; + public WmsActionResponseBean(String percent, String message, List informations, Obj details, Boolean codeStatus, Boolean isBtnDisabled) { this.percent = percent; this.message = message; this.informations = informations; diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java new file mode 100644 index 0000000..edbc48f --- /dev/null +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java @@ -0,0 +1,43 @@ +package cn.estsh.i3plus.pojo.model.wms; + +import io.swagger.annotations.ApiParam; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 消息样式实体类 + * @Reference + * @Author dragon + * @CreateDate 2019/8/26 10:36 + * @Modify + */ +@Data +public class WmsMessageStyleModel implements Serializable { + private static final long serialVersionUID = -810847996371452831L; + @ApiParam("任务状态") + public Integer taskStatus; + @ApiParam("单据明细状态") + public Integer odStatus; + + @ApiParam("消息") + public String message; + + @ApiParam("前景色") + public String foregroundColor; + @ApiParam("背景色") + public String backgroundColor; + @ApiParam("是否粗体") + public boolean isBold; + @ApiParam("是否斜体") + public boolean isItalics; + @ApiParam("字号") + public Integer fontSize; + + public WmsMessageStyleModel() { + } + + public WmsMessageStyleModel(String message) { + this.message = message; + } +} diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsTaskInfoModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsTaskInfoModel.java index e1ede6a..dad2ec7 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsTaskInfoModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsTaskInfoModel.java @@ -53,6 +53,9 @@ public class WmsTaskInfoModel implements Serializable { @ApiParam(value = "供应商编号") private String vendorNo; + @ApiParam(value = "样式") + private WmsMessageStyleModel wmsMessageStyleModel; + public WmsTaskInfoModel() { } diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionGroupDetails.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionGroupDetails.java index 5062bec..1cdfb49 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionGroupDetails.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsActionGroupDetails.java @@ -61,6 +61,14 @@ public class WmsActionGroupDetails extends BaseBean { @ApiParam(value = "长度检查", example = "0") private Integer lenCheck; + @Column(name = "REGULAR_CHECK") + @ApiParam(value = "正则校验") + private String regularCheck; + + @Column(name = "REGULAR_CHECK_FAIL_MSG") + @ApiParam(value = "正则校验失败提示") + private String regularCheckFailMsg; + @Column(name = "AS_ID") @ApiParam(value = "作业步骤", example = "0") @JsonSerialize(using = ToStringSerializer.class) @@ -100,6 +108,16 @@ public class WmsActionGroupDetails extends BaseBean { @ApiParam(value = "是否可提交", example = "2") private Integer isCommitAble; + @Column(name = "IS_AUTO_OPEN_WINDOW") + @ApiParam(value = "是否自动开窗", example = "2") + private Integer isAutoOpenWindow; + + @ApiParam(value = "搜索KEY") + public String searchKey; + + @ApiParam(value = "分组KEY") + public String groupKey; + public int getSeqVal() { return this.seq == null ? 0 : this.seq; } @@ -112,10 +130,6 @@ public class WmsActionGroupDetails extends BaseBean { return this.okSeq == null ? 0 : this.okSeq; } - public int getPreShowVal() { - return this.preShow == null ? 0 : this.preShow; - } - public long getShowAmIdVal() { return this.showAmId == null ? 0 : this.showAmId; } @@ -124,6 +138,10 @@ public class WmsActionGroupDetails extends BaseBean { return this.isCommitAble == null ? 0 : this.isCommitAble; } + public int getIsAutoOpenWindowVal() { + return this.isAutoOpenWindow == null ? 0 : this.isAutoOpenWindow; + } + public int getValueTypeVal() { return this.valueType == null ? 0 : this.valueType; } From 2ef0dd5c3bd42d0a67e17d324160156712365dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E4=BA=91=E6=98=8A?= Date: Tue, 27 Aug 2019 19:15:24 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E5=91=A8=E6=9C=9F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/estsh/i3plus/pojo/platform/bean/SysTaskPlan.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysTaskPlan.java b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysTaskPlan.java index 6b239f8..eac48cd 100644 --- a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysTaskPlan.java +++ b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysTaskPlan.java @@ -132,4 +132,11 @@ public class SysTaskPlan extends BaseBean { @Column(name = "NOTICE_CHANNEL") @ApiParam(value = "通知渠道") private String noticeChannel; + + public int getTaskPlanStatusVal() { + if(taskPlanStatus != null){ + return taskPlanStatus.intValue(); + } + return taskPlanStatus; + } } From f820c449bb13b536901d968e9cc2dc5eb8b564b2 Mon Sep 17 00:00:00 2001 From: crish <570360737@qq.com> Date: Tue, 27 Aug 2019 20:29:36 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E5=B7=A5=E6=AD=A5=E6=9D=A1=E7=A0=81?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: crish <570360737@qq.com> --- .../pojo/mes/pcn/model/StepPrintSnModel.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/model/StepPrintSnModel.java diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/model/StepPrintSnModel.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/model/StepPrintSnModel.java new file mode 100644 index 0000000..bd0498c --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/model/StepPrintSnModel.java @@ -0,0 +1,22 @@ +package cn.estsh.i3plus.pojo.mes.pcn.model; + +import cn.estsh.i3plus.pojo.mes.pcn.bean.MesProduceSn; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; + +import java.util.List; + +/** + * @Description: 打印条码工步, 打印信息模板 + * @Reference: + * @Author: Crish + * @CreateDate:2019-08-27-13:24 + * @Modify: + **/ +@Data +@Api("过程条码打印信息模板") +public class StepPrintSnModel extends MesProduceSn { + @ApiParam("打印描述") + private String printDesc; +} From 592cd15add20850b77c9086d831a130505676ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=95=8F?= <962239776@qq.com> Date: Tue, 27 Aug 2019 20:33:27 +0800 Subject: [PATCH 05/26] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E3=80=81=E5=BA=93=E4=BD=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=B7=A5=E5=8E=82=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/estsh/i3plus/pojo/base/enumutil/WmsEnumUtil.java | 3 +-- .../src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsLocate.java | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/WmsEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/WmsEnumUtil.java index 203bbce..f324149 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/WmsEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/WmsEnumUtil.java @@ -1139,8 +1139,7 @@ public class WmsEnumUtil { CREATE(10, "创建"), BE_HANDLE(20, "待处理"), FINISH(30, "已处理"), - HANDLE_ERROR(40, "处理出错"), - TEST(50, "调试"); + HANDLE_ERROR(40, "处理出错"); private int value; private String description; diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsLocate.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsLocate.java index 4c288f4..4bc52e7 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsLocate.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsLocate.java @@ -11,6 +11,7 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; +import javax.persistence.Transient; /** * @Description : 库位表 @@ -96,6 +97,11 @@ public class WmsLocate extends BaseBean { @ApiParam(value = "零件数", example = "-1") private Double partQty; + // 导入用 + @ApiParam(value = "工厂") + @Transient + private String factory; + public Integer getMaxPackageQty() { return this.maxPackageQty == null ? 0 : this.maxPackageQty.intValue(); } From 953f593207aee60ce22baf018a2c36c231b58ff4 Mon Sep 17 00:00:00 2001 From: WYnneaoapc Date: Tue, 27 Aug 2019 20:52:39 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/MesEnumUtil.java | 34 +++++++++++ .../i3plus/pojo/mes/pcn/bean/MesNumberRule.java | 2 +- .../estsh/i3plus/pojo/mes/bean/MesNumberRule.java | 2 +- .../pojo/mes/model/FastDfsDownloadModel.java | 2 +- .../i3plus/pojo/mes/model/GenSerialNoModel.java | 70 ++++++++++++++++++++++ .../pojo/mes/repository/MesMethodRepository.java | 3 - .../mes/repository/MesNumberRuleRepository.java | 16 +++++ .../repository/MesNumberSerialnoRepository.java | 16 +++++ .../estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java | 33 +++++++++- 9 files changed, 171 insertions(+), 7 deletions(-) create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/GenSerialNoModel.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberRuleRepository.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberSerialnoRepository.java diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java index e140fef..d119c27 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java @@ -861,5 +861,39 @@ public class MesEnumUtil { } } + /** + * 条码生成业务类型 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum COMPANY_TYPE { + PREFIX("prefix", "前缀"), + PART_NO("partNo", "物料号"), + CUST_PART_NO("custPartNo", "客户物料号"), + CUST_CODE("custCode", "客户代码"), + PROD_LOCATION("prodLocation", "产地"), + YEAR("year", "年"), + MOTH("month", "月"), + DAY("day", "日"), + HOUR("hour", "小时"), + MINUTE("minute", "分钟"), + SECOND("second", "秒"), + SERIAL("serialNo", "序列号"); + + private String value; + private String description; + + COMPANY_TYPE(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + } } diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesNumberRule.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesNumberRule.java index 0d83b74..9285d25 100644 --- a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesNumberRule.java +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesNumberRule.java @@ -38,7 +38,7 @@ public class MesNumberRule extends BaseBean { @Column(name = "PREFIX") @ApiParam("前缀") - private Integer prefix; + private String prefix; @Column(name = "NUMBER_RULE") @ApiParam("编码规则") diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesNumberRule.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesNumberRule.java index ab0ae70..edbbdeb 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesNumberRule.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesNumberRule.java @@ -38,7 +38,7 @@ public class MesNumberRule extends BaseBean { @Column(name = "PREFIX") @ApiParam("前缀") - private Integer prefix; + private String prefix; @Column(name = "NUMBER_RULE") @ApiParam("编码规则") diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/FastDfsDownloadModel.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/FastDfsDownloadModel.java index 0e0da69..d58ea90 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/FastDfsDownloadModel.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/FastDfsDownloadModel.java @@ -10,7 +10,7 @@ import lombok.NoArgsConstructor; /** * @Author: Wynne.Lu * @CreateDate: 2019/8/19 7:00 PM - * @Description: + * @Description: mes文件下载的model -> Esop **/ @Data diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/GenSerialNoModel.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/GenSerialNoModel.java new file mode 100644 index 0000000..7d68ab1 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/model/GenSerialNoModel.java @@ -0,0 +1,70 @@ +package cn.estsh.i3plus.pojo.mes.model; + + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberSerialno; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.Column; + +/** + * @Author: Wynne.Lu + * @CreateDate: 2019/8/23 11:42 AM + * @Description: + **/ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Api("生成条码模型") +public class GenSerialNoModel extends BaseBean { + + @ApiParam("规则代码") + private String ruleCode; + + @ApiParam("规则描述") + private String ruleDesc; + + @ApiParam("物料号") + private String partNo; + + @ApiParam("客户物料号") + private String custPartNo; + + @ApiParam("客户代码") + private String custCode; + + @ApiParam("产地") + private String prodLocation; + + @ApiParam("前缀") + private Integer prefix; + + @ApiParam("编码规则") + private String numberRule; + + @ApiParam("序号长度") + private Integer serialnoLength; + + @ApiParam("增量") + private Integer serialnoIncrement; + + @ApiParam("最大值后循环") + private Integer isCycle; + + @ApiParam("当前编号前缀") + private String currentNumberPrefix; + + @ApiParam("当前序号") + private Integer currentSerialno; + + @ApiParam("当前编号") + private String currentNumber; + + +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesMethodRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesMethodRepository.java index d845f61..de4ffea 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesMethodRepository.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesMethodRepository.java @@ -16,7 +16,4 @@ import java.util.List; @Repository public interface MesMethodRepository extends BaseRepository { - List findByMethodCodeAndIsValidAndIsDeleted(String methodCode, Integer isValid, Integer isDeleted); - - List findByOrganizeCodeAndIsDeleted(String organizeCode, int value); } diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberRuleRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberRuleRepository.java new file mode 100644 index 0000000..7b0d09c --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberRuleRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.repository; + + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import org.springframework.stereotype.Repository; + +/** + * @Author: Wynne.Lu + * @CreateDate: 2019/8/23 1:22 PM + * @Description: + **/ + +@Repository +public interface MesNumberRuleRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberSerialnoRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberSerialnoRepository.java new file mode 100644 index 0000000..02be967 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesNumberSerialnoRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.repository; + + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberSerialno; +import org.springframework.stereotype.Repository; + +/** + * @Author: Wynne.Lu + * @CreateDate: 2019/8/23 1:23 PM + * @Description: + **/ + +@Repository +public interface MesNumberSerialnoRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java index 648be8b..2558f43 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java @@ -234,6 +234,14 @@ public class MesHqlPack { return packBean; } + public static DdlPackBean getAllBaseDataByNormalPro(String organizeCode) { + DdlPackBean packBean = new DdlPackBean(); + DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean); + return packBean; + } + /** * MES区域信息查询条件封装 * @@ -445,6 +453,19 @@ public class MesHqlPack { * @param mesESOP * @return */ + public static DdlPackBean getMesESOPExcludeById(MesESOP mesESOP, String org) { + DdlPackBean packBean = getAllBaseDataByNormalPro(org); + DdlPreparedPack.getStringEqualPack(mesESOP.getPartNo(), "partNo", packBean); + DdlPreparedPack.getStringEqualPack(mesESOP.getRouteCode(), "routeCode", packBean); + DdlPreparedPack.getStringEqualPack(mesESOP.getProcessCode(), "processCode", packBean); + DdlPreparedPack.getStringEqualPack(mesESOP.getStepCode(), "stepCode", packBean); + DdlPreparedPack.getNumEqualPack(mesESOP.getStepSeq(), "stepSeq", packBean); + DdlPreparedPack.getStringEqualPack(mesESOP.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(mesESOP.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getNumNOEqualPack(mesESOP.getId(), "id", packBean); + return packBean; + } + public static DdlPackBean getMesESOP(MesESOP mesESOP, String organizeCode) { DdlPackBean packBean = getAllBaseDataByNormalPro(mesESOP, organizeCode); if (StringUtils.isNotEmpty(mesESOP.getWorkCenterCode())) { @@ -834,9 +855,19 @@ public class MesHqlPack { /** * MES 产品配置信息查询条件封装 * - * @param prodCfg + * @param * @return */ + + public static DdlPackBean getMesProdCfgExcludeById(MesProdRouteCfg mesProdRouteCfg, String org) { + DdlPackBean packBean = getAllBaseDataByNormalPro(org); + DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getPartNo(), "partNo", packBean); + DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getRouteCode(), "routeCode", packBean); + DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getNumNOEqualPack(mesProdRouteCfg.getId(), "id", packBean); + return packBean; + } + public static DdlPackBean getMesProdCfg(MesProdCfg prodCfg, String organizeCode) { DdlPackBean packBean = getAllBaseDataByNormalPro(prodCfg, organizeCode); if (StringUtils.isNotEmpty(prodCfg.getProdCfgCode())) { From 2325d18660caf97f40d763205bf0ba460b87b945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E4=BA=91=E6=98=8A?= Date: Wed, 28 Aug 2019 11:49:24 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=99=A8=20=E8=AE=A4=E8=AF=81=E5=8F=82=E6=95=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/base/annotation/AnnoOutputColumn.java | 2 - .../pojo/base/enumutil/SoftSwitchEnumUtil.java | 69 ++++++++++++++++++++++ .../i3plus/pojo/base/tool/DdlPreparedPack.java | 1 + .../pojo/model/softswitch/SuitCoreModel.java | 4 +- .../pojo/softswitch/bean/BsParamAdapter.java | 2 +- .../i3plus/pojo/softswitch/bean/BsSslKey.java | 16 ++--- .../i3plus/pojo/softswitch/bean/BsSslKeyParam.java | 8 ++- .../i3plus/pojo/softswitch/bean/BsSuitCase.java | 6 +- .../i3plus/pojo/softswitch/bean/BsSuitRecord.java | 4 ++ ...SuitRecordParam.java => BsSuitRecordParam.java} | 2 +- .../repository/BsSslKeyParamRepository.java | 14 +++++ .../softswitch/repository/BsSslKeyRepository.java | 2 +- ...itory.java => BsSuitRecordParamRepository.java} | 4 +- .../pojo/softswitch/sqlpack/SoftSwitchHqlPack.java | 68 ++++++++++++++++++++- 14 files changed, 179 insertions(+), 23 deletions(-) rename modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/{SuitRecordParam.java => BsSuitRecordParam.java} (95%) create mode 100644 modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyParamRepository.java rename modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/{SuitRecordParamRepository.java => BsSuitRecordParamRepository.java} (65%) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/annotation/AnnoOutputColumn.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/annotation/AnnoOutputColumn.java index 325358c..eee532e 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/annotation/AnnoOutputColumn.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/annotation/AnnoOutputColumn.java @@ -1,7 +1,5 @@ package cn.estsh.i3plus.pojo.base.annotation; -import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/SoftSwitchEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/SoftSwitchEnumUtil.java index 8d05091..fb98a2a 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/SoftSwitchEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/SoftSwitchEnumUtil.java @@ -82,4 +82,73 @@ public class SoftSwitchEnumUtil { } } + /** + * 认证方式 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum VERIFICATION_METHOD{ + LOGIN(1,"登录"); + + private int value; + private String description; + + VERIFICATION_METHOD(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + /** + * 认证类型 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum KEY_TYPE{ + ACCOUNT_PASSWORD(1,"账号密码"); + + private int value; + private String description; + + KEY_TYPE(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + //keyTypeId } diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/tool/DdlPreparedPack.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/tool/DdlPreparedPack.java index 22b0e41..40f9822 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/tool/DdlPreparedPack.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/tool/DdlPreparedPack.java @@ -531,4 +531,5 @@ public class DdlPreparedPack { } return name; } + } diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/softswitch/SuitCoreModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/softswitch/SuitCoreModel.java index ee14fce..3b748f8 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/softswitch/SuitCoreModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/softswitch/SuitCoreModel.java @@ -48,7 +48,7 @@ public class SuitCoreModel { private String suitCaseStatusCode; /** - * 安全证书 + * 适配认证 */ private BsSslKey sslKey; @@ -88,7 +88,7 @@ public class SuitCoreModel { /** * * @param requestSource 请求来源 - * @param sslKey 安全证书对象 + * @param sslKey 适配认证对象 * @param bsSuitCase 适配器信息 */ public SuitCoreModel(Integer requestSource,BsSslKey sslKey, BsSuitCase bsSuitCase) { diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsParamAdapter.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsParamAdapter.java index 275709a..f449535 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsParamAdapter.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsParamAdapter.java @@ -64,7 +64,7 @@ public class BsParamAdapter extends BaseBean { private String transferParamName; @Column(name = "TRANSFER_PARAM_VAL_TYPE_ID") - @ApiParam(value = "转换参数类型") + @ApiParam(value = "转换参数值类型") private Integer transferParamValTypeId; } diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKey.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKey.java index 232477e..e422ef8 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKey.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKey.java @@ -17,7 +17,7 @@ import javax.persistence.Transient; import java.util.List; /** - * @Description : 安全证书 + * @Description : 适配认证 * @Reference : * @Author : yunhao * @CreateDate : 2019-08-13 9:21 @@ -29,9 +29,13 @@ import java.util.List; @DynamicUpdate @EqualsAndHashCode(callSuper = true) @Table(name = "BS_SSL_KEY") -@Api(value = "安全证书", description = "安全证书") +@Api(value = "适配认证", description = "适配认证") public class BsSslKey extends BaseBean { + @Column(name = "KEY_NAME") + @ApiParam(value = "证书名称") + private String keyName; + @Column(name = "VERIFICATION_METHOD_ID") @ApiParam(value = "认证方式(枚举)") private Integer verificationMethodId; @@ -40,13 +44,9 @@ public class BsSslKey extends BaseBean { @ApiParam(value = "认证url") private String verificationUrl; - @Column(name = "KEY_TYPE") + @Column(name = "KEY_TYPE_ID") @ApiParam(value = "证书类型枚举") - private Integer keyType; - - @Column(name = "KEY_NAME") - @ApiParam(value = "证书名称") - private String keyName; + private Integer keyTypeId; @Column(name = "KEY_FILE_ID") @ApiParam(value = "证书文件id") diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKeyParam.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKeyParam.java index 287cfb3..f9837ca 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKeyParam.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSslKeyParam.java @@ -16,7 +16,7 @@ import javax.persistence.Entity; import javax.persistence.Table; /** - * @Description : 安全证书参数 + * @Description : 适配认证参数 * @Reference : * @Author : yunhao * @CreateDate : 2019-08-13 9:21 @@ -28,7 +28,7 @@ import javax.persistence.Table; @DynamicUpdate @EqualsAndHashCode(callSuper = true) @Table(name = "BS_SSL_KEY_PARAM") -@Api(value = "安全证书参数", description = "安全证书参数") +@Api(value = "适配认证参数", description = "适配认证参数") @XStreamAlias("BsSslKeyParam") public class BsSslKeyParam extends BaseBean { @@ -45,4 +45,8 @@ public class BsSslKeyParam extends BaseBean { @ApiParam(value = "参数值") private String paramValue; + @Column(name = "PARAM_DESCRIPTION") + @ApiParam(value = "参数描述") + private String paramDescription; + } diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitCase.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitCase.java index 8a88131..47d1e44 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitCase.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitCase.java @@ -95,9 +95,13 @@ public class BsSuitCase extends BaseBean { private Integer failNum; @Column(name = "SUIT_CASE_DESCRIPTION") - @ApiParam(value = "适配类型描述") + @ApiParam(value = "适配器描述") private String suitCaseDescription; + @Column(name = "SUIT_CASE_STATUS") + @ApiParam(value = "适配器状态") + private Integer suitCaseStatus; + @Transient @ApiParam(value = "适配器参数") List bsSuitCaseParamList; diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecord.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecord.java index 0c61a85..2563cbf 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecord.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecord.java @@ -59,6 +59,10 @@ public class BsSuitRecord extends BaseBean { @ApiParam(value = "适配方式id枚举") private Integer suitMethodId; + @Column(name = "SUIT_METHOD_NAME_RDD") + @ApiParam(value = "适配方式名称枚举") + private Integer suitMethodNameRdd; + @Column(name = "SUIT_TYPE_ID") @ApiParam(value = "适配类型id") @JsonSerialize(using = ToStringSerializer.class) diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/SuitRecordParam.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecordParam.java similarity index 95% rename from modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/SuitRecordParam.java rename to modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecordParam.java index bb04309f..5b384ce 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/SuitRecordParam.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/BsSuitRecordParam.java @@ -25,7 +25,7 @@ import javax.persistence.Table; @EqualsAndHashCode(callSuper = true) @Table(name = "SUIT_RECORD_PARAM") @Api(value = "适配记录参数", description = "适配记录参数") -public class SuitRecordParam extends BaseBean { +public class BsSuitRecordParam extends BaseBean { @Column(name = "SUIT_RECORD_ID") @ApiParam(value = "适配记录id") diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyParamRepository.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyParamRepository.java new file mode 100644 index 0000000..2dcfb34 --- /dev/null +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyParamRepository.java @@ -0,0 +1,14 @@ +package cn.estsh.i3plus.pojo.softswitch.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.softswitch.bean.BsSslKeyParam; + +/** + * @Description : 安全证书参数 + * @Reference : + * @Author : yunhao + * @CreateDate : 2019-08-21 17:47 + * @Modify: + **/ +public interface BsSslKeyParamRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyRepository.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyRepository.java index 5549947..dd7ef61 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyRepository.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSslKeyRepository.java @@ -5,7 +5,7 @@ import cn.estsh.i3plus.pojo.softswitch.bean.BsSslKey; import org.springframework.stereotype.Repository; /** - * @Description : 安全证书 + * @Description : 适配认证 * @Reference : * @Author : yunhao * @CreateDate : 2019-08-13 9:21 diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/SuitRecordParamRepository.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSuitRecordParamRepository.java similarity index 65% rename from modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/SuitRecordParamRepository.java rename to modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSuitRecordParamRepository.java index e2b4a0b..ac8d35b 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/SuitRecordParamRepository.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/BsSuitRecordParamRepository.java @@ -1,7 +1,7 @@ package cn.estsh.i3plus.pojo.softswitch.repository; import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; -import cn.estsh.i3plus.pojo.softswitch.bean.SuitRecordParam; +import cn.estsh.i3plus.pojo.softswitch.bean.BsSuitRecordParam; import org.springframework.stereotype.Repository; /** @@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository; * @Modify: */ @Repository -public interface SuitRecordParamRepository extends BaseRepository { +public interface BsSuitRecordParamRepository extends BaseRepository { } diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftSwitchHqlPack.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftSwitchHqlPack.java index e10ea61..09901b1 100644 --- a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftSwitchHqlPack.java +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftSwitchHqlPack.java @@ -177,7 +177,7 @@ public class SoftSwitchHqlPack { } /** - * 安全证书查询条件分页 + * 适配认证查询条件分页 * @param bsSslKey 查询条件 * @return */ @@ -185,7 +185,7 @@ public class SoftSwitchHqlPack { DdlPackBean ddlPackBean = new DdlPackBean(); DdlPreparedPack.getStringEqualPack(bsSslKey.getKeyName(),"keyName",ddlPackBean); - DdlPreparedPack.getNumEqualPack(bsSslKey.getKeyType(),"keyType",ddlPackBean); + DdlPreparedPack.getNumEqualPack(bsSslKey.getKeyTypeId(),"keyTypeId",ddlPackBean); ddlPackBean.setOrderByStr(bsSslKey.orderBy()); @@ -193,7 +193,7 @@ public class SoftSwitchHqlPack { } /** - * 安全证书唯一校验 + * 适配认证唯一校验 * @param bsSslKey * @return */ @@ -206,4 +206,66 @@ public class SoftSwitchHqlPack { return ddlPackBean; } + /** + * 适配认证参数按条件查询 + * @param bsSslKeyParam 查询条件 + * @return + */ + public static DdlPackBean packHqlBsSslKeyParam(BsSslKeyParam bsSslKeyParam){ + DdlPackBean ddlPackBean = new DdlPackBean(); + + DdlPreparedPack.getNumEqualPack(bsSslKeyParam.getSslKeyId(), "sslKeyId", ddlPackBean); + DdlPreparedPack.getStringLikerPack(bsSslKeyParam.getParamName(), "paramName", ddlPackBean); + + ddlPackBean.setOrderByStr(bsSslKeyParam.orderBy()); + + return ddlPackBean; + } + + /** + * 适配认证参数唯一校验 + * @param bsSslKeyParam + * @return + */ + public static DdlPackBean packHqlCheckBsSslKeyParamOnly(BsSslKeyParam bsSslKeyParam){ + DdlPackBean ddlPackBean = new DdlPackBean(); + + DdlPreparedPack.getNumEqualPack(bsSslKeyParam.getSslKeyId(), "sslKeyId", ddlPackBean); + DdlPreparedPack.getStringEqualPack(bsSslKeyParam.getParamName(), "paramName", ddlPackBean); + + return ddlPackBean; + } + + /** + * 数据源查询条件封装 + * @param bsDataSource + * @return + */ + public static DdlPackBean packHqlBsDataSource(BsDataSource bsDataSource){ + DdlPackBean ddlPackBean = new DdlPackBean(); + + DdlPreparedPack.getStringLikerPack(bsDataSource.getDataSourceName(), "dataSourceName", ddlPackBean); + DdlPreparedPack.getStringLikerPack(bsDataSource.getDataSourceCode(), "dataSourceCode", ddlPackBean); + DdlPreparedPack.getNumEqualPack(bsDataSource.getDataSourceTypeId(), "dataSourceTypeId", ddlPackBean); + DdlPreparedPack.getNumEqualPack(bsDataSource.getIsValid(), "isValid", ddlPackBean); + + ddlPackBean.setOrderByStr(bsDataSource.orderBy()); + + return ddlPackBean; + } + + /** + * 数据源唯一校验 + * @param bsDataSource + * @return + */ + public static DdlPackBean packHqlCheckBsDataSourceOnly(BsDataSource bsDataSource){ + DdlPackBean ddlPackBean = new DdlPackBean(); + + DdlPreparedPack.getNumEqualPack(bsDataSource.getId(), "id", ddlPackBean); + DdlPreparedPack.getStringLikerPack(bsDataSource.getDataSourceCode(), "dataSourceCode", ddlPackBean); + + return ddlPackBean; + } + } From 5947f88da118cb0318b7280ff5d15edfba6fd37c Mon Sep 17 00:00:00 2001 From: wangjie Date: Wed, 28 Aug 2019 12:15:28 +0800 Subject: [PATCH 08/26] =?UTF-8?q?mes-pcn=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=B7=A5=E4=BD=9C=E6=B8=85=E5=8D=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/MesPcnEnumUtil.java | 38 ++++++++++++++++ .../i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java | 51 ++++++++++++++++++++++ .../pcn/repository/MesPcnTaskLogRepository.java | 16 +++++++ .../mes/pcn/repository/MesPcnTaskRepository.java | 16 +++++++ 4 files changed, 121 insertions(+) create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskLogRepository.java create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskRepository.java diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java index dc68917..e47e78e 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java @@ -10,6 +10,44 @@ import com.fasterxml.jackson.annotation.JsonFormat; * @Modify: **/ public class MesPcnEnumUtil { + + /** + * mes-pcn定时任务同步结果状态 + * 10. + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum MES_PCN_TASK_SYNC_STATUS{ + + SUCCESS(1,"mes主服务定时任务工作清单同步成功"), + ERROR(2,"mes主服务定时任务工作清单同步失败"); + + private int value; + private String description; + + MES_PCN_TASK_SYNC_STATUS(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + /** * PCN同步MES主数据同步方式枚举 * 10. diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java new file mode 100644 index 0000000..9a0d1d1 --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java @@ -0,0 +1,51 @@ +package cn.estsh.i3plus.pojo.mes.pcn.bean; + + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description :mes-pcn定时任务工作清单同步记录 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-27 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name="MES_PCN_TASK_LOG") +@Api("mes-pcn定时任务工作清单同步记录") +public class MesPcnTaskLog extends BaseBean { + + @Column(name="SYNC_TIME_START") + @ApiParam("同步数据开始时间") + private String syncTimeStart; + + @Column(name="SYNC_TIME_END") + @ApiParam("同步数据截止时间") + private String syncTimeEnd; + + @Column(name="SYNC_STATUS") + @ApiParam("同步状态") + private Integer syncStatus; + + @Column(name="ERROR_CONTENT") + @ApiParam("异常内容") + private String errorContent; + + public int getSyncStatusVal() { + return this.syncStatus == null ? 0 : this.syncStatus; + } +} diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskLogRepository.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskLogRepository.java new file mode 100644 index 0000000..66621f9 --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskLogRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.pcn.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.pcn.bean.MesPcnTaskLog; +import org.springframework.stereotype.Repository; + +/** + * @Description : + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-27 + * @Modify: + **/ +@Repository +public interface MesPcnTaskLogRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskRepository.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskRepository.java new file mode 100644 index 0000000..68295ee --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesPcnTaskRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.pcn.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.pcn.bean.MesPcnTask; +import org.springframework.stereotype.Repository; + +/** + * @Description :mes-pcn定时任务清单 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-26 + * @Modify: + **/ +@Repository +public interface MesPcnTaskRepository extends BaseRepository { +} From 90bb35c83f0dbc4865604bc776c6db1479f51b34 Mon Sep 17 00:00:00 2001 From: "wei.peng" <123456> Date: Tue, 27 Aug 2019 15:03:21 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=8F=91=20=E7=94=A8=E6=88=B7=E8=8E=B7=E5=8F=96=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=8F=92=E4=BB=B6Bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/estsh/i3plus/pojo/platform/bean/SessionUser.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SessionUser.java b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SessionUser.java index e871a03..4be5710 100644 --- a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SessionUser.java +++ b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SessionUser.java @@ -48,6 +48,12 @@ public class SessionUser implements Serializable { @ApiParam("用户对象信息") private SysUserInfo userInfo; + @ApiParam("列表默认分页数量配置") + private Integer[] pageSizeArray; + + @ApiParam("列表默认分页数量") + private Integer pageDefaultSize; + public SessionUser() { } From 645b991df8ef96079d8573805861c588a04f540b Mon Sep 17 00:00:00 2001 From: "wei.peng" <123456> Date: Wed, 28 Aug 2019 15:22:08 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e1e35d5..698e9c6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ target *.class .md *.log -*.properties \ No newline at end of file +#*.properties \ No newline at end of file From 540884404f3ebbbca171383c0a3b7bbf65f58173 Mon Sep 17 00:00:00 2001 From: "wei.peng" <123456> Date: Wed, 28 Aug 2019 15:23:55 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=E5=BE=AE=E6=9C=8D=E5=8A=A1=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 698e9c6..e1e35d5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ target *.class .md *.log -#*.properties \ No newline at end of file +*.properties \ No newline at end of file From 7740503a979cdeb1687a3f28d87812abf19cadb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=BF=83=E6=B4=81?= Date: Wed, 28 Aug 2019 15:52:52 +0800 Subject: [PATCH 12/26] =?UTF-8?q?getByProperty=E6=9F=A5=E8=AF=A2=E5=88=B0?= =?UTF-8?q?=E5=A4=9A=E6=9D=A1=E6=95=B0=E6=8D=AE=E6=8A=9B=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/base/jpa/daoimpl/BaseRepositoryImpl.java | 532 +++++++++++---------- 1 file changed, 268 insertions(+), 264 deletions(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java index 0eb845c..1dd2c29 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java @@ -10,6 +10,7 @@ import org.hibernate.NonUniqueResultException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.jpa.repository.support.SimpleJpaRepository; +import org.springframework.util.CollectionUtils; import javax.persistence.*; import java.io.Serializable; @@ -36,7 +37,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep private Class persistentClass; private SnowflakeIdMaker snowflakeIdMaker; - public BaseRepositoryImpl(Class clz, EntityManager em,SnowflakeIdMaker snowflakeIdMaker) { + public BaseRepositoryImpl(Class clz, EntityManager em, SnowflakeIdMaker snowflakeIdMaker) { super(clz, em); this.entityManager = em; this.persistentClass = clz; @@ -82,7 +83,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T insert(T item) { - return insert(item,true); + return insert(item, true); } @Override @@ -93,7 +94,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public S save(S entity) { //复写save方法,若id为0或空则新增,不然则修改 - return (S) innerSave(entity,true); + return (S) innerSave(entity, true); } @Override @@ -135,100 +136,101 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public void deleteById(ID id){ + public void deleteById(ID id) { deleteByProperty("id", id); } @Override public int deleteByProperty(String propName, Object propValue) { - return deleteByProperties(new String[] { propName }, new Object[] { propValue }); + return deleteByProperties(new String[]{propName}, new Object[]{propValue}); } @Override public int deleteByProperties(String[] propName, Object[] propValue) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " model where 1=1 "); - appendQL(sb,propName,propValue); + appendQL(sb, propName, propValue); Query query = entityManager.createQuery(sb.toString()); - setParameter(query,propName,propValue); + setParameter(query, propName, propValue); return query.executeUpdate(); - }else{ + } else { throw new IllegalArgumentException("删除错误!propName:" + propName + ",propValue:" + propValue); } } @Override public int deleteByIds(ID[] ids) { - return deleteByPropertyIn("id", ids); + return deleteByPropertyIn("id", ids); } @Override public int deleteByPropertyIn(String propName, Object[] propValues) { if ((propName != null && propName.length() > 0) && (propValues != null && propValues.length > 0)) { - String hql = "delete from " + persistentClass.getName() + " model where model."+propName+" in(:"+propName+") "; + String hql = "delete from " + persistentClass.getName() + " model where model." + propName + " in(:" + propName + ") "; Query query = entityManager.createQuery(hql); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - }else{ - throw new IllegalArgumentException("删除出错:"+propName+":" + propValues); + } else { + throw new IllegalArgumentException("删除出错:" + propName + ":" + propValues); } } @Override public int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue) { - return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue }); + return updateByProperties(new String[]{conditionName}, new Object[]{conditionValue}, new String[]{propertyName}, new Object[]{propertyValue}); } @Override public int updateByProperties(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, propertyName, propertyValue); + return updateByProperties(new String[]{conditionName}, new Object[]{conditionValue}, propertyName, propertyValue); } @Override public int updateByProperties(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue) { - return updateByProperties(conditionName, conditionValue, new String[] { propertyName }, new Object[] { propertyValue }); + return updateByProperties(conditionName, conditionValue, new String[]{propertyName}, new Object[]{propertyValue}); } @Override public int updateByProperties(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue,true); + return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue, true); } @Override public int updateByPropertiesWithVal(String conditionName, Object conditionValue, String propertyName, Object propertyValue) { - return updateByPropertiesWithVal(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue }); + return updateByPropertiesWithVal(new String[]{conditionName}, new Object[]{conditionValue}, new String[]{propertyName}, new Object[]{propertyValue}); } @Override public int updateByPropertiesWithVal(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesWithVal(new String[] { conditionName }, new Object[] { conditionValue }, propertyName, propertyValue); + return updateByPropertiesWithVal(new String[]{conditionName}, new Object[]{conditionValue}, propertyName, propertyValue); } @Override public int updateByPropertiesWithVal(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue) { - return updateByPropertiesWithVal(conditionName, conditionValue, new String[] { propertyName }, new Object[] { propertyValue }); + return updateByPropertiesWithVal(conditionName, conditionValue, new String[]{propertyName}, new Object[]{propertyValue}); } @Override public int updateByPropertiesWithVal(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue,false); + return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue, false); } /** * 更新参数汇总方法 - * @param conditionName 条件属性名 + * + * @param conditionName 条件属性名 * @param conditionValue 条件属性值 - * @param propertyName 更新属性名 - * @param propertyValue 更新属性值 - * @param valWithSimple 是否简单赋值 - * true为正常eg: price = :price - * false为自身添加eg: price = price + :price + * @param propertyName 更新属性名 + * @param propertyValue 更新属性值 + * @param valWithSimple 是否简单赋值 + * true为正常eg: price = :price + * false为自身添加eg: price = price + :price * @return */ private int updateByPropertiesMain(String[] conditionName, Object[] conditionValue, - String[] propertyName, Object[] propertyValue,boolean valWithSimple) { + String[] propertyName, Object[] propertyValue, boolean valWithSimple) { if ((propertyName != null) && (propertyName.length > 0) && (propertyValue != null) && (propertyValue.length > 0) && (propertyName.length == propertyValue.length) && (conditionValue != null) && (conditionValue.length > 0)) { @@ -236,9 +238,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep sb.append("update " + persistentClass.getName() + " model set "); for (int i = 0; i < propertyName.length; i++) { - if(valWithSimple) { + if (valWithSimple) { sb.append(propertyName[i] + " = :p_" + propertyName[i] + ","); - }else{ + } else { sb.append(propertyName[i] + " = " + propertyName[i] + " + :p_" + propertyName[i] + ","); } } @@ -260,36 +262,36 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public int updateByProperties(String propertyName, Object propertyValue,DdlPackBean packBean) { - return updateByProperties(new String[] { propertyName }, new Object[] { propertyValue },packBean); + public int updateByProperties(String propertyName, Object propertyValue, DdlPackBean packBean) { + return updateByProperties(new String[]{propertyName}, new Object[]{propertyValue}, packBean); } @Override - public int updateByProperties(String[] propertyName, Object[] propertyValue,DdlPackBean packBean) { - return updateByPropertiesDdlPack(propertyName, propertyValue,packBean,true); + public int updateByProperties(String[] propertyName, Object[] propertyValue, DdlPackBean packBean) { + return updateByPropertiesDdlPack(propertyName, propertyValue, packBean, true); } @Override - public int updateByPropertiesWithVal(String propertyName, Object propertyValue,DdlPackBean packBean) { - return updateByPropertiesWithVal(new String[] { propertyName }, new Object[] { propertyValue },packBean); + public int updateByPropertiesWithVal(String propertyName, Object propertyValue, DdlPackBean packBean) { + return updateByPropertiesWithVal(new String[]{propertyName}, new Object[]{propertyValue}, packBean); } @Override - public int updateByPropertiesWithVal(String[] propertyName, Object[] propertyValue,DdlPackBean packBean) { - return updateByPropertiesDdlPack(propertyName, propertyValue,packBean,false); + public int updateByPropertiesWithVal(String[] propertyName, Object[] propertyValue, DdlPackBean packBean) { + return updateByPropertiesDdlPack(propertyName, propertyValue, packBean, false); } private int updateByPropertiesDdlPack(String[] propertyName, Object[] propertyValue, - DdlPackBean packBean,boolean valWithSimple) { + DdlPackBean packBean, boolean valWithSimple) { if ((propertyName != null) && (propertyName.length > 0) && (propertyValue != null) && (propertyValue.length > 0) && (propertyName.length == propertyValue.length)) { StringBuffer sb = new StringBuffer(); sb.append("update " + persistentClass.getName() + " model set "); for (int i = 0; i < propertyName.length; i++) { - if(valWithSimple) { + if (valWithSimple) { sb.append(propertyName[i] + " = :p_" + propertyName[i] + ","); - }else{ + } else { sb.append(propertyName[i] + " = " + propertyName[i] + " + :p_" + propertyName[i] + ","); } } @@ -303,7 +305,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } //查询条件 for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.executeUpdate(); @@ -344,9 +346,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T getById(long id) { - try{ - return entityManager.find(persistentClass,id); - }catch (Exception e){ + try { + return entityManager.find(persistentClass, id); + } catch (Exception e) { return null; } } @@ -360,12 +362,12 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List listPager(Pager pager) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { return entityManager.createQuery("from " + persistentClass.getName()) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -378,16 +380,16 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByPage(DdlPackBean packBean, int offset, int pageSize) { Query query = null; - String ddl = "from " + persistentClass.getName() + " where 1=1 " +packBean.getPackedHql(); + String ddl = "from " + persistentClass.getName() + " where 1=1 " + packBean.getPackedHql(); - if(packBean.isHql()){ + if (packBean.isHql()) { query = entityManager.createQuery(ddl); - }else{ + } else { query = entityManager.createNativeQuery(ddl); } for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(offset) @@ -412,7 +414,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByProperty(String[] propertyNames, Object[] values) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -424,14 +426,14 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -447,7 +449,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByProperty(String[] propertyNames, Object[] values, String orderByStuff) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -459,7 +461,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -468,7 +470,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -478,37 +480,34 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T getByProperty(DdlPackBean packBean) { - - try { - List list = findByHqlWhere(packBean); - return list.size() != 0 ? list.get(0) : null; - }catch(NoResultException ne){ - LOGGER.error("数据不存在,DdlPackBean:{}",packBean); - return null; - }catch(NonUniqueResultException ex){ - LOGGER.error("查询单条记录,但出现多条。packBean:{}",packBean); - throw new RuntimeException("存在多条记录:" + ex.getMessage()); + List list = findByHqlWhere(packBean); + if (CollectionUtils.isEmpty(list)) { + LOGGER.error("数据不存在,DdlPackBean:{}", packBean); + throw new RuntimeException("数据不存在"); + } else if (list.size() > 1) { + LOGGER.error("查询单条记录,但出现多条。packBean:{}", packBean); + throw new RuntimeException("存在多条记录"); } + return list.iterator().next(); } @Override public T getByProperty(String propertyName, Object value) { String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName; try { - List list = entityManager.createQuery(queryString).setParameter(propertyName, value).getResultList(); - return list.size() != 0 ? list.get(0) : null; - }catch(NoResultException ne){ - LOGGER.error("数据不存在,prop:{},value:{}",propertyName,value,ne); + return (T) entityManager.createQuery(queryString).setParameter(propertyName, value).getSingleResult(); + } catch (NoResultException ne) { + LOGGER.error("数据不存在,prop:{},value:{}", propertyName, value, ne); return null; - }catch(NonUniqueResultException ex){ - LOGGER.error("查询单条记录,但出现多条。prop:{},value:{}",propertyName,value,ex); + } catch (NonUniqueResultException ex) { + LOGGER.error("查询单条记录,但出现多条。prop:{},value:{}", propertyName, value, ex); throw new RuntimeException("存在多条记录:" + ex.getMessage()); } } @Override public T getByProperty(String[] propertyNames, Object[] values) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -520,57 +519,56 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try{ - List list = queryObject.getResultList(); - return list.size() != 0 ? list.get(0) : null; - }catch(NoResultException ne){ - LOGGER.error("数据不存在",ne); + try { + return (T) queryObject.getSingleResult(); + } catch (NoResultException ne) { + LOGGER.error("数据不存在", ne); return null; - }catch(NonUniqueResultException ex){ - LOGGER.error("查询单条记录,但出现多条。",ex); + } catch (NonUniqueResultException ex) { + LOGGER.error("查询单条记录,但出现多条。", ex); throw new RuntimeException("存在多条记录:" + ex.getMessage()); } } @Override public int listCount() { - try{ - Long count = entityManager.createQuery("select count(distinct model) from " + persistentClass.getName() + " as model",Long.class) + try { + Long count = entityManager.createQuery("select count(distinct model) from " + persistentClass.getName() + " as model", Long.class) .getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public int findByPropertyCount(String propertyName, Object value) { - try{ + try { String queryString = "select count(distinct model) from " + persistentClass.getName() + " as model where model." + propertyName + "= :" + propertyName; Long count = entityManager.createQuery(queryString, Long.class) .setParameter(propertyName, value) .getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public int findByPropertyCount(String[] propertyNames, Object[] values) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -582,42 +580,42 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } - Query queryObject = entityManager.createQuery(queryString.toString(),Long.class); + Query queryObject = entityManager.createQuery(queryString.toString(), Long.class); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try{ + try { Long count = (Long) queryObject.getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public List findByPropertyPage(String propertyName, Object value, String orderByStuff, Pager pager) { - if(pager.getTotalRows() > 0){ + if (pager.getTotalRows() > 0) { String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName + " " + orderByStuff; return entityManager.createQuery(queryString) .setParameter(propertyName, value) .getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findByPropertyPage(String[] propertyNames, Object[] values, String orderByStuff, Pager pager) { - if(pager.getTotalRows() > 0){ - if(propertyNames.length != values.length){ + if (pager.getTotalRows() > 0) { + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -629,12 +627,12 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } - if(orderByStuff != null && orderByStuff.length() > 0){ + if (orderByStuff != null && orderByStuff.length() > 0) { queryString.append(orderByStuff); } @@ -644,7 +642,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } return queryObject.setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -674,7 +672,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.getResultList(); @@ -682,7 +680,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByHqlWhere(String hqlWhere, String[] propertyNames, Object[] values, String orderByStuff) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } @@ -695,7 +693,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -704,7 +702,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -713,7 +711,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public int findByHqlWhereCount(String hqlWhere, String[] propertyNames, Object[] values) { - if(propertyNames.length != values.length){ + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -725,30 +723,30 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try{ - Long count = entityManager.createQuery(queryString.toString(),Long.class).getSingleResult(); + try { + Long count = entityManager.createQuery(queryString.toString(), Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public List findByHqlWherePage(String hqlWhere, Pager pager, String[] propertyNames, Object[] values, String orderByStuff) { - if(pager.getTotalRows() > 0){ - if(propertyNames.length != values.length){ + if (pager.getTotalRows() > 0) { + if (propertyNames.length != values.length) { throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -760,7 +758,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -768,13 +766,13 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()).setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()); for (int i = 0; i < size; i++) { - if(values[i] != null) { + if (values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } return queryObject.getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -782,7 +780,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Deprecated @Override public List findByHqlWherePage(String hqlWhere, Pager pager) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { StringBuffer queryString = new StringBuffer(); queryString.append("from " + persistentClass.getSimpleName() + " as model where 1=1 "); @@ -794,25 +792,25 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findByHqlWherePage(DdlPackBean packBean, Pager pager) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -826,10 +824,10 @@ public class BaseRepositoryImpl extends SimpleJpaRep if (hqlWhere != null && hqlWhere.length() > 0) { queryString.append(hqlWhere); } - try{ + try { Long count = entityManager.createQuery(queryString.toString(), Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @@ -842,44 +840,44 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query query = entityManager.createQuery(queryString.toString(), Long.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } - try{ + try { Long count = (Long) query.getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public int findByHqlCount(String hql) { - try{ - Long count = entityManager.createQuery(hql,Long.class).getSingleResult(); + try { + Long count = entityManager.createQuery(hql, Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public int findByHqlCount(String hql, String[] paramName, Object[] paramValue) { - Query queryObject = entityManager.createQuery(hql,Integer.class); - for(int i=0;i findByHqlPage(String hqlWhere, Pager pager) { - if(pager.getTotalRows() > 0){ + if (pager.getTotalRows() > 0) { StringBuffer queryString = new StringBuffer(); queryString.append("from " + persistentClass.getSimpleName() + " as model where 1=1 "); @@ -891,32 +889,32 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findByHqlPage(DdlPackBean packBean, Pager pager) { - if(pager.getTotalRows() > 0){ + if (pager.getTotalRows() > 0) { Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findByHqlPage(String hql, Pager pager, String[] paramName, Object[] paramValue) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { Query queryObject = entityManager.createQuery(hql); for (int i = 0; i < paramName.length; i++) { if (paramValue[i] != null) { @@ -927,7 +925,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep return queryObject.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -939,29 +937,29 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findBySql(String sql, Class entity) { - return entityManager.createNativeQuery(sql,entity).getResultList(); + return entityManager.createNativeQuery(sql, entity).getResultList(); } @Override public List findBySqlPage(String sql, Pager pager) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { return entityManager.createNativeQuery(sql) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findBySqlPage(String sql, Class entity, Pager pager) { - if(pager.getTotalRows() > 0){ - return entityManager.createNativeQuery(sql,entity) + if (pager.getTotalRows() > 0) { + return entityManager.createNativeQuery(sql, entity) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -973,74 +971,74 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public int findBySqlCount(String sql) { - try{ + try { Long count = (Long) entityManager - .createNativeQuery("select count(*) from ( " + sql + " ) as usertable",Long.class) + .createNativeQuery("select count(*) from ( " + sql + " ) as usertable", Long.class) .getSingleResult(); return count == null ? 0 : count.intValue(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public double findBySqlSumDouble(String sql, String columnName) { - try{ + try { return (double) entityManager - .createNativeQuery("select sum(" + columnName + ") from ( " + sql + " ) as usertable",Double.class) + .createNativeQuery("select sum(" + columnName + ") from ( " + sql + " ) as usertable", Double.class) .getSingleResult(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public double findByHqlDouble(String hql) { - try{ - Double result = entityManager.createQuery(hql,Double.class).getSingleResult(); + try { + Double result = entityManager.createQuery(hql, Double.class).getSingleResult(); return result == null ? 0 : result; - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public double findByHqlDouble(DdlPackBean packBean) { - try{ - Query query = entityManager.createQuery(packBean.getPackedHqlAll(),Double.class); + try { + Query query = entityManager.createQuery(packBean.getPackedHqlAll(), Double.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } Double result = (Double) query.getSingleResult(); return result == null ? 0 : result; - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @Override public long findByHqlLong(String hql) { - try{ - return entityManager.createQuery(hql,Long.class).getSingleResult(); - }catch(NoResultException e){ + try { + return entityManager.createQuery(hql, Long.class).getSingleResult(); + } catch (NoResultException e) { return 0; } } @Override public long findByHqlLong(DdlPackBean packBean) { - try{ + try { Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() - + " as model where 1=1 " + packBean.getPackedHql(),Long.class); + + " as model where 1=1 " + packBean.getPackedHql(), Long.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return (long) query.getSingleResult(); - }catch(NoResultException e){ + } catch (NoResultException e) { return 0; } } @@ -1062,14 +1060,14 @@ public class BaseRepositoryImpl extends SimpleJpaRep + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(0).setMaxResults(topNum).getResultList(); } @Override public List findColumnsByHql(String hql, String hqlWhere, String orderByStuff, Pager pager) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { StringBuffer queryString = new StringBuffer(); queryString.append(hql + " as model where 1=1 "); @@ -1084,7 +1082,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -1097,8 +1095,8 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByHqlObjects(String hql, String[] paramName, Object[] paramValue) { Query queryObject = entityManager.createQuery(hql); - for(int i=0;i extends SimpleJpaRep @Override public List findByHqlPageObjects(String hql, Pager pager) { - if(pager.getTotalRows() > 0){ + if (pager.getTotalRows() > 0) { return entityManager.createQuery(hql).setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - }else{ + } else { return new ArrayList(); } } @Override public List findByHqlPageObjects(String hql, Pager pager, String[] paramName, Object[] paramValue) { - if(pager.getTotalRows() > 0) { + if (pager.getTotalRows() > 0) { Query queryObject = entityManager.createQuery(hql); for (int i = 0; i < paramName.length; i++) { if (paramValue[i] != null) { @@ -1126,7 +1124,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } return queryObject.setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - }else{ + } else { return new ArrayList(); } } @@ -1138,60 +1136,61 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findBySqlObjListByPager(String sql, Pager pager) { - if(pager.getTotalRows() > 0){ + if (pager.getTotalRows() > 0) { return entityManager.createNativeQuery(sql) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - }else{ + } else { return new ArrayList(); } } /** * 保存对象 + * * @param item 保存对象 * @return */ private T innerSave(T item, boolean initParam) { try { - if(item == null) { + if (item == null) { return null; } Class clazz = item.getClass(); //获取主键 Field idField = clazz.getField("id"); - if(idField == null){ + if (idField == null) { idField = clazz.getField("primaryKey"); } - if(idField == null){ + if (idField == null) { // 遍历所有属性,以@Id声明确认主键 Field[] fields = clazz.getFields(); - for(Field f : fields){ - if(f.getAnnotation(Id.class) != null){ + for (Field f : fields) { + if (f.getAnnotation(Id.class) != null) { idField = f; break; } } } - if(idField != null){ + if (idField != null) { Class type = idField.getType(); Object val = idField.get(item); - if(type == Long.class && (val == null || Long.parseLong(val.toString()) == 0)){ + if (type == Long.class && (val == null || Long.parseLong(val.toString()) == 0)) { // long类型主键,以snowflake为主键 idField.set(item, snowflakeIdMaker.nextId()); - } else if(type == String.class && (val==null || "".equals(val))){ + } else if (type == String.class && (val == null || "".equals(val))) { // String类型主键,以UUID为主键 idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase()); } } //属性值过滤,避免null值 - if(initParam){ - for(Field checkField : clazz.getFields()){ - if(checkField.get(item) == null){ + if (initParam) { + for (Field checkField : clazz.getFields()) { + if (checkField.get(item) == null) { // 未赋值的属性,进行初始化赋值 fieldSetInitParam(item, checkField); } @@ -1200,9 +1199,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep entityManager.merge(item); entityManager.flush(); - if(idField!=null){ + if (idField != null) { return item; - }else { + } else { return null; } } catch (Exception e) { @@ -1213,21 +1212,22 @@ public class BaseRepositoryImpl extends SimpleJpaRep /** * 对为赋值的属性进行赋值 + * * @param field */ - private void fieldSetInitParam(T item,Field field) { + private void fieldSetInitParam(T item, Field field) { try { if (field.getType() == String.class) { field.set(item, ""); } else if (field.getType() == Byte.class || field.getType() == Character.class || field.getType() == Integer.class) { field.set(item, 0); - } else if(field.getType() == Long.class){ + } else if (field.getType() == Long.class) { field.set(item, 0L); - } else if(field.getType() == Float.class){ + } else if (field.getType() == Float.class) { field.set(item, 0.0f); - } else if(field.getType() == Double.class){ + } else if (field.getType() == Double.class) { field.set(item, 0.0d); - } else if(field.getType() == Boolean.class){ + } else if (field.getType() == Boolean.class) { field.set(item, false); } } catch (IllegalAccessException e) { @@ -1252,129 +1252,133 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public int deleteWeaklyById(ID id,String username) { - return deleteWeaklyByProperty("id", id,username); + public int deleteWeaklyById(ID id, String username) { + return deleteWeaklyByProperty("id", id, username); } @Override - public int deleteWeaklyByIds(Long[] ids,String username) { - return deleteWeaklyByPropertyIn("id", ids,username); + public int deleteWeaklyByIds(Long[] ids, String username) { + return deleteWeaklyByPropertyIn("id", ids, username); } @Override - public int deleteWeaklyByProperty(String propName, Object propValue,String username) { - return deleteWeaklyByProperties(new String[] { propName }, new Object[] { propValue },username); + public int deleteWeaklyByProperty(String propName, Object propValue, String username) { + return deleteWeaklyByProperties(new String[]{propName}, new Object[]{propValue}, username); } /** * 批量弱删除 + * * @return */ @Override - public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username) { - if(propValues != null && propValues.length > 0){ + public int deleteWeaklyByPropertyIn(String propName, Object[] propValues, String username) { + if (propValues != null && propValues.length > 0) { String hql = "update " + persistentClass.getName() + " model set model.isDeleted =:modelIsDeleted,model.modifyUser=:modelModifyUser,model.modifyDatetime=:modelModifyDatetime where model." - + propName + " in(:"+propName+") "; + + propName + " in(:" + propName + ") "; Query query = entityManager.createQuery(hql); - query.setParameter("modelIsDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); - query.setParameter("modelModifyUser",username); - query.setParameter("modelModifyDatetime",getNowTime(true)); + query.setParameter("modelIsDeleted", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + query.setParameter("modelModifyUser", username); + query.setParameter("modelModifyDatetime", getNowTime(true)); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - }else{ - throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValues); + } else { + throw new IllegalArgumentException("弱删除失败:" + propName + ":" + propValues); } } /** * 批量弱删除 + * * @return */ @Override - public int deleteWeaklyByProperties(String[] propName, Object[] propValue,String username) { + public int deleteWeaklyByProperties(String[] propName, Object[] propValue, String username) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isDeleted = :modelDeleted,model.modifyUser= :modelModifyUser,model.modifyDatetime=:modelModifyDatetime where 1=1 "); - appendQL(sb,propName,propValue); + appendQL(sb, propName, propValue); Query query = entityManager.createQuery(sb.toString()); - query.setParameter("modelModifyUser",username); - query.setParameter("modelModifyDatetime",getNowTime(true)); - query.setParameter("modelDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + query.setParameter("modelModifyUser", username); + query.setParameter("modelModifyDatetime", getNowTime(true)); + query.setParameter("modelDeleted", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); - setParameter(query,propName,propValue); + setParameter(query, propName, propValue); return query.executeUpdate(); - }else{ - throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValue); + } else { + throw new IllegalArgumentException("弱删除失败:" + propName + ":" + propValue); } } @Override - public int updateValidStatusById(ID id,int status,String username) { - return updateValidStatusByProperty("id", id,status,username); + public int updateValidStatusById(ID id, int status, String username) { + return updateValidStatusByProperty("id", id, status, username); } @Override - public int updateValidStatusByIds(Long[] ids,int status,String username) { - return updateValidStatusByPropertyIn("id", ids,status,username); + public int updateValidStatusByIds(Long[] ids, int status, String username) { + return updateValidStatusByPropertyIn("id", ids, status, username); } @Override - public int updateValidStatusByProperty(String propName, Object propValue,int status,String username) { - return updateValidStatusByProperties(new String[] { propName }, new Object[] { propValue },status,username); + public int updateValidStatusByProperty(String propName, Object propValue, int status, String username) { + return updateValidStatusByProperties(new String[]{propName}, new Object[]{propValue}, status, username); } /** * 批量禁用 + * * @return */ @Override - public int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status,String username) { - if(propValues != null && propValues.length > 0){ + public int updateValidStatusByPropertyIn(String propName, Object[] propValues, int status, String username) { + if (propValues != null && propValues.length > 0) { String hql = "update " + persistentClass.getName() + " model set model.isValid =:modelIsValid ,model.modifyUser=:modelModifyUser,model.modifyDatetime=:modelModifyDatetime where model." - + propName + " in(:"+propName+") "; + + propName + " in(:" + propName + ") "; Query query = entityManager.createQuery(hql); - query.setParameter("modelModifyUser",username); - query.setParameter("modelModifyDatetime",getNowTime(true)); - query.setParameter("modelIsValid",status); + query.setParameter("modelModifyUser", username); + query.setParameter("modelModifyDatetime", getNowTime(true)); + query.setParameter("modelIsValid", status); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - }else{ - throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValues); + } else { + throw new IllegalArgumentException("修改状态失败:" + propName + ":" + propValues); } } /** * 批量禁用 + * * @return */ @Override - public int updateValidStatusByProperties(String[] propName, Object[] propValue,int status,String username) { + public int updateValidStatusByProperties(String[] propName, Object[] propValue, int status, String username) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isValid = :modelIsValid,model.modifyUser= :modelModifyUser,model.modifyDatetime=:modelModifyDatetime where 1=1 "); - appendQL(sb,propName,propValue); + appendQL(sb, propName, propValue); Query query = entityManager.createQuery(sb.toString()); - query.setParameter("modelModifyUser",username); - query.setParameter("modelModifyDatetime",getNowTime(true)); - query.setParameter("modelIsValid",status); + query.setParameter("modelModifyUser", username); + query.setParameter("modelModifyDatetime", getNowTime(true)); + query.setParameter("modelIsValid", status); - setParameter(query,propName,propValue); + setParameter(query, propName, propValue); return query.executeUpdate(); - }else{ - throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValue); + } else { + throw new IllegalArgumentException("修改状态失败:" + propName + ":" + propValue); } } @Override public boolean isExitByProperty(String propertyName, Object value) { //大于0,存在 - return findByPropertyCount(propertyName,value) > 0; + return findByPropertyCount(propertyName, value) > 0; } @Override @@ -1384,7 +1388,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public boolean isExitByHqlWhere(String hqlWhere, String[] propertyNames, Object[] values) { - return findByHqlWhereCount(hqlWhere,propertyNames,values) > 0; + return findByHqlWhereCount(hqlWhere, propertyNames, values) > 0; } @Override @@ -1414,7 +1418,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public double findSumByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findSumByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); + return findSumByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); } @Override @@ -1423,46 +1427,46 @@ public class BaseRepositoryImpl extends SimpleJpaRep StringBuffer sb = new StringBuffer("select sum(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if(StringUtils.isNotBlank(groupByName)) { + if (StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query,paramName,paramValue); + setParameter(query, paramName, paramValue); return getNumberByResultList(query.getResultList()); - }else{ + } else { throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findAvgByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findAvgByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); + return findAvgByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); } @Override public double findAvgByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) { if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { - StringBuffer sb = new StringBuffer("select avg(model."+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 "); - appendQL(sb,paramName,paramValue); + StringBuffer sb = new StringBuffer("select avg(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); + appendQL(sb, paramName, paramValue); - if(StringUtils.isNotBlank(groupByName)) { + if (StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query,paramName,paramValue); + setParameter(query, paramName, paramValue); return getNumberByResultList(query.getResultList()); - }else{ + } else { throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findMaxByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findMaxByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); + return findMaxByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); } @Override @@ -1470,22 +1474,22 @@ public class BaseRepositoryImpl extends SimpleJpaRep if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { StringBuffer sb = new StringBuffer("select max(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if(StringUtils.isNotBlank(groupByName)){ + if (StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query,paramName,paramValue); + setParameter(query, paramName, paramValue); return getNumberByResultList(query.getResultList()); - }else{ + } else { throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findMinByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findMinByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); + return findMinByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); } @Override @@ -1494,28 +1498,28 @@ public class BaseRepositoryImpl extends SimpleJpaRep StringBuffer sb = new StringBuffer("select min(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if(StringUtils.isNotBlank(groupByName)) { + if (StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query,paramName,paramValue); + setParameter(query, paramName, paramValue); return getNumberByResultList(query.getResultList()); - }else{ + } else { throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } //从结果集中获取数字转换 - public double getNumberByResultList(List objList){ + public double getNumberByResultList(List objList) { double num = 0.0; - if(objList != null && objList.size() > 0){ - if(objList.get(0) != null){ + if (objList != null && objList.size() > 0) { + if (objList.get(0) != null) { try { num = Double.parseDouble(objList.get(0).toString()); - }catch(NumberFormatException ne){ - LOGGER.error("数字转换出错!",ne); + } catch (NumberFormatException ne) { + LOGGER.error("数字转换出错!", ne); } } } From 368a3a1c66f267f02e7ecb60dd930fe22a376196 Mon Sep 17 00:00:00 2001 From: crish <570360737@qq.com> Date: Wed, 28 Aug 2019 15:58:07 +0800 Subject: [PATCH 13/26] =?UTF-8?q?mes=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: crish <570360737@qq.com> --- .../i3plus/pojo/base/enumutil/MesPcnEnumUtil.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java index dc68917..5d94648 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java @@ -119,4 +119,42 @@ public class MesPcnEnumUtil { } } + + /** + * MesProduceSn实体对应的printStatus值 条码表条码打印状态 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum PRODUCE_SN_PRINT_STATUS { + + CREATE(10, "创建"), + ONLINE(20, "上线打印"), + OFFLINE(30, "下线打印"); + + private int value; + private String description; + + PRODUCE_SN_PRINT_STATUS(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + } From 19253a9b6ae890536671afa2a8490af1b351c874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=95=8F?= <962239776@qq.com> Date: Wed, 28 Aug 2019 16:03:28 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9D=A1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java index 7453a8c..2b3be7c 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java @@ -211,7 +211,7 @@ public class WmsMoveSn extends BaseBean { } public WmsMoveSn( String organizeCode,String orderNo,Integer item,String partNo,String partNameRdd, String transTypeCode,String transTypeName,Integer itemStatus,String unit, String srcLocateNo,String destLocateNo,Double srcQty,Double destQty,Integer srcQcStatus,Integer descQcStatus,Integer srcSnStatus, - Integer destSnStatus, String lotNo,String dateCode,String refSrc,String destZoneNo,String destWhNo,Integer busiTypeCode){ + Integer destSnStatus, String lotNo,String dateCode,String refSrc,String destZoneNo,String destWhNo,Integer busiTypeCode,String sn){ this.organizeCode=organizeCode; this.orderNo=orderNo; this.item=item; @@ -236,5 +236,6 @@ public class WmsMoveSn extends BaseBean { this.destZoneNo = destZoneNo; this.destWhNo =destWhNo; this.busiTypeCode = busiTypeCode; + this.sn = sn; } } From 057fa88904354779953fbdfe780464bbfed2808c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=BF=83=E6=B4=81?= Date: Wed, 28 Aug 2019 17:36:39 +0800 Subject: [PATCH 15/26] revert --- .../pojo/base/jpa/daoimpl/BaseRepositoryImpl.java | 532 ++++++++++----------- 1 file changed, 264 insertions(+), 268 deletions(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java index 1dd2c29..0eb845c 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java @@ -10,7 +10,6 @@ import org.hibernate.NonUniqueResultException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.jpa.repository.support.SimpleJpaRepository; -import org.springframework.util.CollectionUtils; import javax.persistence.*; import java.io.Serializable; @@ -37,7 +36,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep private Class persistentClass; private SnowflakeIdMaker snowflakeIdMaker; - public BaseRepositoryImpl(Class clz, EntityManager em, SnowflakeIdMaker snowflakeIdMaker) { + public BaseRepositoryImpl(Class clz, EntityManager em,SnowflakeIdMaker snowflakeIdMaker) { super(clz, em); this.entityManager = em; this.persistentClass = clz; @@ -83,7 +82,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T insert(T item) { - return insert(item, true); + return insert(item,true); } @Override @@ -94,7 +93,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public S save(S entity) { //复写save方法,若id为0或空则新增,不然则修改 - return (S) innerSave(entity, true); + return (S) innerSave(entity,true); } @Override @@ -136,101 +135,100 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public void deleteById(ID id) { + public void deleteById(ID id){ deleteByProperty("id", id); } @Override public int deleteByProperty(String propName, Object propValue) { - return deleteByProperties(new String[]{propName}, new Object[]{propValue}); + return deleteByProperties(new String[] { propName }, new Object[] { propValue }); } @Override public int deleteByProperties(String[] propName, Object[] propValue) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " model where 1=1 "); - appendQL(sb, propName, propValue); + appendQL(sb,propName,propValue); Query query = entityManager.createQuery(sb.toString()); - setParameter(query, propName, propValue); + setParameter(query,propName,propValue); return query.executeUpdate(); - } else { + }else{ throw new IllegalArgumentException("删除错误!propName:" + propName + ",propValue:" + propValue); } } @Override public int deleteByIds(ID[] ids) { - return deleteByPropertyIn("id", ids); + return deleteByPropertyIn("id", ids); } @Override public int deleteByPropertyIn(String propName, Object[] propValues) { if ((propName != null && propName.length() > 0) && (propValues != null && propValues.length > 0)) { - String hql = "delete from " + persistentClass.getName() + " model where model." + propName + " in(:" + propName + ") "; + String hql = "delete from " + persistentClass.getName() + " model where model."+propName+" in(:"+propName+") "; Query query = entityManager.createQuery(hql); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - } else { - throw new IllegalArgumentException("删除出错:" + propName + ":" + propValues); + }else{ + throw new IllegalArgumentException("删除出错:"+propName+":" + propValues); } } @Override public int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue) { - return updateByProperties(new String[]{conditionName}, new Object[]{conditionValue}, new String[]{propertyName}, new Object[]{propertyValue}); + return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue }); } @Override public int updateByProperties(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByProperties(new String[]{conditionName}, new Object[]{conditionValue}, propertyName, propertyValue); + return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, propertyName, propertyValue); } @Override public int updateByProperties(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue) { - return updateByProperties(conditionName, conditionValue, new String[]{propertyName}, new Object[]{propertyValue}); + return updateByProperties(conditionName, conditionValue, new String[] { propertyName }, new Object[] { propertyValue }); } @Override public int updateByProperties(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue, true); + return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue,true); } @Override public int updateByPropertiesWithVal(String conditionName, Object conditionValue, String propertyName, Object propertyValue) { - return updateByPropertiesWithVal(new String[]{conditionName}, new Object[]{conditionValue}, new String[]{propertyName}, new Object[]{propertyValue}); + return updateByPropertiesWithVal(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue }); } @Override public int updateByPropertiesWithVal(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesWithVal(new String[]{conditionName}, new Object[]{conditionValue}, propertyName, propertyValue); + return updateByPropertiesWithVal(new String[] { conditionName }, new Object[] { conditionValue }, propertyName, propertyValue); } @Override public int updateByPropertiesWithVal(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue) { - return updateByPropertiesWithVal(conditionName, conditionValue, new String[]{propertyName}, new Object[]{propertyValue}); + return updateByPropertiesWithVal(conditionName, conditionValue, new String[] { propertyName }, new Object[] { propertyValue }); } @Override public int updateByPropertiesWithVal(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue) { - return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue, false); + return updateByPropertiesMain(conditionName, conditionValue, propertyName, propertyValue,false); } /** * 更新参数汇总方法 - * - * @param conditionName 条件属性名 + * @param conditionName 条件属性名 * @param conditionValue 条件属性值 - * @param propertyName 更新属性名 - * @param propertyValue 更新属性值 - * @param valWithSimple 是否简单赋值 - * true为正常eg: price = :price - * false为自身添加eg: price = price + :price + * @param propertyName 更新属性名 + * @param propertyValue 更新属性值 + * @param valWithSimple 是否简单赋值 + * true为正常eg: price = :price + * false为自身添加eg: price = price + :price * @return */ private int updateByPropertiesMain(String[] conditionName, Object[] conditionValue, - String[] propertyName, Object[] propertyValue, boolean valWithSimple) { + String[] propertyName, Object[] propertyValue,boolean valWithSimple) { if ((propertyName != null) && (propertyName.length > 0) && (propertyValue != null) && (propertyValue.length > 0) && (propertyName.length == propertyValue.length) && (conditionValue != null) && (conditionValue.length > 0)) { @@ -238,9 +236,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep sb.append("update " + persistentClass.getName() + " model set "); for (int i = 0; i < propertyName.length; i++) { - if (valWithSimple) { + if(valWithSimple) { sb.append(propertyName[i] + " = :p_" + propertyName[i] + ","); - } else { + }else{ sb.append(propertyName[i] + " = " + propertyName[i] + " + :p_" + propertyName[i] + ","); } } @@ -262,36 +260,36 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public int updateByProperties(String propertyName, Object propertyValue, DdlPackBean packBean) { - return updateByProperties(new String[]{propertyName}, new Object[]{propertyValue}, packBean); + public int updateByProperties(String propertyName, Object propertyValue,DdlPackBean packBean) { + return updateByProperties(new String[] { propertyName }, new Object[] { propertyValue },packBean); } @Override - public int updateByProperties(String[] propertyName, Object[] propertyValue, DdlPackBean packBean) { - return updateByPropertiesDdlPack(propertyName, propertyValue, packBean, true); + public int updateByProperties(String[] propertyName, Object[] propertyValue,DdlPackBean packBean) { + return updateByPropertiesDdlPack(propertyName, propertyValue,packBean,true); } @Override - public int updateByPropertiesWithVal(String propertyName, Object propertyValue, DdlPackBean packBean) { - return updateByPropertiesWithVal(new String[]{propertyName}, new Object[]{propertyValue}, packBean); + public int updateByPropertiesWithVal(String propertyName, Object propertyValue,DdlPackBean packBean) { + return updateByPropertiesWithVal(new String[] { propertyName }, new Object[] { propertyValue },packBean); } @Override - public int updateByPropertiesWithVal(String[] propertyName, Object[] propertyValue, DdlPackBean packBean) { - return updateByPropertiesDdlPack(propertyName, propertyValue, packBean, false); + public int updateByPropertiesWithVal(String[] propertyName, Object[] propertyValue,DdlPackBean packBean) { + return updateByPropertiesDdlPack(propertyName, propertyValue,packBean,false); } private int updateByPropertiesDdlPack(String[] propertyName, Object[] propertyValue, - DdlPackBean packBean, boolean valWithSimple) { + DdlPackBean packBean,boolean valWithSimple) { if ((propertyName != null) && (propertyName.length > 0) && (propertyValue != null) && (propertyValue.length > 0) && (propertyName.length == propertyValue.length)) { StringBuffer sb = new StringBuffer(); sb.append("update " + persistentClass.getName() + " model set "); for (int i = 0; i < propertyName.length; i++) { - if (valWithSimple) { + if(valWithSimple) { sb.append(propertyName[i] + " = :p_" + propertyName[i] + ","); - } else { + }else{ sb.append(propertyName[i] + " = " + propertyName[i] + " + :p_" + propertyName[i] + ","); } } @@ -305,7 +303,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } //查询条件 for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.executeUpdate(); @@ -346,9 +344,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T getById(long id) { - try { - return entityManager.find(persistentClass, id); - } catch (Exception e) { + try{ + return entityManager.find(persistentClass,id); + }catch (Exception e){ return null; } } @@ -362,12 +360,12 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List listPager(Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { return entityManager.createQuery("from " + persistentClass.getName()) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -380,16 +378,16 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByPage(DdlPackBean packBean, int offset, int pageSize) { Query query = null; - String ddl = "from " + persistentClass.getName() + " where 1=1 " + packBean.getPackedHql(); + String ddl = "from " + persistentClass.getName() + " where 1=1 " +packBean.getPackedHql(); - if (packBean.isHql()) { + if(packBean.isHql()){ query = entityManager.createQuery(ddl); - } else { + }else{ query = entityManager.createNativeQuery(ddl); } for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(offset) @@ -414,7 +412,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByProperty(String[] propertyNames, Object[] values) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -426,14 +424,14 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -449,7 +447,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByProperty(String[] propertyNames, Object[] values, String orderByStuff) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -461,7 +459,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -470,7 +468,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -480,34 +478,37 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public T getByProperty(DdlPackBean packBean) { - List list = findByHqlWhere(packBean); - if (CollectionUtils.isEmpty(list)) { - LOGGER.error("数据不存在,DdlPackBean:{}", packBean); - throw new RuntimeException("数据不存在"); - } else if (list.size() > 1) { - LOGGER.error("查询单条记录,但出现多条。packBean:{}", packBean); - throw new RuntimeException("存在多条记录"); + + try { + List list = findByHqlWhere(packBean); + return list.size() != 0 ? list.get(0) : null; + }catch(NoResultException ne){ + LOGGER.error("数据不存在,DdlPackBean:{}",packBean); + return null; + }catch(NonUniqueResultException ex){ + LOGGER.error("查询单条记录,但出现多条。packBean:{}",packBean); + throw new RuntimeException("存在多条记录:" + ex.getMessage()); } - return list.iterator().next(); } @Override public T getByProperty(String propertyName, Object value) { String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName; try { - return (T) entityManager.createQuery(queryString).setParameter(propertyName, value).getSingleResult(); - } catch (NoResultException ne) { - LOGGER.error("数据不存在,prop:{},value:{}", propertyName, value, ne); + List list = entityManager.createQuery(queryString).setParameter(propertyName, value).getResultList(); + return list.size() != 0 ? list.get(0) : null; + }catch(NoResultException ne){ + LOGGER.error("数据不存在,prop:{},value:{}",propertyName,value,ne); return null; - } catch (NonUniqueResultException ex) { - LOGGER.error("查询单条记录,但出现多条。prop:{},value:{}", propertyName, value, ex); + }catch(NonUniqueResultException ex){ + LOGGER.error("查询单条记录,但出现多条。prop:{},value:{}",propertyName,value,ex); throw new RuntimeException("存在多条记录:" + ex.getMessage()); } } @Override public T getByProperty(String[] propertyNames, Object[] values) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -519,56 +520,57 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try { - return (T) queryObject.getSingleResult(); - } catch (NoResultException ne) { - LOGGER.error("数据不存在", ne); + try{ + List list = queryObject.getResultList(); + return list.size() != 0 ? list.get(0) : null; + }catch(NoResultException ne){ + LOGGER.error("数据不存在",ne); return null; - } catch (NonUniqueResultException ex) { - LOGGER.error("查询单条记录,但出现多条。", ex); + }catch(NonUniqueResultException ex){ + LOGGER.error("查询单条记录,但出现多条。",ex); throw new RuntimeException("存在多条记录:" + ex.getMessage()); } } @Override public int listCount() { - try { - Long count = entityManager.createQuery("select count(distinct model) from " + persistentClass.getName() + " as model", Long.class) + try{ + Long count = entityManager.createQuery("select count(distinct model) from " + persistentClass.getName() + " as model",Long.class) .getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public int findByPropertyCount(String propertyName, Object value) { - try { + try{ String queryString = "select count(distinct model) from " + persistentClass.getName() + " as model where model." + propertyName + "= :" + propertyName; Long count = entityManager.createQuery(queryString, Long.class) .setParameter(propertyName, value) .getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public int findByPropertyCount(String[] propertyNames, Object[] values) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -580,42 +582,42 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } - Query queryObject = entityManager.createQuery(queryString.toString(), Long.class); + Query queryObject = entityManager.createQuery(queryString.toString(),Long.class); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try { + try{ Long count = (Long) queryObject.getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public List findByPropertyPage(String propertyName, Object value, String orderByStuff, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0){ String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName + " " + orderByStuff; return entityManager.createQuery(queryString) .setParameter(propertyName, value) .getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findByPropertyPage(String[] propertyNames, Object[] values, String orderByStuff, Pager pager) { - if (pager.getTotalRows() > 0) { - if (propertyNames.length != values.length) { + if(pager.getTotalRows() > 0){ + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -627,12 +629,12 @@ public class BaseRepositoryImpl extends SimpleJpaRep } for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } - if (orderByStuff != null && orderByStuff.length() > 0) { + if(orderByStuff != null && orderByStuff.length() > 0){ queryString.append(orderByStuff); } @@ -642,7 +644,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } return queryObject.setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -672,7 +674,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.getResultList(); @@ -680,7 +682,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByHqlWhere(String hqlWhere, String[] propertyNames, Object[] values, String orderByStuff) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } @@ -693,7 +695,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -702,7 +704,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } @@ -711,7 +713,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public int findByHqlWhereCount(String hqlWhere, String[] propertyNames, Object[] values) { - if (propertyNames.length != values.length) { + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -723,30 +725,30 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } Query queryObject = entityManager.createQuery(queryString.toString()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } - try { - Long count = entityManager.createQuery(queryString.toString(), Long.class).getSingleResult(); + try{ + Long count = entityManager.createQuery(queryString.toString(),Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public List findByHqlWherePage(String hqlWhere, Pager pager, String[] propertyNames, Object[] values, String orderByStuff) { - if (pager.getTotalRows() > 0) { - if (propertyNames.length != values.length) { + if(pager.getTotalRows() > 0){ + if(propertyNames.length != values.length){ throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); } StringBuffer queryString = new StringBuffer(); @@ -758,7 +760,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep int size = propertyNames.length; for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryString.append(" and model." + propertyNames[i] + "= :" + propertyNames[i]); } } @@ -766,13 +768,13 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query queryObject = entityManager.createQuery(queryString.toString()).setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()); for (int i = 0; i < size; i++) { - if (values[i] != null) { + if(values[i] != null) { queryObject.setParameter(propertyNames[i], values[i]); } } return queryObject.getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -780,7 +782,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Deprecated @Override public List findByHqlWherePage(String hqlWhere, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { StringBuffer queryString = new StringBuffer(); queryString.append("from " + persistentClass.getSimpleName() + " as model where 1=1 "); @@ -792,25 +794,25 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findByHqlWherePage(DdlPackBean packBean, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -824,10 +826,10 @@ public class BaseRepositoryImpl extends SimpleJpaRep if (hqlWhere != null && hqlWhere.length() > 0) { queryString.append(hqlWhere); } - try { + try{ Long count = entityManager.createQuery(queryString.toString(), Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @@ -840,44 +842,44 @@ public class BaseRepositoryImpl extends SimpleJpaRep Query query = entityManager.createQuery(queryString.toString(), Long.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } - try { + try{ Long count = (Long) query.getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public int findByHqlCount(String hql) { - try { - Long count = entityManager.createQuery(hql, Long.class).getSingleResult(); + try{ + Long count = entityManager.createQuery(hql,Long.class).getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public int findByHqlCount(String hql, String[] paramName, Object[] paramValue) { - Query queryObject = entityManager.createQuery(hql, Integer.class); - for (int i = 0; i < paramName.length; i++) { - if (paramValue[i] != null) { + Query queryObject = entityManager.createQuery(hql,Integer.class); + for(int i=0;i findByHqlPage(String hqlWhere, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0){ StringBuffer queryString = new StringBuffer(); queryString.append("from " + persistentClass.getSimpleName() + " as model where 1=1 "); @@ -889,32 +891,32 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findByHqlPage(DdlPackBean packBean, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0){ Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findByHqlPage(String hql, Pager pager, String[] paramName, Object[] paramValue) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { Query queryObject = entityManager.createQuery(hql); for (int i = 0; i < paramName.length; i++) { if (paramValue[i] != null) { @@ -925,7 +927,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep return queryObject.setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -937,29 +939,29 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findBySql(String sql, Class entity) { - return entityManager.createNativeQuery(sql, entity).getResultList(); + return entityManager.createNativeQuery(sql,entity).getResultList(); } @Override public List findBySqlPage(String sql, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { return entityManager.createNativeQuery(sql) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findBySqlPage(String sql, Class entity, Pager pager) { - if (pager.getTotalRows() > 0) { - return entityManager.createNativeQuery(sql, entity) + if(pager.getTotalRows() > 0){ + return entityManager.createNativeQuery(sql,entity) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -971,74 +973,74 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public int findBySqlCount(String sql) { - try { + try{ Long count = (Long) entityManager - .createNativeQuery("select count(*) from ( " + sql + " ) as usertable", Long.class) + .createNativeQuery("select count(*) from ( " + sql + " ) as usertable",Long.class) .getSingleResult(); return count == null ? 0 : count.intValue(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public double findBySqlSumDouble(String sql, String columnName) { - try { + try{ return (double) entityManager - .createNativeQuery("select sum(" + columnName + ") from ( " + sql + " ) as usertable", Double.class) + .createNativeQuery("select sum(" + columnName + ") from ( " + sql + " ) as usertable",Double.class) .getSingleResult(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public double findByHqlDouble(String hql) { - try { - Double result = entityManager.createQuery(hql, Double.class).getSingleResult(); + try{ + Double result = entityManager.createQuery(hql,Double.class).getSingleResult(); return result == null ? 0 : result; - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public double findByHqlDouble(DdlPackBean packBean) { - try { - Query query = entityManager.createQuery(packBean.getPackedHqlAll(), Double.class); + try{ + Query query = entityManager.createQuery(packBean.getPackedHqlAll(),Double.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } Double result = (Double) query.getSingleResult(); return result == null ? 0 : result; - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @Override public long findByHqlLong(String hql) { - try { - return entityManager.createQuery(hql, Long.class).getSingleResult(); - } catch (NoResultException e) { + try{ + return entityManager.createQuery(hql,Long.class).getSingleResult(); + }catch(NoResultException e){ return 0; } } @Override public long findByHqlLong(DdlPackBean packBean) { - try { + try{ Query query = entityManager.createQuery("from " + persistentClass.getSimpleName() - + " as model where 1=1 " + packBean.getPackedHql(), Long.class); + + " as model where 1=1 " + packBean.getPackedHql(),Long.class); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return (long) query.getSingleResult(); - } catch (NoResultException e) { + }catch(NoResultException e){ return 0; } } @@ -1060,14 +1062,14 @@ public class BaseRepositoryImpl extends SimpleJpaRep + " as model where 1=1 " + packBean.getPackedHql()); for (String key : packBean.getHqlPreparedMap().keySet()) { - query.setParameter("m_" + key, packBean.getHqlPreparedMap().get(key)); + query.setParameter("m_" + key,packBean.getHqlPreparedMap().get(key)); } return query.setFirstResult(0).setMaxResults(topNum).getResultList(); } @Override public List findColumnsByHql(String hql, String hqlWhere, String orderByStuff, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { StringBuffer queryString = new StringBuffer(); queryString.append(hql + " as model where 1=1 "); @@ -1082,7 +1084,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -1095,8 +1097,8 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findByHqlObjects(String hql, String[] paramName, Object[] paramValue) { Query queryObject = entityManager.createQuery(hql); - for (int i = 0; i < paramName.length; i++) { - if (paramValue[i] != null) { + for(int i=0;i extends SimpleJpaRep @Override public List findByHqlPageObjects(String hql, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0){ return entityManager.createQuery(hql).setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - } else { + }else{ return new ArrayList(); } } @Override public List findByHqlPageObjects(String hql, Pager pager, String[] paramName, Object[] paramValue) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0) { Query queryObject = entityManager.createQuery(hql); for (int i = 0; i < paramName.length; i++) { if (paramValue[i] != null) { @@ -1124,7 +1126,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep } return queryObject.setFirstResult(pager.getStartRow()).setMaxResults(pager.getPageSize()).getResultList(); - } else { + }else{ return new ArrayList(); } } @@ -1136,61 +1138,60 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public List findBySqlObjListByPager(String sql, Pager pager) { - if (pager.getTotalRows() > 0) { + if(pager.getTotalRows() > 0){ return entityManager.createNativeQuery(sql) .setFirstResult(pager.getStartRow()) .setMaxResults(pager.getPageSize()) .getResultList(); - } else { + }else{ return new ArrayList(); } } /** * 保存对象 - * * @param item 保存对象 * @return */ private T innerSave(T item, boolean initParam) { try { - if (item == null) { + if(item == null) { return null; } Class clazz = item.getClass(); //获取主键 Field idField = clazz.getField("id"); - if (idField == null) { + if(idField == null){ idField = clazz.getField("primaryKey"); } - if (idField == null) { + if(idField == null){ // 遍历所有属性,以@Id声明确认主键 Field[] fields = clazz.getFields(); - for (Field f : fields) { - if (f.getAnnotation(Id.class) != null) { + for(Field f : fields){ + if(f.getAnnotation(Id.class) != null){ idField = f; break; } } } - if (idField != null) { + if(idField != null){ Class type = idField.getType(); Object val = idField.get(item); - if (type == Long.class && (val == null || Long.parseLong(val.toString()) == 0)) { + if(type == Long.class && (val == null || Long.parseLong(val.toString()) == 0)){ // long类型主键,以snowflake为主键 idField.set(item, snowflakeIdMaker.nextId()); - } else if (type == String.class && (val == null || "".equals(val))) { + } else if(type == String.class && (val==null || "".equals(val))){ // String类型主键,以UUID为主键 idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase()); } } //属性值过滤,避免null值 - if (initParam) { - for (Field checkField : clazz.getFields()) { - if (checkField.get(item) == null) { + if(initParam){ + for(Field checkField : clazz.getFields()){ + if(checkField.get(item) == null){ // 未赋值的属性,进行初始化赋值 fieldSetInitParam(item, checkField); } @@ -1199,9 +1200,9 @@ public class BaseRepositoryImpl extends SimpleJpaRep entityManager.merge(item); entityManager.flush(); - if (idField != null) { + if(idField!=null){ return item; - } else { + }else { return null; } } catch (Exception e) { @@ -1212,22 +1213,21 @@ public class BaseRepositoryImpl extends SimpleJpaRep /** * 对为赋值的属性进行赋值 - * * @param field */ - private void fieldSetInitParam(T item, Field field) { + private void fieldSetInitParam(T item,Field field) { try { if (field.getType() == String.class) { field.set(item, ""); } else if (field.getType() == Byte.class || field.getType() == Character.class || field.getType() == Integer.class) { field.set(item, 0); - } else if (field.getType() == Long.class) { + } else if(field.getType() == Long.class){ field.set(item, 0L); - } else if (field.getType() == Float.class) { + } else if(field.getType() == Float.class){ field.set(item, 0.0f); - } else if (field.getType() == Double.class) { + } else if(field.getType() == Double.class){ field.set(item, 0.0d); - } else if (field.getType() == Boolean.class) { + } else if(field.getType() == Boolean.class){ field.set(item, false); } } catch (IllegalAccessException e) { @@ -1252,133 +1252,129 @@ public class BaseRepositoryImpl extends SimpleJpaRep } @Override - public int deleteWeaklyById(ID id, String username) { - return deleteWeaklyByProperty("id", id, username); + public int deleteWeaklyById(ID id,String username) { + return deleteWeaklyByProperty("id", id,username); } @Override - public int deleteWeaklyByIds(Long[] ids, String username) { - return deleteWeaklyByPropertyIn("id", ids, username); + public int deleteWeaklyByIds(Long[] ids,String username) { + return deleteWeaklyByPropertyIn("id", ids,username); } @Override - public int deleteWeaklyByProperty(String propName, Object propValue, String username) { - return deleteWeaklyByProperties(new String[]{propName}, new Object[]{propValue}, username); + public int deleteWeaklyByProperty(String propName, Object propValue,String username) { + return deleteWeaklyByProperties(new String[] { propName }, new Object[] { propValue },username); } /** * 批量弱删除 - * * @return */ @Override - public int deleteWeaklyByPropertyIn(String propName, Object[] propValues, String username) { - if (propValues != null && propValues.length > 0) { + public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username) { + if(propValues != null && propValues.length > 0){ String hql = "update " + persistentClass.getName() + " model set model.isDeleted =:modelIsDeleted,model.modifyUser=:modelModifyUser,model.modifyDatetime=:modelModifyDatetime where model." - + propName + " in(:" + propName + ") "; + + propName + " in(:"+propName+") "; Query query = entityManager.createQuery(hql); - query.setParameter("modelIsDeleted", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); - query.setParameter("modelModifyUser", username); - query.setParameter("modelModifyDatetime", getNowTime(true)); + query.setParameter("modelIsDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + query.setParameter("modelModifyUser",username); + query.setParameter("modelModifyDatetime",getNowTime(true)); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - } else { - throw new IllegalArgumentException("弱删除失败:" + propName + ":" + propValues); + }else{ + throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValues); } } /** * 批量弱删除 - * * @return */ @Override - public int deleteWeaklyByProperties(String[] propName, Object[] propValue, String username) { + public int deleteWeaklyByProperties(String[] propName, Object[] propValue,String username) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isDeleted = :modelDeleted,model.modifyUser= :modelModifyUser,model.modifyDatetime=:modelModifyDatetime where 1=1 "); - appendQL(sb, propName, propValue); + appendQL(sb,propName,propValue); Query query = entityManager.createQuery(sb.toString()); - query.setParameter("modelModifyUser", username); - query.setParameter("modelModifyDatetime", getNowTime(true)); - query.setParameter("modelDeleted", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + query.setParameter("modelModifyUser",username); + query.setParameter("modelModifyDatetime",getNowTime(true)); + query.setParameter("modelDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); - setParameter(query, propName, propValue); + setParameter(query,propName,propValue); return query.executeUpdate(); - } else { - throw new IllegalArgumentException("弱删除失败:" + propName + ":" + propValue); + }else{ + throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValue); } } @Override - public int updateValidStatusById(ID id, int status, String username) { - return updateValidStatusByProperty("id", id, status, username); + public int updateValidStatusById(ID id,int status,String username) { + return updateValidStatusByProperty("id", id,status,username); } @Override - public int updateValidStatusByIds(Long[] ids, int status, String username) { - return updateValidStatusByPropertyIn("id", ids, status, username); + public int updateValidStatusByIds(Long[] ids,int status,String username) { + return updateValidStatusByPropertyIn("id", ids,status,username); } @Override - public int updateValidStatusByProperty(String propName, Object propValue, int status, String username) { - return updateValidStatusByProperties(new String[]{propName}, new Object[]{propValue}, status, username); + public int updateValidStatusByProperty(String propName, Object propValue,int status,String username) { + return updateValidStatusByProperties(new String[] { propName }, new Object[] { propValue },status,username); } /** * 批量禁用 - * * @return */ @Override - public int updateValidStatusByPropertyIn(String propName, Object[] propValues, int status, String username) { - if (propValues != null && propValues.length > 0) { + public int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status,String username) { + if(propValues != null && propValues.length > 0){ String hql = "update " + persistentClass.getName() + " model set model.isValid =:modelIsValid ,model.modifyUser=:modelModifyUser,model.modifyDatetime=:modelModifyDatetime where model." - + propName + " in(:" + propName + ") "; + + propName + " in(:"+propName+") "; Query query = entityManager.createQuery(hql); - query.setParameter("modelModifyUser", username); - query.setParameter("modelModifyDatetime", getNowTime(true)); - query.setParameter("modelIsValid", status); + query.setParameter("modelModifyUser",username); + query.setParameter("modelModifyDatetime",getNowTime(true)); + query.setParameter("modelIsValid",status); query.setParameter(propName, Arrays.asList(propValues)); return query.executeUpdate(); - } else { - throw new IllegalArgumentException("修改状态失败:" + propName + ":" + propValues); + }else{ + throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValues); } } /** * 批量禁用 - * * @return */ @Override - public int updateValidStatusByProperties(String[] propName, Object[] propValue, int status, String username) { + public int updateValidStatusByProperties(String[] propName, Object[] propValue,int status,String username) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isValid = :modelIsValid,model.modifyUser= :modelModifyUser,model.modifyDatetime=:modelModifyDatetime where 1=1 "); - appendQL(sb, propName, propValue); + appendQL(sb,propName,propValue); Query query = entityManager.createQuery(sb.toString()); - query.setParameter("modelModifyUser", username); - query.setParameter("modelModifyDatetime", getNowTime(true)); - query.setParameter("modelIsValid", status); + query.setParameter("modelModifyUser",username); + query.setParameter("modelModifyDatetime",getNowTime(true)); + query.setParameter("modelIsValid",status); - setParameter(query, propName, propValue); + setParameter(query,propName,propValue); return query.executeUpdate(); - } else { - throw new IllegalArgumentException("修改状态失败:" + propName + ":" + propValue); + }else{ + throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValue); } } @Override public boolean isExitByProperty(String propertyName, Object value) { //大于0,存在 - return findByPropertyCount(propertyName, value) > 0; + return findByPropertyCount(propertyName,value) > 0; } @Override @@ -1388,7 +1384,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public boolean isExitByHqlWhere(String hqlWhere, String[] propertyNames, Object[] values) { - return findByHqlWhereCount(hqlWhere, propertyNames, values) > 0; + return findByHqlWhereCount(hqlWhere,propertyNames,values) > 0; } @Override @@ -1418,7 +1414,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public double findSumByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findSumByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); + return findSumByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); } @Override @@ -1427,46 +1423,46 @@ public class BaseRepositoryImpl extends SimpleJpaRep StringBuffer sb = new StringBuffer("select sum(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if (StringUtils.isNotBlank(groupByName)) { + if(StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query, paramName, paramValue); + setParameter(query,paramName,paramValue); return getNumberByResultList(query.getResultList()); - } else { + }else{ throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findAvgByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findAvgByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); + return findAvgByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); } @Override public double findAvgByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) { if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { - StringBuffer sb = new StringBuffer("select avg(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); - appendQL(sb, paramName, paramValue); + StringBuffer sb = new StringBuffer("select avg(model."+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 "); + appendQL(sb,paramName,paramValue); - if (StringUtils.isNotBlank(groupByName)) { + if(StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query, paramName, paramValue); + setParameter(query,paramName,paramValue); return getNumberByResultList(query.getResultList()); - } else { + }else{ throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findMaxByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findMaxByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); + return findMaxByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); } @Override @@ -1474,22 +1470,22 @@ public class BaseRepositoryImpl extends SimpleJpaRep if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { StringBuffer sb = new StringBuffer("select max(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if (StringUtils.isNotBlank(groupByName)) { + if(StringUtils.isNotBlank(groupByName)){ sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query, paramName, paramValue); + setParameter(query,paramName,paramValue); return getNumberByResultList(query.getResultList()); - } else { + }else{ throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } @Override public double findMinByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { - return findMinByProperties(sumPropertyName, groupByName, new String[]{propertyName}, new Object[]{value}); + return findMinByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); } @Override @@ -1498,28 +1494,28 @@ public class BaseRepositoryImpl extends SimpleJpaRep StringBuffer sb = new StringBuffer("select min(model." + sumPropertyName + ") from " + persistentClass.getName() + " model where 1=1 "); appendQL(sb, paramName, paramValue); - if (StringUtils.isNotBlank(groupByName)) { + if(StringUtils.isNotBlank(groupByName)) { sb.append(" group by model." + groupByName); } Query query = entityManager.createQuery(sb.toString()); - setParameter(query, paramName, paramValue); + setParameter(query,paramName,paramValue); return getNumberByResultList(query.getResultList()); - } else { + }else{ throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue); } } //从结果集中获取数字转换 - public double getNumberByResultList(List objList) { + public double getNumberByResultList(List objList){ double num = 0.0; - if (objList != null && objList.size() > 0) { - if (objList.get(0) != null) { + if(objList != null && objList.size() > 0){ + if(objList.get(0) != null){ try { num = Double.parseDouble(objList.get(0).toString()); - } catch (NumberFormatException ne) { - LOGGER.error("数字转换出错!", ne); + }catch(NumberFormatException ne){ + LOGGER.error("数字转换出错!",ne); } } } From 71e73622166bca46555c121da80d2d73e33863ee Mon Sep 17 00:00:00 2001 From: crish <570360737@qq.com> Date: Thu, 29 Aug 2019 09:33:22 +0800 Subject: [PATCH 16/26] =?UTF-8?q?PCN=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=EF=BC=8C=20=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: crish <570360737@qq.com> --- .../java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesProdRouteOptParam.java | 4 ++++ .../main/java/cn/estsh/i3plus/pojo/mes/bean/MesProdRouteOptParam.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesProdRouteOptParam.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesProdRouteOptParam.java index 4ca2cb4..effd957 100644 --- a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesProdRouteOptParam.java +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesProdRouteOptParam.java @@ -62,4 +62,8 @@ public class MesProdRouteOptParam extends BaseBean { public int getStepSeq() { return this.stepSeq == null ? 0 : this.stepSeq; } + + public void setStepSeq(int stepSeq) { + this.stepSeq = stepSeq; + } } diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesProdRouteOptParam.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesProdRouteOptParam.java index 786c2eb..313d7e7 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesProdRouteOptParam.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesProdRouteOptParam.java @@ -73,6 +73,10 @@ public class MesProdRouteOptParam extends BaseBean { return this.stepSeq == null ? 0 : this.stepSeq; } + public void setStepSeq(int stepSeq) { + this.stepSeq = stepSeq; + } + public int getParamTypeVal() { return this.paramType == null ? 0 : this.paramType; } From 27d574314d701f612bb42b010ab7481ce801db56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=BF=83=E6=B4=81?= Date: Thu, 29 Aug 2019 15:17:07 +0800 Subject: [PATCH 17/26] =?UTF-8?q?getList=E6=9C=AA=E6=9F=A5=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A6=81=E5=88=A4=E6=96=AD+=E8=A1=A5?= =?UTF-8?q?=E5=85=A8=E6=89=80=E6=9C=89showInformation=E5=8C=BA=E5=88=86?= =?UTF-8?q?=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java index edbc48f..15714c1 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/wms/WmsMessageStyleModel.java @@ -1,5 +1,6 @@ package cn.estsh.i3plus.pojo.model.wms; +import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil; import io.swagger.annotations.ApiParam; import lombok.Data; @@ -40,4 +41,15 @@ public class WmsMessageStyleModel implements Serializable { public WmsMessageStyleModel(String message) { this.message = message; } + + public WmsMessageStyleModel(String message, double transQty, double actQty) { + this.message = message; + if (actQty == 0) {//未处理 + this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.CREATE.getValue(); + } else if (actQty > 0) { + this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT.getValue(); + } else if (actQty == transQty) { + this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT_FINISH.getValue(); + } + } } From f09ac4d897dad882f65ab11426eaf1d29906578b Mon Sep 17 00:00:00 2001 From: crish <570360737@qq.com> Date: Thu, 29 Aug 2019 19:22:06 +0800 Subject: [PATCH 18/26] =?UTF-8?q?=E5=AE=89=E7=81=AF=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: crish <570360737@qq.com> --- .../bean/AndonManageQueue.java | 14 +++++ .../sqlpack/AndonHqlPack.java | 62 ++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/bean/AndonManageQueue.java b/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/bean/AndonManageQueue.java index 8f43576..2e9a6f6 100644 --- a/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/bean/AndonManageQueue.java +++ b/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/bean/AndonManageQueue.java @@ -103,6 +103,12 @@ public class AndonManageQueue extends BaseBean { @AnnoOutputColumn(hidden = true) public String callTime; + @Column(name="CLOSE_TIME") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @ApiParam(value="撤销时间",example = "2018-01-01 01:00:00") + @AnnoOutputColumn(hidden = true) + public String closeTime; + @Transient @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @ApiParam(value="呼叫时间,查询开始时间", example = "2018-01-01 01:00:00") @@ -129,6 +135,10 @@ public class AndonManageQueue extends BaseBean { @ApiParam(value = "呼叫人") private String callUser; + @Column(name = "CLOSE_USER") + @ApiParam(value = "撤销人") + private String closeUser; + @Transient @ApiParam(value = "呼叫人名字") private String callUserName; @@ -203,6 +213,10 @@ public class AndonManageQueue extends BaseBean { @ApiParam(value = "事件方法描述") private String emNameRdd; + @Column(name = "CLOSE_CAUSE") + @ApiParam(value = "撤销原因") + private String closeCause; + @Column(name = "EM_DESC") @ApiParam(value = "事件具体方法") private String emDesc; diff --git a/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/sqlpack/AndonHqlPack.java b/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/sqlpack/AndonHqlPack.java index d1a06e2..ef4198c 100644 --- a/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/sqlpack/AndonHqlPack.java +++ b/modules/i3plus-pojo-andon/src/main/java/cn.estsh.i3plus.pojo.andon/sqlpack/AndonHqlPack.java @@ -3,10 +3,13 @@ package cn.estsh.i3plus.pojo.andon.sqlpack; import cn.estsh.i3plus.pojo.andon.bean.*; import cn.estsh.i3plus.pojo.base.bean.BaseBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.enumutil.AndonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.HqlPack; +import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; /** @@ -17,6 +20,65 @@ import org.apache.commons.lang3.StringUtils; * @Modify: **/ public class AndonHqlPack { + /***************** crish 工作单元呼叫原因配置, 处理方法配置, 处理事件原因配置, 事件现象配置 Start ***********/ + /** + * 工作单元呼叫原因配置查询条件封装 + * @param andonCellAlarmCause + * @return + */ + public static DdlPackBean getAndonCellAlarmCause(AndonCellAlarmCause andonCellAlarmCause) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getOrganizeCode(), "organizeCode", packBean); + DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getAlarmCode(), "alarmCode", packBean); + return packBean; + } + + /** + * 工作单元事件方法配置查询条件封装 + * @param andonEventMethod + * @return + */ + public static DdlPackBean getAndonCellEventMethod(AndonCellEventMethod andonEventMethod) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(andonEventMethod.getOrganizeCode(), "organizeCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventMethod.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventMethod.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventMethod.getEmCode(), "emCode", packBean); + return packBean; + } + + /** + * 工作单元事件原因查询封装 + * @param andonEventCause + * @return + */ + public static DdlPackBean getAndonCellEventCause(AndonCellEventCause andonEventCause) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(andonEventCause.getOrganizeCode(), "organizeCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventCause.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventCause.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventCause.getEcCode(), "ecCode", packBean); + return packBean; + } + + /** + * 工作单元事件现象查询条件封装 + * @param andonEventPhenoMenon + * @return + */ + public static DdlPackBean getAndonCellEventPhenomenon(AndonCellEventPhenomenon andonEventPhenoMenon) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getOrganizeCode(), "organizeCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getEpmCode(), "epmCode", packBean); + return packBean; + } + /***************** crish 工作单元呼叫原因配置, 处理方法配置, 处理事件原因配置, 事件现象配置 End ************/ + + /** * genju 安灯队列参数查询安灯队列 * @param andonManageQueue From 6929e8857089842bcbce468085dd4a330490eb09 Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 11:47:24 +0800 Subject: [PATCH 19/26] =?UTF-8?q?mes-pcn=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/MesPcnEnumUtil.java | 39 +++++++++++++++++++++- .../estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java | 12 +++++++ .../cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java | 12 +++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java index ec57bec..4643e50 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java @@ -12,8 +12,45 @@ import com.fasterxml.jackson.annotation.JsonFormat; public class MesPcnEnumUtil { /** + * mes-pcn定时任务状态 + * + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum MES_PCN_TASK_STATUS{ + + OPEN(1,"OPEN"), + CLOSE(2,"CLOSE"); + + private int value; + private String description; + + MES_PCN_TASK_STATUS(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + /** * mes-pcn定时任务同步结果状态 - * 10. + * */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum MES_PCN_TASK_SYNC_STATUS{ diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java index 0ccb531..054bb21 100644 --- a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java @@ -37,6 +37,10 @@ public class MesPcnTask extends BaseBean { @ApiParam("任务名称") private String taskName; + @Column(name="TASK_GROUP_NAME") + @ApiParam("任务组名称") + private String taskGroupName; + @Column(name="TASK_DESCRIPTION") @ApiParam("任务描述") private String taskDescription; @@ -69,7 +73,15 @@ public class MesPcnTask extends BaseBean { @ApiParam("任务周期描述") private String taskCycleDescription; + @Column(name="TASK_STATUS") + @ApiParam("任务状态") + private Integer taskStatus; + public int getTaskTypeVal() { return this.taskType == null ? 0 : this.taskType; } + + public int getTaskStatusVal() { + return this.taskStatus == null ? 0 : this.taskStatus; + } } diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java index 27daf23..5f2e53d 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java @@ -37,6 +37,10 @@ public class MesPcnTask extends BaseBean { @ApiParam("任务名称") private String taskName; + @Column(name="TASK_GROUP_NAME") + @ApiParam("任务组名称") + private String taskGroupName; + @Column(name="TASK_DESCRIPTION") @ApiParam("任务描述") private String taskDescription; @@ -69,7 +73,15 @@ public class MesPcnTask extends BaseBean { @ApiParam("任务周期描述") private String taskCycleDescription; + @Column(name="TASK_STATUS") + @ApiParam("任务状态") + private Integer taskStatus; + public int getTaskTypeVal() { return this.taskType == null ? 0 : this.taskType; } + + public int getTaskStatusVal() { + return this.taskStatus == null ? 0 : this.taskStatus; + } } From d7ddf4d5a06a318f62d6f702f12382629f843fd6 Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 14:21:04 +0800 Subject: [PATCH 20/26] =?UTF-8?q?mes-pcn=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java index 9a0d1d1..8b5c605 100644 --- a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTaskLog.java @@ -43,7 +43,7 @@ public class MesPcnTaskLog extends BaseBean { @Column(name="ERROR_CONTENT") @ApiParam("异常内容") - private String errorContent; + private Long errorContent; public int getSyncStatusVal() { return this.syncStatus == null ? 0 : this.syncStatus; From 9981c4089b5f918e88032238ee08851d97412e26 Mon Sep 17 00:00:00 2001 From: crish <570360737@qq.com> Date: Fri, 30 Aug 2019 14:40:53 +0800 Subject: [PATCH 21/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=94=AF=E4=B8=80?= =?UTF-8?q?=E6=80=A7=E6=A0=A1=E9=AA=8C=EF=BC=8C=20=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A6=81=E7=94=A8=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: crish <570360737@qq.com> --- .../estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java index cbbb025..6796c95 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java @@ -507,14 +507,17 @@ public class MesHqlPack { } public static DdlPackBean getMesEventByEventCode(String eventCode, String org) { - DdlPackBean packBean = getAllBaseData(org); + DdlPackBean packBean = new DdlPackBean(); + DdlPreparedPack.getStringEqualPack(org, "organizeCode", packBean); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean); DdlPreparedPack.getStringEqualPack(eventCode, "eventCode", packBean); - DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean); return packBean; } public static DdlPackBean getMesActionByActionCode(MesAction mesAction, String organizeCode) { - DdlPackBean packBean = getAllBaseDataByNormalPro(mesAction, organizeCode); + DdlPackBean packBean = new DdlPackBean(); + DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean); DdlPreparedPack.getStringEqualPack(mesAction.getActionCode(), "actionCode", packBean); return packBean; } @@ -567,10 +570,10 @@ public class MesHqlPack { } public static DdlPackBean getMesMethodByMethodCode(MesMethod mesMethod, String organizeCode) { - DdlPackBean packBean = getAllBaseDataByNormalPro(mesMethod, organizeCode); - if (StringUtils.isNotEmpty(mesMethod.getMethodCode())) { - DdlPreparedPack.getStringEqualPack(mesMethod.getMethodCode(), "methodCode", packBean); - } + DdlPackBean packBean = new DdlPackBean(); + DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean); + DdlPreparedPack.getStringEqualPack(mesMethod.getMethodCode(), "methodCode", packBean); return packBean; } @@ -1143,13 +1146,8 @@ public class MesHqlPack { */ public static DdlPackBean getMesPcnTask(MesPcnTask mesPcnTask, String organizeCode) { DdlPackBean packBean = getAllBaseDataByNormalPro(mesPcnTask, organizeCode); - if (StringUtils.isNotEmpty(mesPcnTask.getTaskCode())) { - DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean); - } - if (StringUtils.isNotEmpty(mesPcnTask.getTaskName())) { - DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); - } - + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean); + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); packBean.setOrderByStr(mesPcnTask.orderBy()); return packBean; } From ac1090d6614e5eeb3b16e0723c97ad71db8a8271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=95=8F?= <962239776@qq.com> Date: Fri, 30 Aug 2019 14:42:50 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveDetails.java | 5 ++++- .../src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveMaster.java | 3 ++- .../src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveDetails.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveDetails.java index d3a23e6..d80e4b2 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveDetails.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveDetails.java @@ -177,7 +177,8 @@ public class WmsMoveDetails extends BaseBean { public WmsMoveDetails(String organizeCode,String orderNo,Integer item,String partNo,String partNameRdd,String transTypeCode ,String transTypeName,Integer itemStatus,String unit,String srcWhNo,String destWhNo, String srcZoneNo,String destZoneNo,String srcLocateNo, String destLocateNo, - Double transQty,Double rejectQty,String refSrc,String vendorNo, String custNo,Integer busiTypeCode){ + Double transQty,Double rejectQty,String refSrc,String vendorNo, String custNo,Integer busiTypeCode, + String createUser,String createDatetime){ this.organizeCode = organizeCode; this.partNo = partNo; this.orderNo = orderNo; @@ -199,5 +200,7 @@ public class WmsMoveDetails extends BaseBean { this.vendorNo = vendorNo; this.custNo = custNo; this.busiTypeCode = busiTypeCode; + this.createUser = createUser; + this.createDatetime = createDatetime; } } diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveMaster.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveMaster.java index fb9ac40..8a6324a 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveMaster.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveMaster.java @@ -142,7 +142,7 @@ public class WmsMoveMaster extends BaseBean { public WmsMoveMaster(){}; public WmsMoveMaster(Long id,String orderNo,String organizeCode,String partNo,String partNameRdd,String transTypeCode,String transTypeName,Integer itemStatus, - String unit,String srcWhNo,String srcZoneNo,String destWhNo,String destZoneNo,Double transQty, Double rejectQty,String fixId,Integer busiTypeCode) { + String unit,String srcWhNo,String srcZoneNo,String destWhNo,String destZoneNo,Double transQty, Double rejectQty,String fixId,Integer busiTypeCode,String refSrc) { this.id = id; this.orderNo = orderNo; this.organizeCode = organizeCode; @@ -160,5 +160,6 @@ public class WmsMoveMaster extends BaseBean { this.rejectQty = rejectQty; this.fixId = fixId; this.busiTypeCode = busiTypeCode; + this.refSrc = refSrc; } } diff --git a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java index 2b3be7c..bc36b7c 100644 --- a/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java +++ b/modules/i3plus-pojo-wms/src/main/java/cn/estsh/i3plus/pojo/wms/bean/WmsMoveSn.java @@ -211,7 +211,8 @@ public class WmsMoveSn extends BaseBean { } public WmsMoveSn( String organizeCode,String orderNo,Integer item,String partNo,String partNameRdd, String transTypeCode,String transTypeName,Integer itemStatus,String unit, String srcLocateNo,String destLocateNo,Double srcQty,Double destQty,Integer srcQcStatus,Integer descQcStatus,Integer srcSnStatus, - Integer destSnStatus, String lotNo,String dateCode,String refSrc,String destZoneNo,String destWhNo,Integer busiTypeCode,String sn){ + Integer destSnStatus, String lotNo,String dateCode,String refSrc,String destZoneNo,String destWhNo,Integer busiTypeCode,String sn, + String createUser,String createDatetime){ this.organizeCode=organizeCode; this.orderNo=orderNo; this.item=item; @@ -237,5 +238,7 @@ public class WmsMoveSn extends BaseBean { this.destWhNo =destWhNo; this.busiTypeCode = busiTypeCode; this.sn = sn; + this.createUser = createUser; + this.createDatetime = createDatetime; } } From 5388c4405b8231c58254b005fc7763b0b5f5cac6 Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 14:59:13 +0800 Subject: [PATCH 23/26] =?UTF-8?q?mes-pcn-task=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java | 4 ++++ .../src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java index 054bb21..5120404 100644 --- a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesPcnTask.java @@ -65,6 +65,10 @@ public class MesPcnTask extends BaseBean { @ApiParam("PCN节点名称") private String pcnName; + @Column(name="PCN_CODE") + @ApiParam("PCN节点名称代码") + private String pcnCode; + @Column(name="TASK_CYCLE_EXPS") @ApiParam("任务周期表达式") private String taskCycleExps; diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java index 5f2e53d..cacfdc0 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesPcnTask.java @@ -65,6 +65,10 @@ public class MesPcnTask extends BaseBean { @ApiParam("PCN节点名称") private String pcnName; + @Column(name="PCN_CODE") + @ApiParam("PCN节点名称代码") + private String pcnCode; + @Column(name="TASK_CYCLE_EXPS") @ApiParam("任务周期表达式") private String taskCycleExps; From 8034e104c8adb5a028cb4ca3a9a3fcdf59eb9d1a Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 15:24:24 +0800 Subject: [PATCH 24/26] =?UTF-8?q?mes=E5=B7=A5=E4=BD=9C=E5=8D=95=E5=85=83?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/mes/pcn/bean/MesWorkCellParam.java | 46 ++++++++++++++++++++++ .../pcn/repository/MesWorkCellParamRepository.java | 16 ++++++++ .../i3plus/pojo/mes/bean/MesWorkCellParam.java | 46 ++++++++++++++++++++++ .../mes/repository/MesWorkCellParamRepository.java | 16 ++++++++ 4 files changed, 124 insertions(+) create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesWorkCellParam.java create mode 100644 modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesWorkCellParamRepository.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellParam.java create mode 100644 modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellParamRepository.java diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesWorkCellParam.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesWorkCellParam.java new file mode 100644 index 0000000..97f8525 --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/bean/MesWorkCellParam.java @@ -0,0 +1,46 @@ +package cn.estsh.i3plus.pojo.mes.pcn.bean; + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description :工作单元参数 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-30 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name = "MES_WORK_CELL_PARAM") +@Api("mes工作单元参数") +public class MesWorkCellParam extends BaseBean { + + @Column(name = "PARAM_CODE") + @ApiParam("参数代码") + private String paramCode; + + @Column(name = "PARAM_NAME") + @ApiParam("参数名称") + private String paramName; + + @Column(name = "PARAM_TYPE") + @ApiParam("参数类型") + private Integer paramType; + + @Column(name = "PARAM_MODEL") + @ApiParam("参数模式") + private Integer paramModel; +} diff --git a/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesWorkCellParamRepository.java b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesWorkCellParamRepository.java new file mode 100644 index 0000000..3a714cf --- /dev/null +++ b/modules/i3plus-pojo-mes-pcn/src/main/java/cn/estsh/i3plus/pojo/mes/pcn/repository/MesWorkCellParamRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.pcn.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.pcn.bean.MesWorkCellParam; +import org.springframework.stereotype.Repository; + +/** + * @Description : + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-30 + * @Modify: + **/ +@Repository +public interface MesWorkCellParamRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellParam.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellParam.java new file mode 100644 index 0000000..db71d8e --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellParam.java @@ -0,0 +1,46 @@ +package cn.estsh.i3plus.pojo.mes.bean; + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description :工作单元参数 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-30 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name = "MES_WORK_CELL_PARAM") +@Api("mes工作单元参数") +public class MesWorkCellParam extends BaseBean { + + @Column(name = "PARAM_CODE") + @ApiParam("参数代码") + private String paramCode; + + @Column(name = "PARAM_NAME") + @ApiParam("参数名称") + private String paramName; + + @Column(name = "PARAM_TYPE") + @ApiParam("参数类型") + private Integer paramType; + + @Column(name = "PARAM_MODEL") + @ApiParam("参数模式") + private Integer paramModel; +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellParamRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellParamRepository.java new file mode 100644 index 0000000..7ec67d6 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellParamRepository.java @@ -0,0 +1,16 @@ +package cn.estsh.i3plus.pojo.mes.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellParam; +import org.springframework.stereotype.Repository; + +/** + * @Description : + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-30 + * @Modify: + **/ +@Repository +public interface MesWorkCellParamRepository extends BaseRepository { +} From 09eee24769e47c29bcb5f206cf14c2907a1f9c65 Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 15:52:39 +0800 Subject: [PATCH 25/26] =?UTF-8?q?mes=E5=B7=A5=E4=BD=9C=E5=8D=95=E5=85=83?= =?UTF-8?q?=E5=8F=82=E6=95=B0CRUD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java index 6796c95..b45d67d 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java @@ -1079,6 +1079,27 @@ public class MesHqlPack { } /** + * MES工作单元参数查询条件封装 + * + * @param workCellParam + * @return + */ + public static DdlPackBean getMesWorkCellParam(MesWorkCellParam workCellParam, String organizeCode) { + DdlPackBean packBean = getAllBaseDataByNormalPro(workCellParam, organizeCode); + if (StringUtils.isNotEmpty(workCellParam.getParamCode())) { + DdlPreparedPack.getStringLikerPack(workCellParam.getParamCode(), "paramCode", packBean); + } + if (null != workCellParam.getParamType()) { + DdlPreparedPack.getNumEqualPack(workCellParam.getParamType(), "paramType", packBean); + } + if (null != workCellParam.getParamModel()) { + DdlPreparedPack.getNumEqualPack(workCellParam.getParamModel(), "paramModel", packBean); + } + return packBean; + } + + + /** * MES工作单元队列查询条件封装 * * @param workCellPoint @@ -1146,9 +1167,14 @@ public class MesHqlPack { */ public static DdlPackBean getMesPcnTask(MesPcnTask mesPcnTask, String organizeCode) { DdlPackBean packBean = getAllBaseDataByNormalPro(mesPcnTask, organizeCode); - DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean); - DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); + if (StringUtils.isNotEmpty(mesPcnTask.getTaskCode())) { + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean); + } + if (StringUtils.isNotEmpty(mesPcnTask.getTaskName())) { + DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); + } packBean.setOrderByStr(mesPcnTask.orderBy()); return packBean; } + } From 2e86ff81d0bb9bafb633832d03397a4a1d73389a Mon Sep 17 00:00:00 2001 From: wangjie Date: Fri, 30 Aug 2019 17:45:47 +0800 Subject: [PATCH 26/26] =?UTF-8?q?mes=E5=B7=A5=E4=BD=9C=E5=8D=95=E5=85=83?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/MesEnumUtil.java | 74 ++++++++++++++++++++++ .../estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java | 3 + 2 files changed, 77 insertions(+) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java index 742ff35..cd2e4c1 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesEnumUtil.java @@ -12,6 +12,80 @@ import com.fasterxml.jackson.annotation.JsonFormat; public class MesEnumUtil { /** + * mes工作单元参数类型 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum MES_WORK_CELL_PARAM_TYPE { + + NUMBER(10, "数值"), + STRING(20, "字符串"); + + private int value; + private String description; + + MES_WORK_CELL_PARAM_TYPE(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + /** + * mes工作单元参数模式 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum MES_WORK_CELL_PARAM_MODEL { + + PUBLIC(10, "公用"), + JIT(20, "JIT生产"), + WORK_ORDER(30, "工单生产"), + OTHER(99, "其他"); + + private int value; + private String description; + + MES_WORK_CELL_PARAM_MODEL(int value, String description) { + this.value = value; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + /** * mes条码生成规则最大值后是否循环 */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java index b45d67d..e268aaf 100644 --- a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/sqlpack/MesHqlPack.java @@ -1173,6 +1173,9 @@ public class MesHqlPack { if (StringUtils.isNotEmpty(mesPcnTask.getTaskName())) { DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean); } + if (null != mesPcnTask.getTaskStatus()) { + DdlPreparedPack.getNumEqualPack(mesPcnTask.getTaskStatus(), "taskStatus", packBean); + } packBean.setOrderByStr(mesPcnTask.orderBy()); return packBean; }