浏览代码

电子发票打印

wangxiaoming 6 年之前
父节点
当前提交
2669a3c191
共有 61 个文件被更改,包括 6444 次插入53 次删除
  1. 70 0
      watero-common-tool/src/main/java/com/iamberry/file/DownloadFile.java
  2. 66 0
      watero-common-tool/src/main/java/com/iamberry/file/FileToBase64.java
  3. 24 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/PrivateData.java
  4. 50 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/PublicData.java
  5. 31 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/RequestMode.java
  6. 59 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/ResultMode.java
  7. 27 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/exception/ExConstants.java
  8. 88 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/exception/OpensnsException.java
  9. 178 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/oauth/Oauth2AccessToken.java
  10. 96 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/oauth/RefreshTokenTimer.java
  11. 155 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/service/HttpClientService.java
  12. 149 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/service/OpenApiV1.java
  13. 144 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/test/TestOpenApiV1.java
  14. 62 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/util/Compress.java
  15. 43 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/util/MD5Util.java
  16. 163 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/util/SecurityUtil.java
  17. 69 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/util/StateData.java
  18. 19 0
      watero-common-tool/src/main/java/com/iamberry/nuonuo/util/ValidataUtil.java
  19. 391 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/ei/Billing.java
  20. 147 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/ei/BillingItem.java
  21. 101 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/ei/InvoPlatform.java
  22. 219 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/ei/PlatformInfo.java
  23. 108 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/ei/PushLog.java
  24. 10 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/order/ProductColor.java
  25. 43 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/BillingItemService.java
  26. 54 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/BillingService.java
  27. 43 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/InvoPlatformService.java
  28. 43 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/PlatformInfoService.java
  29. 43 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/PushLogService.java
  30. 6 0
      watero-rst-service/pom.xml
  31. 65 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/BillingItemServiceImpl.java
  32. 101 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/BillingServiceImpl.java
  33. 65 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/InvoPlatformServiceImpl.java
  34. 65 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/PlatformInfoServiceImpl.java
  35. 65 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/PushLogServiceImpl.java
  36. 50 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/BillingItemMapper.java
  37. 51 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/BillingMapper.java
  38. 43 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/InvoPlatformMapper.java
  39. 43 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/PlatformInfoMapper.java
  40. 43 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/PushLogMapper.java
  41. 171 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/billingItemMapper.xml
  42. 323 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/billingMapper.xml
  43. 106 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/invoPlatformMapper.xml
  44. 199 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/platformInfoMapper.xml
  45. 118 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/pushLogMapper.xml
  46. 3 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/product/mapper/productMapper.xml
  47. 223 0
      watero-rst-service/src/main/java/com/iamberry/rst/util/JdServiceUtil.java
  48. 384 0
      watero-rst-service/src/main/java/com/iamberry/rst/util/NuoNuoServiceUtil.java
  49. 18 0
      watero-rst-web/pom.xml
  50. 349 0
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/ei/BillingController.java
  51. 49 50
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/mq/MQTask.java
  52. 0 1
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AdminSalesOrderController.java
  53. 15 0
      watero-rst-web/src/main/resources/platform.properties
  54. 14 0
      watero-rst-web/src/main/resources/watero-rst-orm.xml
  55. 3 0
      watero-rst-web/src/main/webapp/WEB-INF/views/base/add_base.ftl
  56. 252 0
      watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_add_billing.ftl
  57. 229 0
      watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_billing_info.ftl
  58. 292 0
      watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_billing_list.ftl
  59. 37 2
      watero-rst-web/src/main/webapp/common/js/common/common.js
  60. 53 0
      watero-rst-web/src/main/webapp/common/js/common/number.js
  61. 314 0
      watero-rst-web/src/main/webapp/common/js/eiBilling/billing.js

+ 70 - 0
watero-common-tool/src/main/java/com/iamberry/file/DownloadFile.java

@@ -0,0 +1,70 @@
+package com.iamberry.file;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class DownloadFile {
+
+    /**
+     * 从网络Url中下载文件
+     * @param urlStr
+     * @param fileName
+     * @param savePath
+     * @throws IOException
+     */
+    public static void  downLoadByUrl(String urlStr,String fileName,String savePath) throws IOException {
+        URL url = new URL(urlStr);
+        HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+        //设置超时间为3秒
+        conn.setConnectTimeout(5*1000);
+        //防止屏蔽程序抓取而返回403错误
+        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+        //得到输入流
+        InputStream inputStream = conn.getInputStream();
+        //获取自己数组
+        byte[] getData = readInputStream(inputStream);
+        //文件保存位置
+        File saveDir = new File(savePath);
+        if(!saveDir.exists()){
+            saveDir.mkdir();
+        }
+        File file = new File(saveDir+File.separator+fileName);
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(getData);
+        if(fos!=null){
+            fos.close();
+        }
+        if(inputStream!=null){
+            inputStream.close();
+        }
+        System.out.println("info:"+url+" download success");
+
+    }
+
+    /**
+     * 从输入流中获取字节数组
+     * @param inputStream
+     * @return
+     * @throws IOException
+     */
+    public static  byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+    public static void main(String[] args) {
+        try{
+            downLoadByUrl("https://invtest.jss.com.cn/group1/M00/04/13/wKjScVy2pGmAPjiTAACOVJXVKUw718.pdf",
+                    "orderNo.pdf","C:\\Users\\Administrator\\Desktop");
+        }catch (Exception e) {
+            // TODO: handle exception
+        }
+    }
+}

+ 66 - 0
watero-common-tool/src/main/java/com/iamberry/file/FileToBase64.java

