浏览代码

删除不用的类

lighter 4 月之前
父节点
当前提交
a7546214db

+ 0 - 18
src/main/java/thyyxxk/webserver/utils/DynamicDataUtil.java

@@ -1,18 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-
-import java.util.function.Supplier;
-
-public class DynamicDataUtil {
-
-    public static <T> T db(String dbName, Supplier<T> supplier) {
-        DynamicDataSourceContextHolder.push(dbName);
-        try {
-            return supplier.get();
-        } finally {
-            DynamicDataSourceContextHolder.poll();
-        }
-    }
-
-}

+ 0 - 115
src/main/java/thyyxxk/webserver/utils/JiSuanFeiYong.java

@@ -1,115 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import thyyxxk.webserver.entity.datamodify.FeiYongLeiXin;
-import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 描述: 计算住院患者的费用
- * </p>
- *
- * @author xc
- * @date 2021-08-05 11:29
- */
-public class JiSuanFeiYong {
-
-    public static FeiYongLeiXin jiSuan(List<ZyDetailCharge> feiYong, Boolean zhengShu) {
-        FeiYongLeiXin fy = new FeiYongLeiXin();
-        // 创建一个 map
-        Map<String, BigDecimal> map = new HashMap<>();
-        BigDecimal sum;
-        for (ZyDetailCharge zd : feiYong) {
-            if (zhengShu) {
-                if (zd.getAmount() == null) {
-                    sum = zd.getChargeAmount().multiply(zd.getChargeFee());
-                } else {
-                    sum = zd.getChargeAmount().multiply(zd.getAmount());
-                }
-            } else {
-                sum = zd.getChargeAmount().multiply(zd.getChargeFee().negate());
-            }
-            // 判断 map 中是否存在 项目的 key 值 如果存在就相加
-            if (map.containsKey(zd.getBillItemCode())) {
-                // 这里是替换 把原来的 key 的值 替换成 别的
-                map.replace(zd.getBillItemCode(), map.get(zd.getBillItemCode()).add(sum));
-            } else {
-                // 如果没有这个 key 那就 put
-                map.put(zd.getBillItemCode(), sum);
-            }
-        }
-        // 在这里循环 map 往 实体类 费用类型 用添加值
-        for (String key : map.keySet()) {
-            fangRuShiTiLei(fy, key, map.get(key));
-        }
-        return fy;
-    }
-
-    public static void fangRuShiTiLei(FeiYongLeiXin fy, String code, BigDecimal sum) {
-        if ("001".equals(code)) {
-            fy.setCharge1(sum);
-        } else if ("002".equals(code)) {
-            fy.setCharge2(sum);
-        } else if ("003".equals(code)) {
-            fy.setCharge3(sum);
-        } else if ("004".equals(code)) {
-            fy.setCharge4(sum);
-        } else if ("005".equals(code)) {
-            fy.setCharge5(sum);
-        } else if ("006".equals(code)) {
-            fy.setCharge6(sum);
-        } else if ("007".equals(code)) {
-            fy.setCharge7(sum);
-        } else if ("008".equals(code)) {
-            fy.setCharge8(sum);
-        } else if ("009".equals(code)) {
-            fy.setCharge9(sum);
-        } else if ("010".equals(code)) {
-            fy.setCharge10(sum);
-        } else if ("011".equals(code)) {
-            fy.setCharge11(sum);
-        } else if ("012".equals(code)) {
-            fy.setCharge12(sum);
-        } else if ("013".equals(code)) {
-            fy.setCharge13(sum);
-        } else if ("014".equals(code)) {
-            fy.setCharge14(sum);
-        } else if ("015".equals(code)) {
-            fy.setCharge15(sum);
-        } else if ("016".equals(code)) {
-            fy.setCharge16(sum);
-        } else if ("017".equals(code)) {
-            fy.setCharge17(sum);
-        } else if ("018".equals(code)) {
-            fy.setCharge18(sum);
-        } else if ("019".equals(code)) {
-            fy.setCharge19(sum);
-        } else if ("020".equals(code)) {
-            fy.setCharge20(sum);
-        } else if ("021".equals(code)) {
-            fy.setCharge21(sum);
-        } else if ("022".equals(code)) {
-            fy.setCharge22(sum);
-        } else if ("023".equals(code)) {
-            fy.setCharge23(sum);
-        } else if ("024".equals(code)) {
-            fy.setCharge24(sum);
-        } else if ("025".equals(code)) {
-            fy.setCharge25(sum);
-        } else if ("026".equals(code)) {
-            fy.setCharge26(sum);
-        } else if ("027".equals(code)) {
-            fy.setCharge27(sum);
-        } else if ("028".equals(code)) {
-            fy.setCharge28(sum);
-        } else if ("029".equals(code)) {
-            fy.setCharge29(sum);
-        } else if ("030".equals(code)) {
-            fy.setCharge30(sum);
-        }
-    }
-}

