From 061e05291a5048f75bf7c617052966ca6bef62d5 Mon Sep 17 00:00:00 2001 From: 1821349743@qq.com <1821349743@qq.com> Date: 星期一, 20 二月 2023 14:43:33 +0800 Subject: [PATCH] init --- /dev/null | 136 ----- src/main/java/com/product/badge/controller/BadgeBorrowController.java | 346 ++++++++++++ src/main/java/com/product/badge/config/CmnConst.java | 60 ++ src/main/java/com/product/badge/service/idel/IBadgeBorrowService.java | 14 src/main/java/com/product/badge/controller/BadgeController.java | 177 ++++++ src/main/java/com/product/badge/service/BadgeBorrowService.java | 261 +++++++++ src/main/java/com/product/badge/controller/BadgeUseController.java | 169 ++++++ src/test/java/com/product/badge/BadgeTest.java | 208 +++++++ pom.xml | 81 -- src/main/java/com/product/badge/config/BadgeCode.java | 59 ++ src/main/java/com/product/badge/service/BadgeService.java | 76 ++ 11 files changed, 1,382 insertions(+), 205 deletions(-) diff --git a/pom.xml b/pom.xml index 891cd7d..1a89fa1 100644 --- a/pom.xml +++ b/pom.xml @@ -2,15 +2,19 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <parent> - <groupId>com.lx</groupId> <artifactId>product-server</artifactId> + <groupId>com.lx</groupId> <version>1.0.0-SNAPSHOT</version> </parent> - <artifactId>product-server-seal</artifactId> - <name>product-server-seal</name> - <description>product-server-seal</description> + <modelVersion>4.0.0</modelVersion> + + <artifactId>product-server-badge</artifactId> + <name>product-server-badge</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> <dependencies> <dependency> <groupId>com.lx</groupId> @@ -24,69 +28,8 @@ </dependency> <dependency> <groupId>com.lx</groupId> - <artifactId>product-server-core</artifactId> - <version>1.0.0-releases</version> + <artifactId>product-server-admin</artifactId> + <version>1.0.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.spring</groupId> - <artifactId>spring-server-master</artifactId> - <version>1.2.6.6</version> - </dependency> </dependencies> - <build> - <plugins> - <!-- 鎵揓AR鍖� --> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <!-- 涓嶆墦鍖呰祫婧愭枃浠讹紙閰嶇疆鏂囦欢鍜屼緷璧栧寘鍒嗗紑锛� --> - <excludes> - <exclude>*.properties</exclude> - <exclude>*.xml</exclude> - </excludes> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <!-- MANIFEST.MF 涓� Class-Path 鍔犲叆鍓嶇紑 --> - <classpathPrefix>lib/</classpathPrefix> - <!-- jar鍖呬笉鍖呭惈鍞竴鐗堟湰鏍囪瘑 --> - <useUniqueVersions>true</useUniqueVersions> - <!--鎸囧畾鍏ュ彛绫� --> - <mainClass>com.product.Application</mainClass> - </manifest> - <manifestEntries> - <!--MANIFEST.MF 涓� Class-Path 鍔犲叆璧勬簮鏂囦欢鐩綍 --> - <Class-Path>./resources/</Class-Path> - </manifestEntries> - - </archive> - <outputDirectory>${project.build.directory}</outputDirectory> - </configuration> - </plugin> - <!-- 鎷疯礉鏂囦欢 --> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>copy</id> - <phase>package</phase> - <configuration> - <tasks> - <copy file="${project.build.directory}/product-server-seal-1.0.0-SNAPSHOT.jar" - tofile="D:/product/workspace/product-server-install/resources/product-server/product-server-web-1.0.0-SNAPSHOT.jar" - overwrite="true"/> - </tasks> - - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </build> -</project> +</project> \ No newline at end of file diff --git a/src/com/lx/product/seal/config/Config.java b/src/com/lx/product/seal/config/Config.java deleted file mode 100644 index 2e5b695..0000000 --- a/src/com/lx/product/seal/config/Config.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.lx.product.seal.config; - -public class Config { - //浜у搧鐗堟湰绠$悊鐩綍 - private String product_version_root="D:\\product\\浜у搧杩愯惀\\浜у搧鐗堟湰"; - //浜у搧瀹夎宸ョ▼鐩綍 - private String install_project_root="D:\\product\\workspace\\product-server-install"; - //鍓嶇浠g爜鐩綍 - private String product_web_root="D:\\product\\workspace\\product-web_v2.0.0"; - //鍚庣浠g爜鐩綍 - private String product_java_root="D:\\product\\workspace\\product-server_v2.0.0\\product-server-web"; - - //浜у搧鐗堟湰 - private String product_version="V1.0.0"; - - public String getProduct_version_root() { - return product_version_root; - } - public void setProduct_version_root(String product_version_root) { - this.product_version_root = product_version_root; - } - public String getInstall_project_root() { - return install_project_root; - } - public void setInstall_project_root(String install_project_root) { - this.install_project_root = install_project_root; - } - public String getProduct_web_root() { - return product_web_root; - } - public void setProduct_web_root(String product_web_root) { - this.product_web_root = product_web_root; - } - public String getProduct_java_root() { - return product_java_root; - } - public void setProduct_java_root(String product_java_root) { - this.product_java_root = product_java_root; - } - public String getProduct_version() { - return product_version; - } - public void setProduct_version(String product_version) { - this.product_version = product_version; - } - - -} diff --git a/src/com/lx/product/seal/frame/ButtonNextLabel.java b/src/com/lx/product/seal/frame/ButtonNextLabel.java deleted file mode 100644 index acd6716..0000000 --- a/src/com/lx/product/seal/frame/ButtonNextLabel.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.lx.product.seal.frame; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.ImageIcon; -import javax.swing.JLabel; - -public class ButtonNextLabel extends JLabel { - - private boolean operateFlag = false; - - public ButtonNextLabel() { - operateFlag = true; - setOperate(operateFlag); - ButtonNextLabel next = this; - addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent me) { - if (!operateFlag) { - return; - } - fireActionPerformed(new ActionEvent(ButtonNextLabel.this, ActionEvent.ACTION_PERFORMED, "SecretMessage")); - } - public void mouseEntered(MouseEvent me) { - if (!operateFlag) { - return; - } - ImageIcon activeIcon = new ImageIcon("./images/but_nextstepon.png"); - activeIcon.setImage(activeIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - next.setIcon(activeIcon); - } - public void mouseExited(MouseEvent me) { - if (!operateFlag) { - return; - } - ImageIcon activeIcon = new ImageIcon("./images/but_nextstep.png"); - activeIcon.setImage(activeIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - next.setIcon(activeIcon); - } - }); - this.setCursor(new Cursor(Cursor.HAND_CURSOR)); - } - - public void addActionListener(ActionListener l) { - listenerList.add(ActionListener.class, l); - } - - public void removeActionListener(ActionListener l) { - listenerList.remove(ActionListener.class, l); - } - - protected void fireActionPerformed(ActionEvent ae) { - - Object[] listeners = listenerList.getListeners(ActionListener.class); - - for (int i = 0; i < listeners.length; i++) { - ((ActionListener) listeners[i]).actionPerformed(ae); - } - } - public void setOperate(Boolean b) { - operateFlag = b; - if (operateFlag) { - ImageIcon activeIcon = new ImageIcon("./images/but_nextstep.png"); - activeIcon.setImage(activeIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - this.setIcon(activeIcon); - } else { - ImageIcon notActiveIcon = new ImageIcon("./images/but_nextstepnopress.png"); - notActiveIcon.setImage(notActiveIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - this.setIcon(notActiveIcon); - } - - } -} \ No newline at end of file diff --git a/src/com/lx/product/seal/frame/ButtonOKLabel.java b/src/com/lx/product/seal/frame/ButtonOKLabel.java deleted file mode 100644 index ea514c9..0000000 --- a/src/com/lx/product/seal/frame/ButtonOKLabel.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.lx.product.seal.frame; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -public class ButtonOKLabel extends JLabel { - public ButtonOKLabel() { - ImageIcon colorIcon = new ImageIcon("./images/but_ok.png"); - colorIcon.setImage(colorIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - this.setIcon(colorIcon); - ButtonOKLabel ok = this; - addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent me) { - MasterFrame.close(); - } - }); - this.setCursor(new Cursor(Cursor.HAND_CURSOR)); - } -} \ No newline at end of file diff --git a/src/com/lx/product/seal/frame/ButtonPreLabel.java b/src/com/lx/product/seal/frame/ButtonPreLabel.java deleted file mode 100644 index 111968e..0000000 --- a/src/com/lx/product/seal/frame/ButtonPreLabel.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.lx.product.seal.frame; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.ImageIcon; -import javax.swing.JLabel; - -public class ButtonPreLabel extends JLabel { - - public ButtonPreLabel() { - ImageIcon colorIcon = new ImageIcon("./images/but_astep.png"); - colorIcon.setImage(colorIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - this.setIcon(colorIcon); - ButtonPreLabel pre = this; - addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent me) { - fireActionPerformed(new ActionEvent(ButtonPreLabel.this, ActionEvent.ACTION_PERFORMED, "SecretMessage")); - } - public void mouseEntered(MouseEvent me) { - ImageIcon activeIcon = new ImageIcon("./images/but_astepon.png"); - activeIcon.setImage(activeIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - pre.setIcon(activeIcon); - } - public void mouseExited(MouseEvent me) { - ImageIcon activeIcon = new ImageIcon("./images/but_astep.png"); - activeIcon.setImage(activeIcon.getImage().getScaledInstance(110, 32, Image.SCALE_DEFAULT));// 瀹介珮鏍规嵁闇�瑕佽瀹� - pre.setIcon(activeIcon); - } - }); - this.setCursor(new Cursor(Cursor.HAND_CURSOR)); - } - - public void addActionListener(ActionListener l) { - listenerList.add(ActionListener.class, l); - } - - public void removeActionListener(ActionListener l) { - listenerList.remove(ActionListener.class, l); - } - - protected void fireActionPerformed(ActionEvent ae) { - - Object[] listeners = listenerList.getListeners(ActionListener.class); - - for (int i = 0; i < listeners.length; i++) { - ((ActionListener) listeners[i]).actionPerformed(ae); - } - } -} \ No newline at end of file diff --git a/src/com/lx/product/seal/frame/MasterFrame.java b/src/com/lx/product/seal/frame/MasterFrame.java deleted file mode 100644 index 333920f..0000000 --- a/src/com/lx/product/seal/frame/MasterFrame.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.lx.product.seal.frame; - -import java.awt.BorderLayout; -import java.awt.Image; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.WindowConstants; - - -public class MasterFrame extends JFrame { - // 寰楀埌鏄剧ず鍣ㄥ睆骞曠殑瀹介珮 - public int width = Toolkit.getDefaultToolkit().getScreenSize().width; - public int height = Toolkit.getDefaultToolkit().getScreenSize().height - 40; - // 瀹氫箟绐椾綋鐨勫楂� - public int windowsWedth = 698; - public int windowsHeight = 548; - private Map<String, JPanel> panel = new HashMap<String, JPanel>(); - - public JPanel getPanel(String name) { - return panel.get(name); - } - public void setPanel(String name, JPanel panel) { - this.panel.put(name, panel); - } - - JPanel mpanel = new JPanel(new BorderLayout()); - - public JPanel getMpanel() { - return mpanel; - } - - public void setMpanel(JPanel mpanel) { - this.mpanel = mpanel; - } - - private static MasterFrame master; - - JPanel current = null; - - public MasterFrame() { - this.setTitle("浼佷笟杩愯惀绠$悊骞冲彴鈥斺�斾骇鍝佸皝鐗�"); - this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - // 璁剧疆绐椾綋浣嶇疆鍜屽ぇ灏� - this.setBounds((width - windowsWedth) / 2, (height - windowsHeight) / 2, windowsWedth, windowsHeight); - Toolkit tool = this.getToolkit(); //寰楀埌涓�涓猅oolkit瀵硅薄 - Image myimage = tool.getImage("./images/logo.png"); //鐢眛ool鑾峰彇鍥惧儚 - this.setIconImage(myimage); - try { - MasterPanel mp = new MasterPanel(this); - this.setContentPane(mp); - this.setResizable(false); - this.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - - public void changedCenterPanel(String name) { - JPanel p = panel.get(name); - if (current == null || !p.getName().equals(current.getName())) { - if (current != null) { - mpanel.remove(current); - mpanel.updateUI(); - mpanel.repaint(); - this.repaint(); - } - mpanel.add(p, BorderLayout.CENTER); - mpanel.updateUI(); - mpanel.repaint(); - this.repaint(); - current = p; - } - } - - /** - * 鍏抽棴涓荤晫闈� - */ - public static void close() { - master.dispose(); - } - - public static void main(String args[]) { - master = new MasterFrame(); - } -} diff --git a/src/com/lx/product/seal/frame/MasterPanel.java b/src/com/lx/product/seal/frame/MasterPanel.java deleted file mode 100644 index 0e09981..0000000 --- a/src/com/lx/product/seal/frame/MasterPanel.java +++ /dev/null @@ -1,388 +0,0 @@ -package com.lx.product.seal.frame; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import javax.swing.ImageIcon; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import com.product.common.io.FileUtils; -import com.lx.product.seal.config.Config; -import com.lx.product.seal.log.Logger; -import com.lx.product.seal.utils.CommonUtil; - -public class MasterPanel extends JPanel { - public static Logger log = Logger.getInstance(); - private JLabel stepl = new JLabel(); - private int step = 1; - JComponent center = null; - public ButtonNextLabel next = new ButtonNextLabel(); - private ButtonPreLabel pre = new ButtonPreLabel(); - private MasterFrame mainf = null; - private ButtonOKLabel ok = new ButtonOKLabel(); - public Boolean access = true; - public Config config=new Config(); - private ExecutorService executorService; - public MasterPanel(MasterFrame f) { - mainf = f; - this.setLayout(new BorderLayout()); - updateStep(); - this.add(stepl, BorderLayout.NORTH); - updateCenter(); - this.add(initButton(), BorderLayout.SOUTH); - } - - public void updateStep() { - ImageIcon colorIcon = new ImageIcon("./images/step" + step + ".png"); - - colorIcon.setImage(colorIcon.getImage().getScaledInstance(690, 81, Image.SCALE_DEFAULT));//瀹介珮鏍规嵁闇�瑕佽瀹� - stepl.setIcon(colorIcon); - } - - //------------------------------- - public void updateCenter() { - if (center != null) { - this.remove(center); - } - if (step == 1) { - log.writeInfo("鍑嗗浜у搧鐗堟湰", Logger.INFO_TYPE); - center = imageCenter(); - } else if (step == 2) { - log.writeInfo("鐩稿叧璺緞璁剧疆", Logger.INFO_TYPE); - center = pathCenter(); - } else if (step == 3) { - log.writeInfo("缂栬瘧Web绋嬪簭", Logger.INFO_TYPE); - JComponent o= compileCenter(); - if(o !=null) { - center=o;//璇存槑鍙戠敓閿欒 - } - } else if (step == 4) { - log.writeInfo("澶嶅埗Install浠g爜", Logger.INFO_TYPE); - center = copyInstallCode(); - } else if (step == 5) { - log.writeInfo("澶嶅埗Java浠g爜", Logger.INFO_TYPE); - center = copyJavaCode(); - } else if (step == 6) { - log.writeInfo("澶嶅埗Web浠g爜", Logger.INFO_TYPE); - center = copyWebCode(); - }else { - System.out.println("缁撴潫"); - System.exit(0); - } - this.add(center, BorderLayout.CENTER); - this.updateUI(); - this.repaint(); - mainf.repaint(); - } - - private JComponent imageCenter() { - JLabel welcome = new JLabel(); - ImageIcon colorIcon = new ImageIcon("./images/welcome.png"); - colorIcon.setImage(colorIcon.getImage().getScaledInstance(697, 392, Image.SCALE_DEFAULT));//瀹介珮鏍规嵁闇�瑕佽瀹� - welcome.setIcon(colorIcon); - return welcome; - } - private JComponent pathCenter() { - PathPanel cp = new PathPanel(this); - mainf.setPanel(cp.name, cp); - return cp; - } - - /** - * 缂栬瘧Web - * @return - */ - private JComponent compileCenter() { - JLabel web=new JLabel(" 姝e湪缂栬瘧Web绋嬪簭,璇峰嬁鍏抽棴绐楀彛"); - next.setEnabled(false); - executorService = Executors.newSingleThreadExecutor(); - executorService.submit(new Runnable() { - @Override - public void run() { - String path=((PathPanel)mainf.getPanel("path_panel")).product_web_root.getText()+File.separator+"packed.bat"; - String dist=((PathPanel)mainf.getPanel("path_panel")).product_web_root.getText()+File.separator+"dist"; - File distd=new File(dist); - if(distd.exists()) { - FileUtils.delFile(dist); - } - try { - System.out.println(path); - CommonUtil.run("start "+path,web); - while(!distd.exists()) { - Thread.sleep(1000); - web.setText(web.getText()+".."); - } - - web.setText(" 缂栬瘧Web绋嬪簭瀹屾垚銆�"); - next.setEnabled(true); - }catch(Exception e) { - e.printStackTrace(); - web.setText(" 缂栬瘧Web绋嬪簭鍙戠敓閿欒:"+e.getMessage()); - } -// mainf.mpanel.add(center, BorderLayout.CENTER); -// mainf.mpanel.updateUI(); -// mainf.mpanel.repaint(); -// mainf.repaint(); - executorService.shutdown(); - } - }); - return web; - } - private JComponent copyInstallCode() { - JLabel welcome = new JLabel(" 寮�濮嬪鍒跺畨瑁呯▼搴�........"); - next.setEnabled(false); - executorService = Executors.newSingleThreadExecutor(); - executorService.submit(new Runnable() { - @Override - public void run() { - String install_path=((PathPanel)mainf.getPanel("path_panel")).install_project_root.getText()+File.separator+"bin"; - String version_path=((PathPanel)mainf.getPanel("path_panel")).product_version_root.getText()+File.separator+((PathPanel)mainf.getPanel("path_panel")).product_version.getText(); - File vf=new File(version_path); - if(vf.exists()) { - welcome.setText("銆�"+version_path+"銆戠洰褰曞凡瀛樺湪锛岃杩斿洖涓婁竴姝ラ噸鏂版寚瀹氭柊鐗堟湰鍙锋垨鎵嬪姩鍒犻櫎璇ョ洰褰曘��"); - //涓嶆樉绀轰笅涓�姝ユ寜閽紝鍙兘鐐逛笂涓�姝� - - }else { - vf.mkdirs(); - String install=version_path+File.separator+"install"; - File inf=new File(install); - if(inf.exists()) { - FileUtils.deleteDirectory(install); - } - inf.mkdirs(); - File src=new File(install_path); - try { - for(int i=0;i<src.listFiles().length;i++) { - welcome.setText("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - System.out.println("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - if(src.listFiles()[i].isDirectory()) { - FileUtils.copyDirectory(src.listFiles()[i], new File(install+File.separator+src.listFiles()[i].getName())); - }else { - FileUtils.copyFile(src.listFiles()[i], new File(install+File.separator+src.listFiles()[i].getName())); - } - } - welcome.setText(" 澶嶅埗瀹夎绋嬪簭瀹屾垚锛屽叡澶嶅埗"+src.listFiles().length+"涓枃浠讹紒"); - next.setEnabled(true); - }catch(Exception e) { - e.printStackTrace(); - welcome.setText(" 澶嶅埗瀹夎鏂囦欢閿欒锛�"+e.getMessage()+"锛岃澶勭悊鍚庤繑鍥炰笂涓�姝ラ噸鏂版搷浣溿��"); - //涓嶆樉绀轰笅涓�姝ユ寜閽紝鍙兘鐐逛笂涓�姝� - - } - } - executorService.shutdown(); - } - }); - return welcome; - } - private JComponent copyWebCode() { - JLabel welcome = new JLabel(" 姝e湪澶嶅埗Web绋嬪簭........"); - next.setEnabled(false); - executorService = Executors.newSingleThreadExecutor(); - executorService.submit(new Runnable() { - @Override - public void run() { - String web_path=((PathPanel)mainf.getPanel("path_panel")).product_web_root.getText()+File.separator+"dist"; - File src=new File(web_path); - if(!src.exists()) { - welcome.setText(" 鍓嶇浠g爜娌℃湁缂栬瘧:"+web_path); - return ; - } - String version_path=((PathPanel)mainf.getPanel("path_panel")).product_version_root.getText()+File.separator+((PathPanel)mainf.getPanel("path_panel")).product_version.getText(); - String web=version_path+File.separator+"install"+File.separator+"product-server"+File.separator+"web"; - File w=new File(web); - if(w.exists()) { - FileUtils.deleteDirectory(web); - } - w.mkdirs(); - try { - for(int i=0;i<src.listFiles().length;i++) { - welcome.setText("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - System.out.println("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - if(src.listFiles()[i].isDirectory()) { - FileUtils.copyDirectory(src.listFiles()[i], new File(web+File.separator+src.listFiles()[i].getName())); - }else { - FileUtils.copyFile(src.listFiles()[i], new File(web+File.separator+src.listFiles()[i].getName())); - } - - } - welcome.setText(" 澶嶅埗Web绋嬪簭瀹屾垚锛屽叡澶嶅埗"+src.listFiles().length+"涓枃浠讹紒"); - - next.setEnabled(true); - }catch(Exception e) { - welcome.setText("澶嶅埗Web鏂囦欢閿欒锛�"+e.getMessage()+"锛岃澶勭悊鍚庤繑鍥炰笂涓�姝ラ噸鏂版搷浣溿��"); - //涓嶆樉绀轰笅涓�姝ユ寜閽紝鍙兘鐐逛笂涓�姝� - } - executorService.shutdown(); - } - }); - return welcome; - } - private JComponent copyJavaCode() { - JLabel welcome = new JLabel(" 姝e湪澶嶅埗Java绋嬪簭........"); - next.setEnabled(false); - executorService = Executors.newSingleThreadExecutor(); - executorService.submit(new Runnable() { - @Override - public void run() { - String lib_path=((PathPanel)mainf.getPanel("path_panel")).product_java_root.getText()+File.separator+"target"+File.separator+"lib"; - String resources_path=((PathPanel)mainf.getPanel("path_panel")).product_java_root.getText()+File.separator+"target"+File.separator+"resources"; - String version_path=((PathPanel)mainf.getPanel("path_panel")).product_version_root.getText()+File.separator+((PathPanel)mainf.getPanel("path_panel")).product_version.getText(); - String att_path=((PathPanel)mainf.getPanel("path_panel")).product_java_root.getText()+File.separator+"attachment"; - String resources=version_path+File.separator+"install"+File.separator+"product-server"+File.separator+"resources"; - String lib=version_path+File.separator+"install"+File.separator+"product-server"+File.separator+"lib"; - String att=version_path+File.separator+"install"+File.separator+"product-server"+File.separator+"attachment"; - - - File resourcesf=new File(resources); - if(resourcesf.exists()) { - FileUtils.deleteDirectory(resources); - } - resourcesf.mkdirs(); - File libf=new File(lib); - if(libf.exists()) { - FileUtils.deleteDirectory(lib); - } - libf.mkdirs(); - try { - //resources - File src=new File(resources_path); - for(int i=0;i<src.listFiles().length;i++) { - welcome.setText("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - System.out.println("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - if(src.listFiles()[i].isDirectory()) { - FileUtils.copyDirectory(src.listFiles()[i], new File(resources+File.separator+src.listFiles()[i].getName())); - }else { - FileUtils.copyFile(src.listFiles()[i], new File(resources+File.separator+src.listFiles()[i].getName())); - } - - } - //lib/*.jar - int fs=src.listFiles().length; - src=new File(lib_path); - for(int i=0;i<src.listFiles().length;i++) { - if(src.listFiles()[i].getName().indexOf("spring-server-master-1.2.6.0")>=0 - ||src.listFiles()[i].getName().indexOf("product-server-core-1.0.0-SNAPSHOT")>=0) { - continue; - } - if(src.listFiles()[i].isDirectory()) { - FileUtils.copyDirectory(src.listFiles()[i], new File(lib+File.separator+src.listFiles()[i].getName())); - }else { - FileUtils.copyFile(src.listFiles()[i], new File(lib+File.separator+src.listFiles()[i].getName())); - } - welcome.setText("姝e湪澶嶅埗鏂囦欢锛�"+src.listFiles()[i].getAbsolutePath()); - } - String src1=((PathPanel)mainf.getPanel("path_panel")).product_java_root.getText()+File.separator+"target"+File.separator+"product-server-web-1.0.0-SNAPSHOT.jar"; - String aims7=version_path+File.separator+"install"+File.separator+"product-server"+File.separator+"product-server-web-1.0.0-SNAPSHOT.jar"; - if(new File(aims7).exists()) { - FileUtils.deleteFile(aims7); - } - //web.jar - FileUtils.copyFile(src1, aims7); - //澶嶅埗闄勪欢 - FileUtils.copyDir(att_path, att); - fs+=1; - welcome.setText(" 澶嶅埗Java绋嬪簭瀹屾垚锛屽叡澶嶅埗"+(src.listFiles().length+fs)+"涓枃浠讹紒"); - next.setEnabled(true); - }catch(Exception e) { - e.printStackTrace(); - welcome.setText(" 澶嶅埗Java鏂囦欢閿欒锛�"+e.getMessage()+"锛岃澶勭悊鍚庤繑鍥炰笂涓�姝ラ噸鏂版搷浣溿��"); - //涓嶆樉绀轰笅涓�姝ユ寜閽紝鍙兘鐐逛笂涓�姝� - } - executorService.shutdown(); - } - }); - return welcome; - } - //------------------------- - public JComponent initButton() { - JPanel b = new JPanel(); - b.setPreferredSize(new Dimension(690, 48)); - next.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (access) { - step += 1; - updateStep(); - updateSouth(); - updateCenter(); - } - } - }); - pre.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - step -= 1; - updateStep(); - updateSouth(); - updateCenter(); - - } - }); - b.add(pre); - b.add(next); - b.add(ok); - updateSouth(); - return b; - } - - public void updateSouth() { - ok.setEnabled(false); - if (step == 1) { - firstButton(); - }else if (step == 6) { - preButton(); - }else { - nextButton(); - } - } - - /** - * 杩涘叆瀹夎绯荤粺椤甸潰鍒濆鍖栨寜閽负绌� - */ - public void startInstallStepButton() { - pre.setEnabled(false); - next.setOperate(false); - ok.setEnabled(false); - } - - /** - * 瀹夎绯荤粺瀹屾垚鍚庢樉绀烘寜閽� 涓嬩竴姝� - */ - public void finalInstallStepButton() { - pre.setEnabled(false); - next.setOperate(true); - ok.setEnabled(false); - } - - - private void firstButton() { - pre.setEnabled(false); - next.setEnabled(true); - next.setOperate(true); - access = true; - - } - private void nextButton() { - pre.setEnabled(true); - next.setEnabled(true); - next.setOperate(true); - access = true; - - } - - private void preButton() { - pre.setEnabled(true); - next.setEnabled(false); - access = true; - } - -} - diff --git a/src/com/lx/product/seal/frame/PathPanel.java b/src/com/lx/product/seal/frame/PathPanel.java deleted file mode 100644 index ae56f24..0000000 --- a/src/com/lx/product/seal/frame/PathPanel.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.lx.product.seal.frame; - -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - - -public class PathPanel extends JPanel { - public String name="path_panel"; - Font ft =new Font("寰蒋闆呴粦", Font.BOLD, 14); - public JTextField product_version_root = new JTextField (); - public JTextField install_project_root = new JTextField (); - public JTextField product_web_root = new JTextField (); - public JTextField product_java_root = new JTextField (); - public JTextField product_version = new JTextField (); - private JFileChooser path_select = new JFileChooser (); - - private JButton product_version_button = new JButton (); - private JButton install_project_button = new JButton (); - private JButton product_web_button = new JButton (); - private JButton product_java_button = new JButton (); - - - public PathPanel(MasterPanel f) { - product_version_root.setFont(ft); - install_project_root.setFont(ft); - product_web_root.setFont(ft); - product_java_root.setFont(ft); - product_version.setFont(ft); - path_select.setFont(ft); - - product_version_button.setFont(ft); - install_project_button.setFont(ft); - product_web_button.setFont(ft); - product_java_button.setFont(ft); - - product_version_root.setPreferredSize(new Dimension(500, 30)); - install_project_root.setPreferredSize(new Dimension(500, 30)); - product_web_root.setPreferredSize(new Dimension(500, 30)); - product_java_root.setPreferredSize(new Dimension(500, 30)); - product_version.setPreferredSize(new Dimension(500, 30)); - path_select.setPreferredSize(new Dimension(500, 30)); - path_select.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY ); - product_version_button.setText("閫夋嫨鐩綍"); - product_version_button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(product_version_root.getText()!="") - path_select.setCurrentDirectory(new File(product_version_root.getText())); - int result=path_select.showOpenDialog(product_version_button); - if (result == JFileChooser.APPROVE_OPTION) { - // 濡傛灉鐐瑰嚮浜�"淇濆瓨", 鍒欒幏鍙栭�夋嫨鐨勪繚瀛樿矾寰� - File file = path_select.getSelectedFile(); - product_version_root.setText( file.getAbsolutePath()); - } - } - }); - install_project_button.setText("閫夋嫨鐩綍"); - install_project_button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(install_project_root.getText()!="") - path_select.setCurrentDirectory(new File(install_project_root.getText())); - int result=path_select.showOpenDialog(install_project_button); - if (result == JFileChooser.APPROVE_OPTION) { - // 濡傛灉鐐瑰嚮浜�"淇濆瓨", 鍒欒幏鍙栭�夋嫨鐨勪繚瀛樿矾寰� - File file = path_select.getSelectedFile(); - install_project_root.setText( file.getAbsolutePath()); - } - } - }); - product_web_button.setText("閫夋嫨鐩綍"); - product_web_button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(product_web_root.getText()!="") - path_select.setCurrentDirectory(new File(product_web_root.getText())); - int result=path_select.showOpenDialog(product_web_button); - if (result == JFileChooser.APPROVE_OPTION) { - // 濡傛灉鐐瑰嚮浜�"淇濆瓨", 鍒欒幏鍙栭�夋嫨鐨勪繚瀛樿矾寰� - File file = path_select.getSelectedFile(); - product_web_root.setText( file.getAbsolutePath()); - } - } - }); - product_java_button.setText("閫夋嫨鐩綍"); - product_java_button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(product_java_root.getText()!="") - path_select.setCurrentDirectory(new File(product_java_root.getText())); - int result=path_select.showOpenDialog(product_java_button); - if (result == JFileChooser.APPROVE_OPTION) { - // 濡傛灉鐐瑰嚮浜�"淇濆瓨", 鍒欒幏鍙栭�夋嫨鐨勪繚瀛樿矾寰� - File file = path_select.getSelectedFile(); - product_java_root.setText( file.getAbsolutePath()); - } - } - }); - GridBagLayout bg = new GridBagLayout(); - this.setLayout(bg); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.WEST; - c.insets = new Insets(2, 5, 2, 5); - c.gridx = 0; - c.gridy = 0; - c.gridwidth = 2; - c.gridheight = 1; - c.weightx = 0; - c.weighty = 0; - JLabel sl = new JLabel(); - sl.setText("浜у搧鐗堟湰绠$悊鐩綍:"); - sl.setFont(ft); - sl.setHorizontalAlignment(JLabel.LEFT); - this.add(sl, c); - - c.gridy = 1; - c.gridwidth = 1; - product_version_root.setText(f.config.getProduct_version_root()); - this.add(product_version_root, c); - c.gridx = 1; - this.add(product_version_button, c); - c.gridx = 0; - - c.gridwidth = 2; - c.gridy = 2; - this.add(new JLabel(" "), c); - - c.gridy = 3; - JLabel l3= new JLabel("浜у搧瀹夎宸ョ▼鐩綍(product-server-install):"); - l3.setFont(ft); - this.add(l3, c); - c.gridwidth = 1; - c.gridy = 4; - install_project_root.setText(f.config.getInstall_project_root()); - this.add(install_project_root, c); - c.gridx = 1; - this.add(install_project_button, c); - c.gridx = 0; - c.gridwidth = 2; - c.gridy = 5; - this.add(new JLabel(" "), c); - - c.gridy = 6; - JLabel l4=new JLabel("鍓嶇浠g爜鐩綍(product-web):"); - l4.setFont(ft); - this.add(l4, c); - c.gridwidth = 1; - c.gridy = 7; - product_web_root.setText(f.config.getProduct_web_root()); - this.add(product_web_root, c); - c.gridx = 1; - this.add(product_web_button, c); - c.gridx = 0; - c.gridwidth = 2; - c.gridy = 8; - this.add(new JLabel(" "), c); - - c.gridy = 9; - JLabel pl = new JLabel(); - pl.setText("鍚庣浠g爜鐩綍(product-server-web):"); - pl.setFont(ft); - this.add(pl, c); - c.gridwidth = 1; - c.gridy = 10; - product_java_root.setText(f.config.getProduct_java_root()); - this.add(product_java_root, c); - c.gridx = 1; - this.add(product_java_button, c); - - - c.gridx = 0; - c.gridwidth = 2; - c.gridy = 11; - this.add(new JLabel(" "), c); - c.gridy = 12; - JLabel vl = new JLabel(); - vl.setText("浜у搧鐗堟湰鍙�,浠寮�澶�,濡傦細V1.0.2锛�"); - vl.setFont(ft); - this.add(vl, c); - c.gridy = 13; - product_version.setText(f.config.getProduct_version()); - this.add(product_version, c); - - } -} - diff --git a/src/com/lx/product/seal/log/Logger.java b/src/com/lx/product/seal/log/Logger.java deleted file mode 100644 index 22707a4..0000000 --- a/src/com/lx/product/seal/log/Logger.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.lx.product.seal.log; - -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.Date; - -public class Logger { - private Logger() { - } - - private static class LoggerHolder { - private static final Logger LOGGER = new Logger(); - } - - private static File logFile; - private static OutputStreamWriter loger; - - public static final int ERROR_TYPE = 0;//閿欒鏃ュ織 - public static final int INFO_TYPE = 1;//鏅�氭棩蹇� - public static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - public static final SimpleDateFormat formats = new SimpleDateFormat("yyyyMMddHHmmss"); - public static final SimpleDateFormat formatd = new SimpleDateFormat("yyyyMMdd"); - - static { - File menu = new File("logs"); - if (!menu.exists() || !menu.isDirectory()) { - menu.mkdirs(); - } - logFile = new File("logs" + File.separator + "install_" + formats.format(new Date()) + ".log"); - if (!logFile.exists()) { - System.out.println("鏃ュ織鏂囦欢涓嶅瓨鍦細" + logFile.getAbsolutePath()); - try { - logFile.createNewFile(); - System.out.println("宸插垱寤烘棩蹇楁枃浠讹細" + logFile.getAbsolutePath()); - } catch (Exception e) { - System.out.println("鍒涘缓鏃ュ織鏂囦欢澶辫触锛�" + logFile.getAbsolutePath() + "," + e.getMessage()); - } - } - try { - loger = new OutputStreamWriter(new FileOutputStream(logFile), "utf-8"); - } catch (Exception e) { - System.out.println("鍒濆鏃ュ織鏂囦欢澶辫触锛�" + logFile.getAbsolutePath() + "," + e.getMessage()); - } - } - - /** - * 鑾峰彇鏃ュ織瀹炰緥 - * @return - */ - public static Logger getInstance() { - return LoggerHolder.LOGGER; - } - - /** - * 鍐欐棩蹇� - * @param message - * @param type - * @return - */ - public boolean writeInfo(String message, int type) { - if (loger != null) { - try { - loger.write("銆�"); - if (type == this.ERROR_TYPE) - loger.write("ERROR"); - else - loger.write("INFO "); - loger.write(" " + format.format(new Date())); - loger.write("銆� "); - loger.write(message); - loger.write("\r\n"); - loger.flush(); - return true; - } catch (Exception e) { - System.out.println("鏃ュ織鍐欏叆閿欒锛�" + logFile.getAbsolutePath() + "," + e.getMessage()); - } - } - return false; - } - - public void closeLogger() { - if (loger != null) { - try { - loger.close(); - } catch (Exception e) { - System.out.println("鏃ュ織鍐欏叆閿欒锛�" + logFile.getAbsolutePath() + "," + e.getMessage()); - } - } - } -} diff --git a/src/com/lx/product/seal/utils/CommonUtil.java b/src/com/lx/product/seal/utils/CommonUtil.java deleted file mode 100644 index 05ae445..0000000 --- a/src/com/lx/product/seal/utils/CommonUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.lx.product.seal.utils; - -import com.lx.product.seal.log.Logger; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; - -import javax.swing.JLabel; - -/** - * Copyright 漏 6c - * @Date: 2021-02-23 15:24 - * @Author: 6c - * @Description: - */ -public class CommonUtil { - private static Logger log = Logger.getInstance(); - - /** - * 鑾峰彇寮傚父淇℃伅 - * - * @param e 寮傚父 - * @return e.info - */ - public static String getExceptionInfo(Exception e) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - e.printStackTrace(new PrintStream(outputStream)); - String exception = outputStream.toString(); - try { - outputStream.close(); - } catch (IOException e1) { - log.writeInfo("鑾峰彇鏃ュ織淇℃伅鍑洪敊," + e1.getMessage(), Logger.ERROR_TYPE); - } - return exception; - } - - /** - * 鎵ц鎵瑰鐞嗘枃浠朵笖鍏抽棴绐楀彛 - */ - public static void runbatAndCloseIframe(String path) { - try { - String cmd = "cmd /k start " + path; - log.writeInfo("姝e湪鎵ц鎵瑰鐞嗘枃浠讹細 " + path, Logger.INFO_TYPE); - Runtime.getRuntime().exec(cmd); - } catch (IOException e) { - log.writeInfo("鎵ц鎵瑰鐞嗘枃浠跺嚭閿�,璺緞涓猴細 " + path + e.getMessage(), Logger.ERROR_TYPE); - } - } - /** - * 鍒濆鏁版嵁 - * - * @param cmdDos - * @throws Exception - */ - static public void run(String cmdDos,JLabel web) throws Exception { - ProcessBuilder pb = new ProcessBuilder().command("cmd.exe", "/c", cmdDos).inheritIO(); - pb.redirectErrorStream(true);//杩欓噷鏄妸鎺у埗鍙颁腑鐨勭孩瀛楀彉鎴愪簡榛戝瓧锛岀敤閫氬父鐨勬柟娉曞叾瀹炶幏鍙栦笉鍒帮紝鎺у埗鍙扮殑缁撴灉鏄痯b.start()鏂规硶鍐呴儴杈撳嚭鐨勩�� - System.out.println("缂栬瘧寮�濮�.............."); - //pb.start().waitFor();//绛夊緟璇彞鎵ц瀹屾垚锛屽惁鍒欏彲鑳戒細璇讳笉鍒扮粨鏋溿�� - Process process = pb.start(); - BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); - String line; - while ((line = br.readLine()) != null) { - System.out.println(line); - } - int exitCode = process.waitFor(); - // 鐩戝惉鎴愬姛 - System.out.println("exitCode = "+exitCode); - System.out.println("缂栬瘧缁撴潫.............."); - } - -} - diff --git a/src/com/lx/product/seal/utils/FileUtil.java b/src/com/lx/product/seal/utils/FileUtil.java deleted file mode 100644 index 5e3b1f6..0000000 --- a/src/com/lx/product/seal/utils/FileUtil.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.lx.product.seal.utils; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.util.Map; - -import com.lx.product.seal.log.Logger; - -public class FileUtil { - private static final String row = "\n"; - public static Logger log = Logger.getInstance(); - - /** - * 澶嶅埗鏂囦欢 - * @param sourceFile - * @param targetFile - */ - public static void copyFile(File sourceFile, File targetFile) { - - BufferedInputStream inBuff = null; - BufferedOutputStream outBuff = null; - try { - if (!targetFile.getParentFile().exists()) { - targetFile.getParentFile().mkdirs(); - } - // 鏂板缓鏂囦欢杈撳叆娴佸苟瀵瑰畠杩涜缂撳啿 - inBuff = new BufferedInputStream(new FileInputStream(sourceFile)); - // 鏂板缓鏂囦欢杈撳嚭娴佸苟瀵瑰畠杩涜缂撳啿 - outBuff = new BufferedOutputStream(new FileOutputStream(targetFile)); - // 缂撳啿鏁扮粍 - byte[] b = new byte[1024 * 5]; - int len; - while ((len = inBuff.read(b)) != -1) { - outBuff.write(b, 0, len); - } - // 鍒锋柊姝ょ紦鍐茬殑杈撳嚭娴� - outBuff.flush(); - } catch (Exception e) { - log.writeInfo(e.getMessage(), Logger.ERROR_TYPE); - } finally { - // 鍏抽棴娴� - if (inBuff != null) { - try { - inBuff.close(); - } catch (Exception ee) { - log.writeInfo(ee.getMessage(), Logger.ERROR_TYPE); - } - } - if (outBuff != null) { - try { - outBuff.close(); - } catch (Exception ee) { - log.writeInfo(ee.getMessage(), Logger.ERROR_TYPE); - } - } - } - } - - /** - * 淇敼鏂囦欢 - * @param sourceFile - * @param targetFile - */ - public static void modifyFile(File sourceFile, File targetFile, Map<String, String> items, String readEncode, String writeEncode) { - BufferedWriter bw = null; - try (InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(sourceFile), readEncode); - BufferedReader br = new BufferedReader(inputStreamReader);) { - StringBuilder content = new StringBuilder(512); - String line = null; - while ((line = br.readLine()) != null) { - if (line.startsWith("pause")) { - continue; - } - for (Map.Entry<String, String> entry : items.entrySet()) { - if (line.trim().startsWith(entry.getKey())) { - line = entry.getValue(); - } - } - content.append(line).append("\r\n"); - } - bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), writeEncode)); - bw.write(content.toString()); - // 鍒锋柊姝ょ紦鍐茬殑杈撳嚭娴� - bw.flush(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (bw != null) { - try { - bw.close(); - } catch (Exception ee) { - ee.printStackTrace(); - } - } - } - } - - public static void modifyFile(File sourceFile, File targetFile, Map<String, String> items, String encode) { - modifyFile(sourceFile, targetFile, items, encode, encode); - } - - public static void modifyFile(File sourceFile, File targetFile, Map<String, String> items) { - modifyFile(sourceFile, targetFile, items, "utf-8"); - } -} diff --git a/src/com/lx/product/seal/utils/ZipUtil.java b/src/com/lx/product/seal/utils/ZipUtil.java deleted file mode 100644 index fe8e784..0000000 --- a/src/com/lx/product/seal/utils/ZipUtil.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.lx.product.seal.utils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * 鍘嬬缉绠楁硶绫� - * 瀹炵幇鏂囦欢鍘嬬缉锛屾枃浠跺す鍘嬬缉锛屼互鍙婃枃浠跺拰鏂囦欢澶圭殑娣峰悎鍘嬬缉 - * - * - */ -public class ZipUtil { - - /** - * 瀹屾垚鐨勭粨鏋滄枃浠�--杈撳嚭鐨勫帇缂╂枃浠� - */ - File targetFile; - - public ZipUtil() {} - - public ZipUtil(File target) { - targetFile = target; - if (targetFile.exists()) - targetFile.delete(); - } - - /** - * 鍘嬬缉鏂囦欢 - * - * @param srcfile - */ - public void zipFiles(File srcfile) { - - ZipOutputStream out = null; - try { - out = new ZipOutputStream(new FileOutputStream(targetFile)); - - if(srcfile.isFile()){ - zipFile(srcfile, out, ""); - } else{ - File[] list = srcfile.listFiles(); - for (int i = 0; list != null && i < list.length; i++) { - compress(list[i], out, ""); - } - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 鍘嬬缉鏂囦欢澶归噷鐨勬枃浠� - * 璧峰垵涓嶇煡閬撴槸鏂囦欢杩樻槸鏂囦欢澶�--- 缁熶竴璋冪敤璇ユ柟娉� - * @param file - * @param out - * @param basedir - */ - private void compress(File file, ZipOutputStream out, String basedir) { - /* 鍒ゆ柇鏄洰褰曡繕鏄枃浠� */ - if (file.isDirectory()) { - this.zipDirectory(file, out, basedir); - } else { - this.zipFile(file, out, basedir); - } - } - - /** - * 鍘嬬缉鍗曚釜鏂囦欢 - * - * @param srcfile - */ - public void zipFile(File srcfile, ZipOutputStream out, String basedir) { - if (!srcfile.exists()) - return; - - byte[] buf = new byte[1024]; - FileInputStream in = null; - - try { - int len; - in = new FileInputStream(srcfile); - out.putNextEntry(new ZipEntry(basedir + srcfile.getName())); - - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.closeEntry(); - if (in != null) - in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 鍘嬬缉鏂囦欢澶� - * @param dir - * @param out - * @param basedir - */ - public void zipDirectory(File dir, ZipOutputStream out, String basedir) { - if (!dir.exists()) - return; - - File[] files = dir.listFiles(); - for (int i = 0; i < files.length; i++) { - /* 閫掑綊 */ - compress(files[i], out, basedir + dir.getName() + "/"); - } - } - - - //娴嬭瘯 - public static void main(String[] args) { - File f = new File("D:\\FENEW"); - new ZipUtil(new File( "D:/",f.getName()+".zip")).zipFiles(f); - } - -} \ No newline at end of file diff --git a/src/main/java/com/product/badge/config/BadgeCode.java b/src/main/java/com/product/badge/config/BadgeCode.java new file mode 100644 index 0000000..75a0192 --- /dev/null +++ b/src/main/java/com/product/badge/config/BadgeCode.java @@ -0,0 +1,59 @@ +package com.product.badge.config; + +import com.product.common.enums.IEnum; +import com.product.common.enums.ModuleEnum; + +/** + * Copyright 漏 6c + * + * @Date: 2021-06-01 09:54 + * @Author: 6c + * @Description: + */ +public enum BadgeCode implements IEnum { + BADGE_OPERATION_SUCCESS("鎴愬姛", "200"), + + BADGE_SAVE_FAIL("璇佺珷淇濆瓨澶辫触", ModuleEnum.BADGE.getValue() + "001"), + BADGE_DELETE_FAIL("璇佺珷鍒犻櫎澶辫触", ModuleEnum.BADGE.getValue() + "002"), + BADGE_GET_LIST_FAIL("璇佺珷鍒楄〃鑾峰彇澶辫触", ModuleEnum.BADGE.getValue() + "003"), + BADGE_GET_INFO_FAIL("璇佺珷淇℃伅鑾峰彇澶辫触", ModuleEnum.BADGE.getValue() + "004"), + + BADGE_USE_SAVE_FAIL("鍗扮珷浣跨敤璁板綍淇濆瓨澶辫触", ModuleEnum.BADGE.getValue() + "021"), + BADGE_USE_DELETE_FAIL("鍗扮珷浣跨敤璁板綍鍒犻櫎澶辫触", ModuleEnum.BADGE.getValue() + "022"), + BADGE_USE_GET_LIST_FAIL("鍗扮珷浣跨敤璁板綍鍒楄〃鑾峰彇澶辫触", ModuleEnum.BADGE.getValue() + "023"), + BADGE_USE_GET_INFO_FAIL("鍗扮珷浣跨敤璁板綍淇℃伅鑾峰彇澶辫触", ModuleEnum.BADGE.getValue() + "024"), + + BADGE_BORROW_SAVE_FAIL("璇佺珷鍊熺敤淇濆瓨澶辫触", ModuleEnum.BADGE.getValue() + "031"), + BADGE_BORROW_GET_LIST_FAIL("鑾峰彇璇佺珷鍊熺敤鍒楄〃澶辫触", ModuleEnum.BADGE.getValue() + "032"), + BADGE_BORROW_BOARD_FAIL("鑾峰彇璇佺珷鍊熺敤鐪嬫澘澶辫触", ModuleEnum.BADGE.getValue() + "033"), + GET_BADGE_BORROW_AND_RETURN_RECORD_FAIL("鑾峰彇璇佺珷鍊熻繕璁板綍澶辫触", ModuleEnum.BADGE.getValue() + "034"), + BADGE_GET_GIVE_BACK_INFO_FAIL("鑾峰彇璇佺珷璇︽儏澶辫触", ModuleEnum.BADGE.getValue() + "035"), + BADGE_GIVE_BACK_FAIL("璇佺珷褰掕繕澶辫触", ModuleEnum.BADGE.getValue() + "036"), + BADGE_GIVE_BACK_GET_LIST_FAIL("鑾峰彇璇佺珷褰掕繕鍒楄〃澶辫触", ModuleEnum.BADGE.getValue() + "037"), + BADGE_GIVE_BACK_GET_INFO_FAIL("鑾峰彇鍊熺敤鍒楄〃璇︽儏澶辫触", ModuleEnum.BADGE.getValue() + "038"), + BADGE_GET_BORROW_AND_RETURN_TABLE_NAME_FAIL("鑾峰彇璇佺珷鍊熻繕璁板綍琛ㄥ悕澶辫触", ModuleEnum.BADGE.getValue() + "039"), + + + SYSTEM_FORM_NODATA("璇锋眰琛ㄥ崟鍙傛暟涓虹┖", ModuleEnum.BADGE.getValue() + "100"), + SYSTEM_TABLE_NODATA("璇锋眰鍙傛暟琛ㄥ悕涓虹┖", ModuleEnum.BADGE.getValue() + "101"), + + ; + private String text; + private String value; + + private BadgeCode(String text, String value) { + this.text = text; + this.value = value; + } + public String getText() { + return text; + } + public String getValue() { + return value; + } + + @Override + public String toString() { + return value + ": " + text; + } +} diff --git a/src/main/java/com/product/badge/config/CmnConst.java b/src/main/java/com/product/badge/config/CmnConst.java new file mode 100644 index 0000000..c6a9b7a --- /dev/null +++ b/src/main/java/com/product/badge/config/CmnConst.java @@ -0,0 +1,60 @@ +package com.product.badge.config; + +/** + * Copyright 漏 6c + * + * @Date: 2021-03-19 08:45 + * @Author: 6c + * @Description: + */ +public class CmnConst { + private CmnConst() {} + + // 琛ㄥ悕 + public static final String TABLE_PRODUCT_OA_BADGE_COMPANY = "product_oa_badge_company";// 鍏徃璇佺珷 + public static final String TABLE_PRODUCT_OA_BADGE_COMPANY_CERTIFICATE_CHANGE = "product_oa_badge_company_certificate_change";// 鍏徃璇佷功鍙樺姩 + public static final String TABLE_PRODUCT_OA_BADGE_COMPANY_QUALIFICATION = "product_oa_badge_company_qualification";// 鍏徃璧勮川璇佺珷 + public static final String TABLE_PRODUCT_OA_BADGE_CONSTRUCTOR = "product_oa_badge_constructor";// 寤洪�犲笀璇佺珷 + public static final String TABLE_PRODUCT_OA_BADGE_COST_OFFICER = "product_oa_badge_cost_officer";// 閫犱环浜哄憳 + public static final String TABLE_PRODUCT_OA_BADGE_SAFETY_OFFICER = "product_oa_badge_safety_officer";// 瀹夊叏浜哄憳 + public static final String TABLE_PRODUCT_OA_BADGE_SCENE_MANAGE = "product_oa_badge_scene_manage";// 鐜板満绠$悊 + public static final String TABLE_PRODUCT_OA_BADGE_SCENE_OFFICER = "product_oa_badge_scene_officer";// 鐜板満宸ヤ汉 + public static final String TABLE_PRODUCT_OA_BADGE_MANAGER = "product_oa_badge_manager";// 绠$悊浜哄憳 + public static final String TABLE_PRODUCT_OA_BADGE_FINANCE_MANAGE = "product_oa_badge_finance_manage";// 璐㈠姟绠$悊 + public static final String TABLE_PRODUCT_OA_BADGE_AWARDS = "product_oa_badge_awards";// 鑾峰淇℃伅 + public static final String TABLE_PRODUCT_OA_BADGE_USE_RECORD = "product_oa_badge_use_record";// 鍗扮珷浣跨敤 + public static final String TABLE_PRODUCT_OA_BADGE_BORROW_RECORD = "product_oa_badge_borrow_record";// 璇佺珷鍊熺敤鐧昏 + public static final String TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL = "product_oa_badge_borrow_detail";// 璇佺珷鍊熺敤鏄庣粏 + public static final String TABLE_PRODUCT_OA_BADGE_BORROW_V = "product_oa_badge_borrow_v";// 璇佺珷鍊熺敤瑙嗗浘 + + // 鍒嗛〉甯搁噺瀹氫箟 + public static final String CUR_PAGE = "cpage"; // 椤垫暟 + public static final String PAGE_SIZE = "pagesize"; // 姣忛〉鏉℃暟 + + // 瀛楁-閫氱敤 + public static final String FIELD_ID = "id"; + public static final String FIELD_UUID = "uuid"; + public static final String FIELD_TABLE_NAME = "table_name"; + public static final String FIELD_TABLE_UUID = "table_uuid"; + public static final String FIELD_ORDER_BY = "order_by"; + public static final String FIELD_CREATED_BY = "created_by"; + public static final String FIELD_CREATED_UTC_DATETIME = "created_utc_datetime"; + public static final String FIELD_UPDATED_BY = "updated_by"; + public static final String FIELD_UPDATED_UTC_DATETIME = "updated_utc_datetime"; + public static final String FIELD_BADGE_LEVEL = "badge_level"; + public static final String FIELD_BADGE_TYPE = "badge_type"; + public static final String FIELD_IS_VALID = "is_valid"; + public static final String FIELD_BADGE_UUID = "badge_uuid"; + public static final String FIELD_ORG_LEVEL_UUID = "org_level_uuid"; + public static final String FIELD_DEPT_UUID = "dept_uuid"; + + + // 瀛楁-璇佺珷鍊熺敤 + public static final String FIELD_BADGE_BORROW_REASON = "borrow_reason"; + public static final String FIELD_BADGE_BORROW_RETURN_DATE = "return_date"; + public static final String FIELD_BADGE_BORROW_RETURN_BY = "return_by"; + + // 缂撳瓨 + public static final String CACHE_TABLE = "鎵�鏈夎〃淇℃伅(uuid)"; + +} diff --git a/src/main/java/com/product/badge/controller/BadgeBorrowController.java b/src/main/java/com/product/badge/controller/BadgeBorrowController.java new file mode 100644 index 0000000..f9e0c55 --- /dev/null +++ b/src/main/java/com/product/badge/controller/BadgeBorrowController.java @@ -0,0 +1,346 @@ +package com.product.badge.controller; + +import com.product.admin.service.PublicService; +import com.product.admin.service.idel.IPublicService; +import com.product.badge.config.BadgeCode; +import com.product.badge.config.CmnConst; +import com.product.badge.service.BadgeBorrowService; +import com.product.badge.service.idel.IBadgeBorrowService; +import com.product.common.lang.StringUtils; +import com.product.core.config.CoreConst; +import com.product.core.controller.support.AbstractBaseController; +import com.product.core.entity.FieldSetEntity; +import com.product.core.entity.RequestParameterEntity; +import com.product.core.exception.BaseException; +import com.product.core.spring.context.SpringMVCContextHolder; +import com.product.module.sys.version.ApiVersion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + * @Date: 2021-06-03 09:09 + * @Description: 璇佺珷鍊熺敤 + */ +@RestController +@RequestMapping("/api/badge-borrow") +public class BadgeBorrowController extends AbstractBaseController { + + private Logger logger = LoggerFactory.getLogger(BadgeBorrowController.class); + @Autowired + private BadgeBorrowService service; + @Autowired + public PublicService publicService; + + /** + * 鍊熺敤 + * @param request + * @return + */ + @RequestMapping(value = "/borrow/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String borrow(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + IBadgeBorrowService iBadgeBorrowService = (IBadgeBorrowService) getProxyInstance(service); + String uuid = iBadgeBorrowService.borrow(fse); + return OK_Add(uuid); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_BORROW_SAVE_FAIL.getValue(), BadgeCode.BADGE_BORROW_SAVE_FAIL.getText()); + } + } + + /** + * 鍊熺敤鍒楄〃灞曠ず + * @param request + * @return + */ + @RequestMapping(value = "/list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String list(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(publicService.listTable(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_BORROW_GET_LIST_FAIL.getValue(), BadgeCode.BADGE_BORROW_GET_LIST_FAIL.getText()); + } + } + + /** + * 鍒犻櫎 + * @param request + * @return + */ + @RequestMapping(value = "/delete/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String delete(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + IPublicService iPublicService = (IPublicService) getProxyInstance(publicService); + iPublicService.delete(fse); + return OK(); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_DELETE_FAIL.getValue(), BadgeCode.BADGE_DELETE_FAIL.getText()); + } + } + + /** + * 鍊熺敤-鑾峰彇鍊熺敤璇︽儏 + * @param request + * @return + */ + @RequestMapping(value = "/find-badge-borrow-info/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findBadgeBorrowInfo(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(service.findBadgeBorrowInfo(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GET_GIVE_BACK_INFO_FAIL.getValue(), BadgeCode.BADGE_GET_GIVE_BACK_INFO_FAIL.getText()); + } + } + + /** + * 褰掕繕-鍒楄〃 + * @param request + * @return + */ + @RequestMapping(value = "/get-give-back-list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String getGiveBackList(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(service.getGiveBackList(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GIVE_BACK_GET_LIST_FAIL.getValue(), BadgeCode.BADGE_GIVE_BACK_GET_LIST_FAIL.getText()); + } + } + + /** + * 閮ㄥ垎褰掕繕-鑾峰彇鍊熺敤鍒楄〃璇︽儏 + * @param request + * @return + */ + @RequestMapping(value = "/part-give-back-find/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String partGiveBackFind(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(service.partGiveBackFind(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GIVE_BACK_GET_INFO_FAIL.getValue(), BadgeCode.BADGE_GIVE_BACK_GET_INFO_FAIL.getText()); + } + } + + /** + * 褰掕繕 + * @param request + * @return + */ + @RequestMapping(value = "/give-back/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String giveBack(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || (!CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL.equals(fse.getTableName()) && !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName()))) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + service.giveBack(fse); + return OK(); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GIVE_BACK_FAIL.getValue(), BadgeCode.BADGE_GIVE_BACK_FAIL.getText()); + } + } + + /** + * 璇佺珷鍊熺敤鐪嬫澘 + * @param request + * @return + */ + @RequestMapping(value = "/borrow-board/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String borrowBoard(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(service.borrowBoard(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_BORROW_GET_LIST_FAIL.getValue(), BadgeCode.BADGE_BORROW_GET_LIST_FAIL.getText()); + } + } + + /** + * 璇佺珷鍊熻繕璁板綍 + * @param request + * @return + */ + @RequestMapping(value = "/get-badge-borrow-and-return-record/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String getBadgeBorrowAndReturnRecord(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + return OK_List(service.getBadgeBorrowAndReturnRecord(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.GET_BADGE_BORROW_AND_RETURN_RECORD_FAIL.getValue(), BadgeCode.GET_BADGE_BORROW_AND_RETURN_RECORD_FAIL.getText()); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/product/badge/controller/BadgeController.java b/src/main/java/com/product/badge/controller/BadgeController.java new file mode 100644 index 0000000..b028059 --- /dev/null +++ b/src/main/java/com/product/badge/controller/BadgeController.java @@ -0,0 +1,177 @@ +package com.product.badge.controller; + +import com.product.admin.service.PublicService; +import com.product.admin.service.idel.IPublicService; +import com.product.badge.config.BadgeCode; +import com.product.badge.config.CmnConst; +import com.product.badge.service.BadgeService; +import com.product.core.config.CoreConst; +import com.product.core.controller.support.AbstractBaseController; +import com.product.core.entity.DataTableEntity; +import com.product.core.entity.FieldSetEntity; +import com.product.core.entity.RequestParameterEntity; +import com.product.core.exception.BaseException; +import com.product.core.spring.context.SpringMVCContextHolder; +import com.product.module.sys.version.ApiVersion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + * Copyright 漏 6c + * + * @Date: 2021-06-01 09:52 + * @Author: 6c + * @Description: 鍏徃璇佺珷 + */ +@RestController +@RequestMapping("/api/badge") +public class BadgeController extends AbstractBaseController { + + private Logger logger = LoggerFactory.getLogger(BadgeController.class); + @Autowired + private BadgeService badgeService; + @Autowired + private PublicService publicService; + + /** + * 鍒楄〃鑾峰彇 + * @param request + * @return + */ + @RequestMapping(value = "/list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String list(HttpServletRequest request) { + String tableName = ""; + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + tableName = fse.getTableName(); + DataTableEntity dte; + if (CmnConst.TABLE_PRODUCT_OA_BADGE_COMPANY_CERTIFICATE_CHANGE.equals(tableName)) { + dte = publicService.listTable(fse); + } else { + dte = badgeService.listTable(fse); + } + return OK_List(dte); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GET_LIST_FAIL.getValue(), BadgeCode.BADGE_GET_LIST_FAIL.getText() + ": " + tableName); + } + } + + /** + * 淇濆瓨 + * @param request + * @return + */ + @RequestMapping(value = "/save/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String save(HttpServletRequest request) { + String tableName = ""; + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + tableName = fse.getTableName(); + IPublicService iPublicService = (IPublicService) getProxyInstance(publicService); + String uuid = iPublicService.saveFieldSetEntity(fse); + return OK_Add(uuid); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_SAVE_FAIL.getValue(), BadgeCode.BADGE_SAVE_FAIL.getText() + ": " + tableName); + } + } + + /** + * 鏌ヨ + * @param request + * @return + */ + @RequestMapping(value = "/find/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String find(HttpServletRequest request) { + String tableName = ""; + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + tableName = fse.getTableName(); + return OK_List(publicService.getFieldSetEntity(fse, false)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_GET_INFO_FAIL.getValue(), BadgeCode.BADGE_GET_INFO_FAIL.getText() + ": " + tableName); + } + } + + /** + * 鍒犻櫎 + * @param request + * @return + */ + @RequestMapping(value = "/delete/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String delete(HttpServletRequest request) { + String tableName = ""; + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + tableName = fse.getTableName(); + return publicService.delete(fse) ? OK() : error(BadgeCode.BADGE_DELETE_FAIL.getValue(), BadgeCode.BADGE_DELETE_FAIL.getText() + ": " + tableName); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_DELETE_FAIL.getValue(), BadgeCode.BADGE_DELETE_FAIL.getText() + ": " + tableName); + } + } +} diff --git a/src/main/java/com/product/badge/controller/BadgeUseController.java b/src/main/java/com/product/badge/controller/BadgeUseController.java new file mode 100644 index 0000000..e7e75d2 --- /dev/null +++ b/src/main/java/com/product/badge/controller/BadgeUseController.java @@ -0,0 +1,169 @@ +package com.product.badge.controller; + +import com.product.admin.service.PublicService; +import com.product.badge.config.BadgeCode; +import com.product.badge.config.CmnConst; +import com.product.core.config.CoreConst; +import com.product.core.controller.support.AbstractBaseController; +import com.product.core.entity.FieldSetEntity; +import com.product.core.entity.RequestParameterEntity; +import com.product.core.exception.BaseException; +import com.product.core.spring.context.SpringMVCContextHolder; +import com.product.module.sys.version.ApiVersion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + * @Date: 2021-06-03 09:09 + * @Description: 鍗扮珷浣跨敤璁板綍 + */ +@RestController +@RequestMapping("/api/badge-use") +public class BadgeUseController extends AbstractBaseController { + + private Logger logger = LoggerFactory.getLogger(BadgeUseController.class); + @Autowired + public PublicService publicService; + + /** + * 鍒楄〃鑾峰彇 + * @param request + * @return + */ + @RequestMapping(value = "/list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String list(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_USE_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(publicService.listTable(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_USE_GET_LIST_FAIL.getValue(), BadgeCode.BADGE_USE_GET_LIST_FAIL.getText()); + } + } + + /** + * 淇濆瓨 + * @param request + * @return + */ + @RequestMapping(value = "/save/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String save(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_USE_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_Add(publicService.saveFieldSetEntity(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_USE_SAVE_FAIL.getValue(), BadgeCode.BADGE_USE_SAVE_FAIL.getText()); + } + } + + /** + * 鍒犻櫎 + * @param request + * @return + */ + @RequestMapping(value = "/delete/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String delete(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_USE_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return publicService.delete(fse) ? OK() : error(BadgeCode.BADGE_USE_DELETE_FAIL.getValue(), BadgeCode.BADGE_USE_DELETE_FAIL.getText()); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_USE_DELETE_FAIL.getValue(), BadgeCode.BADGE_USE_DELETE_FAIL.getText()); + } + } + + /** + * 鏌ヨ璇︽儏 + * @param request + * @return + */ + @RequestMapping(value = "/find/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String find(HttpServletRequest request) { + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_FORM_NODATA.getValue(), BadgeCode.SYSTEM_FORM_NODATA.getText()); + } + if (fse.getTableName() == null || !CmnConst.TABLE_PRODUCT_OA_BADGE_USE_RECORD.equals(fse.getTableName())) { + SpringMVCContextHolder.getSystemLogger().error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + return this.error(BadgeCode.SYSTEM_TABLE_NODATA.getValue(), BadgeCode.SYSTEM_TABLE_NODATA.getText()); + } + return OK_List(publicService.getFieldSetEntity(fse, false)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e.getCode(), e.getMessageInfo()); + } catch (Exception e) { + SpringMVCContextHolder.getSystemLogger().error(e); + e.printStackTrace(); + return error(BadgeCode.BADGE_USE_GET_INFO_FAIL.getValue(), BadgeCode.BADGE_USE_GET_INFO_FAIL.getText()); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/product/badge/service/BadgeBorrowService.java b/src/main/java/com/product/badge/service/BadgeBorrowService.java new file mode 100644 index 0000000..730cb8c --- /dev/null +++ b/src/main/java/com/product/badge/service/BadgeBorrowService.java @@ -0,0 +1,261 @@ +package com.product.badge.service; + +import com.product.badge.config.BadgeCode; +import com.product.badge.config.CmnConst; +import com.product.badge.service.idel.IBadgeBorrowService; +import com.product.common.lang.StringUtils; +import com.product.core.cache.DataPoolCacheImpl; +import com.product.core.dao.BaseDao; +import com.product.core.entity.DataTableEntity; +import com.product.core.entity.FieldSetEntity; +import com.product.core.exception.BaseException; +import com.product.core.service.support.AbstractBaseService; +import com.product.core.service.support.QueryFilterService; +import com.product.core.spring.context.SpringMVCContextHolder; +import com.product.core.transfer.Transactional; +import com.product.module.sys.entity.SystemUser; +import com.product.util.BaseUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @Date: 2021-06-03 08:37 + * @Description: 璇佺珷鍊熺敤 + */ +@Service +public class BadgeBorrowService extends AbstractBaseService implements IBadgeBorrowService { + @Autowired + public BaseDao baseDao; + @Autowired + public QueryFilterService queryFilterService; + + /** + * 鍊熺敤 + * @param fse + * @return + */ + @Transactional + @Override + public String borrow(FieldSetEntity fse) { + SystemUser curUser = SpringMVCContextHolder.getCurrentUser(); + if (StringUtils.isEmpty(fse.getUUID())) { + // 鏂板 + BaseUtil.createCreatorAndCreationTime(curUser, fse); + } else { + // 淇敼 + BaseUtil.updatedRegeneratorAndUpdateTime(curUser, fse); + } + fse.setValue(CmnConst.FIELD_ORG_LEVEL_UUID, SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid()); + fse.setValue(CmnConst.FIELD_DEPT_UUID, SpringMVCContextHolder.getCurrentUser().getDept_uuid()); + FieldSetEntity tempFse; + DataTableEntity dte = fse.getSubDataTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL); + fse.removeSubData(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL); + DataTableEntity subDte = new DataTableEntity(); + FieldSetEntity subFse; + String[] arr; + for (int i = 0;i < dte.getRows();i++) { + tempFse = dte.getFieldSetEntity(i); + arr = tempFse.getString(CmnConst.FIELD_BADGE_UUID).split(","); + for (String badgeUUID : arr) { + subFse = tempFse.clones(); + subFse.setValue(CmnConst.FIELD_BADGE_UUID, badgeUUID); + subDte.addFieldSetEntity(subFse); + } + } + fse.addSubDataTable(subDte); + baseDao.saveFieldSetEntity(fse); + return fse.getUUID(); + } + + /** + * 鍊熺敤-鑾峰彇鍊熺敤璇︽儏 + * @param fse + * @return + */ + public FieldSetEntity findBadgeBorrowInfo(FieldSetEntity fse) { + FieldSetEntity recordFse = baseDao.getFieldSetEntity(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD, fse.getUUID(), false); + StringBuilder sql = new StringBuilder(128); + sql.append("select badge_level,badge_type,GROUP_CONCAT(badge_uuid) badge_uuid") + .append("\nfrom product_oa_badge_borrow_detail") + .append("\nwhere record_uuid=?") + .append("\ngroup by badge_level,badge_type"); + DataTableEntity detailDte = baseDao.listTable(sql.toString(), new Object[]{fse.getUUID()}); + recordFse.addSubDataTable(detailDte); + return recordFse; + } + + /** + * 褰掕繕-鍒楄〃 + * @param fse + * @return + */ + public DataTableEntity getGiveBackList(FieldSetEntity fse) { + StringBuilder sql = new StringBuilder(128); + sql.append("select * from product_oa_badge_borrow_record r") + .append("\ninner join (") + .append("\n select distinct record_uuid from product_oa_badge_borrow_detail") + .append("\n where return_date is null") + .append("\n) d on r.uuid=d.record_uuid"); + int pageSize = fse.getInteger(CmnConst.PAGE_SIZE) == null ? Integer.MAX_VALUE : fse.getInteger(CmnConst.PAGE_SIZE); + int curPage = fse.getInteger(CmnConst.CUR_PAGE) == null ? 1 : fse.getInteger(CmnConst.CUR_PAGE); + DataTableEntity dte = baseDao.listTable(sql.toString(), new Object[]{}, pageSize, curPage); + baseDao.loadPromptData(dte); + return dte; + } + + /** + * 褰掕繕-閮ㄥ垎褰掕繕-鑾峰彇鍊熺敤鍒楄〃璇︽儏 + * @param fse + * @return + */ + public FieldSetEntity partGiveBackFind(FieldSetEntity fse) { + String recordUUID = fse.getUUID(); + DataTableEntity detailDte = baseDao.listTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL, "return_date is null and record_uuid=?", new Object[]{recordUUID}); + baseDao.loadPromptData(detailDte); + FieldSetEntity recordFse = baseDao.getFieldSetEntity(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD, recordUUID, false); + baseDao.loadPromptData(recordFse); + recordFse.addSubDataTable(detailDte); + return recordFse; + } + + /** + * 褰掕繕 + * @param fse + */ + public void giveBack(FieldSetEntity fse) { + String uuids = fse.getUUID(); + if (StringUtils.isEmpty(uuids)) { + return; + } + SystemUser curUser = SpringMVCContextHolder.getCurrentUser(); + String tableName = fse.getTableName(); + DataTableEntity dte = null; + if (CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD.equalsIgnoreCase(tableName)) { + // 褰掕繕鎵�鏈� + dte = baseDao.listTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL, "record_uuid=? and return_date is null", new Object[]{uuids}); + } + if (CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL.equalsIgnoreCase(tableName)) { + // 閮ㄥ垎褰掕繕 + String[] uuidArr = uuids.split(","); + String filter = BaseUtil.buildQuestionMarkFilter(CmnConst.FIELD_UUID, uuidArr.length, true); + dte = baseDao.listTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL, filter, uuidArr); + } + if (!BaseUtil.dataTableIsEmpty(dte)) { + FieldSetEntity tempFse; + for (int i = 0; i < dte.getRows(); i++) { + tempFse = dte.getFieldSetEntity(i); + tempFse.setValue(CmnConst.FIELD_BADGE_BORROW_RETURN_DATE, new Date()); + tempFse.setValue(CmnConst.FIELD_BADGE_BORROW_RETURN_BY, curUser.getUser_id()); + baseDao.saveFieldSetEntity(tempFse); + } + } + } + + /** + * 璇佺珷鍊熺敤鐪嬫澘 + * @param fse + * @return + */ + public DataTableEntity borrowBoard(FieldSetEntity fse) { + StringBuilder sql = new StringBuilder(); + sql.append("\nselect d.table_uuid,d.uuid,table_name,c.org_level_name org_level_uuid,badge_name,type_name,cp.dict_label badge_type,holder,ifnull(badge_status,'鏈�熷嚭') badge_status,borrow_by,borrow_time,return_date,useful_life "); + sql.append("\nfrom ( "); + sql.append("\n select '725928d8-a0ed-4f68-9e1d-87f66d899df0' table_uuid,'product_oa_badge_awards' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'鑾峰淇℃伅璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_awards "); + sql.append("\n union all "); + sql.append("\n select '66d5e271-41bc-48c3-a0f5-6d696c70a036' table_uuid,'product_oa_badge_company' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'鍏徃璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_company "); + sql.append("\n union all "); + sql.append("\n select '6468cd40-c9c9-41ff-b819-d670e3af9cee' table_uuid,'product_oa_badge_company_qualification' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'鍏徃璧勮川璇佺珷' type_name,holder,useful_life from product_oa_badge_company_qualification "); + sql.append("\n union all "); + sql.append("\n select 'a743e548-7b49-4f45-a072-acc03b873bdd' table_uuid,'product_oa_badge_constructor' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'寤洪�犲笀璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_constructor "); + sql.append("\n union all "); + sql.append("\n select 'c07d0bcd-3e2d-43b9-9df0-ae60c6d57577' table_uuid,'product_oa_badge_cost_officer' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'閫犱环浜哄憳璇佺珷' type_name,holder,useful_life from product_oa_badge_cost_officer "); + sql.append("\n union all "); + sql.append("\n select '3d6d8e93-f347-4a07-abb0-c6ec7ccf907b' table_uuid,'product_oa_badge_finance_manage' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'璐㈠姟绠$悊璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_finance_manage "); + sql.append("\n union all "); + sql.append("\n select '4cca65f6-dc58-443a-abb1-222524930d4c' table_uuid,'product_oa_badge_manager' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'绠$悊浜哄憳璇佺珷' type_name,holder,useful_life from product_oa_badge_manager "); + sql.append("\n union all "); + sql.append("\n select 'a980ba45-e286-4e5d-ba39-a28d7a0de3dc' table_uuid,'product_oa_badge_safety_officer' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'瀹夊叏浜哄憳璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_safety_officer "); + sql.append("\n union all "); + sql.append("\n select '53dc61c1-70d3-493b-b271-b886f723e50d' table_uuid,'product_oa_badge_scene_manage' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'鐜板満绠$悊璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_scene_manage "); + sql.append("\n union all "); + sql.append("\n select '0761488e-d10f-4c25-8b57-469114d9b7b4' table_uuid,'product_oa_badge_scene_officer' table_name,org_level_uuid,badge_level,badge_type,badge_name,uuid,'鐜板満宸ヤ汉璇佺珷' type_name,holder,'姘镐箙' useful_life from product_oa_badge_scene_officer "); + sql.append("\n) d "); + sql.append("\nleft join ( "); + sql.append("\n select b.* from ( "); + sql.append("\n select s.uuid,u.user_name borrow_by,m.created_utc_datetime borrow_time,s.return_by,s.return_date,badge_uuid, "); + sql.append("\n case when s.return_by is null or s.return_by='' then '鍊熷嚭' else '褰掕繕' END badge_status "); + sql.append("\n from product_oa_badge_borrow_record m "); + sql.append("\n left join product_oa_badge_borrow_detail s on m.uuid=s.record_uuid "); + sql.append("\n inner join product_sys_users u on u.user_id=m.created_by "); + sql.append("\n ) b "); + sql.append("\n inner join ( "); + sql.append("\n select uuid,max(created_utc_datetime) last_borrow_time "); + sql.append("\n from ( "); + sql.append("\n select s.uuid,m.created_utc_datetime "); + sql.append("\n from product_oa_badge_borrow_record m "); + sql.append("\n left join product_oa_badge_borrow_detail s "); + sql.append("\n on m.uuid=s.record_uuid "); + sql.append("\n ) b "); + sql.append("\n group by uuid "); + sql.append("\n ) t "); + sql.append("\n on b.uuid=t.uuid and b.borrow_time=t.last_borrow_time "); + sql.append("\n) b "); + sql.append("\non d.uuid=b.badge_uuid "); + sql.append("\ninner join ( "); + sql.append("\n select * FROM product_sys_dict where dict_name='badge_common_type' "); + sql.append("\n) cp on d.badge_type=cp.dict_value "); + sql.append("\ninner join product_sys_org_levels c on c.uuid=d.org_level_uuid "); + + String queryFilter = queryFilterService.getQueryFilter(fse); + if (!StringUtils.isEmpty(queryFilter)) { + sql.append("\nwhere ").append(queryFilter); + } + + int pageSize = fse.getInteger(CmnConst.PAGE_SIZE) == null ? Integer.MAX_VALUE : fse.getInteger(CmnConst.PAGE_SIZE); + int curPage = fse.getInteger(CmnConst.CUR_PAGE) == null ? 1 : fse.getInteger(CmnConst.CUR_PAGE); + DataTableEntity dte = baseDao.listTable(sql.toString(), new Object[]{}, pageSize, curPage); + dte.getMeta().addAliasTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD,"m"); + dte.getMeta().addAliasTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL, "s"); + dte.getMeta().addAliasField(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD + ".created_utc_datetime","borrow_time"); + baseDao.loadPromptData(dte); + return dte; + } + + /** + * 璇佺珷鍊熻繕璁板綍 + * @param fse + * @return + */ + public DataTableEntity getBadgeBorrowAndReturnRecord(FieldSetEntity fse) { + String tableUUID = fse.getString(CmnConst.FIELD_TABLE_UUID); + DataTableEntity tableCacheDte = DataPoolCacheImpl.getInstance().getCacheData(CmnConst.CACHE_TABLE, new String[]{tableUUID}); + if (BaseUtil.dataTableIsEmpty(tableCacheDte)) { + throw new BaseException(BadgeCode.BADGE_GET_BORROW_AND_RETURN_TABLE_NAME_FAIL.getValue(), BadgeCode.BADGE_GET_BORROW_AND_RETURN_TABLE_NAME_FAIL.getText()); + } + FieldSetEntity tableCacheFse = tableCacheDte.getFieldSetEntity(0); + String tableName = tableCacheFse.getString(CmnConst.FIELD_TABLE_NAME); + String badgeUUID = fse.getUUID(); + StringBuilder sql = new StringBuilder(512); + sql.append("\nselect b.*,org_level_uuid,badge_name,badge_level,badge_type,holder from ( "); + sql.append("\n select s.uuid,m.created_by borrow_by,m.created_utc_datetime borrow_time,s.return_by,s.return_date,badge_uuid "); + sql.append("\n from product_oa_badge_borrow_record m "); + sql.append("\n left join product_oa_badge_borrow_detail s "); + sql.append("\n on m.uuid=s.record_uuid "); + sql.append("\n) b "); + sql.append("\ninner join ").append(tableName).append(" d "); + sql.append("\non b.badge_uuid=d.uuid "); + sql.append("\nwhere d.uuid=?"); + + int pageSize = fse.getInteger(CmnConst.PAGE_SIZE) == null ? Integer.MAX_VALUE : fse.getInteger(CmnConst.PAGE_SIZE); + int curPage = fse.getInteger(CmnConst.CUR_PAGE) == null ? 1 : fse.getInteger(CmnConst.CUR_PAGE); + DataTableEntity dte = baseDao.listTable(sql.toString(), new Object[]{badgeUUID}, pageSize, curPage); + dte.getMeta().addAliasTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD, "m"); + dte.getMeta().addAliasTable(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_DETAIL, "s"); + dte.getMeta().addAliasField(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD + ".created_by","borrow_by"); + dte.getMeta().addAliasField(CmnConst.TABLE_PRODUCT_OA_BADGE_BORROW_RECORD + ".created_utc_datetime","borrow_time"); + baseDao.loadPromptData(dte); + return dte; + } +} \ No newline at end of file diff --git a/src/main/java/com/product/badge/service/BadgeService.java b/src/main/java/com/product/badge/service/BadgeService.java new file mode 100644 index 0000000..858ad6c --- /dev/null +++ b/src/main/java/com/product/badge/service/BadgeService.java @@ -0,0 +1,76 @@ +package com.product.badge.service; + +import com.product.admin.service.PublicService; +import com.product.badge.config.CmnConst; +import com.product.common.lang.StringUtils; +import com.product.core.dao.BaseDao; +import com.product.core.entity.DataTableEntity; +import com.product.core.entity.FieldSetEntity; +import com.product.core.service.support.AbstractBaseService; +import com.product.core.service.support.QueryFilterService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Copyright 漏 6c + * + * @Date: 2021-06-29 16:30 + * @Author: 6c + * @Description: + */ +@Service +public class BadgeService extends AbstractBaseService { + @Autowired + public BaseDao baseDao; + @Autowired + public QueryFilterService queryFilterService; + @Autowired + public PublicService publicService; + + /** + * 鍒楄〃鍙拌处 + * @param fse + * @return + */ + public DataTableEntity listTable(FieldSetEntity fse) { + StringBuilder sql = new StringBuilder(512); + sql.append("select * from ("); + sql.append("\nselect d.uuid,org_level_uuid,badge_name,badge_level,holder,badge_type,ifnull(badge_status,'鏈�熷嚭') badge_status,borrow_by,borrow_time,return_date,flow_flag"); + sql.append("\nfrom ").append(fse.getTableName()).append(" d"); + sql.append("\nleft join ( "); + sql.append("\n select b.* from ( "); + sql.append("\n select s.uuid,m.created_by borrow_by,m.created_utc_datetime borrow_time,s.return_by,s.return_date,badge_uuid, "); + sql.append("\n case when s.return_by is null or s.return_by='' then '鍊熷嚭' else '褰掕繕' END badge_status "); + sql.append("\n from product_oa_badge_borrow_record m "); + sql.append("\n left join product_oa_badge_borrow_detail s "); + sql.append("\n on m.uuid=s.record_uuid "); + sql.append("\n ) b "); + sql.append("\n inner join ( "); + sql.append("\n select uuid,max(created_utc_datetime) last_borrow_time "); + sql.append("\n from ( "); + sql.append("\n select s.uuid,m.created_utc_datetime "); + sql.append("\n from product_oa_badge_borrow_record m "); + sql.append("\n left join product_oa_badge_borrow_detail s "); + sql.append("\n on m.uuid=s.record_uuid "); + sql.append("\n ) b "); + sql.append("\n group by uuid "); + sql.append("\n ) t "); + sql.append("\n on b.uuid=t.uuid and b.borrow_time=t.last_borrow_time "); + sql.append("\n) b "); + sql.append("\non d.uuid=b.badge_uuid "); + sql.append("\n) a "); + + + String filter = publicService.getListFilter(fse, 0); + + if (!StringUtils.isEmpty(filter)) { + sql.append(" where ").append(filter); + } + int pageSize = fse.getInteger(CmnConst.PAGE_SIZE) == null ? Integer.MAX_VALUE : fse.getInteger(CmnConst.PAGE_SIZE); + int curPage = fse.getInteger(CmnConst.CUR_PAGE) == null ? 1 : fse.getInteger(CmnConst.CUR_PAGE); + DataTableEntity dte = baseDao.listTable(sql.toString(), new Object[]{}, pageSize, curPage); + dte.getMeta().addAliasTable(fse.getTableName(),"d"); + baseDao.loadPromptData(dte); + return dte; + } +} diff --git a/src/main/java/com/product/badge/service/idel/IBadgeBorrowService.java b/src/main/java/com/product/badge/service/idel/IBadgeBorrowService.java new file mode 100644 index 0000000..77425dc --- /dev/null +++ b/src/main/java/com/product/badge/service/idel/IBadgeBorrowService.java @@ -0,0 +1,14 @@ +package com.product.badge.service.idel; + +import com.product.core.entity.FieldSetEntity; + +/** + * Copyright 漏 6c + * + * @Date: 2021-06-03 11:54 + * @Author: 6c + * @Description: + */ +public interface IBadgeBorrowService { + String borrow(FieldSetEntity fse); +} diff --git a/src/test/java/com/product/badge/BadgeTest.java b/src/test/java/com/product/badge/BadgeTest.java new file mode 100644 index 0000000..5f51947 --- /dev/null +++ b/src/test/java/com/product/badge/BadgeTest.java @@ -0,0 +1,208 @@ +package com.product.badge; + +import com.google.common.collect.Maps; +import com.product.common.utils.HttpTest; +import org.assertj.core.util.Lists; +import org.junit.Test; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * Copyright 漏 6c + * + * @Date: 2021-06-02 11:31 + * @Author: 6c + * @Description: + */ +public class BadgeTest { + @Test + public void testList(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("url/api", "/api/badge/list/v1"); + m.put("~table~", "product_oa_badge_company_certificate_change"); + + HttpTest.testPost(m); + } + + @Test + public void testSave(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("url/api", "/api/badge/save/v1"); + // 鍏徃璇佷功鍙樺姩 +// m.put("~table~", "product_oa_badge_company_certificate_change"); +// m.put("org_level_uuid", "6c-test-org_level_uuid"); +// m.put("certificate_name", "鑳滃埄涔嬭瘉"); +// m.put("certificate_type", "0"); +// m.put("certificate_level", "0"); +// m.put("change_type", "1"); + + // 鑾峰淇℃伅 +// m.put("~table~", "product_oa_badge_awards"); +// m.put("org_level_uuid", "6c-test-org_level_uuid"); +// m.put("is_valid", "1"); +// m.put("prizewinner", "寮犱笁"); +// m.put("badge_name", "浜旀湁闈掑勾"); +// m.put("holder", "寮犱笁"); +// m.put("badge_level", "0"); +// m.put("badge_type", "0"); +// m.put("certificate_authority", "娓呭崕闈掑勾瀹�"); +// m.put("awards_show", "鏈変簲瀹�"); + + // 閫犱环浜哄憳璇佺珷 + m.put("~table~", "product_oa_badge_cost_officer"); + m.put("is_valid", "1"); + m.put("open_date", new Date()); + m.put("badge_name", "鍗佷匠闈掑勾"); + m.put("holder", "鏉庣惁"); + m.put("badge_level", "0"); + m.put("badge_type", "0"); + m.put("useful_life", new Date()); + + HttpTest.testPost(m); + } + + @Test + public void testDelete(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("url/api", "/api/badge/delete/v1"); + m.put("~table~", "product_oa_badge_company_certificate_change"); + m.put("uuid", "e7bc1ac1-f6c4-4610-8340-dbf0f348ef23"); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-淇濆瓨 + */ + @Test + public void testBadgeBorrowSave(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/borrow/v1"); + m.put("borrow_reason", "鍐嶅�熸潵鐪嬪搱"); + + // ----------瀛愯〃-------------- + List<Map<String, Object>> languageValuesList = Lists.newArrayList(); +// Map<String, Object> languageValue1 = Maps.newHashMap(); +// languageValue1.put("badge_level", "0"); +// languageValue1.put("badge_type", "0"); +// languageValue1.put("badge_uuid", "c3595c5a-a607-4806-ab90-69b1f552438d,23c10c4b-2852-49c9-9ed1-952f6326fc92"); +// languageValuesList.add(languageValue1); + +// Map<String, Object> languageValue2 = Maps.newHashMap(); +// languageValue2.put("badge_level", "0"); +// languageValue2.put("badge_type", "0"); +// languageValue2.put("badge_uuid", "bf8abe73-99f9-4cc5-b8bb-a9b21877d479,9fa3c9ee-309e-4cbb-9fdb-b71a24a53882"); +// languageValuesList.add(languageValue2); + + Map<String, Object> languageValue3 = Maps.newHashMap(); + languageValue3.put("badge_level", "0"); + languageValue3.put("badge_type", "0"); + languageValue3.put("badge_uuid", "23c10c4b-2852-49c9-9ed1-952f6326fc92"); + languageValuesList.add(languageValue3); + + m.put("product_oa_badge_borrow_detail",languageValuesList); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-鍒楄〃灞曠ず + */ + @Test + public void testBadgeBorrowList(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/list/v1"); + m.put("cpage", 1); + m.put("pagesize", 20); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-鍒犻櫎 + */ + @Test + public void testBadgeBorrowDelete(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/delete/v1"); + m.put("uuid", "7334fdef-617b-410e-8480-1e5eb1ee0591"); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-鑾峰彇鍊熺敤璇︽儏 + */ + @Test + public void testBadgeBorrowFind(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/find-badge-borrow-info/v1"); + m.put("uuid", "02f9df91-023d-40de-9baa-5682f8d90219"); + + HttpTest.testPost(m); + } + + /** + * 閮ㄥ垎褰掕繕-鑾峰彇鍊熺敤鍒楄〃璇︽儏 + */ + @Test + public void testPartGiveBackFind(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/part-give-back-find/v1"); + m.put("uuid", "02f9df91-023d-40de-9baa-5682f8d90219"); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-褰掕繕 + */ + @Test + public void testBadgeBorrowGiveBack(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("url/api", "/api/badge-borrow/give-back/v1"); +// m.put("~table~", "product_oa_badge_borrow_detail"); +// m.put("uuid", "d427516d-8791-48ff-9db4-2c89d97347b1"); + + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("uuid", "02f9df91-023d-40de-9baa-5682f8d90219"); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-璇佺珷鍊熺敤鐪嬫澘 + */ + @Test + public void testBadgeBorrowBoard(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_borrow_record"); + m.put("url/api", "/api/badge-borrow/borrow-board/v1"); + m.put("pagesize", 20); + m.put("cpage", 1); + + HttpTest.testPost(m); + } + + /** + * 鍊熺敤-璇佺珷鍊熻繕璁板綍 + */ + @Test + public void testGetBadgeBorrowAndReturnRecord(){ + Map<String, Object> m = Maps.newHashMap(); + m.put("~table~", "product_oa_badge_cost_officer"); + m.put("url/api", "/api/badge-borrow/get-badge-borrow-and-return-record/v1"); + m.put("uuid", "23c10c4b-2852-49c9-9ed1-952f6326fc92"); + m.put("pagesize", 20); + m.put("cpage", 1); + + HttpTest.testPost(m); + } +} -- Gitblit v1.9.2