@@ -0,0 +1,66 @@
+package com.iamberry.file;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+public class FileToBase64 {
+    /**
+     * <p>将文件转成base64 字符串</p>
+     * @param path 文件路径
+     * @return
+     * @throws Exception
+     */
+    public static String encodeBase64File(String path) throws Exception {
+        File file = new File(path);
+        FileInputStream inputFile = new FileInputStream(file);
+        byte[] buffer = new byte[(int)file.length()];
+        inputFile.read(buffer);
+        inputFile.close();
+        return new BASE64Encoder().encode(buffer);
+    }
+    /**
+     * <p>将base64字符解码保存文件</p>
+     * @param base64Code
+     * @param targetPath
+     * @throws Exception
+     */
+    public static void decoderBase64File(String base64Code,String targetPath) throws Exception {
+        byte[] buffer = new BASE64Decoder().decodeBuffer(base64Code);
+        FileOutputStream out = new FileOutputStream(targetPath);
+        out.write(buffer);
+        out.close();
+    }
+    /**
+     * <p>将base64字符保存文本文件</p>
+     * @param base64Code
+     * @param targetPath
+     * @throws Exception
+     */
+    public static void toFile(String base64Code,String targetPath) throws Exception {
+        byte[] buffer = base64Code.getBytes();
+        FileOutputStream out = new FileOutputStream(targetPath);
+        out.write(buffer);
+        out.close();
+    }
+    public static void main(String[] args) {
+        try {
+            String base64Code =encodeBase64File("C:\\Users\\Administrator\\Desktop\\85775386589cc.pdf");
+
+            System.out.println(base64Code);
+
+            String encodeStr= DigestUtils.md5Hex(base64Code);
+
+            System.out.println(encodeStr);
+
+//            decoderBase64File(base64Code, "/Users/Crazy/Desktop/zyb.png");
+//            toFile(base64Code, "/Users/Crazy/Desktop/zyb.txt");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 24 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/PrivateData.java

@@ -0,0 +1,24 @@
+package com.iamberry.nuonuo.bean;
+
+/**
+ * 请求体中业务参数model
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class PrivateData<T> {
+	
+	/**
+	 * 请求数据
+	 */
+	private Object servicedata;
+
+	public void setServicedata(Object servicedata) {
+		this.servicedata = servicedata;
+	}
+
+	public Object getServicedata() {
+		return servicedata;
+	}
+	
+}

+ 50 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/PublicData.java

@@ -0,0 +1,50 @@
+package com.iamberry.nuonuo.bean;
+
+/**
+ * 请求体中公共参数model
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class PublicData {
+	
+	/**
+	 * 调用方法
+	 */
+	private String method;
+	
+	/**
+	 * API版本
+	 */
+	private String version;
+	
+	/**
+	 * 时间戳 
+	 */
+	private String timestamp;
+
+	public String getVersion() {
+		return version;
+	}
+
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	public String getMethod() {
+		return method;
+	}
+
+	public void setMethod(String method) {
+		this.method = method;
+	}
+
+	public String getTimestamp() {
+		return timestamp;
+	}
+
+	public void setTimestamp(String timestamp) {
+		this.timestamp = timestamp;
+	}
+	
+}

+ 31 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/RequestMode.java

@@ -0,0 +1,31 @@
+package com.iamberry.nuonuo.bean;
+
+/**
+ * 请求model
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class RequestMode {
+	
+	private PublicData Public;
+
+	private PrivateData Private;
+
+	public PublicData getPublic() {
+		return Public;
+	}
+
+	public void setPublic(PublicData public1) {
+		Public = public1;
+	}
+
+	public PrivateData getPrivate() {
+		return Private;
+	}
+
+	public void setPrivate(PrivateData private1) {
+		Private = private1;
+	}
+	
+}

+ 59 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/bean/ResultMode.java

@@ -0,0 +1,59 @@
+package com.iamberry.nuonuo.bean;
+
+/**
+ * 返回数据model
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class ResultMode {
+
+	/**
+	 * 返回码
+	 */
+	private String code;
+	
+	/**
+	 * 描述
+	 */
+	private String describe;
+	
+	/**
+	 * 返回值
+	 */
+	private String result;
+
+	public ResultMode() {
+	}
+
+	public ResultMode(String code, String describe, String result) {
+		this.code = code;
+		this.describe = describe;
+		this.result = result;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getDescribe() {
+		return describe;
+	}
+
+	public void setDescribe(String describe) {
+		this.describe = describe;
+	}
+
+	public String getResult() {
+		return result;
+	}
+
+	public void setResult(String result) {
+		this.result = result;
+	}
+	
+}

+ 27 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/exception/ExConstants.java

@@ -0,0 +1,27 @@
+package com.iamberry.nuonuo.exception;
+
+/**
+ * 异常静态数据
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class ExConstants {
+	
+	public final static String security_Decryption = "0701";
+	public final static String security_Encryption_Msg = "加密异常";
+
+	public final static String security_Decryption_arithmeticNULL = "070103";
+	public final static String security_Decryption_arithmeticNULL_Msg = "无法识别加密算法";
+
+	public final static String input_Data_Null = "0101";
+	public final static String input_Data_Null_Msg = "入参为空";
+
+	public final static String input_Data_Type = "0201";
+	public final static String input_Data_Type_Msg = "输入参数格式有误";
+	public final static String input_Data_Type_Msg1 = "必填项输入参数空";
+
+	public final static String http_invoke_Interrupt = "040102";
+	public final static String http_invoke_Interrupt_Msg = "http连接异常";
+	
+}

+ 88 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/exception/OpensnsException.java

@@ -0,0 +1,88 @@
+package com.iamberry.nuonuo.exception;
+
+
+import com.iamberry.nuonuo.bean.ResultMode;
+
+/**
+ * 异常返回结果
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class OpensnsException extends Exception {
+	
+	// 序列化UID
+	private static final long serialVersionUID = 8243127099991355146L;
+	
+	// 错误码
+	private String code;
+	
+	// 错误描述
+	private String describe;
+
+	private ResultMode resultMode;
+
+	public OpensnsException(String code, String describe) {
+		super(describe);
+		this.code = code;
+	}
+	
+	/**
+	 * 构造异常
+	 * @param code 异常状态码
+	 * @param msg 异常讯息
+	 */
+	public OpensnsException(ResultMode resultMode) {
+		super(resultMode.getDescribe());
+		this.resultMode = resultMode;
+	}
+	
+	/**
+	 * 构造异常
+	 * @param code 异常状态码
+	 * @param ex 异常来源
+	 */
+	public OpensnsException(String code, Exception ex) {
+		super(ex);
+		this.code = code;
+	}
+	
+	/**
+	 * 返回异常状态码
+	 * @return
+	 */
+	public String getErrorCode() {
+		return code;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getDescribe() {
+		return describe;
+	}
+
+	public void setDescribe(String describe) {
+		this.describe = describe;
+	}
+
+	public ResultMode getResultMode() {
+		return resultMode;
+	}
+
+	public void setResultMode(ResultMode resultMode) {
+		this.resultMode = resultMode;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+   
+}
+
+

+ 178 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/oauth/Oauth2AccessToken.java

@@ -0,0 +1,178 @@
+package com.iamberry.nuonuo.oauth;
+
+import com.iamberry.nuonuo.test.TestOpenApiV1;
+import com.iamberry.nuonuo.util.StateData;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.methods.RequestBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * ISV类用户在获取到auth_code后可套用此方法
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ **/
+public class Oauth2AccessToken {
+
+    public static String _url = StateData.accessToken_url; //获取token地址
+    public static String _header = StateData.contentType;  //http发送模式
+    public static String client_id = StateData.client_id;  //创建应用后,分配给应用的appKey
+    public static String client_secret = StateData.client_secret; //创建应用后,分配给应用的appSecret
+    public static String token_grant_type = StateData.grant_type_token;   //授权类型,在本步骤中,此值为“authorization_code”
+    public static String redirect_uri = StateData.redirect_uri;   //回调地址,必传且不能为空
+
+    public static void main(String[] args) {
+
+        StateData.taxNum = "914403003120360455";
+
+        TestOpenApiV1.setHeader();
+
+        //开发者通过code可以换取access_token、授权商户的uerId
+        String code = StateData.auth_code;//临时授权码code,isv用户通过页面请求(authorize.html)返回code值;
+        String taxNum = StateData.taxNum;//授权企业的税号,isv用户通过页面请求(authorize.html)返回taxnum值;
+        String resValue = getAccessToken();
+
+       /**
+        * ISV用户定时刷新token
+        * refresh_token提供给开发者一种延长access_token有效期的机制,提升开发者提供给商户应用的使用流畅性。
+        * 开发者使用code获取access_token时会返回一个refresh_token,在refresh_token有效期内可以通过refresh_token刷新access_token有效时长。
+        * 注:refresh_token超时时,需重走授权流程
+        */
+       
+//        if (!StringUtils.isEmpty(resValue)) {
+//            Map<String, Object> map = parseJSON2Map(resValue);
+//            new RefreshTokenTimer( _url, _header,
+//                    String.valueOf(map.get("refresh_token")), client_secret, String.valueOf(map.get("userId"))).executeTimer();
+//        } else {
+//            System.out.println("获取授权码报错");
+//        }
+
+    }
+
+
+    /**
+     * 获取去token
+     * @return
+     */
+    public static String getAccessToken() {
+        CloseableHttpClient client = null;
+        CloseableHttpResponse response = null;
+        try {
+            client = HttpClients.createDefault();
+            HttpUriRequest build = RequestBuilder
+                    .post(_url)
+                    .addHeader("Content-Type",_header)
+                    .addParameter("client_id", client_id)
+                    .addParameter("client_secret", client_secret)
+                    .addParameter("grant_type", token_grant_type)
+                    .build();
+            //请求
+            response = client.execute(build);
+            HttpEntity entity = response.getEntity();
+
+            String resValue = "";
+            if (entity != null) {
+                resValue = EntityUtils.toString(entity);
+                System.out.println("response: " + resValue);
+            }
+            //释放资源
+            EntityUtils.consume(entity);
+            return resValue;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                client.close();
+                response.close();
+            } catch (IOException e) {
+                // TODO 自动生成的 catch 块
+                e.printStackTrace();
+            }
+        }
+        return "更新token失败";
+    }
+
+    /**
+     * 获取去token
+     * @return
+     */
+    public static String getAccessToken(String code, String taxNum) {
+    	 CloseableHttpClient client = null;
+    	 CloseableHttpResponse response = null;
+        try {
+            client = HttpClients.createDefault();
+            HttpUriRequest build = RequestBuilder
+                    .post(_url)
+                    .addHeader("Content-Type",_header)
+                    .addParameter("client_id", client_id)
+                    .addParameter("client_secret", client_secret)
+                    .addParameter("grant_type", token_grant_type)
+                    .addParameter("redirect_uri", redirect_uri)
+                    .addParameter("code", code)
+                    .addParameter("taxNum", taxNum)
+                    .build();
+
+            //请求
+            response = client.execute(build);
+            HttpEntity entity = response.getEntity();
+
+            String resValue = "";
+            if (entity != null) {
+                resValue = EntityUtils.toString(entity);
+                System.out.println("response: " + resValue);
+            }
+            //释放资源
+            EntityUtils.consume(entity);
+            return resValue;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally{
+        	try {
+				client.close();
+				response.close();
+			} catch (IOException e) {
+				// TODO 自动生成的 catch 块
+				e.printStackTrace();
+			}
+        }
+        return null;
+    }
+
+    /**
+     * json转map
+     * @param jsonStr
+     * @return
+     */
+    public static Map<String, Object> parseJSON2Map(String jsonStr) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        //最外层解析
+        JSONObject json = JSONObject.fromObject(jsonStr);
+        for (Object k : json.keySet()) {
+            Object v = json.get(k);
+            //如果内层还是数组的话,继续解析
+            if (v instanceof JSONArray) {
+                List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+                Iterator<JSONObject> it = ((JSONArray) v).iterator();
+                while (it.hasNext()) {
+                    JSONObject json2 = it.next();
+                    list.add(parseJSON2Map(json2.toString()));
+                }
+                map.put(k.toString(), list);
+            } else {
+                map.put(k.toString(), v);
+            }
+        }
+        return map;
+    }
+
+}

+ 96 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/oauth/RefreshTokenTimer.java

@@ -0,0 +1,96 @@
+package com.iamberry.nuonuo.oauth;
+
+import com.iamberry.nuonuo.util.StateData;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.methods.RequestBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 定时刷新token
+ *  当refreshToken过期时需重新执行授权流程
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ **/
+public class RefreshTokenTimer implements Runnable{
+
+    ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
+
+    private String _url; //获取token地址
+    private String _header;
+    private String client_secret; //创建应用后,分配给应用的appSecret
+
+    private String refresh_token; //刷新令牌
+    private String client_id; //获取access_token时授权商户的userId
+    private String grant_type = StateData.grant_type_refreshToken; //授权类型,此值固定为“refresh_token”
+    
+    public RefreshTokenTimer(String url, String header, String refresh_token,
+                             String client_secret, String client_id) {
+        this._url = url;
+        this._header = header;
+        this.refresh_token = refresh_token;
+        this.client_secret = client_secret;
+        this.client_id = client_id;
+    }
+
+    void executeTimer() {
+        executor.scheduleAtFixedRate(new RefreshTokenTimer( _url, _header,
+                refresh_token, client_secret, client_id), StateData.delay, StateData.preiod, TimeUnit.SECONDS);
+    }
+
+    @Override
+    public void run() {
+    	CloseableHttpClient client = null;
+    	CloseableHttpResponse response = null;
+        try {
+            client = HttpClients.createDefault();
+            HttpUriRequest build = RequestBuilder
+                    .post(_url)
+                    .addHeader("Content-Type", _header)
+                    .addParameter("refresh_token", refresh_token)
+                    .addParameter("client_id", client_id)
+                    .addParameter("client_secret", client_secret)
+                    .addParameter("grant_type", grant_type)
+                    .build();
+
+            //请求
+            response = client.execute(build);
+            HttpEntity entity = response.getEntity();
+
+            String resValue = "";
+            if (entity != null) {
+                resValue = EntityUtils.toString(entity);
+                System.out.println("refresh_toke_response: " + resValue);
+            }
+
+            if (!StringUtils.isEmpty(resValue)) {
+                Map<String, Object> map = Oauth2AccessToken.parseJSON2Map(resValue);
+                refresh_token = String.valueOf(map.get("refresh_token"));
+            }
+
+            //释放资源
+            EntityUtils.consume(entity);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally{
+        	try {
+				client.close();
+				response.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+        }
+    }
+}
+

+ 155 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/service/HttpClientService.java

@@ -0,0 +1,155 @@
+package com.iamberry.nuonuo.service;
+
+import com.iamberry.nuonuo.util.Compress;
+import org.apache.http.Header;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.HTTP;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.ProtocolException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 发送请求
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class HttpClientService {
+	private Logger logger = LoggerFactory.getLogger(HttpClientService.class);
+
+	// 连接超时时间
+	private static final int CONNECTION_TIMEOUT = 3000;
+
+	// 读数据超时时间
+	private static final int READ_DATA_TIMEOUT = 3000;
+
+	private static final int successCode = 200;
+	
+	/**
+	 * 同步发送方式
+	 * @return
+	 */
+	public String sendSyncSingleHttp(String url, Map<String, String> headers, String param) {
+		CloseableHttpClient httpclient = HttpClients.createDefault();
+		RequestConfig defaultRequestConfig = RequestConfig.custom().build();
+		RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig).setSocketTimeout(READ_DATA_TIMEOUT)
+				.setConnectTimeout(CONNECTION_TIMEOUT).build();
+		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+		CloseableHttpResponse response = null;
+		String compress = (String) headers.get("compress");
+		try {
+			HttpPost httpPost = setConnectionParam(url, headers);
+			param = java.net.URLEncoder.encode(param, HTTP.UTF_8);
+			if ("GZIP".equals(compress)) {
+				param = Compress.compress(param); // 压缩
+			}
+			nvps.add(new BasicNameValuePair("param", param));
+			UrlEncodedFormEntity utlencode = new UrlEncodedFormEntity(nvps);// ,HTTP.UTF_8
+			httpPost.setEntity(utlencode);
+			httpPost.setConfig(requestConfig);
+			response = httpclient.execute(httpPost);
+			Header[] heads = httpPost.getAllHeaders();
+			for (int i = 0; i < heads.length; i++) {
+				logger.info(heads[i].getName() + "   " + heads[i].getValue());
+			}
+			return printResult(response);
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (response != null) {
+					response.close();
+				}
+				if (httpclient != null) {
+					httpclient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return null;
+	}
+	
+	private String printResult(CloseableHttpResponse response) {
+		String str = "";
+		InputStream input = null;
+		;
+		if (response.getStatusLine().getStatusCode() == successCode) {
+			try {
+				input = response.getEntity().getContent();
+				str = java.net.URLDecoder.decode(inputStreamToString(input), HTTP.UTF_8);
+				Header[] heahers = response.getAllHeaders();
+				logger.info("+++++返回消息头:");
+				for (Header header : heahers) {
+					logger.info("++++++:" + header.getName() + ":" + header.getValue());
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+			} finally {
+				try {
+					if (input != null) {
+						input.close();
+					}
+					response.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		} else {
+			System.out.println(response.getStatusLine().getStatusCode());
+		}
+		return str;
+	}
+	
+	/**
+	 * 构建post请求
+	 * @param url
+	 * @param headers
+	 * @return
+	 * @throws IOException
+	 * @throws ProtocolException
+	 */
+	private static HttpPost setConnectionParam(String url, Map<String, String> headers)
+			throws IOException, ProtocolException {
+		HttpPost hpost = new HttpPost(url);
+		Set<String> headerSet = headers.keySet();
+		for (String key : headerSet) {
+			// 指定请求header参数
+			hpost.setHeader(key, headers.get(key));
+		}
+		return hpost;
+	}
+	
+	/**
+	 * 获取流
+	 * @return
+	 * @throws IOException
+	 */
+	public String inputStreamToString(InputStream input) throws IOException {
+		BufferedReader br = null;
+		String data = "";
+		StringBuffer sb = new StringBuffer();
+		br = new BufferedReader(new InputStreamReader(input));
+		while ((data = br.readLine()) != null) {
+			sb.append(data);
+		}
+		return sb.toString();
+	}
+    
+}

+ 149 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/service/OpenApiV1.java

@@ -0,0 +1,149 @@
+package com.iamberry.nuonuo.service;
+
+
+import com.iamberry.nuonuo.bean.RequestMode;
+import com.iamberry.nuonuo.exception.ExConstants;
+import com.iamberry.nuonuo.exception.OpensnsException;
+import com.iamberry.nuonuo.util.SecurityUtil;
+import com.iamberry.nuonuo.util.StateData;
+import com.iamberry.nuonuo.util.ValidataUtil;
+import net.sf.json.xml.XMLSerializer;
+import org.json.JSONObject;
+
+import java.util.Map;
+
+/**
+* 提供访问爱信诺开放平台 OpenApiV1 的接口
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+*/
+public class OpenApiV1{
+
+	/**
+	 * 执行API调用
+	 * @param serverName 服务器的地址
+	 * @param headers  请求头参数
+	 * @param requestMode 请求体model
+	 * @return  返回服务器响应内容
+	 * @throws OpensnsException
+	 */
+	public String handle(String serverName, Map<String, String> headers, RequestMode requestMode) throws OpensnsException {
+		// 客户端请求的数据进行基本校验
+		requestDataValidata(serverName, headers, requestMode);
+		String dataType = (String) headers.get("dataType");
+		String signMethod = (String) headers.get("signMethod");
+		String clientReqParam = "";
+		String aesParams = "";
+		try {
+			if ("json".equalsIgnoreCase(dataType)) {
+				clientReqParam = installJsonStr(requestMode, clientReqParam);
+			} else if ("xml".equalsIgnoreCase(dataType)) {
+				clientReqParam = installXmlStr(requestMode);
+			}
+		} catch (Exception e) {
+			throw new OpensnsException(ExConstants.input_Data_Type, ExConstants.input_Data_Type_Msg);
+		}
+//		System.out.println("客户端组装的参数格式-->:" + clientReqParam);
+		try {
+			// 每个APP密钥不同,根据当前APP赋值相应密钥值
+			aesParams = (String) SecurityUtil.AESEncrypt(clientReqParam, StateData.app_secret);
+		} catch (Exception e) {
+			throw new OpensnsException(ExConstants.security_Decryption, ExConstants.security_Encryption_Msg);
+		}
+		// 发送请求(客户端可以自定义自己的请求)
+		HttpClientService httpService = new HttpClientService();
+		String result = httpService.sendSyncSingleHttp(serverName, headers, aesParams);
+		// 如果返回值为密文,此处进行AES解密操作
+		if ("AES/AES".equalsIgnoreCase(signMethod)) {	//{"result":"","code":"E9301","describe":"企业信息备案错误,请联系诺诺网"}
+			result = String.valueOf(SecurityUtil.AESDecrypt(result, StateData.app_secret));
+		}
+		return result;
+	}
+
+
+	/**
+	 * 客户端请求数据校验
+	 * @param headers
+	 * @param requestMode
+	 * @throws OpensnsException
+	 */
+	private void requestDataValidata(String serverName, Map<String, String> headers, RequestMode requestMode) throws OpensnsException {
+		if (ValidataUtil.isEmpty(serverName) || (headers == null || headers.isEmpty()) || requestMode == null
+				|| requestMode.getPublic() == null || requestMode.getPrivate() == null) {
+			throw new OpensnsException(ExConstants.input_Data_Null, ExConstants.input_Data_Null_Msg);
+		}
+		// 检查header参数不为空
+		if (ValidataUtil.isEmpty(headers.get("appKey")) // appkey
+				|| ValidataUtil.isEmpty(headers.get("dataType"))// 数据格式<xml/json>
+				|| ValidataUtil.isEmpty(headers.get("accessToken"))// 授权码
+				|| ValidataUtil.isEmpty(headers.get("appRate"))) {
+			throw new OpensnsException(ExConstants.input_Data_Type, ExConstants.input_Data_Type_Msg1);
+		}
+		// 检查加密算法
+		if (!valiSignMethod(String.valueOf(headers.get("signMethod")))) {
+			throw new OpensnsException(ExConstants.security_Decryption_arithmeticNULL,
+					ExConstants.security_Decryption_arithmeticNULL_Msg);
+		}
+		// 检查public参数不为空
+		if (ValidataUtil.isEmpty(requestMode.getPublic().getMethod())
+				|| ValidataUtil.isEmpty(requestMode.getPublic().getTimestamp())
+				|| ValidataUtil.isEmpty(requestMode.getPublic().getVersion())) {
+			throw new OpensnsException(ExConstants.input_Data_Type, ExConstants.input_Data_Null_Msg);
+		}
+		String dataType = (String) headers.get("dataType");
+		// 检查public参数不为空
+		if ((!"json".equalsIgnoreCase(dataType)) && (!"xml".equalsIgnoreCase(dataType))) {
+			throw new OpensnsException(ExConstants.input_Data_Type, ExConstants.input_Data_Type_Msg);
+		}
+	}
+	
+	/**
+	 * 判断加密方法是否正确
+	 *   true 正确
+	 * @param signMethod
+	 * @return
+	 */
+	private boolean valiSignMethod(String signMethod) {
+		boolean isFlag = false;
+		if ("AES".equalsIgnoreCase(signMethod) || "AES/AES".equalsIgnoreCase(signMethod)) {
+			isFlag = true;
+		}
+		return isFlag;
+	}
+
+
+	/**
+	 * 组装成JSON格式字符串
+	 * @param requestMode
+	 * @param clientReqParam
+	 * @return
+	 */
+	private String installJsonStr(RequestMode requestMode, String clientReqParam) throws Exception {
+		JSONObject jSONObj = new JSONObject();
+		JSONObject publicObj = new JSONObject();
+		JSONObject privateObj = new JSONObject();
+		publicObj.put("method", requestMode.getPublic().getMethod());
+		publicObj.put("version", requestMode.getPublic().getVersion());
+		publicObj.put("timestamp", requestMode.getPublic().getTimestamp());
+		privateObj.put("servicedata", requestMode.getPrivate().getServicedata());
+		jSONObj.put("public", publicObj);
+		jSONObj.put("private", privateObj);
+		clientReqParam = jSONObj.toString();
+		return clientReqParam;
+	}
+
+
+	/**
+	 * 组装成XML格式字符串
+	 * @param requestMode
+	 * @return
+	 */
+	private String installXmlStr(RequestMode requestMode) throws Exception {
+		net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(requestMode);
+		XMLSerializer xml = new XMLSerializer();
+		String xmlStr = xml.write(jsonObject, "UTF-8");
+		return xmlStr;
+	}
+	
+}

+ 144 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/test/TestOpenApiV1.java

@@ -0,0 +1,144 @@
+package com.iamberry.nuonuo.test;
+
+import com.iamberry.nuonuo.bean.PrivateData;
+import com.iamberry.nuonuo.bean.PublicData;
+import com.iamberry.nuonuo.bean.RequestMode;
+import com.iamberry.nuonuo.exception.OpensnsException;
+import com.iamberry.nuonuo.oauth.Oauth2AccessToken;
+import com.iamberry.nuonuo.service.OpenApiV1;
+import com.iamberry.nuonuo.util.SecurityUtil;
+import com.iamberry.nuonuo.util.StateData;
+import com.iamberry.nuonuo.util.ValidataUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 测试示例
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class TestOpenApiV1 {
+	
+	public static void main(String[] args) {
+		TestOpenApiV1.setHeader();
+		Map<String,String> headers = getHeaders();
+        PublicData pdData = getPublicData();
+        PrivateData<Object> pvData = new PrivateData<Object>();
+        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
+        List<Map<String,Object>> list_invoiceDetail = new ArrayList<Map<String,Object>>();
+        Map<String,Object> map_s = new HashMap<String,Object>();
+        Map<String,Object> map_order = new HashMap<String,Object>();
+        Map<String,Object> map_invoiceDetails = new HashMap<String,Object>();
+        map_order.put("pushMode", "1");
+        map_order.put("buyerName", "安徽省安迈达进出口有限公司");
+        map_order.put("buyerTaxNum", "913400007349708745");
+        map_order.put("buyerPhone", "17098074113");
+        map_order.put("buyerAddress", "333");
+        map_order.put("buyerAccount", "333");
+        map_order.put("orderNo", System.currentTimeMillis() + "001");
+        map_order.put("invoiceDate", "2016-06-15 01:59:41");
+        map_order.put("clerk", "袁牧庆");
+        map_order.put("salerAccount", "东亚银行杭州分行131001088303400");
+        map_order.put("salerTel", "0571-87022168");
+        map_order.put("salerAddress", "杭州市中河中路222号平海国际商务大厦5楼");
+        map_order.put("salerTaxNum", "339901999999142");
+        map_order.put("invoiceType", "1");
+        map_order.put("remark", "开票机号为02 请前往诺诺网(www.jss.com.cn)查询发票详情");
+        map_order.put("payee", "络克");
+        map_order.put("checker", "朱燕");
+        map_order.put("invoiceCode", "11");
+        map_order.put("invoiceNum", "11");
+        map_order.put("pushMode", "1");
+        map_order.put("email", "122@qq.com");
+        map_order.put("listFlag", "0");
+        map_order.put("listName", "1111");
+        map_order.put("buyerTel", "0571-88888888");
+        map_order.put("proxyInvoiceFlag", "0");
+        map_order.put("departmentId", "23456790");
+        map_order.put("clerkId", "");
+        map_invoiceDetails.put("goodsName", "1");
+        map_invoiceDetails.put("num", "1");
+        map_invoiceDetails.put("withTaxFlag", "1");
+        map_invoiceDetails.put("price", "46.79");
+        map_invoiceDetails.put("taxRate", "0.16");
+        map_invoiceDetails.put("specType", "1");
+        map_invoiceDetails.put("unit", "1");
+        map_invoiceDetails.put("goodsCode", "1090511030000000000");
+        map_invoiceDetails.put("selfCode", null);
+        map_invoiceDetails.put("invoiceLineProperty", "0");
+        map_invoiceDetails.put("favouredPolicyFlag", "0");
+        map_invoiceDetails.put("favouredPolicyName", null);
+        map_invoiceDetails.put("zeroRateFlag", null);
+        map_invoiceDetails.put("deduction", null);
+        map_invoiceDetails.put("tax", "6.45");
+        map_invoiceDetails.put("taxIncludedAmount", "46.79");
+        map_invoiceDetails.put("taxExcludedAmount", "40.34");
+        list_invoiceDetail.add(map_invoiceDetails);
+        map_order.put("invoiceDetail", list_invoiceDetail);
+        map_order.put("invoiceLine", "p");
+        map_order.put("productOilFlag", "0");
+        map_s.put("order", map_order);
+        list.add(map_s);
+        pvData.setServicedata(list);
+        RequestMode requestMode = getRequestMode(pdData,pvData);
+        OpenApiV1 sdk =  new OpenApiV1();
+        try {
+            String result = sdk.handle(StateData.url,headers, requestMode);
+        } catch (OpensnsException e) {
+            e.printStackTrace();
+        }
+	}
+
+	public static void setHeader(){
+		StateData.app_secret = "SD950B2179EB4A77"; // 填写本APP申请的 appSecret,注意区分正式环境与沙箱环境参数,如: 9B4CA8CEA5EE4823
+		StateData.app_key = "SDnyMiOMQZ"; // 填写本APP申请的 appKey,注意区分正式环境与沙箱环境参数,如:fk5dWkPA
+		StateData.app_api = "nuonuo.electronInvoice.requestBilling"; // 填写APP调用接口名称,如:nuonuo.speedBilling.billingByCode  	--开票:nuonuo.electronInvoice.requestBilling
+		StateData.app_apiVersion = "V1.0.0"; // 填写本APP调用接口版本,如:1.0.0
+		StateData.app_accessToken = "fdd052d08bbad090aeff770febrcasfs"; // 填写本APP申请的 令牌 ,注意区分正式环境与沙箱环境参数,如://{"access_token":"fdd052d08bbad090aeff770kgia1mkms","expires_in":86400}
+		StateData.app_dataType = "JSON"; // 填写本APP传输数据格式,如:JSON,XML
+		StateData.app_compressType = ""; // 填写本APP传输数据压缩格式,如:GZIP
+		StateData.app_signType = "AES"; // 填写本APP传输数据加密格式,如:AES/AES
+		StateData.user_Tax = ""; // 业务发生方税号(ISV类型用户必填);如:339901999999142  授权商户的税号(商家应用非必填,服务商应用必填)
+		StateData.url = "https://sandbox.jss.com.cn/openPlatform/services";
+		StateData.grant_type_token = "authorization_code";
+
+        Oauth2AccessToken.client_id = "SDnyMiOMQZ";  //创建应用后,分配给应用的appKey
+        Oauth2AccessToken.client_secret = "SD950B2179EB4A77"; //创建应用后,分配给应用的appSecret
+        Oauth2AccessToken.token_grant_type = StateData.grant_type_token;   //授权类型,在本步骤中,此值为“authorization_code”
+	}
+
+	// 定义请求头数据
+	private static Map<String, String> getHeaders() {
+		Map<String, String> headers = new HashMap<String, String>();
+		headers.put("appKey", StateData.app_key); // 用户申请的appkey
+		headers.put("accessToken", StateData.app_accessToken); // 用户Oauth登录后得到的令牌accessToken
+		headers.put("compress", StateData.app_compressType);// 压缩方式:提供GZIP 置空“”不压缩
+		headers.put("signMethod", StateData.app_signType); // 加密方式:提供AES/AES,不可为空
+		headers.put("dataType", StateData.app_dataType); // 数据请求格式: JSON/XML
+		headers.put("appRate", StateData.app_rate); // app并发请求数 ,平台默认10如需升级请联系开放平台
+		headers.put("userTax", StateData.user_Tax); // ISV下商家需要填写当前商户税号,普通商家模式用户可以不填写此值
+		headers.put("Content-Type", StateData.contentType); // http发送模式
+		return headers;
+	}
+
+	// 定义请求体中的公共数据
+	private static PublicData getPublicData() {
+		PublicData pdData = new PublicData();
+		pdData.setVersion(StateData.app_apiVersion); // API版本
+		pdData.setTimestamp(String.valueOf(System.currentTimeMillis()));
+		pdData.setMethod(StateData.app_api);// API名称
+		return pdData;
+	}
+
+	private static RequestMode getRequestMode(PublicData pdata, PrivateData<Object> pvData) {
+		RequestMode requestMode = new RequestMode();
+		requestMode.setPrivate(pvData);
+		requestMode.setPublic(pdata);
+		return requestMode;
+	}
+
+}

+ 62 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/util/Compress.java

@@ -0,0 +1,62 @@
+package com.iamberry.nuonuo.util;
+
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+/**
+ * 压缩
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class Compress {
+
+	public static String compress(String str) throws Exception {
+		if (str == null || str.length() == 0) {
+			return "";
+		}
+		byte[] tArray;
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		GZIPOutputStream gzip = new GZIPOutputStream(out);
+		try {
+			gzip.write(str.getBytes("UTF-8"));
+			gzip.flush();
+		} finally {
+			gzip.close();
+		}
+
+		tArray = out.toByteArray();
+		out.close();
+		BASE64Encoder tBase64Encoder = new BASE64Encoder();
+		return tBase64Encoder.encode(tArray);
+	}
+
+	public static String uncompress(String str) throws Exception {
+		if (str == null || str.length() == 0) {
+			return "";
+		}
+		BASE64Decoder tBase64Decoder = new BASE64Decoder();
+		byte[] t = tBase64Decoder.decodeBuffer(str);
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		ByteArrayInputStream in = new ByteArrayInputStream(t);
+		GZIPInputStream gunzip = new GZIPInputStream(in);
+		try {
+			byte[] buffer = new byte[256];
+			int n;
+			while ((n = gunzip.read(buffer)) >= 0) {
+				out.write(buffer, 0, n);
+			}
+		} finally {
+			gunzip.close();
+		}
+		in.close();
+		out.close();
+		return out.toString("UTF-8");
+	}
+	
+}

+ 43 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/util/MD5Util.java

@@ -0,0 +1,43 @@
+package com.iamberry.nuonuo.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * sdk.jss.com.cn
+ * @author open.jss.com
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class MD5Util {
+	
+	/**
+	 * 将字符串转换成md5
+	 * @param source
+	 * @return
+	 */
+	public static String toMD5(String source) {
+		try {
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			md.update(source.getBytes());
+			byte b[] = md.digest();
+			int i;
+
+			StringBuffer buf = new StringBuffer("");
+			for (int offset = 0; offset < b.length; offset++) {
+				i = b[offset];
+				if (i < 0)
+					i += 256;
+				if (i < 16)
+					buf.append("0");
+				buf.append(Integer.toHexString(i));
+			}
+
+			return buf.toString();
+
+		} catch (NoSuchAlgorithmException e) {
+			return null;
+		}
+
+	}
+}

+ 163 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/util/SecurityUtil.java

@@ -0,0 +1,163 @@
+package com.iamberry.nuonuo.util;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.BitSet;
+
+/**
+ * 安全类工具类
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class SecurityUtil {
+
+	/**
+	 * 极速开票密钥
+	 */
+	public final static String speedBilling = "F59E1B2970D64B8F926E9932E0A1A1DB";
+
+	private static final BitSet UNRESERVED = new BitSet(256);
+	private static final BitSet URLENCODER = new BitSet(256);
+	private static final BitSet PUNCT = new BitSet(256);
+	private static final BitSet USERINFO = new BitSet(256);
+	private static final BitSet PATHSAFE = new BitSet(256);
+	private static final BitSet URIC = new BitSet(256);
+	private static final BitSet RESERVED = new BitSet(256);
+	  
+	  static
+	  {
+	    for (int i = 97; i <= 122; i++) {
+	      UNRESERVED.set(i);
+	    }
+	    for (int i = 65; i <= 90; i++) {
+	      UNRESERVED.set(i);
+	    }
+	    
+	    for (int i = 48; i <= 57; i++) {
+	      UNRESERVED.set(i);
+	    }
+	    UNRESERVED.set(95);
+	    UNRESERVED.set(45);
+	    UNRESERVED.set(46);
+	    UNRESERVED.set(42);
+	    URLENCODER.or(UNRESERVED);
+	    UNRESERVED.set(33);
+	    UNRESERVED.set(126);
+	    UNRESERVED.set(39);
+	    UNRESERVED.set(40);
+	    UNRESERVED.set(41);
+	    
+	    PUNCT.set(44);
+	    PUNCT.set(59);
+	    PUNCT.set(58);
+	    PUNCT.set(36);
+	    PUNCT.set(38);
+	    PUNCT.set(43);
+	    PUNCT.set(61);
+	    
+	    USERINFO.or(UNRESERVED);
+	    USERINFO.or(PUNCT);
+	    
+	    PATHSAFE.or(UNRESERVED);
+	    PATHSAFE.set(47);
+	    PATHSAFE.set(59);
+	    PATHSAFE.set(58);
+	    PATHSAFE.set(64);
+	    PATHSAFE.set(38);
+	    PATHSAFE.set(61);
+	    PATHSAFE.set(43);
+	    PATHSAFE.set(36);
+	    PATHSAFE.set(44);
+	    
+	    RESERVED.set(59);
+	    RESERVED.set(47);
+	    RESERVED.set(63);
+	    RESERVED.set(58);
+	    RESERVED.set(64);
+	    RESERVED.set(38);
+	    RESERVED.set(61);
+	    RESERVED.set(43);
+	    RESERVED.set(36);
+	    RESERVED.set(44);
+	    RESERVED.set(91);
+	    RESERVED.set(93);
+	    
+	    URIC.or(RESERVED);
+	    URIC.or(UNRESERVED);
+	  }
+	  
+    /**
+     *  AES加密
+     * @param sSrc  待加密字符串
+     * @param sKey	加密Key值
+     * @return
+     */
+	public static Object AESEncrypt(String sSrc, String sKey) {
+		try {
+			if (sKey == null) {
+				System.out.print("Key为空");
+				throw new Exception();
+			}
+			// 判断Key是否为16位
+			if (sKey.length() != 16) {
+				System.out.print("Key长度不等于16位");
+				throw new Exception();
+			}
+			byte[] raw = sKey.getBytes("utf-8");
+			SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+			Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+			cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+			byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+			return new Base64().encodeToString(encrypted);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+    
+    /**
+     * AES 解密
+     * @param sSrc
+     * @param sKey
+     * @return
+     */
+	public static Object AESDecrypt(String sSrc, String sKey) {
+		try {
+			if (sKey == null) {
+				return null;
+			}
+			// 判断Key是否为16位
+			if (sKey.length() != 16) {
+				return null;
+			}
+			byte[] raw = sKey.getBytes("UTF-8");
+			SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+			Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+			cipher.init(Cipher.DECRYPT_MODE, skeySpec);
+			byte[] encrypted1 = new Base64().decode(sSrc);
+			byte[] original = cipher.doFinal(encrypted1);
+			String originalString = new String(original, "utf-8");
+			return originalString;
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			return null;
+		}
+	}
+    
+	/**
+	 * 仅针对极速开票MD5加密
+	 * MD5加密
+	 * validator+F59E1B2970D64B8F926E9932E0A1A1DB,然后再进行MD5加密;
+	 * @param source
+	 * @return
+	 */
+	public static String MD5Encrypt(String randomSixNum){
+		String signidSource = new StringBuffer(randomSixNum).append(SecurityUtil.speedBilling).toString();
+		String signidTarget  = MD5Util.toMD5(signidSource);
+		return signidTarget;
+	}
+	
+}

+ 69 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/util/StateData.java

@@ -0,0 +1,69 @@
+package com.iamberry.nuonuo.util;
+
+/**
+ * 静态用户数据
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class StateData {
+
+	/**
+	 * APP 调用接口需填写以下系统参数
+	 */
+	public static int app_id = 0; // 本地新增,诺诺系统的id
+	public static String app_secret = ""; // 填写本APP申请的 appSecret,注意区分正式环境与沙箱环境参数,如: 9B4CA8CEA5EE4823
+	public static String app_key = ""; // 填写本APP申请的 appKey,注意区分正式环境与沙箱环境参数,如:fk5dWkPA
+	public static String app_api = ""; // 填写APP调用接口名称,如:nuonuo.speedBilling.billingByCode  	--开票:nuonuo.electronInvoice.requestBilling
+	public static String app_apiVersion = "V1.0.0"; // 填写本APP调用接口版本,如:1.0.0
+	public static String app_accessToken = ""; // 填写本APP申请的 令牌 ,注意区分正式环境与沙箱环境参数,如://{"access_token":"fdd052d08bbad090aeff770kgia1mkms","expires_in":86400}
+	public static String app_dataType = "JSON"; // 填写本APP传输数据格式,如:JSON,XML
+	public static String app_compressType = ""; // 填写本APP传输数据压缩格式,如:GZIP
+	public static String app_signType = "AES/AES"; // 填写本APP传输数据加密格式,如:AES/AES
+	public static String user_Tax = ""; // 业务发生方税号(ISV类型用户必填);如:339901999999142  授权商户的税号(商家应用非必填,服务商应用必填)
+	
+	/**
+	 * APP 请求并发数(平台默认)
+	 */
+	public static String app_rate = "10"; // 填写APP并发请求数
+	
+	/**
+	 * 发送方式
+	 */
+	public static String contentType = "application/x-www-form-urlencoded";
+	
+	/**
+	 * 开放平台API访问地址
+	 */
+	public static String url = ""; // 正式环境地址  --在platform.properties获取
+
+	/**
+	 * 开放平台Oauth授权访问地址
+	 */
+	public static String url_token = "https://open.jss.com.cn/accessToken"; // 正式环境地址
+	
+	/**
+	 * 正式环境/沙箱环境OAUTH参数
+	 *  请求access_token环节
+	 */
+	public static String auth_code = ""; // ISV商户获取的auth_code
+	public static String refresh_token = ""; // ISV商户刷新令牌,普通商户无此值,可程序赋值
+	public static String taxNum = ""; // 获取auth_code时开放平台返回当前商户税号,ISV模式下商户请求API时需传此值,可程序赋值
+	public static String userId = ""; // 获取access_token时开放平台返回,ISV模式下商户刷新令牌时需传此值,可程序赋值
+	public static String expires_in = ""; // access_token失效时间,可程序赋值
+	public static String client_id = app_key; // 用户ID,取$appKey值,当调用刷新令牌时取$userId值
+	public static String client_secret = app_secret; // 用户秘钥,取$app_secret值
+	public static String redirect_uri = "https://rst.iamberry.com/back/nuonuo_back"; // 对调地址由商户自定义
+//	public static String grant_type_token = "authorization_code"; // 获取access_token时,OAUTH定义编码类型
+	public static String grant_type_token = "client_credentials"; // 获取access_token时,OAUTH定义编码类型
+	public static String grant_type_refreshToken = "refresh_token"; // 获取access_token时,OAUTH定义编码类型
+	public static String accessToken_url = url_token; // 获取access_token和refresh_token请求地址
+	
+	
+    /**
+     * 定时任务 刷新access_token
+     */
+	public static long delay = 60; // 步长
+	public static long preiod = 29 * 24 * 60 * 60; // 偏移量accesstoken尝试时间
+	
+}

+ 19 - 0
watero-common-tool/src/main/java/com/iamberry/nuonuo/util/ValidataUtil.java

@@ -0,0 +1,19 @@
+package com.iamberry.nuonuo.util;
+
+
+/**
+ * 校验类
+ * @author sdk.jss.com.cn
+ * @version 2.0
+ * @since jdk1.6
+ */
+public class ValidataUtil {
+
+	public static boolean isEmpty(String str) {
+		if (str == null || str.trim().equals("")) {
+			return true;
+		}
+		return false;
+	}
+	
+}

+ 391 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/ei/Billing.java

@@ -0,0 +1,391 @@
+package com.iamberry.rst.core.ei;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.ArrayList;
+import  java.util.Date;
+import  java.io.Serializable;
+import java.util.List;
+
+/**
+ *  开票记录类
+ * @author xm
+ * @Date 2019-04-08
+ */
+public class Billing  implements  Serializable{
+    private static final long serialVersionUID = -4671825979406279369L;
+    //开票记录id
+    private Integer billId;
+    //所属平台id
+    private Integer platId;
+    //所属平台全称    数据库没有该值,用platId关联
+    private String platCompanyName;
+    //所属平台简称  数据库没有该值,用platId关联
+    private String platName;
+    //订单编号
+    private String billOrderNo;
+    //订单时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date billOrderDate;
+    //开票金额 - 精确到分
+    private Integer billAmount;
+    //开票类型 1:企业 2:个人
+    private Integer billType;
+    //购方公司名称
+    private String billCompanyName;
+    //购方企业税号
+    private String billTaxNumber;
+    //购方电话
+    private String billTel;
+    //购方地址
+    private String billAddress;
+    //购方银行卡号
+    private String billBankNumber;
+    //购方银行名称
+    private String billBankName;
+    //购方支行名称    暂不用
+    private String billBankBranchName;
+    //姓名
+    private String billPersonalName;
+    //状态 0:未开票; 1:开票中; 2为开票成功 3:开票失败;
+    private Integer billStatus;
+    //开票流水号 开票成功,诺诺平台流水号
+    private String billInvoiceSerialNum;
+    //开票失败原因 开票状态为失败会有失败原因
+    private String billResultMsg;
+    //发票pdf地址 开票成功才有该值 -- 本地地址
+    private String billInvoiceFileUrl;
+    //发票详情地址 开票成功才有该值 --
+    private String billInvoiceImageUrl;
+    //开票日期
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date billInvoiceDate;
+    //发票代码
+    private String billInvoiceCode;
+    //发票号码
+    private String billInvoiceNum;
+    //不含税金额-单位为分
+    private Integer billTaxExcludedAmount;
+    //合计税额-单位为分
+    private Integer billTaxIncludedAmount;
+    //发票类型-一般返回:电子增值税普通发票
+    private String billInvoiceLine;
+    //备注
+    private String billRemarks;
+    //创建人
+    private Integer billCreateUser;
+    //创建名称
+    private String billCreateName;
+    //创建时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date billCreateTime;
+    //修改时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date billUpdateTime;
+
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date startDate;                 //开始时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date endDate;                   //结束时间
+
+    //开票记录产品集合
+    private List<BillingItem> billingItemList = new ArrayList<BillingItem>();
+
+    //开票平台
+    private Integer invoPlatId;
+
+    public Integer getBillId(){
+        return billId;
+    }
+
+    public void setBillId(Integer  billId){
+        this.billId=billId;
+    }
+
+    public Integer getPlatId(){
+        return platId;
+    }
+
+    public void setPlatId(Integer  platId){
+        this.platId=platId;
+    }
+
+    public String getBillOrderNo(){
+        return billOrderNo;
+    }
+
+    public void setBillOrderNo(String  billOrderNo){
+        this.billOrderNo=billOrderNo;
+    }
+
+    public Integer getBillAmount(){
+        return billAmount;
+    }
+
+    public void setBillAmount(Integer  billAmount){
+        this.billAmount=billAmount;
+    }
+
+    public Integer getBillType(){
+        return billType;
+    }
+
+    public void setBillType(Integer  billType){
+        this.billType=billType;
+    }
+
+    public String getBillCompanyName(){
+        return billCompanyName;
+    }
+
+    public void setBillCompanyName(String  billCompanyName){
+        this.billCompanyName=billCompanyName;
+    }
+
+    public String getBillTaxNumber(){
+        return billTaxNumber;
+    }
+
+    public void setBillTaxNumber(String  billTaxNumber){
+        this.billTaxNumber=billTaxNumber;
+    }
+
+    public String getBillTel(){
+        return billTel;
+    }
+
+    public void setBillTel(String  billTel){
+        this.billTel=billTel;
+    }
+
+    public String getBillAddress(){
+        return billAddress;
+    }
+
+    public void setBillAddress(String  billAddress){
+        this.billAddress=billAddress;
+    }
+
+    public String getBillBankNumber(){
+        return billBankNumber;
+    }
+
+    public void setBillBankNumber(String  billBankNumber){
+        this.billBankNumber=billBankNumber;
+    }
+
+    public String getBillBankName(){
+        return billBankName;
+    }
+
+    public void setBillBankName(String  billBankName){
+        this.billBankName=billBankName;
+    }
+
+    public String getBillBankBranchName(){
+        return billBankBranchName;
+    }
+
+    public void setBillBankBranchName(String  billBankBranchName){
+        this.billBankBranchName=billBankBranchName;
+    }
+
+    public String getBillPersonalName(){
+        return billPersonalName;
+    }
+
+    public void setBillPersonalName(String  billPersonalName){
+        this.billPersonalName=billPersonalName;
+    }
+
+    public Integer getBillStatus(){
+        return billStatus;
+    }
+
+    public void setBillStatus(Integer  billStatus){
+        this.billStatus=billStatus;
+    }
+
+    public String getBillInvoiceSerialNum(){
+        return billInvoiceSerialNum;
+    }
+
+    public void setBillInvoiceSerialNum(String  billInvoiceSerialNum){
+        this.billInvoiceSerialNum=billInvoiceSerialNum;
+    }
+
+    public String getBillResultMsg(){
+        return billResultMsg;
+    }
+
+    public void setBillResultMsg(String  billResultMsg){
+        this.billResultMsg=billResultMsg;
+    }
+
+    public String getBillInvoiceFileUrl(){
+        return billInvoiceFileUrl;
+    }
+
+    public void setBillInvoiceFileUrl(String  billInvoiceFileUrl){
+        this.billInvoiceFileUrl=billInvoiceFileUrl;
+    }
+
+    public String getBillInvoiceImageUrl(){
+        return billInvoiceImageUrl;
+    }
+
+    public void setBillInvoiceImageUrl(String  billInvoiceImageUrl){
+        this.billInvoiceImageUrl=billInvoiceImageUrl;
+    }
+
+    public Date getBillInvoiceDate(){
+        return billInvoiceDate;
+    }
+
+    public void setBillInvoiceDate(Date  billInvoiceDate){
+        this.billInvoiceDate=billInvoiceDate;
+    }
+
+    public String getBillInvoiceCode(){
+        return billInvoiceCode;
+    }
+
+    public void setBillInvoiceCode(String  billInvoiceCode){
+        this.billInvoiceCode=billInvoiceCode;
+    }
+
+    public String getBillInvoiceNum(){
+        return billInvoiceNum;
+    }
+
+    public void setBillInvoiceNum(String  billInvoiceNum){
+        this.billInvoiceNum=billInvoiceNum;
+    }
+
+    public Integer getBillTaxExcludedAmount(){
+        return billTaxExcludedAmount;
+    }
+
+    public void setBillTaxExcludedAmount(Integer  billTaxExcludedAmount){
+        this.billTaxExcludedAmount=billTaxExcludedAmount;
+    }
+
+    public Integer getBillTaxIncludedAmount(){
+        return billTaxIncludedAmount;
+    }
+
+    public void setBillTaxIncludedAmount(Integer  billTaxIncludedAmount){
+        this.billTaxIncludedAmount=billTaxIncludedAmount;
+    }
+
+    public String getBillInvoiceLine(){
+        return billInvoiceLine;
+    }
+
+    public void setBillInvoiceLine(String  billInvoiceLine){
+        this.billInvoiceLine=billInvoiceLine;
+    }
+
+    public String getBillRemarks(){
+        return billRemarks;
+    }
+
+    public void setBillRemarks(String  billRemarks){
+        this.billRemarks=billRemarks;
+    }
+
+    public Date getBillCreateTime(){
+        return billCreateTime;
+    }
+
+    public void setBillCreateTime(Date  billCreateTime){
+        this.billCreateTime=billCreateTime;
+    }
+
+    public Date getBillUpdateTime(){
+        return billUpdateTime;
+    }
+
+    public void setBillUpdateTime(Date  billUpdateTime){
+        this.billUpdateTime=billUpdateTime;
+    }
+
+    public String getPlatCompanyName() {
+        return platCompanyName;
+    }
+
+    public void setPlatCompanyName(String platCompanyName) {
+        this.platCompanyName = platCompanyName;
+    }
+
+    public String getPlatName() {
+        return platName;
+    }
+
+    public void setPlatName(String platName) {
+        this.platName = platName;
+    }
+
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    public List<BillingItem> getBillingItemList() {
+        return billingItemList;
+    }
+
+    public void setBillingItemList(List<BillingItem> billingItemList) {
+        this.billingItemList = billingItemList;
+    }
+
+    public Integer getBillCreateUser() {
+        return billCreateUser;
+    }
+
+    public void setBillCreateUser(Integer billCreateUser) {
+        this.billCreateUser = billCreateUser;
+    }
+
+    public Integer getInvoPlatId() {
+        return invoPlatId;
+    }
+
+    public void setInvoPlatId(Integer invoPlatId) {
+        this.invoPlatId = invoPlatId;
+    }
+
+    public Date getBillOrderDate() {
+        return billOrderDate;
+    }
+
+    public void setBillOrderDate(Date billOrderDate) {
+        this.billOrderDate = billOrderDate;
+    }
+
+    public String getBillCreateName() {
+        return billCreateName;
+    }
+
+    public void setBillCreateName(String billCreateName) {
+        this.billCreateName = billCreateName;
+    }
+}

+ 147 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/ei/BillingItem.java

@@ -0,0 +1,147 @@
+package com.iamberry.rst.core.ei;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import  java.util.Date;
+import  java.io.Serializable;
+/**
+ *  开票记录产品类
+ * @author xm
+ * @Date 2019-04-08
+ */
+public class BillingItem  implements  Serializable{
+    private static final long serialVersionUID = 4049910064503295000L;
+    //开票产品信息id
+    private Integer billItemId;
+    //记录id
+    private Integer billId;
+    //商品id
+    private Integer productId;
+    //颜色id
+    private Integer colorId;
+    //商品名称
+    private String billItemProductName;
+    //颜色名称
+    private String billItemColorName;
+    //产品数量
+    private Integer billItemNum;
+    //产品单价-单位为分
+    private Integer billItemUnitPrice;
+    //类型
+    private Integer billItemProductType;
+    //合计
+    private Integer billItemAmountPrice;
+    //
+    private String billItemColorBar;
+    //京东id
+    private String jdProductId;
+    //创建时间'
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date billItemCreateTime;
+
+    public Integer getBillItemId(){
+        return billItemId;
+    }
+
+    public void setBillItemId(Integer  billItemId){
+        this.billItemId=billItemId;
+    }
+
+    public Integer getBillId(){
+        return billId;
+    }
+
+    public void setBillId(Integer  billId){
+        this.billId=billId;
+    }
+
+    public Integer getProductId(){
+        return productId;
+    }
+
+    public void setProductId(Integer  productId){
+        this.productId=productId;
+    }
+
+    public Integer getColorId(){
+        return colorId;
+    }
+
+    public void setColorId(Integer  colorId){
+        this.colorId=colorId;
+    }
+
+    public String getBillItemProductName(){
+        return billItemProductName;
+    }
+
+    public void setBillItemProductName(String  billItemProductName){
+        this.billItemProductName=billItemProductName;
+    }
+
+    public String getBillItemColorName(){
+        return billItemColorName;
+    }
+
+    public void setBillItemColorName(String  billItemColorName){
+        this.billItemColorName=billItemColorName;
+    }
+
+    public Integer getBillItemNum(){
+        return billItemNum;
+    }
+
+    public void setBillItemNum(Integer  billItemNum){
+        this.billItemNum=billItemNum;
+    }
+
+    public Integer getBillItemUnitPrice(){
+        return billItemUnitPrice;
+    }
+
+    public void setBillItemUnitPrice(Integer  billItemUnitPrice){
+        this.billItemUnitPrice=billItemUnitPrice;
+    }
+
+    public Integer getBillItemAmountPrice(){
+        return billItemAmountPrice;
+    }
+
+    public void setBillItemAmountPrice(Integer  billItemAmountPrice){
+        this.billItemAmountPrice=billItemAmountPrice;
+    }
+
+    public Date getBillItemCreateTime(){
+        return billItemCreateTime;
+    }
+
+    public void setBillItemCreateTime(Date  billItemCreateTime){
+        this.billItemCreateTime=billItemCreateTime;
+    }
+
+    public Integer getBillItemProductType() {
+        return billItemProductType;
+    }
+
+    public void setBillItemProductType(Integer billItemProductType) {
+        this.billItemProductType = billItemProductType;
+    }
+
+    public String getBillItemColorBar() {
+        return billItemColorBar;
+    }
+
+    public void setBillItemColorBar(String billItemColorBar) {
+        this.billItemColorBar = billItemColorBar;
+    }
+
+    public String getJdProductId() {
+        return jdProductId;
+    }
+
+    public void setJdProductId(String jdProductId) {
+        this.jdProductId = jdProductId;
+    }
+}

+ 101 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/ei/InvoPlatform.java

@@ -0,0 +1,101 @@
+package com.iamberry.rst.core.ei;
+
+import  java.util.Date;
+import  java.io.Serializable;
+/**
+ *  类
+ * @author xm
+ * @Date 2019-04-16
+ */
+public class InvoPlatform  implements  Serializable{
+    //发票平台id
+    private Integer invoPlatId;
+    //平台名称
+    private String invoPlatName;
+    //Key
+    private String invoPlatAppKey;
+    //secret
+    private String invoPlatAppSecret;
+    //Version
+    private String invoPlatVersion;
+    //access_token
+    private String invoPlatAccessToken;
+    //Token过期时间
+    private Date invoPlatEndDate;
+    //1:使用 2:未使用
+    private Integer invoPlatStatus;
+    //创建时间'
+    private Date invoPlatCreateTime;
+
+    public Integer getInvoPlatId(){
+        return invoPlatId;
+    }
+
+    public void setInvoPlatId(Integer  invoPlatId){
+        this.invoPlatId=invoPlatId;
+    }
+
+    public String getInvoPlatName(){
+        return invoPlatName;
+    }
+
+    public void setInvoPlatName(String  invoPlatName){
+        this.invoPlatName=invoPlatName;
+    }
+
+    public String getInvoPlatAppKey(){
+        return invoPlatAppKey;
+    }
+
+    public void setInvoPlatAppKey(String  invoPlatAppKey){
+        this.invoPlatAppKey=invoPlatAppKey;
+    }
+
+    public String getInvoPlatAppSecret(){
+        return invoPlatAppSecret;
+    }
+
+    public void setInvoPlatAppSecret(String  invoPlatAppSecret){
+        this.invoPlatAppSecret=invoPlatAppSecret;
+    }
+
+    public String getInvoPlatVersion(){
+        return invoPlatVersion;
+    }
+
+    public void setInvoPlatVersion(String  invoPlatVersion){
+        this.invoPlatVersion=invoPlatVersion;
+    }
+
+    public String getInvoPlatAccessToken(){
+        return invoPlatAccessToken;
+    }
+
+    public void setInvoPlatAccessToken(String  invoPlatAccessToken){
+        this.invoPlatAccessToken=invoPlatAccessToken;
+    }
+
+    public Date getInvoPlatEndDate(){
+        return invoPlatEndDate;
+    }
+
+    public void setInvoPlatEndDate(Date  invoPlatEndDate){
+        this.invoPlatEndDate=invoPlatEndDate;
+    }
+
+    public Integer getInvoPlatStatus(){
+        return invoPlatStatus;
+    }
+
+    public void setInvoPlatStatus(Integer  invoPlatStatus){
+        this.invoPlatStatus=invoPlatStatus;
+    }
+
+    public Date getInvoPlatCreateTime(){
+        return invoPlatCreateTime;
+    }
+
+    public void setInvoPlatCreateTime(Date  invoPlatCreateTime){
+        this.invoPlatCreateTime=invoPlatCreateTime;
+    }
+}

+ 219 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/ei/PlatformInfo.java

@@ -0,0 +1,219 @@
+package com.iamberry.rst.core.ei;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import  java.util.Date;
+import  java.io.Serializable;
+/**
+ *  所属平台类
+ * @author xm
+ * @Date 2019-04-08
+ */
+public class PlatformInfo  implements  Serializable{
+    private static final long serialVersionUID = -5243764591213322430L;
+    //平台id
+    private Integer platId;
+    //平台名称(简称)
+    private String platName;
+    //销方电话
+    private String platTel;
+    //邮箱地址
+    private String platEmail;
+    //购方名称(全称 )
+    private String platCompanyName;
+    //销方税号
+    private String platTaxNumber;
+    //销方地址
+    private String platAddress;
+    //销方银行账号
+    private String platBankNumber;
+    //银行名称
+    private String platBankName;
+    //支行名称
+    private String platBankBranchName;
+    //开票员
+    private String platBilling;
+    //收款人
+    private String platPayee;
+    //复核人
+    private String platReviewer;
+    //AppKey
+    private String platAppKey;
+    //App Secret
+    private String platAppSecret;
+    //access_token
+    private String platAccessToken;
+    //状态 1:使用中 2:禁用中
+    private Integer platStatus;
+    //备注
+    private String platRemarks;
+    //创建时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date platCreateTime;
+    //修改时间'
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date platUpdateTime;
+
+    public Integer getPlatId(){
+        return platId;
+    }
+
+    public void setPlatId(Integer  platId){
+        this.platId=platId;
+    }
+
+    public String getPlatName(){
+        return platName;
+    }
+
+    public void setPlatName(String  platName){
+        this.platName=platName;
+    }
+
+    public String getPlatTel(){
+        return platTel;
+    }
+
+    public void setPlatTel(String  platTel){
+        this.platTel=platTel;
+    }
+
+    public String getPlatEmail(){
+        return platEmail;
+    }
+
+    public void setPlatEmail(String  platEmail){
+        this.platEmail=platEmail;
+    }
+
+    public String getPlatCompanyName(){
+        return platCompanyName;
+    }
+
+    public void setPlatCompanyName(String  platCompanyName){
+        this.platCompanyName=platCompanyName;
+    }
+
+    public String getPlatTaxNumber(){
+        return platTaxNumber;
+    }
+
+    public void setPlatTaxNumber(String  platTaxNumber){
+        this.platTaxNumber=platTaxNumber;
+    }
+
+    public String getPlatAddress(){
+        return platAddress;
+    }
+
+    public void setPlatAddress(String  platAddress){
+        this.platAddress=platAddress;
+    }
+
+    public String getPlatBankNumber(){
+        return platBankNumber;
+    }
+
+    public void setPlatBankNumber(String  platBankNumber){
+        this.platBankNumber=platBankNumber;
+    }
+
+    public String getPlatBankName(){
+        return platBankName;
+    }
+
+    public void setPlatBankName(String  platBankName){
+        this.platBankName=platBankName;
+    }
+
+    public String getPlatBankBranchName(){
+        return platBankBranchName;
+    }
+
+    public void setPlatBankBranchName(String  platBankBranchName){
+        this.platBankBranchName=platBankBranchName;
+    }
+
+    public String getPlatBilling(){
+        return platBilling;
+    }
+
+    public void setPlatBilling(String  platBilling){
+        this.platBilling=platBilling;
+    }
+
+    public String getPlatPayee(){
+        return platPayee;
+    }
+
+    public void setPlatPayee(String  platPayee){
+        this.platPayee=platPayee;
+    }
+
+    public String getPlatReviewer(){
+        return platReviewer;
+    }
+
+    public void setPlatReviewer(String  platReviewer){
+        this.platReviewer=platReviewer;
+    }
+
+    public String getPlatAppKey(){
+        return platAppKey;
+    }
+
+    public void setPlatAppKey(String  platAppKey){
+        this.platAppKey=platAppKey;
+    }
+
+    public String getPlatAppSecret(){
+        return platAppSecret;
+    }
+
+    public void setPlatAppSecret(String  platAppSecret){
+        this.platAppSecret=platAppSecret;
+    }
+
+    public String getPlatAccessToken(){
+        return platAccessToken;
+    }
+
+    public void setPlatAccessToken(String  platAccessToken){
+        this.platAccessToken=platAccessToken;
+    }
+
+    public Integer getPlatStatus(){
+        return platStatus;
+    }
+
+    public void setPlatStatus(Integer  platStatus){
+        this.platStatus=platStatus;
+    }
+
+    public String getPlatRemarks(){
+        return platRemarks;
+    }
+
+    public void setPlatRemarks(String  platRemarks){
+        this.platRemarks=platRemarks;
+    }
+
+    public Date getPlatCreateTime(){
+        return platCreateTime;
+    }
+
+    public void setPlatCreateTime(Date  platCreateTime){
+        this.platCreateTime=platCreateTime;
+    }
+
+    public Date getPlatUpdateTime(){
+        return platUpdateTime;
+    }
+
+    public void setPlatUpdateTime(Date  platUpdateTime){
+        this.platUpdateTime=platUpdateTime;
+    }
+}

+ 108 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/ei/PushLog.java

@@ -0,0 +1,108 @@
+package com.iamberry.rst.core.ei;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import  java.util.Date;
+import  java.io.Serializable;
+/**
+ *  发票推送日志类
+ * @author xm
+ * @Date 2019-04-08
+ */
+public class PushLog  implements  Serializable{
+    private static final long serialVersionUID = -3912661885604828865L;
+    //记录id
+    private Integer pushLogId;
+    //推送类型 1:所属平台 2:短信 3:邮箱
+    private Integer pushLogType;
+    //所属平台
+    private Integer platId;
+    //推送类型为短信
+    private String pushLogTel;
+    //推送类型为邮箱
+    private String pushLogEmail;
+    //状态 1:成功 2:失败
+    private Integer pushLogStatus;
+    //返回信息
+    private String pushLogResultMsg;
+    //创建时间'
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date pushLogCreateTime;
+
+    //开票记录id
+    private Integer billId;
+
+    public Integer getPushLogId(){
+        return pushLogId;
+    }
+
+    public void setPushLogId(Integer  pushLogId){
+        this.pushLogId=pushLogId;
+    }
+
+    public Integer getPushLogType(){
+        return pushLogType;
+    }
+
+    public void setPushLogType(Integer  pushLogType){
+        this.pushLogType=pushLogType;
+    }
+
+    public Integer getPlatId(){
+        return platId;
+    }
+
+    public void setPlatId(Integer  platId){
+        this.platId=platId;
+    }
+
+    public String getPushLogTel(){
+        return pushLogTel;
+    }
+
+    public void setPushLogTel(String  pushLogTel){
+        this.pushLogTel=pushLogTel;
+    }
+
+    public String getPushLogEmail(){
+        return pushLogEmail;
+    }
+
+    public void setPushLogEmail(String  pushLogEmail){
+        this.pushLogEmail=pushLogEmail;
+    }
+
+    public Integer getPushLogStatus(){
+        return pushLogStatus;
+    }
+
+    public void setPushLogStatus(Integer  pushLogStatus){
+        this.pushLogStatus=pushLogStatus;
+    }
+
+    public String getPushLogResultMsg(){
+        return pushLogResultMsg;
+    }
+
+    public void setPushLogResultMsg(String  pushLogResultMsg){
+        this.pushLogResultMsg=pushLogResultMsg;
+    }
+
+    public Date getPushLogCreateTime(){
+        return pushLogCreateTime;
+    }
+
+    public void setPushLogCreateTime(Date  pushLogCreateTime){
+        this.pushLogCreateTime=pushLogCreateTime;
+    }
+
+    public Integer getBillId() {
+        return billId;
+    }
+
+    public void setBillId(Integer billId) {
+        this.billId = billId;
+    }
+}

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/order/ProductColor.java

@@ -45,6 +45,8 @@ public class ProductColor implements Serializable {
 
     private Integer colorIsWeight;    //重量
 
+    private String colorJdProductId;    //京东的sku
+
     private Integer colorIsMachine; //是否是水机 1:水机 2;其它产品
 
     public String getProductName() {
@@ -175,6 +177,14 @@ public class ProductColor implements Serializable {
         this.colorAbbreviation = colorAbbreviation;
     }
 
+    public String getColorJdProductId() {
+        return colorJdProductId;
+    }
+
+    public void setColorJdProductId(String colorJdProductId) {
+        this.colorJdProductId = colorJdProductId;
+    }
+
     @Override
     public String toString() {
         return "ProductColor{" +

+ 43 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/BillingItemService.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.faces.ei;
+
+import com.iamberry.rst.core.ei.BillingItem;
+
+import java.util.List;
+
+/**
+ *  开票记录产品接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface BillingItemService {
+    /**
+     * 获取集合
+     * @param  billingItem
+     * @return List
+     */
+    List<BillingItem> getBillingItemList(BillingItem  billingItem);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billingItem
+     */
+    BillingItem getBillingItemById(Integer  id);
+    /**
+     * 增加数据
+     * @param  billingItem
+     * @return Integer
+     */
+    Integer  save(BillingItem  billingItem);
+    /**
+     * 修改数据
+     * @param  billingItem
+     * @return Integer
+     */
+    Integer  update(BillingItem  billingItem);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 54 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/BillingService.java

@@ -0,0 +1,54 @@
+package com.iamberry.rst.faces.ei;
+
+import com.github.pagehelper.PageHelper;
+import com.iamberry.rst.core.ei.Billing;
+import com.iamberry.rst.core.page.PagedResult;
+
+import java.util.List;
+
+/**
+ *  开票记录接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface BillingService {
+
+    PagedResult<Billing> getBillingPage(int pageNO, int pageSize, Billing billing, boolean isTotalNum);
+
+    /**
+     * 获取集合
+     * @param  billing
+     * @return List
+     */
+    List<Billing> getBillingList(Billing  billing);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billing
+     */
+    Billing  getBillingById(Integer  id);
+    /**
+     * 增加数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  save(Billing  billing);
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  update(Billing  billing);
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  updateByOrderNo(Billing  billing);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/InvoPlatformService.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.faces.ei;
+
+import com.iamberry.rst.core.ei.InvoPlatform;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author xm
+ * @Date 2019-04-16
+ */
+public interface InvoPlatformService {
+    /**
+     * 获取集合
+     * @param  invoPlatform
+     * @return List
+     */
+    List<InvoPlatform> getInvoPlatformList(InvoPlatform  invoPlatform);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  invoPlatform
+     */
+    InvoPlatform  getInvoPlatformById(Integer  id);
+    /**
+     * 增加数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    Integer  save(InvoPlatform  invoPlatform);
+    /**
+     * 修改数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    Integer  update(InvoPlatform invoPlatform);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/PlatformInfoService.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.faces.ei;
+
+import com.iamberry.rst.core.ei.PlatformInfo;
+
+import java.util.List;
+
+/**
+ *  所属平台接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface PlatformInfoService {
+    /**
+     * 获取集合
+     * @param  platformInfo
+     * @return List
+     */
+    List<PlatformInfo> getPlatformInfoList(PlatformInfo  platformInfo);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  platformInfo
+     */
+    PlatformInfo getPlatformInfoById(Integer  id);
+    /**
+     * 增加数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    Integer  save(PlatformInfo  platformInfo);
+    /**
+     * 修改数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    Integer  update(PlatformInfo  platformInfo);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/ei/PushLogService.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.faces.ei;
+
+import com.iamberry.rst.core.ei.PushLog;
+
+import java.util.List;
+
+/**
+ *  发票推送日志接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface PushLogService {
+    /**
+     * 获取集合
+     * @param  pushLog
+     * @return List
+     */
+    List<PushLog> getPushLogList(PushLog  pushLog);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  pushLog
+     */
+    PushLog  getPushLogById(Integer  id);
+    /**
+     * 增加数据
+     * @param  pushLog
+     * @return Integer
+     */
+    Integer  save(PushLog  pushLog);
+    /**
+     * 修改数据
+     * @param  pushLog
+     * @return Integer
+     */
+    Integer  update(PushLog  pushLog);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 6 - 0
watero-rst-service/pom.xml

@@ -22,6 +22,12 @@
             <artifactId>watero-common-tool</artifactId>
             <version>1.0.0</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.jd</groupId>
+            <artifactId>open-api-sdk</artifactId>
+            <version>2.0</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 65 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/BillingItemServiceImpl.java

@@ -0,0 +1,65 @@
+package com.iamberry.rst.service.ei;
+
+import com.iamberry.rst.core.ei.BillingItem;
+import com.iamberry.rst.faces.ei.BillingItemService;
+import com.iamberry.rst.service.ei.mapper.BillingItemMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  开票记录产品接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+@Service
+public class BillingItemServiceImpl  implements BillingItemService {
+    @Autowired
+    private BillingItemMapper billingItemMapper;
+    /**
+     * 获取集合
+     * @param  billingItem
+     * @return List
+     */
+    @Override
+    public List<BillingItem> getBillingItemList(BillingItem  billingItem){
+        return  billingItemMapper.getBillingItemList(billingItem);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billingItem
+     */
+    @Override
+    public  BillingItem  getBillingItemById(Integer  id){
+        return  billingItemMapper.getBillingItemById(id);
+    }
+    /**
+     * 增加数据
+     * @param  billingItem
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(BillingItem  billingItem){
+        return  billingItemMapper.save(billingItem);
+    }
+    /**
+     * 修改数据
+     * @param  billingItem
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(BillingItem  billingItem){
+        return  billingItemMapper.update(billingItem);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  billingItemMapper.delete(id);
+    }
+}

+ 101 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/BillingServiceImpl.java

@@ -0,0 +1,101 @@
+package com.iamberry.rst.service.ei;
+
+import com.github.pagehelper.PageHelper;
+import com.iamberry.rst.core.ei.Billing;
+import com.iamberry.rst.core.ei.BillingItem;
+import com.iamberry.rst.core.page.PagedResult;
+import com.iamberry.rst.faces.ei.BillingService;
+import com.iamberry.rst.service.ei.mapper.BillingItemMapper;
+import com.iamberry.rst.service.ei.mapper.BillingMapper;
+import com.iamberry.rst.util.PageUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ *  开票记录接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+@Service
+public class BillingServiceImpl  implements BillingService {
+    @Autowired
+    private BillingMapper billingMapper;
+    @Autowired
+    private BillingItemMapper billingItemMapper;
+
+    @Override
+    public PagedResult<Billing> getBillingPage(int pageNO, int pageSize, Billing billing, boolean isTotalNum) {
+        PageHelper.startPage(pageNO, pageSize, isTotalNum);
+        List<Billing> list = billingMapper.getBillingList(billing);
+        return PageUtil.getPage(list);
+    }
+    /**
+     * 获取集合
+     * @param  billing
+     * @return List
+     */
+    @Override
+    public List<Billing> getBillingList(Billing billing){
+        return  billingMapper.getBillingList(billing);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billing
+     */
+    @Override
+    public  Billing  getBillingById(Integer  id){
+        return  billingMapper.getBillingById(id);
+    }
+    /**
+     * 增加数据
+     * @param  billing
+     * @return Integer
+     */
+    @Override
+    @Transactional
+    public  Integer  save(Billing  billing){
+        Integer flag = billingMapper.save(billing);
+        if(flag < 1){
+            throw new RuntimeException("添加发票记录失败!");
+        }
+        for (BillingItem billingItem : billing.getBillingItemList()) {
+            billingItem.setBillId(billing.getBillId());
+        }
+        flag = billingItemMapper.saveList(billing.getBillingItemList());
+        if(flag < 1){
+            throw new RuntimeException("添加发票产品记录失败!");
+        }
+        return  flag;
+    }
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(Billing  billing){
+        return  billingMapper.update(billing);
+    }
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    @Override
+    public  Integer  updateByOrderNo(Billing  billing){
+        return  billingMapper.updateByOrderNo(billing);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  billingMapper.delete(id);
+    }
+}

+ 65 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/InvoPlatformServiceImpl.java

@@ -0,0 +1,65 @@
+package com.iamberry.rst.service.ei;
+
+import com.iamberry.rst.core.ei.InvoPlatform;
+import com.iamberry.rst.faces.ei.InvoPlatformService;
+import com.iamberry.rst.service.ei.mapper.InvoPlatformMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author xm
+ * @Date 2019-04-16
+ */
+@Service
+public class InvoPlatformServiceImpl  implements InvoPlatformService {
+    @Autowired
+    private InvoPlatformMapper invoPlatformMapper;
+    /**
+     * 获取集合
+     * @param  invoPlatform
+     * @return List
+     */
+    @Override
+    public List<InvoPlatform> getInvoPlatformList(InvoPlatform  invoPlatform){
+        return  invoPlatformMapper.getInvoPlatformList(invoPlatform);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  invoPlatform
+     */
+    @Override
+    public  InvoPlatform  getInvoPlatformById(Integer  id){
+        return  invoPlatformMapper.getInvoPlatformById(id);
+    }
+    /**
+     * 增加数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(InvoPlatform  invoPlatform){
+        return  invoPlatformMapper.save(invoPlatform);
+    }
+    /**
+     * 修改数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(InvoPlatform  invoPlatform){
+        return  invoPlatformMapper.update(invoPlatform);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  invoPlatformMapper.delete(id);
+    }
+}

+ 65 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/PlatformInfoServiceImpl.java

@@ -0,0 +1,65 @@
+package com.iamberry.rst.service.ei;
+
+import com.iamberry.rst.core.ei.PlatformInfo;
+import com.iamberry.rst.faces.ei.PlatformInfoService;
+import com.iamberry.rst.service.ei.mapper.PlatformInfoMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  所属平台接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+@Service
+public class PlatformInfoServiceImpl  implements PlatformInfoService {
+    @Autowired
+    private PlatformInfoMapper platformInfoMapper;
+    /**
+     * 获取集合
+     * @param  platformInfo
+     * @return List
+     */
+    @Override
+    public List<PlatformInfo> getPlatformInfoList(PlatformInfo  platformInfo){
+        return  platformInfoMapper.getPlatformInfoList(platformInfo);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  platformInfo
+     */
+    @Override
+    public  PlatformInfo  getPlatformInfoById(Integer  id){
+        return  platformInfoMapper.getPlatformInfoById(id);
+    }
+    /**
+     * 增加数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(PlatformInfo  platformInfo){
+        return  platformInfoMapper.save(platformInfo);
+    }
+    /**
+     * 修改数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(PlatformInfo  platformInfo){
+        return  platformInfoMapper.update(platformInfo);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  platformInfoMapper.delete(id);
+    }
+}

+ 65 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/PushLogServiceImpl.java

@@ -0,0 +1,65 @@
+package com.iamberry.rst.service.ei;
+
+import com.iamberry.rst.core.ei.PushLog;
+import com.iamberry.rst.faces.ei.PushLogService;
+import com.iamberry.rst.service.ei.mapper.PushLogMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  发票推送日志接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+@Service
+public class PushLogServiceImpl  implements PushLogService {
+    @Autowired
+    private PushLogMapper pushLogMapper;
+    /**
+     * 获取集合
+     * @param  pushLog
+     * @return List
+     */
+    @Override
+    public List<PushLog> getPushLogList(PushLog  pushLog){
+        return  pushLogMapper.getPushLogList(pushLog);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  pushLog
+     */
+    @Override
+    public  PushLog  getPushLogById(Integer  id){
+        return  pushLogMapper.getPushLogById(id);
+    }
+    /**
+     * 增加数据
+     * @param  pushLog
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(PushLog  pushLog){
+        return  pushLogMapper.save(pushLog);
+    }
+    /**
+     * 修改数据
+     * @param  pushLog
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(PushLog  pushLog){
+        return  pushLogMapper.update(pushLog);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  pushLogMapper.delete(id);
+    }
+}

+ 50 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/BillingItemMapper.java

@@ -0,0 +1,50 @@
+package com.iamberry.rst.service.ei.mapper;
+
+import com.iamberry.rst.core.ei.BillingItem;
+
+import java.util.List;
+
+/**
+ *  开票记录产品接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface BillingItemMapper {
+    /**
+     * 获取集合
+     * @param  billingItem
+     * @return List
+     */
+    List<BillingItem> getBillingItemList(BillingItem  billingItem);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billingItem
+     */
+    BillingItem  getBillingItemById(Integer  id);
+    /**
+     * 增加数据
+     * @param  billingItem
+     * @return Integer
+     */
+    Integer  save(BillingItem  billingItem);
+    /**
+     * 修改数据
+     * @param  billingItem
+     * @return Integer
+     */
+    Integer  update(BillingItem  billingItem);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+    /**
+     * 增加数据 <集合>
+     * @param  billingItemList
+     * @return Integer
+     */
+    Integer  saveList(List<BillingItem>  billingItemList);
+
+}

+ 51 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/BillingMapper.java

@@ -0,0 +1,51 @@
+package com.iamberry.rst.service.ei.mapper;
+
+import com.iamberry.rst.core.ei.Billing;
+
+import java.util.List;
+
+/**
+ *  开票记录接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface BillingMapper {
+    /**
+     * 获取集合
+     * @param  billing
+     * @return List
+     */
+    List<Billing> getBillingList(Billing billing);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  billing
+     */
+    Billing  getBillingById(Integer  id);
+    /**
+     * 增加数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  save(Billing  billing);
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  update(Billing  billing);
+
+    /**
+     * 修改数据
+     * @param  billing
+     * @return Integer
+     */
+    Integer  updateByOrderNo(Billing  billing);
+
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/InvoPlatformMapper.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.service.ei.mapper;
+
+import com.iamberry.rst.core.ei.InvoPlatform;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author xm
+ * @Date 2019-04-16
+ */
+public interface InvoPlatformMapper {
+    /**
+     * 获取集合
+     * @param  invoPlatform
+     * @return List
+     */
+    List<InvoPlatform> getInvoPlatformList(InvoPlatform  invoPlatform);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  invoPlatform
+     */
+    InvoPlatform  getInvoPlatformById(Integer  id);
+    /**
+     * 增加数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    Integer  save(InvoPlatform  invoPlatform);
+    /**
+     * 修改数据
+     * @param  invoPlatform
+     * @return Integer
+     */
+    Integer  update(InvoPlatform  invoPlatform);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/PlatformInfoMapper.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.service.ei.mapper;
+
+import com.iamberry.rst.core.ei.PlatformInfo;
+
+import java.util.List;
+
+/**
+ *  所属平台接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface PlatformInfoMapper {
+    /**
+     * 获取集合
+     * @param  platformInfo
+     * @return List
+     */
+    List<PlatformInfo> getPlatformInfoList(PlatformInfo platformInfo);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  platformInfo
+     */
+    PlatformInfo  getPlatformInfoById(Integer  id);
+    /**
+     * 增加数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    Integer  save(PlatformInfo  platformInfo);
+    /**
+     * 修改数据
+     * @param  platformInfo
+     * @return Integer
+     */
+    Integer  update(PlatformInfo  platformInfo);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 43 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/PushLogMapper.java

@@ -0,0 +1,43 @@
+package com.iamberry.rst.service.ei.mapper;
+
+import com.iamberry.rst.core.ei.PushLog;
+
+import java.util.List;
+
+/**
+ *  发票推送日志接口
+ * @author xm
+ * @Date 2019-04-08
+ */
+public interface PushLogMapper {
+    /**
+     * 获取集合
+     * @param  pushLog
+     * @return List
+     */
+    List<PushLog> getPushLogList(PushLog pushLog);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  pushLog
+     */
+    PushLog  getPushLogById(Integer  id);
+    /**
+     * 增加数据
+     * @param  pushLog
+     * @return Integer
+     */
+    Integer  save(PushLog  pushLog);
+    /**
+     * 修改数据
+     * @param  pushLog
+     * @return Integer
+     */
+    Integer  update(PushLog  pushLog);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 171 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/billingItemMapper.xml

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.ei.mapper.BillingItemMapper">
+    <resultMap  id="BaseResultMap" type="BillingItem" >
+        <result    column="bill_item_id"    property="billItemId" />
+        <result    column="bill_id"    property="billId" />
+        <result    column="product_id"    property="productId" />
+        <result    column="color_id"    property="colorId" />
+        <result    column="bill_item_product_name"    property="billItemProductName" />
+        <result    column="bill_item_color_name"    property="billItemColorName" />
+        <result    column="bill_item_num"    property="billItemNum" />
+        <result    column="bill_item_unit_price"    property="billItemUnitPrice" />
+        <result    column="bill_item_amount_price"    property="billItemAmountPrice" />
+        <result    column="bill_item_product_type"    property="billItemProductType" />
+        <result    column="bill_item_color_bar"    property="billItemColorBar" />
+        <result    column="bill_item_create_time"    property="billItemCreateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.bill_item_id,
+        t.bill_id,
+        t.product_id,
+        t.color_id,
+        t.bill_item_product_name,
+        t.bill_item_color_name,
+        t.bill_item_num,
+        t.bill_item_unit_price,
+        t.bill_item_amount_price,
+        t.bill_item_product_type,
+        t.bill_item_color_bar,
+        t.bill_item_create_time
+    </sql>
+    <select id="getBillingItemList" resultMap="BaseResultMap" parameterType="BillingItem" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_billing_item t
+        <where>
+            <if test="billItemId != null ">
+                AND t.bill_item_id = #{billItemId}
+            </if >
+            <if test="billId != null ">
+                AND t.bill_id = #{billId}
+            </if >
+            <if test="productId != null ">
+                AND t.product_id = #{productId}
+            </if >
+            <if test="colorId != null ">
+                AND t.color_id = #{colorId}
+            </if >
+            <if test="billItemProductName != null and billItemProductName != ''">
+                AND t.bill_item_product_name  like  CONCAT ('%',#{billItemProductName},'%')
+            </if >
+            <if test="billItemColorName != null and billItemColorName != ''">
+                AND t.bill_item_color_name  like  CONCAT ('%',#{billItemColorName},'%')
+            </if >
+            <if test="billItemProductType != null ">
+                AND t.bill_item_product_type = #{billItemProductType}
+            </if >
+            <if test="billItemColorBar != null and billItemColorBar != ''">
+                AND t.bill_item_color_bar = #{billItemColorBar}
+            </if >
+        </where>
+    </select>
+    <select id="getBillingItemById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_billing_item t
+        where t.bill_item_id= #{billItemId}
+    </select>
+    <insert id="save" parameterType="BillingItem" >
+        insert into
+        tb_rst_ei_billing_item
+        (
+        bill_id,
+        product_id,
+        color_id,
+        bill_item_product_name,
+        bill_item_color_name,
+        bill_item_num,
+        bill_item_unit_price,
+        bill_item_amount_price,
+        bill_item_product_type,
+        bill_item_color_bar
+        )
+        values
+        (
+        #{billId},
+        #{productId},
+        #{colorId},
+        #{billItemProductName},
+        #{billItemColorName},
+        #{billItemNum},
+        #{billItemUnitPrice},
+        #{billItemAmountPrice},
+        #{billItemProductType},
+        #{billItemColorBar}
+        )
+    </insert>
+    <update id="update" parameterType="BillingItem" >
+        update
+        tb_rst_ei_billing_item
+        <set >
+            <if test="billId != null ">
+                bill_id = #{billId},
+            </if >
+            <if test="productId != null ">
+                product_id = #{productId},
+            </if >
+            <if test="colorId != null ">
+                color_id = #{colorId},
+            </if >
+            <if test="billItemProductName != null and billItemProductName != ''">
+                bill_item_product_name = #{billItemProductName},
+            </if >
+            <if test="billItemColorName != null and billItemColorName != ''">
+                bill_item_color_name = #{billItemColorName},
+            </if >
+            <if test="billItemNum != null ">
+                bill_item_num = #{billItemNum},
+            </if >
+            <if test="billItemUnitPrice != null ">
+                bill_item_unit_price = #{billItemUnitPrice},
+            </if >
+            <if test="billItemAmountPrice != null ">
+                bill_item_amount_price = #{billItemAmountPrice},
+            </if >
+            <if test="billItemProductType != null ">
+                bill_item_product_type = #{billItemProductType},
+            </if >
+            <if test="billItemColorBar != null and billItemColorBar != ''">
+                bill_item_color_bar = #{billItemColorBar},
+            </if >
+        </set >
+        where bill_item_id= #{billItemId}
+    </update>
+    <insert id="saveList" parameterType="java.util.List" >
+        insert into
+        tb_rst_ei_billing_item
+        (
+        bill_id,
+        product_id,
+        color_id,
+        bill_item_product_name,
+        bill_item_color_name,
+        bill_item_num,
+        bill_item_unit_price,
+        bill_item_amount_price,
+        bill_item_product_type,
+        bill_item_color_bar
+        )
+        values
+        <foreach collection="list" item="node" index="index" separator="," open="" close="">
+            (
+            #{node.billId},
+            #{node.productId},
+            #{node.colorId},
+            #{node.billItemProductName},
+            #{node.billItemColorName},
+            #{node.billItemNum},
+            #{node.billItemUnitPrice},
+            #{node.billItemAmountPrice},
+            #{node.billItemProductType},
+            #{node.billItemColorBar}
+            )
+        </foreach >
+    </insert>
+    <delete id="delete" parameterType="Integer" >
+        delete FROM
+        tb_rst_ei_billing_item
+        where bill_item_id=#{billItemId}
+    </delete>
+</mapper>

+ 323 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/billingMapper.xml

@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.ei.mapper.BillingMapper">
+    <resultMap  id="BaseResultMap" type="Billing" >
+        <result    column="bill_id"    property="billId" />
+        <result    column="plat_id"    property="platId" />
+        <result    column="bill_order_no"    property="billOrderNo" />
+        <result    column="bill_amount"    property="billAmount" />
+        <result    column="bill_type"    property="billType" />
+        <result    column="bill_company_name"    property="billCompanyName" />
+        <result    column="bill_tax_number"    property="billTaxNumber" />
+        <result    column="bill_tel"    property="billTel" />
+        <result    column="bill_address"    property="billAddress" />
+        <result    column="bill_bank_number"    property="billBankNumber" />
+        <result    column="bill_bank_name"    property="billBankName" />
+        <result    column="bill_bank_branch_name"    property="billBankBranchName" />
+        <result    column="bill_personal_name"    property="billPersonalName" />
+        <result    column="bill_status"    property="billStatus" />
+        <result    column="bill_invoice_serial_num"    property="billInvoiceSerialNum" />
+        <result    column="bill_result_msg"    property="billResultMsg" />
+        <result    column="bill_invoice_file_url"    property="billInvoiceFileUrl" />
+        <result    column="bill_invoice_image_url"    property="billInvoiceImageUrl" />
+        <result    column="bill_invoice_date"    property="billInvoiceDate" />
+        <result    column="bill_invoice_code"    property="billInvoiceCode" />
+        <result    column="bill_invoice_num"    property="billInvoiceNum" />
+        <result    column="bill_tax_excluded_amount"    property="billTaxExcludedAmount" />
+        <result    column="bill_tax_included_amount"    property="billTaxIncludedAmount" />
+        <result    column="bill_invoice_line"    property="billInvoiceLine" />
+        <result    column="bill_remarks"    property="billRemarks" />
+        <result    column="bill_create_user"    property="billCreateUser" />
+        <result    column="bill_create_time"    property="billCreateTime" />
+        <result    column="bill_update_time"    property="billUpdateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.bill_id,
+        t.plat_id,
+        t.bill_order_no,
+        t.bill_amount,
+        t.bill_type,
+        t.bill_company_name,
+        t.bill_tax_number,
+        t.bill_tel,
+        t.bill_address,
+        t.bill_bank_number,
+        t.bill_bank_name,
+        t.bill_bank_branch_name,
+        t.bill_personal_name,
+        t.bill_status,
+        t.bill_invoice_serial_num,
+        t.bill_result_msg,
+        t.bill_invoice_file_url,
+        t.bill_invoice_image_url,
+        t.bill_invoice_date,
+        t.bill_invoice_code,
+        t.bill_invoice_num,
+        t.bill_tax_excluded_amount,
+        t.bill_tax_included_amount,
+        t.bill_invoice_line,
+        t.bill_remarks,
+        t.bill_create_user,
+        t.bill_create_time,
+        t.bill_update_time
+    </sql>
+    <select id="getBillingList" resultMap="BaseResultMap" parameterType="Billing" >
+        select
+        <include refid="Base_List" />,
+        epi.plat_company_name,
+        epi.plat_name
+        from tb_rst_ei_billing t
+        LEFT  JOIN  tb_rst_ei_platform_info epi ON  t.plat_id = epi.plat_id
+        <where>
+            <if test="billId != null ">
+                AND t.bill_id = #{billId}
+            </if >
+            <if test="platId != null ">
+                AND t.plat_id = #{platId}
+            </if >
+            <if test="billOrderNo != null and billOrderNo != ''">
+                AND t.bill_order_no  like  CONCAT ('%',#{billOrderNo},'%')
+            </if >
+            <if test="billAmount != null ">
+                AND t.bill_amount = #{billAmount}
+            </if >
+            <if test="billType != null ">
+                AND t.bill_type = #{billType}
+            </if >
+            <if test="billCompanyName != null and billCompanyName != ''">
+                AND t.bill_company_name  like  CONCAT ('%',#{billCompanyName},'%')
+            </if >
+            <if test="billTaxNumber != null and billTaxNumber != ''">
+                AND t.bill_tax_number  like  CONCAT ('%',#{billTaxNumber},'%')
+            </if >
+            <if test="billTel != null and billTel != ''">
+                AND t.bill_tel  like  CONCAT ('%',#{billTel},'%')
+            </if >
+            <if test="billAddress != null and billAddress != ''">
+                AND t.bill_address  like  CONCAT ('%',#{billAddress},'%')
+            </if >
+            <if test="billPersonalName != null and billPersonalName != ''">
+                AND t.bill_personal_name  like  CONCAT ('%',#{billPersonalName},'%')
+            </if >
+            <if test="billStatus != null ">
+                AND t.bill_status = #{billStatus}
+            </if >
+            <if test="billInvoiceCode != null and billInvoiceCode != ''">
+                AND t.bill_invoice_code  like  CONCAT ('%',#{billInvoiceCode},'%')
+            </if >
+            <if test="billInvoiceNum != null and billInvoiceNum != ''">
+                AND t.bill_invoice_num  like  CONCAT ('%',#{billInvoiceNum},'%')
+            </if >
+            <if test="startDate != null and startDate != ''">
+                AND t.bill_create_time <![CDATA[>=]]> #{startDate}
+            </if>
+            <if test="endDate != null and endDate != ''">
+                AND t.bill_create_time <![CDATA[<=]]> #{endDate}
+            </if>
+        </where>
+        ORDER BY  t.bill_id DESC
+    </select>
+    <select id="getBillingById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />,
+        epi.plat_company_name,
+        epi.plat_name,
+        sa.admin_name AS  billCreateName
+        from tb_rst_ei_billing t
+        LEFT  JOIN  tb_rst_ei_platform_info epi ON  t.plat_id = epi.plat_id
+        LEFT  JOIN  tb_rst_sys_admin sa ON  t.bill_create_user = sa.admin_id
+        where t.bill_id= #{billId}
+    </select>
+    <insert id="save" parameterType="Billing"  keyProperty="billId" useGeneratedKeys="true" >
+        insert into
+        tb_rst_ei_billing
+        (
+        bill_id,
+        plat_id,
+        bill_order_no,
+        bill_amount,
+        bill_type,
+        bill_company_name,
+        bill_tax_number,
+        bill_tel,
+        bill_address,
+        bill_bank_number,
+        bill_bank_name,
+        bill_bank_branch_name,
+        bill_personal_name,
+        bill_status,
+        bill_invoice_serial_num,
+        bill_result_msg,
+        bill_invoice_file_url,
+        bill_invoice_image_url,
+        bill_invoice_date,
+        bill_invoice_code,
+        bill_invoice_num,
+        bill_tax_excluded_amount,
+        bill_tax_included_amount,
+        bill_invoice_line,
+        bill_create_user,
+        bill_remarks
+        )
+        values
+        (
+        #{billId},
+        #{platId},
+        #{billOrderNo},
+        #{billAmount},
+        #{billType},
+        #{billCompanyName},
+        #{billTaxNumber},
+        #{billTel},
+        #{billAddress},
+        #{billBankNumber},
+        #{billBankName},
+        #{billBankBranchName},
+        #{billPersonalName},
+        #{billStatus},
+        #{billInvoiceSerialNum},
+        #{billResultMsg},
+        #{billInvoiceFileUrl},
+        #{billInvoiceImageUrl},
+        #{billInvoiceDate},
+        #{billInvoiceCode},
+        #{billInvoiceNum},
+        #{billTaxExcludedAmount},
+        #{billTaxIncludedAmount},
+        #{billInvoiceLine},
+        #{billCreateUser},
+        #{billRemarks}
+        )
+    </insert>
+    <update id="update" parameterType="Billing" >
+        update
+        tb_rst_ei_billing
+        <set >
+            <if test="platId != null ">
+                plat_id = #{platId},
+            </if >
+            <if test="billOrderNo != null and billOrderNo != ''">
+                bill_order_no = #{billOrderNo},
+            </if >
+            <if test="billAmount != null ">
+                bill_amount = #{billAmount},
+            </if >
+            <if test="billType != null ">
+                bill_type = #{billType},
+            </if >
+            <if test="billCompanyName != null and billCompanyName != ''">
+                bill_company_name = #{billCompanyName},
+            </if >
+            <if test="billTaxNumber != null and billTaxNumber != ''">
+                bill_tax_number = #{billTaxNumber},
+            </if >
+            <if test="billTel != null and billTel != ''">
+                bill_tel = #{billTel},
+            </if >
+            <if test="billAddress != null and billAddress != ''">
+                bill_address = #{billAddress},
+            </if >
+            <if test="billBankNumber != null and billBankNumber != ''">
+                bill_bank_number = #{billBankNumber},
+            </if >
+            <if test="billBankName != null and billBankName != ''">
+                bill_bank_name = #{billBankName},
+            </if >
+            <if test="billBankBranchName != null and billBankBranchName != ''">
+                bill_bank_branch_name = #{billBankBranchName},
+            </if >
+            <if test="billPersonalName != null and billPersonalName != ''">
+                bill_personal_name = #{billPersonalName},
+            </if >
+            <if test="billStatus != null ">
+                bill_status = #{billStatus},
+            </if >
+            <if test="billInvoiceSerialNum != null and billInvoiceSerialNum != ''">
+                bill_invoice_serial_num = #{billInvoiceSerialNum},
+            </if >
+            <if test="billResultMsg != null and billResultMsg != ''">
+                bill_result_msg = #{billResultMsg},
+            </if >
+            <if test="billInvoiceFileUrl != null and billInvoiceFileUrl != ''">
+                bill_invoice_file_url = #{billInvoiceFileUrl},
+            </if >
+            <if test="billInvoiceImageUrl != null and billInvoiceImageUrl != ''">
+                bill_invoice_image_url = #{billInvoiceImageUrl},
+            </if >
+            <if test="billInvoiceDate != null and billInvoiceDate != ''">
+                bill_invoice_date = #{billInvoiceDate},
+            </if >
+            <if test="billInvoiceCode != null and billInvoiceCode != ''">
+                bill_invoice_code = #{billInvoiceCode},
+            </if >
+            <if test="billInvoiceNum != null and billInvoiceNum != ''">
+                bill_invoice_num = #{billInvoiceNum},
+            </if >
+            <if test="billTaxExcludedAmount != null ">
+                bill_tax_excluded_amount = #{billTaxExcludedAmount},
+            </if >
+            <if test="billTaxIncludedAmount != null ">
+                bill_tax_included_amount = #{billTaxIncludedAmount},
+            </if >
+
+            <if test="billInvoiceLine != null and billInvoiceLine != ''">
+                bill_invoice_line = #{billInvoiceLine},
+            </if >
+            <if test="billRemarks != null and billRemarks != ''">
+                bill_remarks = #{billRemarks},
+            </if >
+        </set >
+        where bill_id= #{billId}
+    </update>
+
+    <update id="updateByOrderNo" parameterType="Billing" >
+        update
+        tb_rst_ei_billing
+        <set >
+            <if test="billStatus != null ">
+                bill_status = #{billStatus},
+            </if >
+            <if test="billInvoiceSerialNum != null and billInvoiceSerialNum != ''">
+                bill_invoice_serial_num = #{billInvoiceSerialNum},
+            </if >
+            <if test="billResultMsg != null and billResultMsg != ''">
+                bill_result_msg = #{billResultMsg},
+            </if >
+            <if test="billInvoiceFileUrl != null and billInvoiceFileUrl != ''">
+                bill_invoice_file_url = #{billInvoiceFileUrl},
+            </if >
+            <if test="billInvoiceImageUrl != null and billInvoiceImageUrl != ''">
+                bill_invoice_image_url = #{billInvoiceImageUrl},
+            </if >
+            <if test="billInvoiceDate != null and billInvoiceDate != ''">
+                bill_invoice_date = #{billInvoiceDate},
+            </if >
+            <if test="billInvoiceCode != null and billInvoiceCode != ''">
+                bill_invoice_code = #{billInvoiceCode},
+            </if >
+            <if test="billInvoiceNum != null and billInvoiceNum != ''">
+                bill_invoice_num = #{billInvoiceNum},
+            </if >
+            <if test="billTaxExcludedAmount != null ">
+                bill_tax_excluded_amount = #{billTaxExcludedAmount},
+            </if >
+            <if test="billTaxIncludedAmount != null ">
+                bill_tax_included_amount = #{billTaxIncludedAmount},
+            </if >
+
+            <if test="billInvoiceLine != null and billInvoiceLine != ''">
+                bill_invoice_line = #{billInvoiceLine},
+            </if >
+            <if test="billRemarks != null and billRemarks != ''">
+                bill_remarks = #{billRemarks},
+            </if >
+        </set >
+        where bill_order_no = #{billOrderNo}
+    </update>
+
+    <delete id="delete" parameterType="Integer" >
+        delete FROM
+        tb_rst_ei_billing
+        where bill_id=#{billId}
+    </delete>
+</mapper>

+ 106 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/invoPlatformMapper.xml

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.ei.mapper.InvoPlatformMapper">
+    <resultMap  id="BaseResultMap" type="InvoPlatform" >
+        <result    column="invo_plat_id"    property="invoPlatId" />
+        <result    column="invo_plat_name"    property="invoPlatName" />
+        <result    column="invo_plat_app_key"    property="invoPlatAppKey" />
+        <result    column="invo_plat_app_secret"    property="invoPlatAppSecret" />
+        <result    column="invo_plat_version"    property="invoPlatVersion" />
+        <result    column="invo_plat_access_token"    property="invoPlatAccessToken" />
+        <result    column="invo_plat_end_date"    property="invoPlatEndDate" />
+        <result    column="invo_plat_status"    property="invoPlatStatus" />
+        <result    column="invo_plat_create_time"    property="invoPlatCreateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.invo_plat_id,
+        t.invo_plat_name,
+        t.invo_plat_app_key,
+        t.invo_plat_app_secret,
+        t.invo_plat_version,
+        t.invo_plat_access_token,
+        t.invo_plat_end_date,
+        t.invo_plat_status,
+        t.invo_plat_create_time
+    </sql>
+    <select id="getInvoPlatformList" resultMap="BaseResultMap" parameterType="InvoPlatform" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_invo_platform t
+        <where>
+            <if test="invoPlatId != null ">
+                AND t.invo_plat_id = #{invoPlatId}
+            </if >
+            <if test="invoPlatName != null and invoPlatName != ''">
+                AND t.invo_plat_name  like  CONCAT ('%',#{invoPlatName},'%')
+            </if >
+            <if test="invoPlatStatus != null ">
+                AND t.invo_plat_status = #{invoPlatStatus}
+            </if >
+        </where>
+    </select>
+    <select id="getInvoPlatformById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_invo_platform t
+        where t.invo_plat_id= #{invoPlatId}
+    </select>
+    <insert id="save" parameterType="InvoPlatform" >
+        insert into
+        tb_rst_ei_invo_platform
+        (
+        invo_plat_id,
+        invo_plat_name,
+        invo_plat_app_key,
+        invo_plat_app_secret,
+        invo_plat_version,
+        invo_plat_access_token,
+        invo_plat_end_date,
+        invo_plat_status
+        )
+        values
+        (
+        #{invoPlatId},
+        #{invoPlatName},
+        #{invoPlatAppKey},
+        #{invoPlatAppSecret},
+        #{invoPlatVersion},
+        #{invoPlatAccessToken},
+        #{invoPlatEndDate},
+        #{invoPlatStatus}
+        )
+    </insert>
+    <update id="update" parameterType="InvoPlatform" >
+        update
+        tb_rst_ei_invo_platform
+        <set >
+            <if test="invoPlatName != null and invoPlatName != ''">
+                invo_plat_name = #{invoPlatName},
+            </if >
+            <if test="invoPlatAppKey != null and invoPlatAppKey != ''">
+                invo_plat_app_key = #{invoPlatAppKey},
+            </if >
+            <if test="invoPlatAppSecret != null and invoPlatAppSecret != ''">
+                invo_plat_app_secret = #{invoPlatAppSecret},
+            </if >
+            <if test="invoPlatVersion != null and invoPlatVersion != ''">
+                invo_plat_version = #{invoPlatVersion},
+            </if >
+            <if test="invoPlatAccessToken != null and invoPlatAccessToken != ''">
+                invo_plat_access_token = #{invoPlatAccessToken},
+            </if >
+            <if test="invoPlatEndDate != null and invoPlatEndDate != ''">
+                invo_plat_end_date = #{invoPlatEndDate},
+            </if >
+            <if test="invoPlatStatus != null ">
+                invo_plat_status = #{invoPlatStatus},
+            </if >
+        </set >
+        where invo_plat_id= #{invoPlatId}
+    </update>
+    <delete id="delete" parameterType="Integer" >
+        delete
+        tb_rst_ei_invo_platform
+        where invo_plat_id=#{invoPlatId}
+    </delete>
+</mapper>

+ 199 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/platformInfoMapper.xml

@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.ei.mapper.PlatformInfoMapper">
+    <resultMap  id="BaseResultMap" type="PlatformInfo" >
+        <result    column="plat_id"    property="platId" />
+        <result    column="plat_name"    property="platName" />
+        <result    column="plat_tel"    property="platTel" />
+        <result    column="plat_email"    property="platEmail" />
+        <result    column="plat_company_name"    property="platCompanyName" />
+        <result    column="plat_tax_number"    property="platTaxNumber" />
+        <result    column="plat_address"    property="platAddress" />
+        <result    column="plat_bank_number"    property="platBankNumber" />
+        <result    column="plat_bank_name"    property="platBankName" />
+        <result    column="plat_bank_branch_name"    property="platBankBranchName" />
+        <result    column="plat_billing"    property="platBilling" />
+        <result    column="plat_payee"    property="platPayee" />
+        <result    column="plat_reviewer"    property="platReviewer" />
+        <result    column="plat_app_key"    property="platAppKey" />
+        <result    column="plat_app_secret"    property="platAppSecret" />
+        <result    column="plat_access_token"    property="platAccessToken" />
+        <result    column="plat_status"    property="platStatus" />
+        <result    column="plat_remarks"    property="platRemarks" />
+        <result    column="plat_create_time"    property="platCreateTime" />
+        <result    column="plat_update_time"    property="platUpdateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.plat_id,
+        t.plat_name,
+        t.plat_tel,
+        t.plat_email,
+        t.plat_company_name,
+        t.plat_tax_number,
+        t.plat_address,
+        t.plat_bank_number,
+        t.plat_bank_name,
+        t.plat_bank_branch_name,
+        t.plat_billing,
+        t.plat_payee,
+        t.plat_reviewer,
+        t.plat_app_key,
+        t.plat_app_secret,
+        t.plat_access_token,
+        t.plat_status,
+        t.plat_remarks,
+        t.plat_create_time,
+        t.plat_update_time
+    </sql>
+    <select id="getPlatformInfoList" resultMap="BaseResultMap" parameterType="PlatformInfo" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_platform_info t
+        <where>
+            <if test="platId != null ">
+                AND t.plat_id = #{platId}
+            </if >
+            <if test="platName != null and platName != ''">
+                AND t.plat_name  like  CONCAT ('%',#{platName},'%')
+            </if >
+            <if test="platTel != null and platTel != ''">
+                AND t.plat_tel  like  CONCAT ('%',#{platTel},'%')
+            </if >
+            <if test="platEmail != null and platEmail != ''">
+                AND t.plat_email  like  CONCAT ('%',#{platEmail},'%')
+            </if >
+            <if test="platCompanyName != null and platCompanyName != ''">
+                AND t.plat_company_name  like  CONCAT ('%',#{platCompanyName},'%')
+            </if >
+            <if test="platTaxNumber != null and platTaxNumber != ''">
+                AND t.plat_tax_number  like  CONCAT ('%',#{platTaxNumber},'%')
+            </if >
+            <if test="platBilling != null and platBilling != ''">
+                AND t.plat_billing  like  CONCAT ('%',#{platBilling},'%')
+            </if >
+            <if test="platPayee != null and platPayee != ''">
+                AND t.plat_payee  like  CONCAT ('%',#{platPayee},'%')
+            </if >
+            <if test="platReviewer != null and platReviewer != ''">
+                AND t.plat_reviewer  like  CONCAT ('%',#{platReviewer},'%')
+            </if >
+            <if test="platStatus != null ">
+                AND t.plat_status = #{platStatus}
+            </if >
+        </where>
+    </select>
+    <select id="getPlatformInfoById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_platform_info t
+        where t.plat_id= #{platId}
+    </select>
+    <insert id="save" parameterType="PlatformInfo" >
+        insert into
+        tb_rst_ei_platform_info
+        (
+        plat_id,
+        plat_name,
+        plat_tel,
+        plat_email,
+        plat_company_name,
+        plat_tax_number,
+        plat_address,
+        plat_bank_number,
+        plat_bank_name,
+        plat_bank_branch_name,
+        plat_billing,
+        plat_payee,
+        plat_reviewer,
+        plat_app_key,
+        plat_app_secret,
+        plat_access_token,
+        plat_status,
+        plat_remarks
+        )
+        values
+        (
+        #{platId},
+        #{platName},
+        #{platTel},
+        #{platEmail},
+        #{platCompanyName},
+        #{platTaxNumber},
+        #{platAddress},
+        #{platBankNumber},
+        #{platBankName},
+        #{platBankBranchName},
+        #{platBilling},
+        #{platPayee},
+        #{platReviewer},
+        #{platAppKey},
+        #{platAppSecret},
+        #{platAccessToken},
+        #{platStatus},
+        #{platRemarks}
+        )
+    </insert>
+    <update id="update" parameterType="PlatformInfo" >
+        update
+        tb_rst_ei_platform_info
+        <set >
+            <if test="platName != null and platName != ''">
+                plat_name = #{platName},
+            </if >
+            <if test="platTel != null and platTel != ''">
+                plat_tel = #{platTel},
+            </if >
+            <if test="platEmail != null and platEmail != ''">
+                plat_email = #{platEmail},
+            </if >
+            <if test="platCompanyName != null and platCompanyName != ''">
+                plat_company_name = #{platCompanyName},
+            </if >
+            <if test="platTaxNumber != null and platTaxNumber != ''">
+                plat_tax_number = #{platTaxNumber},
+            </if >
+            <if test="platAddress != null and platAddress != ''">
+                plat_address = #{platAddress},
+            </if >
+            <if test="platBankNumber != null and platBankNumber != ''">
+                plat_bank_number = #{platBankNumber},
+            </if >
+            <if test="platBankName != null and platBankName != ''">
+                plat_bank_name = #{platBankName},
+            </if >
+            <if test="platBankBranchName != null and platBankBranchName != ''">
+                plat_bank_branch_name = #{platBankBranchName},
+            </if >
+            <if test="platBilling != null and platBilling != ''">
+                plat_billing = #{platBilling},
+            </if >
+            <if test="platPayee != null and platPayee != ''">
+                plat_payee = #{platPayee},
+            </if >
+            <if test="platReviewer != null and platReviewer != ''">
+                plat_reviewer = #{platReviewer},
+            </if >
+            <if test="platAppKey != null and platAppKey != ''">
+                plat_app_key = #{platAppKey},
+            </if >
+            <if test="platAppSecret != null and platAppSecret != ''">
+                plat_app_secret = #{platAppSecret},
+            </if >
+            <if test="platAccessToken != null and platAccessToken != ''">
+                plat_access_token = #{platAccessToken},
+            </if >
+            <if test="platStatus != null ">
+                plat_status = #{platStatus},
+            </if >
+            <if test="platRemarks != null and platRemarks != ''">
+                plat_remarks = #{platRemarks},
+            </if >
+        </set >
+        where plat_id= #{platId}
+    </update>
+    <delete id="delete" parameterType="Integer" >
+        delete FROM
+        tb_rst_ei_platform_info
+        where plat_id=#{platId}
+    </delete>
+</mapper>

+ 118 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/ei/mapper/pushLogMapper.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.ei.mapper.PushLogMapper">
+    <resultMap  id="BaseResultMap" type="PushLog" >
+        <result    column="push_log_id"    property="pushLogId" />
+        <result    column="bill_id"    property="billId" />
+        <result    column="push_log_type"    property="pushLogType" />
+        <result    column="plat_id"    property="platId" />
+        <result    column="push_log_tel"    property="pushLogTel" />
+        <result    column="push_log_email"    property="pushLogEmail" />
+        <result    column="push_log_status"    property="pushLogStatus" />
+        <result    column="push_log_result_msg"    property="pushLogResultMsg" />
+        <result    column="push_log_create_time"    property="pushLogCreateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.push_log_id,
+        t.bill_id,
+        t.push_log_type,
+        t.plat_id,
+        t.push_log_tel,
+        t.push_log_email,
+        t.push_log_status,
+        t.push_log_result_msg,
+        t.push_log_create_time
+    </sql>
+    <select id="getPushLogList" resultMap="BaseResultMap" parameterType="PushLog" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_push_log t
+        <where>
+            <if test="pushLogId != null ">
+                AND t.push_log_id = #{pushLogId}
+            </if >
+            <if test="billId != null ">
+                AND t.bill_id = #{billId}
+            </if >
+            <if test="pushLogType != null ">
+                AND t.push_log_type = #{pushLogType}
+            </if >
+            <if test="platId != null ">
+                AND t.plat_id = #{platId}
+            </if >
+            <if test="pushLogTel != null and pushLogTel != ''">
+                AND t.push_log_tel  like  CONCAT ('%',#{pushLogTel},'%')
+            </if >
+            <if test="pushLogEmail != null and pushLogEmail != ''">
+                AND t.push_log_email  like  CONCAT ('%',#{pushLogEmail},'%')
+            </if >
+            <if test="pushLogStatus != null ">
+                AND t.push_log_status = #{pushLogStatus}
+            </if >
+        </where>
+    </select>
+    <select id="getPushLogById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_ei_push_log t
+        where t.push_log_id= #{pushLogId}
+    </select>
+    <insert id="save" parameterType="PushLog" >
+        insert into
+        tb_rst_ei_push_log
+        (
+        push_log_id,
+        bill_id,
+        push_log_type,
+        plat_id,
+        push_log_tel,
+        push_log_email,
+        push_log_status,
+        push_log_result_msg
+        )
+        values
+        (
+        #{pushLogId},
+        #{billId},
+        #{pushLogType},
+        #{platId},
+        #{pushLogTel},
+        #{pushLogEmail},
+        #{pushLogStatus},
+        #{pushLogResultMsg}
+        )
+    </insert>
+    <update id="update" parameterType="PushLog" >
+        update
+        tb_rst_ei_push_log
+        <set >
+            <if test="billId != null ">
+                bill_id = #{billId},
+            </if >
+            <if test="pushLogType != null ">
+                push_log_type = #{pushLogType},
+            </if >
+            <if test="platId != null ">
+                plat_id = #{platId},
+            </if >
+            <if test="pushLogTel != null and pushLogTel != ''">
+                push_log_tel = #{pushLogTel},
+            </if >
+            <if test="pushLogEmail != null and pushLogEmail != ''">
+                push_log_email = #{pushLogEmail},
+            </if >
+            <if test="pushLogStatus != null ">
+                push_log_status = #{pushLogStatus},
+            </if >
+            <if test="pushLogResultMsg != null and pushLogResultMsg != ''">
+                push_log_result_msg = #{pushLogResultMsg},
+            </if >
+        </set >
+        where push_log_id= #{pushLogId}
+    </update>
+    <delete id="delete" parameterType="Integer" >
+        delete FROM
+        tb_rst_ei_push_log
+        where push_log_id=#{pushLogId}
+    </delete>
+</mapper>

+ 3 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/product/mapper/productMapper.xml

@@ -48,6 +48,9 @@
             <if test="colorBar != null and colorBar != ''">
                 AND c.color_bar = #{colorBar}
             </if>
+            <if test="colorJdProductId != null and colorJdProductId != ''">
+                AND c.color_jd_product_id = #{colorJdProductId}
+            </if>
             <if test="colorStatus != null">
                 and color_status = #{colorStatus}
             </if>

+ 223 - 0
watero-rst-service/src/main/java/com/iamberry/rst/util/JdServiceUtil.java

@@ -0,0 +1,223 @@
+package com.iamberry.rst.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.iamberry.file.FileToBase64;
+import com.iamberry.rst.core.ei.Billing;
+import com.iamberry.rst.core.ei.BillingItem;
+import com.iamberry.rst.core.ei.PlatformInfo;
+import com.iamberry.rst.core.ei.PushLog;
+import com.iamberry.rst.faces.ei.BillingService;
+import com.iamberry.rst.faces.ei.PlatformInfoService;
+import com.iamberry.rst.faces.ei.PushLogService;
+import com.iamberry.wechat.tools.NameUtils;
+import com.jd.open.api.sdk.DefaultJdClient;
+import com.jd.open.api.sdk.JdClient;
+import com.jd.open.api.sdk.JdException;
+import com.jd.open.api.sdk.domain.jinsuanpan.FinInvoiceOwnProvider.response.apply.InvoiceOwnResult;
+import com.jd.open.api.sdk.request.jinsuanpan.PopInvoiceSelfAmountRequest;
+import com.jd.open.api.sdk.request.jinsuanpan.PopInvoiceSelfApplyRequest;
+import com.jd.open.api.sdk.response.jinsuanpan.PopInvoiceSelfAmountResponse;
+import com.jd.open.api.sdk.response.jinsuanpan.PopInvoiceSelfApplyResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 京东对接后台商户服务
+ */
+@Service
+public class JdServiceUtil {
+    private Logger logger = LoggerFactory.getLogger(JdServiceUtil.class);
+    private String JD_URL = NameUtils.getConfig("JD_URL");
+    private String JD_ORDER = NameUtils.getConfig("JD_ORDER");
+
+    @Autowired
+    private PlatformInfoService platformInfoService;
+    @Autowired
+    private BillingService billingService;
+    @Autowired
+    private PushLogService pushLogService;
+
+    /**
+     * 京东商户平台查询订单信息
+     * @param orderId
+     * @param platId
+     * @json
+     * @return
+     * @throws JdException
+     */
+    public Billing getJdOrder(String orderId, Integer platId){
+        Billing billing = new Billing();
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(platId);
+        JdClient client = new DefaultJdClient(JD_URL,platformInfo.getPlatAccessToken(),platformInfo.getPlatAppKey(),platformInfo.getPlatAppSecret());
+        PopInvoiceSelfAmountRequest rq=new PopInvoiceSelfAmountRequest();
+        rq.setOrderId(orderId);
+        PopInvoiceSelfAmountResponse response = null;
+        try {
+            response = client.execute(rq);
+        } catch (JdException e) {
+            e.printStackTrace();
+            billing.setBillResultMsg("京东api调用失败!");
+            return billing;
+        }
+        String json = response.getMsg();
+
+        List<BillingItem> billingItemList = new ArrayList<BillingItem>();
+        String billCompanyName = "",billTaxNumber="";
+        Double amount = 0.00;
+        try{
+            JSONObject jsonObject = JSON.parseObject(json);
+            jsonObject = jsonObject.getJSONObject("jingdong_pop_invoice_self_amount_responce")
+                    .getJSONObject("queryamountforown_result")
+                    .getJSONObject("data");
+            amount = jsonObject.getDouble("shouldInvoiceAmount")*100;
+            billCompanyName =  jsonObject.getString("ivcTitle");    //公司名称
+            billTaxNumber =  jsonObject.getString("customerTaxNo"); //公司税号
+
+            JSONArray jsonArray = (JSONArray) jsonObject.get("orderShouldInvoiceAmountDetailList");
+            if(jsonArray != null && jsonArray.size()>0){
+                for(int i=0;i<jsonArray.size();i++){
+                    JSONObject insertObj = jsonArray.getJSONObject(i);
+                    String jdProductId = insertObj.getString("productId");
+                    Double invoiceAmount = insertObj.getDouble("shouldInvoiceAmount")*100;  //
+                    Double price = insertObj.getDouble("price")*100;
+                    Integer num = insertObj.getInteger("num");
+
+                    boolean isPresence = false; //是否存在 该产品
+                    if(jdProductId != null && !"".equals(jdProductId)){
+                        for (BillingItem billingItem : billingItemList){
+                            if(jdProductId.equals(billingItem.getJdProductId())){
+                                isPresence = true;  //存在该产品
+                                //id,代表是同一个订单项
+                                billingItem.setBillItemAmountPrice(billingItem.getBillItemAmountPrice() + Integer.valueOf(invoiceAmount.intValue()));    //因为京东有一个售价和一个优惠价(负数),所以同一个商品相加就行了
+                                billingItem.setBillItemUnitPrice(billingItem.getBillItemUnitPrice() + Integer.valueOf(price.intValue()));    //因为京东有一个售价和一个优惠价(负数),所以同一个商品相加就行了
+                                break;
+                            }
+                        }
+                    }
+                    if(!isPresence){
+                        //不存在该产品,添加该产品
+                        BillingItem bi = new BillingItem();
+                        bi.setBillItemNum(num);
+                        bi.setBillItemUnitPrice(Integer.valueOf(price.intValue()));
+                        bi.setBillItemAmountPrice(Integer.valueOf(invoiceAmount.intValue()));
+                        bi.setJdProductId(jdProductId);
+                        billingItemList.add(bi);
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            billing.setBillResultMsg("JSON解析失败!失败原因:"+json);
+            return billing;
+        }
+        billing.setBillingItemList(billingItemList);
+        billing.setBillAmount(Integer.valueOf(amount.intValue()));
+        billing.setBillCompanyName(billCompanyName);
+        billing.setBillTaxNumber(billTaxNumber);
+        return billing;
+    }
+
+    /**
+     *  上传蓝票
+     * @param pushLog
+     * @return
+     */
+    public PushLog pushInvo(PushLog pushLog,String path){
+        Billing billing = billingService.getBillingById(pushLog.getBillId());
+        PushLog ps = new PushLog();
+        ps.setPlatId(billing.getPlatId());
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(billing.getPlatId());
+        JdClient client = new DefaultJdClient(JD_URL,platformInfo.getPlatAccessToken(),platformInfo.getPlatAppKey(),platformInfo.getPlatAppSecret());
+        PopInvoiceSelfApplyRequest request=new PopInvoiceSelfApplyRequest();
+//        request.setProductId( "jingdong,yanfa,pop" );
+//        request.setProductName( "jingdong,yanfa,pop" );
+//        request.setNum( "123,234,345" );
+//        request.setPrice( "jingdong,yanfa,pop" );
+//        request.setSpec( "jingdong,yanfa,pop" );
+//        request.setUnit( "jingdong,yanfa,pop" );
+//        request.setTaxRate( "jingdong,yanfa,pop" );
+//        request.setTaxCategroyCode( "jingdong,yanfa,pop" );
+//        request.setIsTaxDiscount( "123,234,345" );
+//        request.setTaxDiscountContent( "jingdong,yanfa,pop" );
+//        request.setZeroTax( "jingdong,yanfa,pop" );
+//        request.setDeductions( "jingdong,yanfa,pop" );
+//        request.setImei( "jingdong,yanfa,pop" );
+//        request.setDiscount( "jingdong,yanfa,pop" );
+//        request.setFreight( "jingdong,yanfa,pop" );
+
+        if("1".equals(JD_ORDER)){
+            request.setOrderId(JD_ORDER);
+        }else{
+            request.setOrderId(billing.getBillOrderNo());  //订单编号
+        }
+
+        request.setReceiverTaxNo(platformInfo.getPlatTaxNumber() ); //销货方识别号(税号)
+        request.setReceiverName( platformInfo.getPlatCompanyName() );
+        request.setInvoiceCode(billing.getBillInvoiceCode() );   //	发票代码
+        request.setInvoiceNo(Integer.valueOf(billing.getBillInvoiceNum()));    //	发票号码
+        request.setIvcTitle( billing.getBillCompanyName());  //发票抬头
+
+        Double amount  = Double.valueOf(billing.getBillAmount());
+        amount = amount/100;
+        DecimalFormat df = new DecimalFormat("0.00");
+        String amountString = df.format(amount);
+        request.setTotalPrice( amountString );    //开票金额 两位小数     N
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String invoDate =  sdf.format( billing.getBillInvoiceDate());
+        request.setInvoiceTime(invoDate);
+
+        String filePath  = path + billing.getBillInvoiceFileUrl();
+        String base64 = "";
+        try {
+            base64 = FileToBase64.encodeBase64File(filePath);
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.info("发票转为base64失败!");
+            ps.setPushLogResultMsg("发票转为base64失败!");
+            ps.setPushLogStatus(2);
+            return ps;
+        }
+        request.setPdfInfo(base64);   //发票PDF文件二进制流base64
+
+//        request.setOrderType( 123 );
+//        request.setIvcContentType( 123 );
+//        request.setIvcContentName( "jingdong" );
+//        request.setEiRemark( "jingdong" );
+
+        request.setReceiverAddress(platformInfo.getPlatAddress());   //	销货方公司地址
+        request.setReceiverPhone( platformInfo.getPlatTel() );
+//        request.setReceiverBankName( "jingdong" );
+//        request.setReceiverBankAccount( "jingdong" );
+        request.setDrawer( platformInfo.getPlatBilling());  //	开票人platBilling
+        request.setPayee( platformInfo.getPlatPayee()); //	收款人platPayee
+        try {
+            PopInvoiceSelfApplyResponse response = client.execute(request);
+            String msg = response.getMsg();
+
+            InvoiceOwnResult invoiceOwnResult = response.getApplyinvoiceforownResult();
+            if(invoiceOwnResult.getSuccess()){
+                ps.setPushLogResultMsg(invoiceOwnResult.getMessage());
+                ps.setPushLogStatus(1);
+                pushLogService.save(ps);
+            }else{
+                ps.setPushLogResultMsg("发票上传失败!");
+                ps.setPushLogStatus(2);
+            }
+        } catch (JdException e) {
+            e.printStackTrace();
+        }
+        return ps;
+    }
+
+
+}

+ 384 - 0
watero-rst-service/src/main/java/com/iamberry/rst/util/NuoNuoServiceUtil.java

@@ -0,0 +1,384 @@
+package com.iamberry.rst.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.iamberry.file.DownloadFile;
+import com.iamberry.nuonuo.bean.PrivateData;
+import com.iamberry.nuonuo.bean.PublicData;
+import com.iamberry.nuonuo.bean.RequestMode;
+import com.iamberry.nuonuo.exception.OpensnsException;
+import com.iamberry.nuonuo.oauth.Oauth2AccessToken;
+import com.iamberry.nuonuo.service.OpenApiV1;
+import com.iamberry.nuonuo.util.StateData;
+import com.iamberry.rst.core.ei.Billing;
+import com.iamberry.rst.core.ei.BillingItem;
+import com.iamberry.rst.core.ei.InvoPlatform;
+import com.iamberry.rst.core.ei.PlatformInfo;
+import com.iamberry.rst.faces.ei.BillingService;
+import com.iamberry.rst.faces.ei.InvoPlatformService;
+import com.iamberry.rst.faces.ei.PlatformInfoService;
+import com.iamberry.wechat.tools.NameUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 诺诺开票系统
+ */
+@Service
+public class NuoNuoServiceUtil {
+    private Logger logger = LoggerFactory.getLogger(NuoNuoServiceUtil.class);
+    private static String NUONUO_URL = NameUtils.getConfig("NUONUO_URL");
+    private static Integer NUONUO_ID = Integer.valueOf(NameUtils.getConfig("NUONUO_ID"));
+
+    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+    @Autowired
+    private InvoPlatformService invoPlatformService;
+    @Autowired
+    private PlatformInfoService platformInfoService;
+    @Autowired
+    private BillingService billingService;
+
+    /**
+     * 开票
+     * @param billing
+     * @return
+     */
+    public String nuoNInvo(Billing billing){
+        InvoPlatform invoPlatform  = invoPlatformService.getInvoPlatformById(billing.getInvoPlatId());
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(billing.getPlatId());
+
+        if(StateData.app_id != billing.getInvoPlatId()){
+            this.setHeader(invoPlatform,platformInfo);
+        }
+        String msg = this.setToken(invoPlatform);
+        if(!"success".equals(msg)){
+            return msg;
+        }
+
+        Map<String,String> headers = getHeaders();
+        PublicData pdData = getPublicData("nuonuo.electronInvoice.requestBilling");
+        PrivateData<Object> pvData = new PrivateData<Object>();
+        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
+        List<Map<String,Object>> list_invoiceDetail = new ArrayList<Map<String,Object>>();
+        Map<String,Object> map_s = new HashMap<String,Object>();
+        Map<String,Object> map_order = new HashMap<String,Object>();
+
+        map_order.put("buyerName", billing.getBillCompanyName()); //购方名称,  个人填“个人”
+        map_order.put("buyerTaxNum", billing.getBillTaxNumber()); //购方税号(企业要填,个人可为空)
+        if(billing.getBillTel() == null || "".equals(billing.getBillTel())){
+            map_order.put("buyerPhone", "13265476840"); //购方手机(开票成功会短信提醒购方,不受推送方式影响)
+        }else{
+            map_order.put("buyerPhone", billing.getBillTel()); //购方手机(开票成功会短信提醒购方,不受推送方式影响)
+        }
+        map_order.put("buyerAddress", billing.getBillAddress());   //购方地址
+
+        String billBankInfo =  getStr(billing.getBillBankName())  + getStr(billing.getBillBankNumber());
+        map_order.put("buyerAccount", billBankInfo);   //	购方银行账号及开户行地址
+        map_order.put("orderNo", billing.getBillOrderNo());   //订单号(每个企业唯一)
+
+        if(billing.getBillOrderDate() == null){
+            map_order.put("invoiceDate", sdf.format(new Date()));    //订单时间
+        }else{
+            map_order.put("invoiceDate", sdf.format(billing.getBillOrderDate()));    //订单时间
+        }
+
+        map_order.put("clerk", platformInfo.getPlatBilling());  //开票员 platBilling
+        String platBankInfo =  getStr(platformInfo.getPlatBankName())  + getStr(platformInfo.getPlatBankNumber());
+        map_order.put("salerAccount", platBankInfo);       //销方银行账号和开户行地址
+        map_order.put("salerTel", platformInfo.getPlatTel());
+        map_order.put("salerAddress", platformInfo.getPlatAddress());
+
+        if(1 == NUONUO_ID){  //表示沙箱环境
+            map_order.put("salerTaxNum", "339901999999142");
+        }else{
+            map_order.put("salerTaxNum", platformInfo.getPlatTaxNumber());
+        }
+
+        map_order.put("invoiceType", "1");  //开票类型:1,正票;2,红票
+        map_order.put("remark", "");    //冲红时,在备注中注明“对应正数发票代码:XXXXXXXXX号码:YYYYYYYY”文案,其中“X”为发票代码,“Y”为发票号码,可以不填,接口会自动添加该文案
+        map_order.put("payee", platformInfo.getPlatPayee());   //收款人platPayee
+        map_order.put("checker",platformInfo.getPlatReviewer());     //复核人   platReviewer
+        map_order.put("invoiceCode", ""); //	冲红时填写的对应蓝票发票代码(红票必填,不满12位请左补0)
+        map_order.put("invoiceNum", "");  //冲红时填写的对应蓝票发票号码(红票必填,不满8位请左补0)
+        map_order.put("pushMode", "1"); //推送方式:-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
+        map_order.put("email", ""); //推送邮箱(pushMode为0或2时,此项为必填)
+        map_order.put("listFlag", "1"); //清单标志:0,根据项目名称数,自动产生清单;1,将项目信息打印至清单
+        map_order.put("listName", "详见销货清单");  //清单项目名称:打印清单时对应发票票面项目名称(listFlag为1是,此项为必填,默认为“详见销货清单”)
+        map_order.put("buyerTel", getStr(billing.getBillTel()));
+        map_order.put("proxyInvoiceFlag", "0");  //代开标志:0非代开;1代开。
+        map_order.put("departmentId", "");  //部门门店id(诺诺系统中的id)  N
+        map_order.put("clerkId", "");   //开票员id(诺诺系统中的id) N
+
+        for (BillingItem billingItem : billing.getBillingItemList()) {
+            Map<String,Object> map_invoiceDetails = new HashMap<String,Object>();
+            map_invoiceDetails.put("goodsName", billingItem.getBillItemProductName()+"("+ billingItem.getBillItemColorName() +")");   //商品名称(如invoiceLineProperty =1,则此商品行为折扣行,折扣行不允许多行折扣,折扣行必须紧邻被折扣行,商品名称必须与被折扣行一致)
+            map_invoiceDetails.put("num", billingItem.getBillItemNum());
+            map_invoiceDetails.put("withTaxFlag", "1"); //单价含税标志,0:不含税,1:含税
+            map_invoiceDetails.put("price", Double.valueOf(billingItem.getBillItemUnitPrice())/100);
+            map_invoiceDetails.put("taxRate", "0.13");  //税率
+            map_invoiceDetails.put("specType", "");    //规格型号
+            map_invoiceDetails.put("unit", "");    //	单位
+            map_invoiceDetails.put("goodsCode", billingItem.getBillItemColorBar());   //商品编码(商品税收分类编码开发者自行填写) -- rst 标准69吗
+            map_invoiceDetails.put("selfCode", billingItem.getJdProductId());   //自行编码(可不填) - 京东
+            map_invoiceDetails.put("invoiceLineProperty", "0"); //发票行性质:0,正常行;1,折扣行;2,被折扣行
+            map_invoiceDetails.put("favouredPolicyFlag", "0");  //优惠政策标识:0,不使用;1,使用
+            map_invoiceDetails.put("favouredPolicyName", null); //增值税特殊管理(优惠政策名称),当favouredPolicyFlag为1时,此项必填
+            map_invoiceDetails.put("zeroRateFlag", null);
+            map_invoiceDetails.put("deduction", null);  //扣除额。差额征收时填写,目前只支持填写一项
+//            map_invoiceDetails.put("tax", "6.45");
+            map_invoiceDetails.put("taxIncludedAmount", null);   //含税金额,[不含税金额] + [税额] = [含税金额],红票为负。不含税金额、税额、含税金额任何一个不传时,会根据传入的单价,数量进行计算,可能和实际数值存在误差,建议都传入
+            map_invoiceDetails.put("taxExcludedAmount", null);   //不含税金额。红票为负。不含税金额、税额、含税金额任何一个不传时,会根据传入的单价,数量进行计算,可能和实际数值存在误差,建议都传入
+            list_invoiceDetail.add(map_invoiceDetails);
+        }
+
+        map_order.put("invoiceDetail", list_invoiceDetail);
+        map_order.put("invoiceLine", "p");  //发票种类:p,普通发票(电票)(默认);c,普通发票(纸票);s,专用发票;e,收购发票(电票);f,收购发票(纸质)
+        map_order.put("productOilFlag", "0");   //成品油标志:0,非成品油(默认);1,成品油
+        map_s.put("order", map_order);
+        list.add(map_s);
+        pvData.setServicedata(list);
+        RequestMode requestMode = getRequestMode(pdData,pvData);
+        OpenApiV1 sdk =  new OpenApiV1();
+        String result = "";
+        try {
+            result = sdk.handle(NUONUO_URL,headers, requestMode);
+            String invoiceSerialNum = "";  //调用结果与流水号
+            Integer status = 0;     //状态 0:未开票; 1:开票中; 2为开票成功 3:开票失败;
+            JSONObject jsonObject = JSON.parseObject(result);
+            String code = jsonObject.getString("code");
+            if("E0000".equals(code)){
+                status = 1;
+                JSONObject jo = jsonObject.getJSONObject("result");
+                invoiceSerialNum = jo.getString("invoiceSerialNum");
+                msg = "success";
+            }else if("E9106".equals(code)){
+                status = 1;
+                msg = "success";
+            }else{
+                msg =  "发票生成错误:"+result;
+            }
+            Billing bl = new Billing();
+            bl.setBillId(billing.getBillId());
+            bl.setBillInvoiceSerialNum(invoiceSerialNum);  //billInvoiceSerialNum
+            bl.setBillResultMsg(msg);
+            bl.setBillStatus(status);
+            Integer flag = billingService.update(bl);
+        } catch (OpensnsException e) {
+            e.printStackTrace();
+            msg =  "发票生成错误:"+result;
+        }
+        return msg;
+    }
+
+    /**
+     *  获取电子发票
+     * @return
+     */
+    public boolean invoGetByNuoNuo(String path){
+        boolean flag = true;
+
+        Billing bl = new Billing();
+        bl.setBillStatus(1);
+        List<Billing> billingList = billingService.getBillingList(bl);
+        if(billingList != null && billingList.size() > 0){
+            List<String> list_s = new ArrayList<>();
+            Integer platId = 0;
+            for (Billing bi:billingList) {
+                platId = bi.getPlatId();
+                list_s.add(bi.getBillInvoiceSerialNum());
+            }
+            invoGetByNuoNuoList(NUONUO_ID,platId,list_s,path);
+        }
+        return flag;
+    }
+
+    /**
+     *  获取电子发票
+     * @param InvoPlatId  诺诺平台在数据库的id
+     * @param platId    所属平台
+     * @param list_s
+     * @param path E:\java-work\iamberry-work\watero-rst-web\target\watero-rst-web\common
+     * @return
+     */
+    public void invoGetByNuoNuoList(Integer InvoPlatId,Integer platId, List<String> list_s,String path){
+        InvoPlatform invoPlatform  = invoPlatformService.getInvoPlatformById(platId);
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(InvoPlatId);
+        if(StateData.app_id != InvoPlatId){
+            this.setHeader(invoPlatform,platformInfo);
+        }
+       this.setToken(invoPlatform);
+
+        Map<String,String> headers = getHeaders();
+        PublicData pdData = getPublicData("nuonuo.electronInvoice.CheckEInvoice");
+        PrivateData<Object> pvData = new PrivateData<Object>();
+        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
+        Map<String,Object> map_s = new HashMap<String,Object>();
+        map_s.put("invoiceSerialNum", list_s);
+        list.add(map_s);
+        pvData.setServicedata(list);
+        RequestMode requestMode = getRequestMode(pdData,pvData);
+        OpenApiV1 sdk = new OpenApiV1();
+        String result = null;
+        try {
+            result = sdk.handle(NUONUO_URL,headers, requestMode);
+            JSONObject jsonObject = JSON.parseObject(result);
+            String res = jsonObject.getString("result");
+            JSONArray jsonArray = JSON.parseArray(res);
+            for (int i=0;i<jsonArray.size();i++){
+                JSONObject jo = jsonArray.getJSONObject(i);
+                Integer status = jo.getInteger("status");
+                String orderNo = jo.getString("orderNo");
+                String statusMsg = jo.getString("statusMsg");
+                Billing billing = new Billing();
+                billing.setBillOrderNo(orderNo);
+                billing.setBillResultMsg(statusMsg);
+                if(2 == status){
+                    String invoiceFileUrl = jo.getString("invoiceFileUrl");
+                    String invoiceDate = jo.getString("invoiceDate");   //开票日期
+                    String invoiceLine = jo.getString("invoiceLine");
+                    String invoiceCode = jo.getString("invoiceCode");   //发票代码
+                    String invoiceNum = jo.getString("invoiceNum"); ///发票号码
+                    Double taxExcludedAmount = jo.getDouble("taxExcludedAmount")*100;   //不含税金额  48*
+                    Double taxIncludedAmount = jo.getDouble("taxIncludedAmount")*100;   //总  48*
+
+                    String pdfUnitPath = "common/ei/pdf";
+
+                    long start = System.currentTimeMillis();
+                    DownloadFile.downLoadByUrl(invoiceFileUrl,orderNo+".pdf",path+pdfUnitPath);
+                    long end = System.currentTimeMillis();
+                    System.out.println("下载pdf时间为:"+ (end-start));
+
+                    String pdfFilePath = pdfUnitPath+ "/" + orderNo+".pdf";
+                    billing.setBillStatus(status);
+                    billing.setBillInvoiceFileUrl(pdfFilePath); //billInvoiceFileUrl
+                    billing.setBillInvoiceImageUrl(invoiceFileUrl); //billInvoiceImageUrl
+                    billing.setBillInvoiceDate(sdf.parse(invoiceDate));
+                    billing.setBillInvoiceLine(invoiceLine);
+                    billing.setBillTaxExcludedAmount(Integer.valueOf(taxExcludedAmount.intValue()));
+                    billing.setBillTaxIncludedAmount(Integer.valueOf(taxIncludedAmount.intValue()));
+                    billing.setBillInvoiceCode(invoiceCode);
+                    billing.setBillInvoiceNum(invoiceNum);
+                    Integer flag = billingService.updateByOrderNo(billing);
+                    if(flag < 1){
+                        logger.info("发票修改失败:"+result);
+                        billing.setBillStatus(3);
+                    }
+                }else{
+                    logger.info("订单编号:"+orderNo+",发票还在生成中!");
+                    billing.setBillStatus(status);
+                }
+                Integer flag = billingService.updateByOrderNo(billing);
+            }
+        } catch (OpensnsException e) {
+            e.printStackTrace();
+            logger.info("获取发票信息失败:"+list_s.toString());
+        }catch (Exception e){
+            e.printStackTrace();
+            logger.info("获取发票信息失败:"+result);
+        }
+    }
+
+    /**
+     * 如果token过期,获取新的token
+     * @param invoPlatform
+     * @return
+     */
+    private String setToken(InvoPlatform invoPlatform){
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.DAY_OF_MONTH, 1); //因为有效期24小时,所以加一天
+        if(invoPlatform.getInvoPlatEndDate() == null || invoPlatform.getInvoPlatEndDate().before(new Date())){   //当前时间大于截止时间
+            StateData.grant_type_token = "authorization_code";
+            String msg =  Oauth2AccessToken.getAccessToken();
+            String token = "";
+
+            try{
+                JSONObject jsonObject = JSON.parseObject(msg);    //{"access_token":"fdd052d08bbad090aeff770tg7h2ehxs","expires_in":86400}
+                token = jsonObject.getString("access_token");
+                if(token == null || "".equals(token)){
+                    throw new Exception();
+                }
+            }catch (Exception e){
+                logger.info("获取新token失败,获取token结果:"+msg);
+                return "获取新token失败,获取token结果:"+msg;
+            }
+
+            InvoPlatform ip = new InvoPlatform();
+            ip.setInvoPlatId(invoPlatform.getInvoPlatId());
+            ip.setInvoPlatAccessToken(token);
+            ip.setInvoPlatEndDate(calendar.getTime());
+            Integer flag = invoPlatformService.update(ip);
+            if(flag < 0){
+                logger.info("刷新诺诺token失败");
+                return "刷新诺诺token失败";
+            }
+            StateData.app_accessToken = token;
+        }
+        return "success";
+    }
+
+    /**
+     * 设置key
+     * @param invoPlatform
+     * @param platformInfo
+     */
+    private void setHeader(InvoPlatform invoPlatform,PlatformInfo platformInfo){
+        StateData.app_id = invoPlatform.getInvoPlatId(); //
+        StateData.app_secret = invoPlatform.getInvoPlatAppSecret(); // 填写本APP申请的 appSecret,注意区分正式环境与沙箱环境参数,如: 9B4CA8CEA5EE4823
+        StateData.app_key = invoPlatform.getInvoPlatAppKey(); // 填写本APP申请的 appKey,注意区分正式环境与沙箱环境参数,如:fk5dWkPA
+        StateData.app_accessToken = invoPlatform.getInvoPlatAccessToken(); // 填写本APP申请的 令牌 ,注意区分正式环境与沙箱环境参数,如://{"access_token":"fdd052d08bbad090aeff770kgia1mkms","expires_in":86400}
+        StateData.app_signType = "AES"; // 填写本APP传输数据加密格式,如:AES/AES
+
+        if(1 == NUONUO_ID){  //表示沙箱环境
+            StateData.user_Tax =  "339901999999142";
+        }else{
+            StateData.user_Tax = platformInfo.getPlatTaxNumber(); //销方税号
+        }
+
+        Oauth2AccessToken.client_id = invoPlatform.getInvoPlatAppKey();  //创建应用后,分配给应用的appKey
+        Oauth2AccessToken.client_secret = invoPlatform.getInvoPlatAppSecret(); //创建应用后,分配给应用的appSecret
+        Oauth2AccessToken.token_grant_type = "client_credentials";   //授权类型,在本步骤中,此值为“authorization_code” ,获取token用client_credentials
+    }
+
+    // 定义请求头数据
+    private Map<String, String> getHeaders() {
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("appKey", StateData.app_key); // 用户申请的appkey
+        headers.put("accessToken", StateData.app_accessToken); // 用户Oauth登录后得到的令牌accessToken
+        headers.put("compress", StateData.app_compressType);// 压缩方式:提供GZIP 置空“”不压缩
+        headers.put("signMethod",  StateData.app_signType); // 加密方式:提供AES/AES,不可为空
+        headers.put("dataType", StateData.app_dataType); // 数据请求格式: JSON/XML
+        headers.put("appRate", StateData.app_rate); // app并发请求数 ,平台默认10如需升级请联系开放平台
+        headers.put("userTax", StateData.user_Tax); // ISV下商家需要填写当前商户税号,普通商家模式用户可以不填写此值
+        headers.put("Content-Type", StateData.contentType); // http发送模式
+        return headers;
+    }
+
+    // 定义请求体中的公共数据
+    private  PublicData getPublicData(String api) {
+        PublicData pdData = new PublicData();
+        pdData.setVersion(StateData.app_apiVersion); // API版本
+        pdData.setTimestamp(String.valueOf(System.currentTimeMillis()));
+        pdData.setMethod(api);// API名称
+        return pdData;
+    }
+
+    private  RequestMode getRequestMode(PublicData pdata, PrivateData<Object> pvData) {
+        RequestMode requestMode = new RequestMode();
+        requestMode.setPrivate(pvData);
+        requestMode.setPublic(pdata);
+        return requestMode;
+    }
+
+    private static String getStr(String str){
+        if(str == null)
+            return "";
+        return str;
+    }
+}

+ 18 - 0
watero-rst-web/pom.xml

@@ -133,6 +133,24 @@
             <version>6.0.0</version>
         </dependency>
 
+
+        <!-- 工作流 -->
+     <!--   <dependency>
+            <groupId>org.codehaus</groupId>
+            <artifactId>jackson</artifactId>
+            <version>1.9.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus</groupId>
+            <artifactId>jackson-core-asl</artifactId>
+            <version>1.9.8</version>
+        </dependency>-->
+
+
+
+
+
+
     </dependencies>
 
     <build>

+ 349 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/ei/BillingController.java

@@ -0,0 +1,349 @@
+package com.iamberry.rst.controllers.ei;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.iamberry.rst.core.ei.Billing;
+import com.iamberry.rst.core.ei.BillingItem;
+import com.iamberry.rst.core.ei.PlatformInfo;
+import com.iamberry.rst.core.ei.PushLog;
+import com.iamberry.rst.core.order.ProductColor;
+import com.iamberry.rst.core.page.PagedResult;
+import com.iamberry.rst.core.sys.Admin;
+import com.iamberry.rst.faces.ei.BillingItemService;
+import com.iamberry.rst.faces.ei.BillingService;
+import com.iamberry.rst.faces.ei.PlatformInfoService;
+import com.iamberry.rst.faces.product.ProductService;
+import com.iamberry.rst.util.JdServiceUtil;
+import com.iamberry.rst.util.NuoNuoServiceUtil;
+import com.iamberry.rst.utils.AdminUtils;
+import com.iamberry.rst.utils.StitchAttrUtil;
+import com.iamberry.wechat.tools.NameUtils;
+import com.iamberry.wechat.tools.ResponseJson;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 发票管理
+ */
+@Controller
+@RequestMapping("/admin/ei_billing")
+public class BillingController {
+    private Logger logger = LoggerFactory.getLogger(BillingController.class);
+    private static Integer NUONUO_ID = Integer.valueOf(NameUtils.getConfig("NUONUO_ID"));
+
+    @Autowired
+    private  BillingService billingService;
+    @Autowired
+    private BillingItemService billingItemService;
+    @Autowired
+    private PlatformInfoService platformInfoService;
+    @Autowired
+    private ProductService productService;
+    @Autowired
+    private JdServiceUtil jdServiceUtil;
+    @Autowired
+    private NuoNuoServiceUtil nuoNuoServiceUtil;
+
+    /**
+     * 查询客户基本信息列表
+     *
+     * @return
+     * @author LJK
+     * @date 时间
+     */
+    @RequiresPermissions("ei:billing:list")
+    @RequestMapping("/billing_list")
+    public ModelAndView billingList(HttpServletRequest request, Billing billing,
+                                          @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
+                                          @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
+                                          @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
+        ModelAndView mv = new ModelAndView("ei/ei_billing_list");
+
+        PagedResult<Billing> pagedResult = billingService.getBillingPage(pageNO, pageSize, billing, totalNum == 0);
+        if (totalNum != 0) {
+            pagedResult.setTotal(totalNum);
+        }
+
+//        String path = request.getSession().getServletContext().getRealPath("/");
+//        boolean flag = nuoNuoServiceUtil.invoGetByNuoNuo(path);
+
+        StitchAttrUtil.getSa()
+                .addDatePro("yyyy-MM-dd HH:mm:ss","startDate","endDate")
+                .setModelAndView(billing, mv, "/admin/customerBasic/listCustomerBasic", pagedResult);
+        return mv;
+    }
+
+
+    /**
+     *  to添加发票
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping("/to_add_billing")
+    @RequiresPermissions("ei:billing:add")
+    public ModelAndView toAddBilling(HttpServletRequest request) throws Exception {
+        ModelAndView mv = new ModelAndView("ei/ei_add_billing");
+        PlatformInfo platformInfo = new PlatformInfo();
+        platformInfo.setPlatStatus(1);
+        List<PlatformInfo> platformInfoList = platformInfoService.getPlatformInfoList(platformInfo);
+        mv.addObject("platformInfoList",platformInfoList);
+        return mv;
+    }
+
+    /**
+     * 查询发票金额
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/select_billing_amount")
+    @RequiresPermissions("ei:billing:add")
+    public ResponseJson selectBillingAmount(HttpServletRequest request,Integer platId,String billOrderNo) throws Exception {
+        ResponseJson rj = new ResponseJson();
+
+        if(null == billOrderNo || "".equals(billOrderNo)){
+            rj = new ResponseJson(500, "订单号不能为空", 500);
+            return rj;
+        }
+
+        if(platId == null || platId == 0){
+            rj = new ResponseJson(500, "查询所属平台失败", 500);
+            return rj;
+        }
+
+        Billing billing = jdServiceUtil.getJdOrder(billOrderNo,platId);
+        if(billing.getBillCompanyName() == null || billing.getBillTaxNumber() == null){
+            rj = new ResponseJson(500, "获取订单信息失败"+billing.getBillResultMsg(), 500);
+            return  rj;
+        }
+
+        for (BillingItem billingItem: billing.getBillingItemList()) {
+            ProductColor productColor = new ProductColor();
+            productColor.setColorJdProductId(billingItem.getJdProductId());
+            List<ProductColor> pclist = productService.listproductAndColor(productColor);
+            if(pclist != null && pclist.size()>0){
+                productColor = pclist.get(0);
+                billingItem.setColorId(productColor.getColorId());
+                billingItem.setProductId(productColor.getColorProductId());
+                billingItem.setBillItemProductName(productColor.getProductName());
+                billingItem.setBillItemColorName(productColor.getColorName());
+            }
+        }
+
+        rj = new ResponseJson(200, "获取成功", 200);
+        rj.addResponseKeyValue("billing",billing);
+        return  rj;
+    }
+
+
+    /**
+     * 添加发票
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/add_billing")
+    @RequiresPermissions("ei:billing:add")
+    public ResponseJson addBilling(HttpServletRequest request,Billing billing,String orderItemString) throws Exception {
+        ResponseJson rj = new ResponseJson();
+        if(null == billing.getBillOrderNo() || "".equals(billing.getBillOrderNo())){
+            rj = new ResponseJson(500, "订单号不能为空", 500);
+            return rj;
+        }
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(billing.getPlatId());
+        if(platformInfo == null){
+            rj = new ResponseJson(500, "查询所属平台失败", 500);
+            return rj;
+        }
+
+        Admin admin = AdminUtils.getLoginAdmin();
+
+        List<BillingItem> billingItemList = JSONArray.parseArray(orderItemString, BillingItem.class);
+        for (BillingItem billingItem:billingItemList) {
+            if(billingItem.getBillItemNum() > 0 && billingItem.getColorId() > 0){
+                ProductColor productColor = productService.getProduceColor(billingItem.getColorId());
+                if(productColor == null){
+                    return  new ResponseJson(500, "商品不存在", 500);
+                }
+                billingItem.setProductId(productColor.getColorProductId());  ////产品id
+                billingItem.setBillItemProductType(productColor.getProductType());
+                billingItem.setBillItemProductName(productColor.getProductName());
+                billingItem.setBillItemColorName(productColor.getColorName());
+            }else{
+                return  new ResponseJson(500, "添加商品错误", 500);
+            }
+        }
+        billing.setBillingItemList(billingItemList);
+        billing.setBillStatus(0);   //未开票
+        billing.setBillCreateUser(admin.getAdminId());
+
+        Integer flag = 0;
+        try {
+            flag = billingService.save(billing);
+        }catch (RuntimeException e){
+            e.printStackTrace();
+            return  new ResponseJson(500, "添加错误"+e.getMessage(), 500);
+        }
+
+        String msg = "",invoiceSerialNum = "";  //调用结果与流水号
+        Integer status = 0;     //状态 0:未开票; 1:开票中; 2为开票成功 3:开票失败;
+        Billing bl = new Billing();
+        bl.setBillId(billing.getBillId());
+        try{
+            billing.setInvoPlatId(NUONUO_ID);   //获取诺诺的平台id
+            //调用诺诺接口生成发票流水号
+            msg = nuoNuoServiceUtil.nuoNInvo(billing);  //{"result":{"invoiceSerialNum":"19041710353801188438"},"code":"E0000","describe":"开票提交成功"}
+
+            JSONObject jsonObject = JSON.parseObject(msg);
+            String code = jsonObject.getString("code");
+            if("E0000".equals(code)){
+                status = 1;
+                JSONObject jo = jsonObject.getJSONObject("result");
+                invoiceSerialNum = jo.getString("invoiceSerialNum");
+                rj = new ResponseJson(200, "发票正在生成中,可到列表页面等待发票生成完成", 200);
+            }else{
+                msg =  "发票生成错误:"+msg;
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            msg =  "发票生成错误:"+msg;
+        }
+
+        bl.setBillId(billing.getBillId());
+        bl.setBillInvoiceSerialNum(invoiceSerialNum);  //billInvoiceSerialNum
+        bl.setBillResultMsg(msg);
+        bl.setBillStatus(status);
+        flag = billingService.update(bl);
+        if(status == 1){
+            List<String> list_s = new ArrayList<>();
+            list_s.add(invoiceSerialNum);
+            String path = request.getSession().getServletContext().getRealPath("/");
+            nuoNuoServiceUtil.invoGetByNuoNuoList(NUONUO_ID,billing.getPlatId(),list_s,path);
+            return rj;
+        }
+        return  new ResponseJson(500, "发票生成失败,失败原因("+msg+")", 500);
+    }
+
+    /**
+     * 重新开票
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/re_invoice")
+    @RequiresPermissions("ei:billing:add")
+    public ResponseJson reInvoice(HttpServletRequest request,Integer billId) throws Exception {
+        ResponseJson rj = new ResponseJson();
+        Billing billing = billingService.getBillingById(billId);
+        PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(billing.getPlatId());
+        if(platformInfo == null){
+            rj = new ResponseJson(500, "查询所属平台失败", 500);
+            return rj;
+        }
+        BillingItem billingItem = new BillingItem();
+        billingItem.setBillId(billId);
+        List<BillingItem> billingItemList =  billingItemService.getBillingItemList(billingItem);
+        billing.setBillingItemList(billingItemList);
+
+        String msg = "";
+        try{
+            billing.setInvoPlatId(NUONUO_ID);   //获取诺诺的平台id
+            //调用诺诺接口生成发票流水号
+            msg = nuoNuoServiceUtil.nuoNInvo(billing);  //{"result":{"invoiceSerialNum":"19041710353801188438"},"code":"E0000","describe":"开票提交成功"}
+            if(!"success".equals(msg)){
+                return  new ResponseJson(500, "发票生成失败,失败原因("+msg+")", 500);
+            }
+
+            Billing bill = billingService.getBillingById(billId);
+            if(bill.getBillInvoiceSerialNum() != null && !"".equals(bill.getBillInvoiceSerialNum())){
+                List<String> list_s = new ArrayList<>();
+                list_s.add(bill.getBillInvoiceSerialNum());
+                String path = request.getSession().getServletContext().getRealPath("/");
+                nuoNuoServiceUtil.invoGetByNuoNuoList(NUONUO_ID,billing.getPlatId(),list_s,path);
+            }
+
+            return new ResponseJson(200, "发票正在生成中,可到列表页面等待发票生成完成", 200);
+
+        }catch (Exception e){
+            e.printStackTrace();
+            return  new ResponseJson(500, "发票生成失败,失败原因("+msg+")", 500);
+        }
+    }
+
+    /**
+     *  查询发票详情
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping("/to_order_info")
+    @RequiresPermissions("ei:billing:list")
+    public ModelAndView toOrderInfo(HttpServletRequest request,Integer billId) throws Exception {
+        ModelAndView mv = new ModelAndView("ei/ei_billing_info");
+        Billing billing =  billingService.getBillingById(billId);
+        BillingItem billingItem = new BillingItem();
+        billingItem.setBillId(billId);
+        List<BillingItem> billingItemList =  billingItemService.getBillingItemList(billingItem);
+        billing.setBillingItemList(billingItemList);
+        mv.addObject("billing",billing);
+        return mv;
+    }
+
+    /**
+     * 推送发票
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/push_upload")
+    @RequiresPermissions("ei:billing:push")
+    public ResponseJson pushUpload(HttpServletRequest request,PushLog pushLog) throws Exception {
+        ResponseJson rj = new ResponseJson();
+        if(pushLog == null || pushLog.getBillId() == null || pushLog.getPushLogType() == null){
+            rj = new ResponseJson(500, "未查询到该开票记录", 500);
+            return rj;
+        }
+        String path = request.getSession().getServletContext().getRealPath("/");
+        PushLog jdPushLog = new PushLog();
+        switch (pushLog.getPushLogType()){ // 1:所属平台 2:短信 3:邮箱
+            case 1:
+                try{
+                    jdPushLog = jdServiceUtil.pushInvo(pushLog,path);
+                }catch (Exception e){
+                    e.printStackTrace();
+                    rj = new ResponseJson(500, "上传失败,失败原因:"+e.getMessage(), 500);
+                    return rj;
+                }
+                break;
+            case 2:
+                //Billing billing = billingService.getBillingById(pushLog.getBillId());
+                break;
+            case 3:
+                break;
+            default:
+                break;
+        }
+        if(jdPushLog.getPushLogStatus() == 1){
+            return new ResponseJson(200, "上传发票成功", 200);
+        }else{
+            return new ResponseJson(500, "上传发票失败,"+jdPushLog.getPushLogResultMsg(), 500);
+        }
+    }
+}

+ 49 - 50
watero-rst-web/src/main/java/com/iamberry/rst/controllers/mq/MQTask.java

@@ -380,55 +380,55 @@ public class MQTask implements InitializingBean {
 	 * 查询省市县id
 	 * @param
 	 */
-	public Map<String,String> provincesCitiesCounties(EfastOrder efastOrder){
-		Map<String,String> map = new HashMap<String, String>();
-		String province = "";
-		String city = "";
-		String zone = "";
-		//省
-		if(efastOrder.getOrderProvince().substring(efastOrder.getOrderProvince().length() - 1,efastOrder.getOrderProvince().length()).equals("省")){
-			province = efastOrder.getOrderProvince().substring(0,efastOrder.getOrderProvince().length() - 1);
-		}else{
-			province = efastOrder.getOrderProvince();
-		}
-		Province provinceinfo = new Province();
-		provinceinfo.setProvince(province);
-		List<Province> provinceList = addressService.listProvince(provinceinfo);
-		if(provinceList.size() < 1){
-			provinceinfo.setProvince(null);
-			provinceList = addressService.listProvince(provinceinfo);
-		}
-		map.put("provinceId",String.valueOf(provinceList.get(0).getProvinceId()));
-		map.put("province",provinceList.get(0).getProvince());
-
-
-		//市
-		city = efastOrder.getOrderCity().substring(0,efastOrder.getOrderCity().length() - 1);
-		City cityInfo = new City();
-		cityInfo.setCity(city);
-		List<City> cityList = addressService.listCity(cityInfo);
-		if(cityList.size() < 1){
-			cityInfo.setCity(null);
-			cityInfo.setProvinceId(provinceList.get(0).getProvinceId());
-			cityList = addressService.listCity(cityInfo);
-		}
-		map.put("cityId",String.valueOf(cityList.get(0).getCityId()));
-		map.put("city",cityList.get(0).getCity());
-
-		//区
-		zone = efastOrder.getOrderArea().substring(0,efastOrder.getOrderArea().length() - 1);
-		District district = new  District();
-		district.setDistrict(zone);
-		List<District> districtList = addressService.listDistrict(district);
-		if(districtList.size() < 1){
-			district.setDistrict(null);
-			district.setCityId(cityList.get(0).getCityId());
-			districtList = addressService.listDistrict(district);
-		}
-		map.put("districtId",String.valueOf(districtList.get(0).getDistrictId()));
-		map.put("district",districtList.get(0).getDistrict());
-		return map;
-	}
+//	public Map<String,String> provincesCitiesCounties(EfastOrder efastOrder){
+//		Map<String,String> map = new HashMap<String, String>();
+//		String province = "";
+//		String city = "";
+//		String zone = "";
+//		//省
+//		if(efastOrder.getOrderProvince().substring(efastOrder.getOrderProvince().length() - 1,efastOrder.getOrderProvince().length()).equals("省")){
+//			province = efastOrder.getOrderProvince().substring(0,efastOrder.getOrderProvince().length() - 1);
+//		}else{
+//			province = efastOrder.getOrderProvince();
+//		}
+//		Province provinceinfo = new Province();
+//		provinceinfo.setProvince(province);
+//		List<Province> provinceList = addressService.listProvince(provinceinfo);
+//		if(provinceList.size() < 1){
+//			provinceinfo.setProvince(null);
+//			provinceList = addressService.listProvince(provinceinfo);
+//		}
+//		map.put("provinceId",String.valueOf(provinceList.get(0).getProvinceId()));
+//		map.put("province",provinceList.get(0).getProvince());
+//
+//
+//		//市
+//		city = efastOrder.getOrderCity().substring(0,efastOrder.getOrderCity().length() - 1);
+//		City cityInfo = new City();
+//		cityInfo.setCity(city);
+//		List<City> cityList = addressService.listCity(cityInfo);
+//		if(cityList.size() < 1){
+//			cityInfo.setCity(null);
+//			cityInfo.setProvinceId(provinceList.get(0).getProvinceId());
+//			cityList = addressService.listCity(cityInfo);
+//		}
+//		map.put("cityId",String.valueOf(cityList.get(0).getCityId()));
+//		map.put("city",cityList.get(0).getCity());
+//
+//		//区
+//		zone = efastOrder.getOrderArea().substring(0,efastOrder.getOrderArea().length() - 1);
+//		District district = new  District();
+//		district.setDistrict(zone);
+//		List<District> districtList = addressService.listDistrict(district);
+//		if(districtList.size() < 1){
+//			district.setDistrict(null);
+//			district.setCityId(cityList.get(0).getCityId());
+//			districtList = addressService.listDistrict(district);
+//		}
+//		map.put("districtId",String.valueOf(districtList.get(0).getDistrictId()));
+//		map.put("district",districtList.get(0).getDistrict());
+//		return map;
+//	}
 
 
 	/**客诉系统  自动追踪发货信息**/
@@ -554,5 +554,4 @@ public class MQTask implements InitializingBean {
 		}
 	}
 
-
 }

+ 0 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AdminSalesOrderController.java

@@ -641,7 +641,6 @@ public class AdminSalesOrderController {
      * @throws Exception
      */
     @RequestMapping("/to_add_product")
-    @RequiresPermissions("salesOrder:add:manual")
     public ModelAndView toAddProduct(HttpServletRequest request, ProductColor productColor,Integer isRadio) throws Exception {
         ModelAndView mv = new ModelAndView("order/salesOrder/product_list");
 

+ 15 - 0
watero-rst-web/src/main/resources/platform.properties

@@ -112,4 +112,19 @@ ReqURL=http://api.kdniao.com/api/Eorderservice
 
 DO_MAIN=test.iamberry.com
 
+##jd_url
+#JD_ORDER=2
+
+##jd_url_test
+JD_URL=https://api.jd.com/routerjson
+JD_ORDER=1
+
+##nuonuo_url
+#NUONUO_URL=https://sdk.jss.com.cn/openPlatform/services
+#NUONUO_ID=2
+
+##nuonuo_url_test
+NUONUO_URL=https://sandbox.jss.com.cn/openPlatform/services
+NUONUO_ID=1
+
 

+ 14 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -200,6 +200,13 @@
 		<typeAlias type="com.iamberry.rst.core.order.SmsTemplateInfo" alias="SmsTemplateInfo"/>
 		<typeAlias type="com.iamberry.rst.core.order.SmsSignatureInfo" alias="SmsSignatureInfo"/>
 		<typeAlias type="com.iamberry.rst.core.cm.DownloadProgressInfo" alias="DownloadProgressInfo"/>
+
+		<!--ei 电子发票-->
+		<typeAlias type="com.iamberry.rst.core.ei.Billing" alias="Billing"/>
+		<typeAlias type="com.iamberry.rst.core.ei.BillingItem" alias="BillingItem"/>
+		<typeAlias type="com.iamberry.rst.core.ei.PlatformInfo" alias="PlatformInfo"/>
+		<typeAlias type="com.iamberry.rst.core.ei.PushLog" alias="PushLog"/>
+		<typeAlias type="com.iamberry.rst.core.ei.InvoPlatform" alias="InvoPlatform"/>
 	</typeAliases>
 	<!-- PageHelper -->
 	<plugins>
@@ -304,5 +311,12 @@
 		<!-- scm - 上朵定制 -->
 		<mapper resource="com/iamberry/rst/service/scm/mapper/scmOrderInfoMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/scm/mapper/scmOrderItemMapper.xml"/>
+
+		<!--ei 电子发票-->
+		<mapper resource="com/iamberry/rst/service/ei/mapper/billingItemMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/ei/mapper/billingMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/ei/mapper/platformInfoMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/ei/mapper/pushLogMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/ei/mapper/invoPlatformMapper.xml"/>
 	</mappers>
 </configuration>

+ 3 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/base/add_base.ftl

@@ -32,7 +32,10 @@
 <script type="text/javascript" src="${path}/common/js/common/common.js"></script>
 <script type="text/javascript" src="${path}/common/js/common/commonInit.js"></script>
 
+<script type="text/javascript" src="${path}/common/js/common/number.js"></script>
+
 <script type="text/javascript" src="${path}/common/js/common/UnlimitedLevelContact.js"></script>
 
 <script type="text/javascript" src="${path}/common/js/common/address.js"></script>
 <script type="text/javascript" src="${path}/common/js/common/salesChannel.js"></script>
+

+ 252 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_add_billing.ftl

@@ -0,0 +1,252 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+    <meta http-equiv="Cache-Control" content="no-siteapp"/>
+    <#include "/base/add_base.ftl">
+
+    <style>
+        .tit{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        .tit-2{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit-2:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        #province select{margin-right:10px; width:100px;height: 31px;-webkit-appearance:none !important;appearance:none;background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;padding-left:3px;padding-right: 25px;}
+        .ac_results li a {white-space: nowrap;text-decoration:none;display:block;color:#05a;padding:1px 3px}
+        .ac_results li {border:1px solid #fff}
+        .ac_results li a span {float:right}
+        .select-box{background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;}
+        .select-box select{-webkit-appearance:none !important;background-color: transparent; appearance:none;padding-right: 25px;}
+        .dalog-ask{position: absolute;left:60%;top:0;-webkit-transform: translateY(-30%);transform: translateY(-30%);display: none;background-color: #fff;z-index: 10;}
+        .tag{ width:300px; min-height:300px; border:1px solid #32a3d8; position:relative;background-color: #fff;line-height: 1.5;padding: 10px 12px;}
+        .tag em{display:block; border-width:15px; position:absolute; top:30%; left:-30px;border-style:solid dashed dashed; border-color:transparent  #32a3d8 transparent transparent;font-size:0; line-height:0;}
+        .time-line-list{list-style: none;width: 100%;margin-left: -20px;}
+        .time-line-list>li{position: relative;float: left; text-align: center;width: 100px;overflow: hidden;white-space: nowrap;word-break: break-all;padding: 2px 0;}
+        .time-line-list .number{display: inline-block; padding: 2px; background: #32a3d8;border: 2px solid #fff;box-shadow:0 0 0 1px #32a3d8;width: 20px;height: 20px;color: #fff;line-height: 20px;border-radius: 50%;}
+        .time-line-list>li:before{content:'';position: absolute;height: 1px;width: 30%;right:0;top: 15px; background-color: #32a3d8;}
+        .time-line-list>li:after{content: '';position: absolute;height: 1px;width: 30%;left: 0;top: 15px;background:#32a3d8;}
+        .time-line-list>li:first-child:after,.time-line-list>li:last-child:before{display: none;}
+        .time-line-list .arrow{border-width:7px; position:absolute; left:25%; top:9px;border-style:solid dashed dashed; border-color:transparent  transparent  transparent #32a3d8;font-size:0; line-height:0;}
+        .time-line-list>li:first-child .arrow{display: none;}
+        .table-bg th{background-color: #e2f6ff;}
+        .update-parts>span{margin-right: 10px;padding: 3px 4px;background-color: #effaff;border: 1px solid #32a3d8;}
+        .msg-phone{height: 35px;line-height: 35px;}
+        .col-sm-1{width: 150px;}
+
+        .all_down{text-decoration: underline;color: #00c;}
+    </style>
+    <title>添加发票 - 发票管理 - RST</title>
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
+    <span class="c-gray en">&gt;</span> 发票管理
+    <span class="c-gray en">&gt;</span> 添加发票
+    <a class="btn radius r"
+       style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
+       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
+    <a class="btn radius r"
+       style="line-height:1.6em;margin-top:3px;margin-right: 5px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
+       href="javascript:history.back(-1);" title="后退"><i class="Hui-iconfont">&#xe6d4;</i></a>
+</nav>
+<article class="page-container" style="padding: 10px;">
+    <div class="pd-20 cl">
+        <form action="${path}/admin/ei_billing/add_billing" method="post" class="form form-horizontal" id="form-order-add"  onkeydown="if(event.keyCode==13)return false;">
+
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">基本信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+
+            <div class="row cl" id="" style="">
+                <label class="form-label col-1 col-sm-1">所属平台:</label>
+                <div class="formControls col-2 col-sm-2" >
+                    <span class="select-box">
+                        <select class="select" name="platId" id="platId" >
+                        <#list platformInfoList as platformInfo>
+                            <option value="${platformInfo.platId}" >${platformInfo.platName}</option>
+                        </#list>
+                        </select>
+				    </span>
+                </div>
+            </div>
+
+            <div class="row cl" id="" style="">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>订单编号:</label>
+                <div class="formControls col-2 col-sm-2">
+                    <input type="text" class="input-text trim_input" value="" placeholder="订单编号" id="billOrderNo" datatype="*1-50" name="billOrderNo" >
+                </div>
+                <div class="formControls col-1 col-sm-1">
+                    <input type="button" class="btn btn-primary add-order-button" onclick="select_amount()" value="查询订单信息" >
+                </div>
+            </div>
+
+            <div class="row cl" id="" style="">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>开票金额:</label>
+                <div class="formControls col-2 col-sm-2">
+                    <input type="text" class="input-text trim_input" value="0" placeholder="开票金额" id="billAmountCopy" datatype="*1-7" name="billAmountCopy" >
+                    <input type="hidden" value="0" id="billAmount" datatype="*1-7" name="billAmount" >
+                </div>
+                <div class="formControls col-1 col-sm-1">
+                    <input type="button" class="btn btn-primary add-order-button" onclick="calc_amount()" value="计算总金额" >
+                </div>
+            </div>
+
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">开票信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+
+            <div class="row cl">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>开票类型:</label>
+                <div class="formControls col-10 col-sm-10 skin-minimal ">
+                    <div class="radio-box">
+                        <input type="radio" id="tel-1" name="billType" value="1" checked>
+                        <label for="tel-1">企业</label>
+                    </div>
+                    <div class="radio-box">
+                        <input type="radio" id="tel-2" name="billType" value="2" >
+                        <label for="tel-2">个人</label>
+                    </div>
+                </div>
+            </div>
+
+            <div id="billCompany">
+                <div class="row cl" id="" style="">
+                    <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>购方信息:</label>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="企业名称" id="billCompanyName" datatype="*1-50" name="billCompanyName" >
+                    </div>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="企业税号" id="billTaxNumber" datatype="*1-30" name="billTaxNumber" >
+                    </div>
+                </div>
+
+                <div class="row cl" id="" style="">
+                    <label class="form-label col-1 col-sm-1">电话地址:</label>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="企业电话" id="billTel" datatype="/^.{0,15}$/" name="billTel" >
+                    </div>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="企业地址" id="billAddress" datatype="/^.{0,80}$/" name="billAddress" >
+                    </div>
+                </div>
+
+                <div class="row cl" id="" style="">
+                    <label class="form-label col-1 col-sm-1">银行信息:</label>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="开户行名称" id="billBankName" datatype="/^.{0,50}$/" name="billAmount" >
+                    </div>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="银行账号" id="billAmount" datatype="/^.{0,50}$/" name="billAmount" >
+                    </div>
+                </div>
+            </div>
+
+            <div id="billPersonal" style="display: none;">
+                <div class="row cl" id="" style="">
+                    <label class="form-label col-1 col-sm-1">用户姓名 :</label>
+                    <div class="formControls col-2 col-sm-2">
+                        <input type="text" class="input-text trim_input" value="" placeholder="用户姓名" id="billPersonalName" datatype="/^.{0,50}$/" name="billPersonalName" >
+                    </div>
+                </div>
+            </div>
+
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">商品信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+
+            <div class="row cl" id="" style="">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>商品信息:</label>
+                <div class="formControls col-8 col-sm-8">
+                    <input type="button" class="btn btn-primary add-order-button" onclick="add_product()" value="添加商品" >
+                    <table class="table table-border table-bg table-bordered" style="margin-top: 10px;display: none" id="all_add_product">
+                        <thead>
+                        <tr class="text-c" id="table1">
+                            <th style="text-align: center;" width="30" >产品名称</th>
+                            <th style="text-align: center;" width="15" >产品颜色</th>
+                            <th style="text-align: center;" width="10">产品单价</th>
+                            <th style="text-align: center;" width="10">产品数量</th>
+                            <th style="text-align: center;" width="10">合计金额</th>
+                            <th style="text-align: center;" width="10">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody id="add_product">
+                        </tbody>
+                    </table>
+                    <input type="hidden" id="orderItemString" name="orderItemString" value="" >
+                </div>
+            </div>
+
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">备注信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+
+            <div class="row cl" id="" style="">
+                <label class="form-label col-1 col-sm-1">用户备注:</label>
+                <div class="formControls col-6 col-sm-6">
+                    <textarea name="billRemarks" id="billRemarks" cols="" rows="2"  class="textarea" placeholder="请填写用户备注,最多支持300字符" onKeyUp="$.Huitextarealength(this,300)"></textarea>
+                    <#--<span id="addrssMsg"></span>-->
+                </div>
+            </div>
+
+            <div class="row cl">
+                <div class="col-2 col-sm-2 col-offset-3">
+                    <button class="btn btn-block btn-primary size-XL" type="submit">确认录入</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</article>
+
+<script type="text/javascript">
+    var url_path = "${path}";
+</script>
+
+
+
+<script type="text/javascript">
+    $(function(){
+        $('.skin-minimal input').iCheck({
+            checkboxClass: 'icheckbox-blue',
+            radioClass: 'iradio-blue',
+            increaseArea: '20%'
+        });
+
+        $("input[name='billType']").change(function (){
+            var billType = $(this).val()
+           if(billType == 1){   //企业
+                $("#billCompany").show();
+                $("#billPersonal").hide();
+           }else{
+               $("#billCompany").hide();
+               $("#billPersonal").show();
+           }
+        })
+    });
+
+
+</script>
+
+
+<script type="text/javascript" charset="utf-8" src="${path}/common/js/eiBilling/billing.js"></script>
+
+
+</body>
+</html>

+ 229 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_billing_info.ftl

@@ -0,0 +1,229 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+<#include "/base/add_base.ftl">
+    <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css"/>
+    <link href="${path}/common/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
+    <link href="${path}/common/lib/icheck/icheck.css" rel="stylesheet" type="text/css"/>
+    <style>
+        .tit{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        .tit-2{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit-2:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        #province select{margin-right:10px; width:100px;height: 31px;-webkit-appearance:none !important;appearance:none;background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;padding-left:3px;padding-right: 25px;}
+
+        #suggest, #suggest2 {width:200px}
+        .gray {color:gray}
+        .ac_results {background:#fff;border:1px solid #7f9db9;position: absolute;z-index: 10000;display: none}
+        .ac_results li a {white-space: nowrap;text-decoration:none;display:block;color:#05a;padding:1px 3px}
+        .ac_results li {border:1px solid #fff}
+        .ac_over, .ac_results li a:hover {background:#c8e3fc}
+        .ac_results li a span {float:right}
+        .ac_result_tip {border-bottom:1px dashed #666;padding:3px}
+
+        .select-box{background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;}
+        .select-box select{-webkit-appearance:none !important;background-color: transparent; appearance:none;padding-right: 25px;}
+        .dalog-ask{position: absolute;left:60%;top:0;-webkit-transform: translateY(-30%);transform: translateY(-30%);display: none;background-color: #fff;z-index: 10;}
+        .tag{ width:300px; min-height:300px; border:1px solid #32a3d8; position:relative;background-color: #fff;line-height: 1.5;padding: 10px 12px;}
+        .tag em{display:block; border-width:15px; position:absolute; top:30%; left:-30px;border-style:solid dashed dashed; border-color:transparent  #32a3d8 transparent transparent;font-size:0; line-height:0;}
+        .dalog-ask .ask{color: #000;margin: 10px 0 5px 0;}
+        .dalog-ask .answer{color: #666;margin-bottom: 10px;}
+        .dalog-ask .answer:hover{color: #32a3d8;cursor: pointer;}
+        .time-line-list{list-style: none;width: 100%;margin-left: -20px;}
+        .time-line-list>li{position: relative;float: left; text-align: center;width: 100px;overflow: hidden;white-space: nowrap;word-break: break-all;padding: 2px 0;}
+        .time-line-list .number{display: inline-block; padding: 2px; background: #32a3d8;border: 2px solid #fff;box-shadow:0 0 0 1px #32a3d8;width: 20px;height: 20px;color: #fff;line-height: 20px;border-radius: 50%;}
+        .time-line-list .red{display: inline-block; padding: 2px; background: red;border: 2px solid #fff;box-shadow:0 0 0 1px #32a3d8;width: 20px;height: 20px;color: #fff;line-height: 20px;border-radius: 50%;}
+        .time-line-list>li:before{content:'';position: absolute;height: 1px;width: 30%;right:0;top: 15px; background-color: #32a3d8;}
+        .time-line-list>li:after{content: '';position: absolute;height: 1px;width: 30%;left: 0;top: 15px;background:#32a3d8;}
+        .time-line-list>li:first-child:after,.time-line-list>li:last-child:before{display: none;}
+        .time-line-list .arrow{border-width:7px; position:absolute; left:25%; top:9px;border-style:solid dashed dashed; border-color:transparent  transparent  transparent #32a3d8;font-size:0; line-height:0;}
+        .time-line-list>li:first-child .arrow{display: none;}
+        .table-bg th{background-color: #e2f6ff;}
+        .update-parts>span{margin-right: 10px;padding: 3px 4px;background-color: #effaff;border: 1px solid #32a3d8;}
+        .my-search-input{padding-left: 30px;background: url(${path}/common/images/cm/search.png) 6px center no-repeat;background-size: auto 60%; }
+        .txt-red{color:red}
+        .my-btn-search{border: 1px solid #32a3d8;padding: 1px 25px;height: 32px;background-color: #32a3d8;color: #fff;}
+    </style>
+    <title>发票详情</title>
+</head>
+<body>
+
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
+    <span class="c-gray en">&gt;</span> 发票管理
+    <span class="c-gray en">&gt;</span> 发票详情
+    <a class="btn radius r"
+       style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
+       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
+    <a class="btn radius r"
+       style="line-height:1.6em;margin-top:3px;margin-right: 5px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
+       href="javascript:history.back(-1);" title="后退"><i class="Hui-iconfont">&#xe6d4;</i></a>
+</nav>
+
+<article class="cl pd-20">
+    <form action="" method="post" class="form form-horizontal" id="form-article-add">
+        <div class="row cl">
+            <label class="form-label col-3">
+                <div class="tit-2">基本信息</div>
+            </label>
+            <div class="formControls col-9">
+            </div>
+        </div>
+        <table class="table table-border table-bg table-bordered" style="margin-top: 10px;">
+            <tr>
+                <th width="10">所属平台:</th>
+                <td width="10" style="font-weight: normal;"><span>${billing.platName!''}</span></td>
+                <th width="10">订单编号:</th>
+                <td width="10" style="font-weight: normal;"><span>${billing.billOrderNo!''}</span></td>
+            </tr>
+
+            <tr>
+                <th width="10">开票金额:</th>
+                <td width="10" style="font-weight: normal;"><span>${billing.billAmount/100!''}</span></td>
+                <th width="10">发票状态:</th>
+                <td width="10" style="font-weight: normal;"><span>
+                    <#if billing.billStatus??><#if billing.billStatus == 0 >未开票</#if></#if>
+                    <#if billing.billStatus??><#if billing.billStatus == 1 >开票中</#if></#if>
+                    <#if billing.billStatus??><#if billing.billStatus == 2 >开票成功</#if></#if>
+                    <#if billing.billStatus??><#if billing.billStatus == 3 >开票失败</#if></#if>
+                </span></td>
+            </tr>
+
+            <tr>
+                <th width="10">开票时间:</th>
+                <td width="10" style="font-weight: normal;"><span>
+                     ${(billing.billInvoiceDate?string("yyyy-MM-dd HH:mm:ss"))!''}
+                </span></td>
+                <th width="10">开票创建人:</th>
+                <td width="10" style="font-weight: normal;"><span>${billing.billCreateName!''}</span></td>
+            </tr>
+        </table>
+        <table class="table table-border table-bg table-bordered" style="margin-top: 10px;">
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">开票信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <tr>
+                <th width="10">开票类型:</th>
+                <td width="10" style="font-weight: normal;" colspan="3"><span>
+                   <#if billing.billType??><#if billing.billType == 1 >企业</#if></#if>
+                   <#if billing.billType??><#if billing.billType == 2 >个人</#if></#if>
+                </span></td>
+            </tr>
+
+            <#if billing.billType == 1 >
+                <tr>
+                    <th width="10">企业名称:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billCompanyName!''}</span></td>
+                    <th width="10">企业税号:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billCompanyName!''}</span></td>
+                </tr>
+                <tr>
+                    <th width="10">企业电话:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billTel!''}</span></td>
+                    <th width="10">企业地址:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billAddress!''}</span></td>
+                </tr>
+                <tr>
+                    <th width="10">开户行名称:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billBankName!''}</span></td>
+                    <th width="10">银行账号:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billBankNumber!''}</span></td>
+                </tr>
+            </#if>
+            <#if billing.billType == 2 >
+                <tr>
+                    <th width="10">用户姓名:</th>
+                    <td width="10" style="font-weight: normal;"><span>${billing.billPersonalName!''}</span></td>
+                    <th width="10"></th>
+                    <td width="10" style="font-weight: normal;"><span></span></td>
+                </tr>
+            </#if>
+        </table>
+
+        <div class="row cl">
+            <label class="form-label col-3">
+                <div class="tit-2">商品信息</div>
+            </label>
+            <div class="formControls col-9">
+            </div>
+        </div>
+
+        <table class="table table-border table-bg table-bordered" style="margin-top: 10px;">
+            <tr class="text-c">
+                <th>产品名称</th>
+                <th>产品颜色</th>
+                <th>产品单价</th>
+                <th>产品数量</th>
+                <th>合计金额</th>
+            </tr>
+            <#if billing.billingItemList?? &&  (billing.billingItemList?size > 0) >
+                <#list billing.billingItemList as billingItem>
+                    <tr class="text-c">
+                        <td>${billingItem.billItemProductName!''}</td>
+                        <td>${billingItem.billItemColorName!''}</td>
+                        <td>${billingItem.billItemUnitPrice/100!''}</td>
+                        <td>${billingItem.billItemNum!''}</td>
+                        <td>${billingItem.billItemAmountPrice/100!''}</td>
+                    </tr>
+                </#list>
+            </#if>
+        </table>
+
+        <div class="row cl">
+            <label class="form-label col-3">
+                <div class="tit-2">备注信息</div>
+            </label>
+            <div class="formControls col-9">
+            </div>
+        </div>
+        <div class="row cl" id="" style="">
+            <label class="form-label col-1 col-sm-1">PDF查看:</label>
+            <div class="formControls col-6 col-sm-6">
+                <#if billing.billStatus??>
+                    <#if billing.billStatus == 2 >
+                        <a href="javascript:void(0)" style="color: #00b;" onclick="toReadPdf('${billing.billInvoiceFileUrl!''}')">查看PDF</a>
+                    <#else>
+                        暂无发票!
+                    </#if>
+                </#if>
+            </div>
+        </div>
+
+        <div class="row cl">
+            <label class="form-label col-3">
+                <div class="tit-2">备注信息</div>
+            </label>
+            <div class="formControls col-9">
+            </div>
+        </div>
+        <div class="row cl" id="" style="">
+            <label class="form-label col-1 col-sm-1">备注信息:</label>
+            <div class="formControls col-6 col-sm-6">
+                ${billing.billRemarks!''}
+            </div>
+        </div>
+
+    </form>
+</article>
+
+<script type="text/javascript">
+    /**
+     * 查看pdf
+     * @param url
+     */
+    function toReadPdf(url) {
+        window.open("/"+url);
+    }
+</script>
+
+
+</body>
+</html>

文件差异内容过多而无法显示
+ 292 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/ei/ei_billing_list.ftl


+ 37 - 2
watero-rst-web/src/main/webapp/common/js/common/common.js

@@ -54,6 +54,16 @@ function cufte(val) {
 }
 
 /**
+ * 空值返回0,其他值返回原值
+ * @param val
+ */
+function cufteInt(val) {
+    if(convertUndefinedToEmpty(val) == "")
+        return 0;
+    return val;
+}
+
+/**
  * 空值返回false
  * @param val
  */
@@ -93,6 +103,7 @@ function Trim(str)
 
 /**
  * 获取当前节点,将当前节点的val值除了数字其他的删掉
+ * 整数
  * @param node
  * @param maxNumber  最大值
  * @param minNumber  最小值
@@ -116,6 +127,31 @@ function keyFun(node,maxNumber,minNumber){
 
 
 /**
+ * 获取当前节点,将当前节点的val值除了数字其他的删掉
+ * 小数
+ * @param node
+ * @param maxNumber  最大值
+ * @param minNumber  最小值
+ */
+function keyFunDecimal(node,maxNumber,minNumber){
+    var c=$(node);
+    if(c.val() == ""){
+        $(node).val("");
+        return false;
+    }
+    var temp_amount=c.val().replace(/[^\d.]/g,'');;
+    var number  = Number(temp_amount)
+    if(maxNumber!= null && maxNumber!= "" && number > maxNumber){
+        number = maxNumber;
+    }
+    if(minNumber!= null && minNumber!= "" && number < minNumber){
+        number = minNumber;
+    }
+    $(node).val(number);
+}
+
+
+/**
  * 获取当前节点,超过最大字节删除
  * @param node
  * @param maxNumber  最大字节数
@@ -156,7 +192,7 @@ function vailErrorMsg(node,msg,number){
 }
 
 /**
- * 1000的提示信息
+ * 1000毫秒的提示信息
  * 用于展示错误信息,并让该节点得到焦点
  */
 function vailErrorMsg_1(node,msg){
@@ -231,4 +267,3 @@ function replace(code) {
     }
     return name;
 }
-

+ 53 - 0
watero-rst-web/src/main/webapp/common/js/common/number.js

@@ -0,0 +1,53 @@
+/**
+ * 除法
+ * @param arg1
+ * @param arg2
+ * @returns {number}
+ */
+function accDiv(arg1,arg2){
+    var t1=0,t2=0,r1,r2;
+    try{t1=arg1.toString().split(".")[1].length}catch(e){}
+    try{t2=arg2.toString().split(".")[1].length}catch(e){}
+    with(Math){
+        r1=Number(arg1.toString().replace(".",""));
+        r2=Number(arg2.toString().replace(".",""));
+        return (r1/r2)*pow(10,t2-t1);
+    }
+}
+
+/**
+ * 乘法
+ * @param arg1
+ * @param arg2
+ * @returns {number}
+ */
+function accMul(arg1,arg2)
+{
+    var m=0,s1=arg1.toString(),s2=arg2.toString();
+    try{m+=s1.split(".")[1].length}catch(e){}
+    try{m+=s2.split(".")[1].length}catch(e){}
+    return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
+}
+
+/**
+ * 减法
+ * @param arg1
+ * @param arg2
+ */
+function accSub(arg1,arg2){
+    return accAdd(arg1,-arg2);
+}
+
+/**
+ * 加法
+ * @param arg1
+ * @param arg2
+ * @returns {number}
+ */
+function accAdd(arg1,arg2){
+    var r1,r2,m;
+    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
+    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
+    m=Math.pow(10,Math.max(r1,r2));
+    return (arg1*m+arg2*m)/m
+}

+ 314 - 0
watero-rst-web/src/main/webapp/common/js/eiBilling/billing.js

@@ -0,0 +1,314 @@
+/* add = 添加    update = 修改*/
+var isAddOrUpDate = "add";
+var $isUpDateNode;   //当isAddOrUpDate = update 的时候才会有值
+
+var TR_NUMBER = 0;  //用于在添加产品的时候,一个区别值;
+
+
+$(function(){
+    var loadIndex = 0;
+    $("#form-order-add").Validform({
+        tiptype: function (msg, o, cssctl) {
+            if (o.type == 3) {//失败
+                layer.msg(msg, {icon: 5, time: 3000});
+                $(window).scrollTop(o.obj.offset().top - 40);
+            }
+        },
+        datatype: {//自定义验证类型
+        },
+        ignoreHidden: true,
+        tipSweep: true, //若为true,则只在表单提交时验证
+        ajaxPost: true, //异步提交
+        beforeCheck: function (curform) {  //验证通过之前执行的函数
+            var flag = false;
+        },
+        beforeSubmit: function (curform) {  //验证通过之后执行的函数
+            var billAmountCopy = Number($("#billAmountCopy").val());
+            if(!isEmpty(billAmountCopy)){
+                vailErrorMsg($("#billAmountCopy"),"开票金额为空!");
+                return false;
+            }
+            if(Number(billAmountCopy) <= 0){
+                vailErrorMsg($("#billAmountCopy"),"开票金额不能小于等于0!");
+                return false;
+            }
+
+            // 计算价格
+            var itemBillAmount = 0;
+            $("#add_product").find("tr").each(function () {
+                var billItemUnitPrice = Number($(this).find(".billItemUnitPrice").val());
+                var billItemNum = Number($(this).find(".billItemNum").val());
+                var billItemAmountPrice = accMul(billItemUnitPrice,billItemNum);
+                $(this).find(".billItemAmountPrice").val(billItemAmountPrice);
+                itemBillAmount += billItemAmountPrice;
+            });
+            if(billAmountCopy != itemBillAmount){
+                vailErrorMsg($("#billAmountCopy"),"开票总金额与商品总金额不符!",3000);
+                return false;
+            }
+
+            $("#billAmount").val(accMul(billAmountCopy,100));
+
+            var flag = false;
+            /*封装订单项*/
+            var orderItemArray = new Array();
+            $("#add_product").find("tr").each(function(){
+                var billingItem = new Object();
+                billingItem.colorId = $(this).find(".color_id").val();
+                billingItem.billItemNum = $(this).find(".billItemNum").val();
+                var unitPrice = $(this).find(".billItemUnitPrice").val();
+                var amountPrice =  $(this).find(".billItemAmountPrice").val();
+                billingItem.billItemUnitPrice =  accMul(unitPrice,100);
+                billingItem.billItemAmountPrice = accMul(amountPrice,100);
+                orderItemArray.push(billingItem);
+                flag = true;
+            });
+            if(!flag){
+                vailErrorMsg($(".add-order-button"),"必须要有一个产品");
+                return false;
+            }
+
+            $("#orderItemString").val(JSON.stringify(orderItemArray));
+
+            loadIndex = layer.load(1, {
+                shade: [0.5,'#fff'] //0.1透明度的白色背景
+            });
+        },
+        callback: function (data) {//异步回调函数
+            if (data) {
+                var index = layer.alert(data.resultMsg, function (index) {
+                    if (data.resultCode == 200) {
+                        location.href = url_path + "/admin/ei_billing/billing_list";
+                    }else {
+                        layer.close(index);
+                    }
+                });
+                if(loadIndex != 0 ){
+                    layer.close(loadIndex);
+                }
+            }
+            return false;
+        }
+    });
+});
+
+
+/**
+ * 查询发票余额
+ */
+function  select_amount() {
+    var platId = $("#platId").val();
+    var billOrderNo = $("#billOrderNo").val();
+    if(!isEmpty(billOrderNo)){
+        vailErrorMsg($("#billOrderNo"),"订单号不能为空!",3000);
+        return false;
+    }
+    var index = layer.load(1, {
+        shade: [0.5,'#fff'] //0.1透明度的白色背景
+    });
+    $.ajax({
+        type: "POST",
+        data: {
+            platId : platId,
+            billOrderNo : billOrderNo
+        },
+        url: url_path +"/admin/ei_billing/select_billing_amount",
+        success: function(data){
+            layer.close(index);
+            if (data.returnCode == 200 ) {
+                layer.msg("已成功获取订单信息", {icon: 1, time: 2000});
+                var billing = data.returnMsg.billing;
+
+               $("#billAmountCopy").val(accDiv(billing.billAmount,100));
+               $("#billCompanyName").val(billing.billCompanyName);
+               $("#billTaxNumber").val(billing.billTaxNumber);
+
+                $("#all_add_product").show();
+
+                TR_NUMBER ++;
+
+                for(var i=0;i<billing.billingItemList.length;i++){
+                    var billingItem = billing.billingItemList[i];
+                    var html = '<tr class="text-c tr_chang_'+ TR_NUMBER +'">'
+                        + '<input type="hidden" class="color_id" id="" value="'+ billingItem.colorId +'" >'
+                        + ' <td>'+ cufte(billingItem.billItemProductName) +'</td>'
+                        + ' <td>'+ cufte(billingItem.billItemColorName) +'</td>'
+                        + '<td style="width: 50px;">'
+                        + '<input type="text" class="input-text input-number billItemUnitPrice" value="'+ accDiv(billingItem.billItemUnitPrice,100) +'"  style="width: 100%;text-align: center;" name="billItemUnitPrice" id="" placeholder="产品单价" onblur="keyFunDecimal($(this),99999,0.01)" onpaste="keyFunDecimal($(this),999,0.01)">'
+                        + '</td>'
+                        + '<td style="width: 50px;">'
+                        + '<input type="text" class="input-text input-number billItemNum" value="'+ billingItem.billItemNum +'"  style="width: 100%;text-align: center;" name="billItemNum" id="" placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)">'
+                        + '</td>'
+                        + '<td style="width: 50px;">'
+                        + '<input type="text" class="input-text input-number billItemAmountPrice" value="'+ accDiv(billingItem.billItemAmountPrice,100) +'"  style="width: 100%;text-align: center;" name="billItemAmountPrice" id="" placeholder="合计金额" onblur="keyFunDecimal($(this),99999,0.01)" onpaste="keyFunDecimal($(this),999,0.01)">'
+                        + '</td>'
+                        + '<td>'
+                        + '<a href="javascript:void(0)" class="del_product all_down" onclick="updateProduct($(this))" >修改</a>&nbsp;'
+                        + '<a href="javascript:void(0)" class="del_product all_down" onclick="delProduct($(this))" >删除</a>'
+                        + '</td>';
+
+                        $("#add_product").append(html);
+                }
+
+                $(".tr_chang_"+TR_NUMBER).each(function () {
+                    $(this).find(".billItemUnitPrice").change(function () {
+                        countAmountPrice($(this));
+                    })
+                    $(this).find(".billItemNum").change(function () {
+                        countAmountPrice($(this));
+                    })
+                });
+            }else{
+                //第三方扩展皮肤
+                layer.alert(data.resultMsg, {
+                    icon: 5,
+                    skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则,去这里查阅
+                });
+            }
+
+        },
+        error:function(xhr,status,error){
+            layer.close(index);
+        }
+    });
+}
+
+
+/**
+ * 打开商品列表
+ */
+function add_product() {
+    isAddOrUpDate = "add";
+    layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product","1000","500");
+}
+
+
+/**
+ * 选择商品回调
+ * @param colorIds
+ */
+function setSelectProduct(colorIds){
+    var index = layer.load(1, {
+        shade: [0.5,'#fff'] //0.1透明度的白色背景
+    });
+
+    $("#all_add_product").show();
+
+    var colorIdArray = colorIds.split("_");
+    for(var i=0;i<colorIdArray.length;i++){
+        var colorId = colorIdArray[i];
+        if(colorId == ""){
+            break;
+        }
+
+        var flag = true;
+        $("#add_product").find("tr").each(function (){
+            var colId = $(this).find(".color_id").eq(0).val();
+            if(colId == colorId){
+                flag  = false;
+            }
+        });
+        if(!flag){
+            continue;
+        }
+        $.ajax({
+            type: "POST",
+            data: { colorId : colorId},
+            url: url_path +"/admin/product/get_product",
+            success: function(data){
+                if (data.returnCode == 200 && data.returnMsg.productColorList.length > 0 ) {
+                    TR_NUMBER ++;
+                    for(var i=0;i<data.returnMsg.productColorList.length;i++){
+                        var productColor = data.returnMsg.productColorList[i];
+
+                        var discount = cufteInt(productColor.colorDiscount);
+
+                        var html = '<tr class="text-c tr_chang_'+ TR_NUMBER +'">'
+                            + '<input type="hidden" class="color_id" id="" value="'+ productColor.colorId +'" >'
+                            + ' <td>'+ cufte(productColor.productName) +'</td>'
+                            + ' <td>'+ cufte(productColor.colorName) +'</td>'
+                            + '<td style="width: 50px;">'
+                            + '<input type="text" class="input-text input-number billItemUnitPrice" value="'+  accDiv(discount,100) +'"  style="width: 100%;text-align: center;" name="billItemUnitPrice" id="" placeholder="产品单价" onblur="keyFunDecimal($(this),99999,0.01)" onpaste="keyFunDecimal($(this),999,0.01)">'
+                            + '</td>'
+                            + '<td style="width: 50px;">'
+                            + '<input type="text" class="input-text input-number billItemNum" value="1"  style="width: 100%;text-align: center;" name="billItemNum" id="" placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)">'
+                            + '</td>'
+                            + '<td style="width: 50px;">'
+                            + '<input type="text" class="input-text input-number billItemAmountPrice" value="'+  accDiv(discount,100) +'"  style="width: 100%;text-align: center;" name="billItemAmountPrice" id="" placeholder="合计金额" onblur="keyFunDecimal($(this),99999,0.01)" onpaste="keyFunDecimal($(this),999,0.01)">'
+                            + '</td>'
+                            + '<td>'
+                            + '<a href="javascript:void(0)" class="del_product all_down" onclick="updateProduct($(this))" >修改</a>&nbsp;'
+                            + '<a href="javascript:void(0)" class="del_product all_down" onclick="delProduct($(this))" >删除</a>'
+                            + '</td>';
+
+                        if(isAddOrUpDate == 'update'){
+                            $isUpDateNode.parent().parent().before(html);
+                            $isUpDateNode.parent().parent().remove();
+                        }else{
+                            $("#add_product").append(html);
+                        }
+                    }
+
+                    $(".tr_chang_"+TR_NUMBER).each(function () {
+                        $(this).find(".billItemUnitPrice").change(function () {
+                            countAmountPrice($(this));
+                        })
+                        $(this).find(".billItemNum").change(function () {
+                            countAmountPrice($(this));
+                        })
+                    });
+                }else{
+                    html = '<tr class="text-c"><td colspan="12">没有搜索到商品,请重试!</td></tr>';
+                }
+            }
+        });
+    }
+    layer.close(index);
+}
+
+/**
+ *  修改商品
+ */
+function updateProduct($this){
+    $isUpDateNode = $($this);
+    isAddOrUpDate = 'update';
+    layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product?isRadio=1","1000","500");
+}
+
+/**
+ *  删除商品
+ */
+function delProduct($this){
+    $this.parents("tr").remove();
+}
+
+/**
+ * 计算合计金额
+ */
+function countAmountPrice($node) {
+    var billItemUnitPrice = $node.parent().parent().find(".billItemUnitPrice").val();
+    var billItemNum = $node.parent().parent().find(".billItemNum").val();
+    if(!isEmpty(billItemUnitPrice) || !isEmpty(billItemNum)){
+        return false;
+    }
+    var billingAmount = accMul(billItemUnitPrice,billItemNum);
+    if(!isNaN(billingAmount)){
+        $node.parent().parent().find(".billItemAmountPrice").val(billingAmount);
+    }
+}
+
+/**
+ * 计算总金额
+ */
+function calc_amount() {
+    // 计算价格
+    var itemBillAmount = 0;
+    $("#add_product").find("tr").each(function () {
+        var billItemUnitPrice = Number($(this).find(".billItemUnitPrice").val());
+        var billItemNum = Number($(this).find(".billItemNum").val());
+        var billItemAmountPrice = accMul(billItemUnitPrice,billItemNum);
+        $(this).find(".billItemAmountPrice").val(billItemAmountPrice);
+        itemBillAmount += billItemAmountPrice;
+    });
+    $("#billAmountCopy").val(itemBillAmount);
+}