+ 0 - 73
src/main/java/thyyxxk/webserver/utils/JsonUtils.java

@@ -1,73 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import java.util.Map;
-
-/**
- * json工具类
- *
- * @Version 1.0
- */
-public final class JsonUtils {
-
-    /**
-     * 去除json值前后空格
-     *
-     * @param jsonStr jsonStr
-     * @return
-     */
-    public static JSONObject jsonTrim(String jsonStr) {
-        return jsonTrim(JSONObject.parseObject(jsonStr));
-    }
-
-    public static String jsonTrimToString(String jsonStr) {
-        return jsonTrim(JSONObject.parseObject(jsonStr)).toJSONString();
-    }
-
-
-    /**
-     * 去除value的空格
-     *
-     * @param jsonObject jsonObject
-     */
-    public static JSONObject jsonTrim(JSONObject jsonObject) {
-        for (Map.Entry<String, Object> next : jsonObject.entrySet()) {
-            Object value = next.getValue();
-            if (value != null) {
-                if (value instanceof String) {
-                    //清空值前后空格
-                    jsonObject.put(next.getKey(), ((String) value).trim());
-                } else if (value instanceof JSONObject) {
-                    jsonTrim((JSONObject) value);
-                } else if (value instanceof JSONArray) {
-                    jsonTrimArray((JSONArray) value);
-                }
-            }
-        }
-
-        return jsonObject;
-    }
-
-    /**
-     * 清空JSONArray 值前后空格
-     *
-     */
-    private static void jsonTrimArray(JSONArray array) {
-        if (array != null && !array.isEmpty()) {
-            for (int i = 0; i < array.size(); i++) {
-                Object object = array.get(i);
-                if (object != null) {
-                    if (object instanceof String) {
-                        array.set(i, ((String) object).trim());
-                    } else if (object instanceof JSONObject) {
-                        jsonTrim((JSONObject) object);
-                    } else if (object instanceof JSONArray) {
-                        jsonTrimArray((JSONArray) object);
-                    }
-                }
-            }
-        }
-    }
-}

+ 0 - 226
src/main/java/thyyxxk/webserver/utils/JsonXmlUtils.java

