wangliang пре 1 година
родитељ
комит
a6f0b3a068

+ 20 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -323,8 +323,19 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                 if (Objects.nonNull(f.getOperator())) {
                     //加入固定字段转换
                     if (SystemConstant.SOP_TRANSFORM_MAP.containsKey(f.getFieldId())) {
-                        f.setFieldId(SystemConstant.SOP_TRANSFORM_MAP.get(f.getFieldId()));
-                        formWidgetMetadataParamLinkedMultiValueMap.add(SystemConstant.SOP_TRANSFORM_MAP.get(f.getFieldId()), f);
+                        if (Objects.equals(f.getFieldId().toLowerCase(), "status")) {
+                            if (Objects.equals(f.getFieldValue(), "已完结")) {
+                                f.setFieldValue(FlowStatusEnum.FINISH.name());
+                            } else if (Objects.equals(f.getFieldValue(), "已作废")) {
+                                f.setFieldValue(FlowStatusEnum.END.name());
+                            } else {
+                                f.setOperator(FormWidgetMetadataOperator.NOT_IN);
+                                f.setFieldValue("('" + FlowStatusEnum.FINISH.name() + "','" + FlowStatusEnum.END.name() + "')");
+                            }
+                        }
+                        String fieldId = SystemConstant.SOP_TRANSFORM_MAP.get(f.getFieldId());
+                        f.setFieldId(fieldId);
+                        formWidgetMetadataParamLinkedMultiValueMap.add(fieldId, f);
                     } else {
                         formWidgetMetadataParamLinkedMultiValueMap.add(f.getFieldId(), f);
                     }
@@ -338,14 +349,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                         FormWidgetMetadataParam f = formWidgetMetadataParamList.get(y);
                         if (f.getOperator() == FormWidgetMetadataOperator.LIKE) {
                             conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','").add(f.getFieldValue()).add("','%')");
-                            if (y < formWidgetMetadataParamList.size() - 1) {
-                                conditionJoin.add(" or ");
-                            }
+                        } else if (f.getOperator() == FormWidgetMetadataOperator.IN || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
+                            conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add(f.getFieldValue());
                         } else {
                             conditionJoin.add(f.getFieldId()).add(f.getOperator().getCode()).add("'").add(f.getFieldValue()).add("'");
-                            if (y < formWidgetMetadataParamList.size() - 1) {
-                                conditionJoin.add(" or ");
-                            }
+                        }
+                        if (y < formWidgetMetadataParamList.size() - 1) {
+                            conditionJoin.add(" or ");
                         }
                     }
                     conditionJoin.add(" ) ");
@@ -354,6 +364,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                     for (FormWidgetMetadataParam f : formWidgetMetadataParamList) {
                         if (f.getOperator() == FormWidgetMetadataOperator.LIKE) {
                             stringJoinerCondition.add(SystemConstant.AND).add(f.getFieldId()).add(f.getOperator().getCode()).add("('%','").add(f.getFieldValue()).add("','%')").add("\r\n");
+                        } else if (f.getOperator() == FormWidgetMetadataOperator.IN || f.getOperator() == FormWidgetMetadataOperator.NOT_IN) {
+                            stringJoinerCondition.add(SystemConstant.AND).add(f.getFieldId()).add(f.getOperator().getCode()).add(f.getFieldValue()).add("\r\n");
                         } else {
                             stringJoinerCondition.add(SystemConstant.AND).add(f.getFieldId()).add(f.getOperator().getCode()).add("'").add(f.getFieldValue()).add("'").add("\r\n");
                         }

+ 5 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/FormWidgetMetadataOperator.java

@@ -21,7 +21,11 @@ public enum FormWidgetMetadataOperator {
 
     LE("小于等于", " <= "),
 
-    LIKE("模糊查询", " like concat ");
+    LIKE("模糊查询", " like concat "),
+
+    IN("在范围内", " in "),
+
+    NOT_IN("不在范围内", " not in ");
 
     private String title;