@@ -1,226 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.ValueFilter;
-import lombok.extern.slf4j.Slf4j;
-import org.dom4j.*;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * <p>
- * 描述:
- * </p>
- *
- * @author xc
- * @date 2022-03-28 16:28
- */
-@Slf4j
-public class JsonXmlUtils {
-    /**
-     * 解决 CDATA 问题
-     */
-    private static final Pattern PATTERN = Pattern.compile("[<>&\"',]");
-    public static ValueFilter filter = (obj, s, v) -> {
-        if (v == null) {
-            return "";
-        }
-        return v;
-    };
-
-    private static String escape(String string) {
-        return PATTERN.matcher(string).find() ? "<![CDATA[" + string + "]]>" : string;
-    }
-
-    public static boolean isEmpty(String str) {
-        return str == null || str.trim().isEmpty() || "null".equals(str);
-    }
-
-    /**
-     * updateXml 处理xml头,以及根标签
-     */
-    private static String updateXml(String xmlStr) {
-        xmlStr = xmlStr.trim();
-        if (StringUtil.isBlank(xmlStr)) {
-            return xmlStr;
-        }
-
-        // 过滤非法字符
-        xmlStr = xmlStr.replaceAll("[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]", "");
-
-        StringBuilder xmlSb = new StringBuilder(xmlStr);
-        if (!xmlStr.startsWith("<?")) {
-            xmlSb.insert(0, "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
-        }
-
-        int idx = xmlSb.indexOf("?>") + 2;
-        xmlSb.insert(idx, "<root_chinadaas>").append("</root_chinadaas>");
-        return xmlSb.toString();
-    }
-
-    /**
-     * xml转json的核心循环方法
-     *
-     * @param element
-     * @param json
-     */
-    private static void dom4j2Json(Element element, JSONObject json) {
-        // 如果是属性
-        for (Object o : element.attributes()) {
-            Attribute attr = (Attribute) o;
-            if (!isEmpty(attr.getValue())) {
-                json.put("@" + attr.getName(), attr.getValue());
-            }
-        }
-        List<Element> chdEl = element.elements();
-        if (chdEl.isEmpty() && !isEmpty(element.getText())) { // 如果没有子元素,只有一个值
-            json.put(element.getName(), element.getText());
-        }
-
-        for (Element e : chdEl) { // 有子元素
-            if (!e.elements().isEmpty() || e.attributes().size() > 0) { // 子元素也有子元素,
-                JSONObject chdjson = new JSONObject();
-                dom4j2Json(e, chdjson);
-                Object o = json.get(e.getName());
-                if (o != null) {
-                    JSONArray jsona = null;
-                    if (o instanceof JSONObject) { // 如果此元素已存在,则转为jsonArray
-                        JSONObject jsono = (JSONObject) o;
-                        json.remove(e.getName());
-                        jsona = new JSONArray();
-                        jsona.add(jsono);
-                        jsona.add(chdjson);
-                    }
-                    if (o instanceof JSONArray) {
-                        jsona = (JSONArray) o;
-                        jsona.add(chdjson);
-                    }
-                    json.put(e.getName(), jsona);
-                } else {
-                    if (!chdjson.isEmpty()) {
-                        json.put(e.getName(), chdjson);
-                    }
-                }
-            } else { // 子元素没有子元素
-                for (Object o : element.attributes()) {
-                    Attribute attr = (Attribute) o;
-                    if (!isEmpty(attr.getValue())) {
-                        json.put("@" + attr.getName(), attr.getValue());
-                    }
-                }
-                if (!e.getText().isEmpty()) {
-                    json.put(e.getName(), e.getText());
-                }
-            }
-        }
-    }
-
-    /**
-     * xml转Json调用
-     *
-     * @throws DocumentException
-     */
-    public static JSONObject xml2Json(String xmlStr) throws DocumentException {
-        xmlStr = updateXml(xmlStr);
-        Document doc = DocumentHelper.parseText(xmlStr);
-        JSONObject json = new JSONObject();
-        dom4j2Json(doc.getRootElement(), json);
-        return json;
-    }
-
-    /**
-     * 根据at号获取所有的属性list
-     */
-    public static JSONObject getAttribute(JSONObject jdata) {
-        JSONObject rdata = new JSONObject();
-        try {
-            Set<Map.Entry<String, Object>> setdata = jdata.entrySet();
-            for (Map.Entry<String, Object> en : setdata) {
-                if (en.getKey().startsWith("@")) {
-                    rdata.put(en.getKey().substring(1), escape((String) en.getValue()));
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return rdata;
-    }
-
-    /**
-     * Json to xmlstr 核心循环方法
-     */
-    public static String json2Xmlstr(JSONObject jObj, StringBuffer buffer) {
-        Set<Map.Entry<String, Object>> se = jObj.entrySet();
-        for (Map.Entry<String, Object> en : se) {
-            switch (en.getValue().getClass().getName()) {
-                case "com.alibaba.fastjson.JSONObject":
-                    JSONObject jo = jObj.getJSONObject(en.getKey());
-                    buffer.append("<").append(en.getKey());
-
-                    //处理xml标签的属性值
-                    JSONObject attrlist1 = getAttribute(jo);
-                    Set<Map.Entry<String, Object>> attr1 = attrlist1.entrySet();
-                    for (Map.Entry<String, Object> amap : attr1) {
-                        buffer.append(" ").append(amap.getKey()).append("=\"").append(escape((String) amap.getValue())).append("\"");
-                    }
-                    buffer.append(">");
-                    if (jo.containsKey(en.getKey())) {
-                        //标签直接有值的话,直接赋值
-                        buffer.append(jo.getString(en.getKey()));
-                    } else {
-                        json2Xmlstr(jo, buffer);
-                    }
-                    buffer.append("</").append(en.getKey()).append(">");
-                    break;
-                case "com.alibaba.fastjson.JSONArray":
-                    JSONArray jarray = jObj.getJSONArray(en.getKey());
-                    for (int i = 0; i < jarray.size(); i++) {
-                        buffer.append("<").append(en.getKey());
-                        JSONObject jsonobject = jarray.getJSONObject(i);
-
-                        //处理xml标签的属性值
-                        JSONObject attrlist2 = getAttribute(jsonobject);
-                        Set<Map.Entry<String, Object>> attr2 = attrlist2.entrySet();
-                        for (Map.Entry<String, Object> amap : attr2) {
-                            buffer.append(" ").append(amap.getKey()).append("=\"").append(escape((String) amap.getValue())).append("\"");
-                        }
-                        buffer.append(">");
-
-                        json2Xmlstr(jsonobject, buffer);
-                        buffer.append("</").append(en.getKey()).append(">");
-                    }
-                    break;
-                case "java.lang.String":
-                    if (!en.getKey().startsWith("@")) {//@号的是属性,在前面已经处理过,这里就不处理了
-                        buffer.append("<").append(en.getKey()).append(">").append(escape((String) en.getValue()));
-                        buffer.append("</").append(en.getKey()).append(">");
-                    }
-                    break;
-            }
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * json转xml调用
-     *
-     * @param json
-     * @return java.lang.String
-     */
-    public static String json2Xml(String json) {
-        try {
-            StringBuffer buffer = new StringBuffer();
-            JSONObject jObj = JSON.parseObject(json);
-            json2Xmlstr(jObj, buffer);
-            return buffer.toString();
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-}

+ 0 - 47
src/main/java/thyyxxk/webserver/utils/ProgressBar.java

@@ -1,47 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-@Slf4j
-public class ProgressBar {
-    public Map<Integer, String> map = new TreeMap<>();
-
-    public void show() {
-        StringBuilder a = new StringBuilder();
-        for (Map.Entry<Integer, String> item : map.entrySet()) {
-            a.append("任务")
-                    .append(item.getKey())
-                    .append(":")
-                    .append(item.getValue())
-                    .append("\n");
-        }
-        log.info("\n{}", a);
-    }
-
-    public void drawProgressBar(int name, int total, int current) {
-        int progress = (int) (((double) current / total) * 100); // 计算进度百分比
-        StringBuilder progressBar = new StringBuilder("["); // 进度条字符串
-
-        for (int i = 0; i < 100; i += 5) { // 遍历 0 到 100
-            if (i < progress) {
-                progressBar.append("="); // 表示已完成的进度
-            } else if (i == progress) {
-                progressBar.append(">"); // 表示当前进度
-            } else {
-                progressBar.append(" "); // 表示未完成的进度
-            }
-        }
-        progressBar.append("] ")
-                .append(progress)
-                .append("%")
-                .append("当前:【").append(current).append("】")
-                .append("总:【").append(total).append("】");
-
-        map.put(name, progressBar.toString());
-        show();
-    }
-
-}

+ 0 - 69
src/main/java/thyyxxk/webserver/utils/PropertiesUtil.java

@@ -1,69 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Properties;
-
-public class PropertiesUtil {
-    private static final HashMap<String, Properties> dbMap = new HashMap<>();
-
-    public static Properties get(String name) {
-        Properties properties = dbMap.get(name);
-        if (null == properties) {
-            properties = getProperties(name);
-            dbMap.put(name, properties);
-        }
-        return properties;
-    }
-
-
-    /**
-     * 按key获取值
-     */
-    static String readProperty(String properiesName, String key) {
-        String value = "";
-        InputStream is = null;
-        try {
-            is = PropertiesUtil.class.getClassLoader().getResourceAsStream(properiesName);
-            Properties p = new Properties();
-            p.load(is);
-            value = p.getProperty(key);
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (null != is) {
-                try {
-                    is.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return value;
-    }
-
-    /**
-     * 获取整个配置信息
-     */
-    static Properties getProperties(String properiesName) {
-        Properties p = new Properties();
-        InputStream is = null;
-        try {
-            is = PropertiesUtil.class.getClassLoader().getResourceAsStream(properiesName);
-            p.load(is);
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return p;
-    }
-
-}

+ 0 - 36
src/main/java/thyyxxk/webserver/utils/ReadCardUtil.java

@@ -1,36 +0,0 @@
-package thyyxxk.webserver.utils;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author dj
- */
-public class ReadCardUtil {
-
-    private final ConcurrentHashMap<String, String> rcMap;
-    private static ReadCardUtil INSTANCE;
-
-    private ReadCardUtil() {
-        rcMap = new ConcurrentHashMap<>();
-    }
-
-    public static ReadCardUtil instance() {
-        synchronized (ReadCardUtil.class) {
-            if (null == INSTANCE) {
-                synchronized (ReadCardUtil.class) {
-                    INSTANCE = new ReadCardUtil();
-                }
-            }
-        }
-        return INSTANCE;
-    }
-
-    public void put(String key, String val) {
-        rcMap.put(key, val);
-    }
-
-    public String get(String key) {
-        return rcMap.get(key);
-    }
-
-}

+ 0 - 49
src/main/java/thyyxxk/webserver/utils/WebsocketUtil.java

@@ -1,49 +0,0 @@
-package thyyxxk.webserver.utils;
-
-
-import java.lang.reflect.Field;
-import java.net.InetSocketAddress;
-import javax.websocket.RemoteEndpoint.Async;
-import javax.websocket.Session;
-
-/**
- * @author xc
- */
-public class WebsocketUtil {
-
-    public static InetSocketAddress getRemoteAddress(Session session) {
-        if (session == null) {
-            return null;
-        }
-        Async async = session.getAsyncRemote();
-        return (InetSocketAddress) getFieldInstance(async);
-    }
-
-    private static Object getFieldInstance(Object obj) {
-        String[] fields = "base#socketWrapper#socket#sc#remoteAddress".split("#");
-        for (String field : fields) {
-            obj = getField(obj, obj.getClass(), field);
-            if (obj == null) {
-                return null;
-            }
-        }
-
-        return obj;
-    }
-
-    private static Object getField(Object obj, Class<?> clazz, String fieldName) {
-        for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
-            try {
-                Field field;
-                field = clazz.getDeclaredField(fieldName);
-                field.setAccessible(true);
-                return field.get(obj);
-            } catch (Exception ignored) {
-            }
-        }
-
-        return null;
-    }
-
-
-}