Browse Source

Merge remote-tracking branch 'origin/dev' into dev

heqinwei 7 years ago
parent
commit
03c84a42d0

+ 3 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -46,6 +46,9 @@ public enum BizExceptionCode implements BaseExceptionCode {
     DEAL_FAILED(79800, "编号:<u>%s</u>处理失败,%s"),
     USING_EXISTS(79504, ""),
 
+    VENDOR_ISCLOSE(79505, "供应商已关闭"),
+    PRODUCT_ISCLOSE(79506, "物料已关闭"),
+    CUSTOMER_ISCLOSE(79507, "客户资料已关闭"),
 
 
     //采购 70000-71999

+ 4 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java

@@ -32,4 +32,8 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
     Integer checkTurnInstatus(Long id);
 
     void updateCreator(@Param("userId") Long userId,@Param("userName") String userName,@Param("id") Long pu_id);
+
+    Integer validateVendor(@Param("id") Long id);
+
+    Integer validateProduct(@Param("id") Long id);
 }

+ 11 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -499,6 +499,17 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     public Result singleAudit(Long id) {
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         Result result = Result.success(docBaseDTO);
+        //检查供应商是否开启状态
+        Integer count =0;
+        count = purchaseMapper.validateVendor(id);
+        if (count != 0) {
+            throw new BizException(BizExceptionCode.VENDOR_ISCLOSE);
+        }
+        //检查物料是否开启状态
+        count = purchaseMapper.validateProduct(id);
+        if (count != 0) {
+            throw new BizException(BizExceptionCode.PRODUCT_ISCLOSE);
+        }
         //检查最小包装数
         result.setMessage(purchasedetailMapper.checkzxbzs(id));
         commonService.commonAudit("purchase", "pu_id=" + id, "pu_status",

+ 9 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -436,5 +436,14 @@
     update purchase set creatorId = #{userId} , creatorName=#{userName} where pu_id=#{id}
   </update>
 
+  <select id="validateVendor" resultType="int" >
+    select count(1) from vendor where ve_id = (select pu_vendid from purchase where pu_id=#{id}) and ve_statuscode='CLOSE';
+  </select>
+
+  <select id="validateProduct" resultType="int" >
+    select count(1) from purchasedetail left join product on PD_PRODID=pr_id where  pd_puid=#{id} and pr_statuscode='CLOSE';
+  </select>
+
+
 
 </mapper>

+ 4 - 4
base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java

@@ -21,7 +21,7 @@ import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.exception.ExceptionCode;
 import com.usoftchina.saas.page.PageDefault;
 import com.usoftchina.saas.page.PageRequest;
-import com.usoftchina.saas.server.error.ServletErrorUtils;
+import com.usoftchina.saas.server.web.ServletUtils;
 import com.usoftchina.saas.socket.api.SocketMessageApi;
 import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.CollectionUtils;
@@ -136,7 +136,7 @@ public class AuthController {
                     accountDTO = createAccountByCookieInfo(info);
                 } else {
                     logger.error(result.getMessage());
-                    ServletErrorUtils.writeJsonPMessage(response, callback, false);
+                    ServletUtils.writeJsonPMessage(response, callback, false);
                     return;
                 }
             } else {
@@ -147,7 +147,7 @@ public class AuthController {
                     Result updateResult = accountApi.update(BeanMapper.map(accountDTO, AccountUpdateDTO.class));
                     if (!updateResult.isSuccess()) {
                         logger.error(updateResult.getMessage());
-                        ServletErrorUtils.writeJsonPMessage(response, callback, false);
+                        ServletUtils.writeJsonPMessage(response, callback, false);
                         return;
                     }
                 }
@@ -170,7 +170,7 @@ public class AuthController {
                 socketMessageApi.sendToClient(clientId, "/sso/callback",
                         JsonUtils.toJsonString(new AuthDTO(tokenDTO, accountDTO)));
             }
-            ServletErrorUtils.writeJsonPMessage(response, callback, true);
+            ServletUtils.writeJsonPMessage(response, callback, true);
         }
     }
 

+ 0 - 28
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java

@@ -50,32 +50,4 @@ public class ServletErrorUtils {
         writer.flush();
     }
 
-    public static void writeMessage(HttpServletResponse response, String text) throws IOException {
-        response.setContentType(MediaType.TEXT_HTML_VALUE);
-        response.setCharacterEncoding("UTF-8");
-        PrintWriter writer = response.getWriter();
-        writer.print(text);
-        writer.flush();
-    }
-
-    /**
-     * 输出jsonp
-     *
-     * @param response
-     * @param callbackFn
-     * @param success
-     * @throws IOException
-     */
-    public static void writeJsonPMessage(HttpServletResponse response, String callbackFn, boolean success) throws IOException {
-        response.setContentType(MediaType.TEXT_HTML_VALUE);
-        response.setCharacterEncoding("UTF-8");
-        PrintWriter writer = response.getWriter();
-        writer.print(buildJsonPMessage(callbackFn, success));
-        writer.flush();
-    }
-
-    public static String buildJsonPMessage(String callbackFn, boolean success) {
-        return String.format("%s({success:\"%s\"})", callbackFn, success ? 1 : 0);
-    }
-
 }

+ 41 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/web/ServletUtils.java

@@ -0,0 +1,41 @@
+package com.usoftchina.saas.server.web;
+
+import org.springframework.http.MediaType;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author yingp
+ * @date 2018/11/19
+ */
+public class ServletUtils {
+    public static void writeMessage(HttpServletResponse response, String text) throws IOException {
+        response.setContentType(MediaType.TEXT_HTML_VALUE);
+        response.setCharacterEncoding("UTF-8");
+        PrintWriter writer = response.getWriter();
+        writer.print(text);
+        writer.flush();
+    }
+
+    /**
+     * 输出jsonp
+     *
+     * @param response
+     * @param callbackFn
+     * @param success
+     * @throws IOException
+     */
+    public static void writeJsonPMessage(HttpServletResponse response, String callbackFn, boolean success) throws IOException {
+        response.setContentType(MediaType.TEXT_HTML_VALUE);
+        response.setCharacterEncoding("UTF-8");
+        PrintWriter writer = response.getWriter();
+        writer.print(buildJsonPMessage(callbackFn, success));
+        writer.flush();
+    }
+
+    public static String buildJsonPMessage(String callbackFn, boolean success) {
+        return String.format("%s({success:\"%s\"})", callbackFn, success ? 1 : 0);
+    }
+}

+ 2 - 1
frontend/saas-web/Dockerfile

@@ -2,4 +2,5 @@ FROM hub.c.163.com/library/nginx
 MAINTAINER USOFTCHINA <yingp@usoftchina.com>
 RUN rm /etc/nginx/conf.d/default.conf
 ADD runtime/nginx/default.conf /etc/nginx/conf.d/
-COPY build/production/saas/ /usr/share/nginx/html/
+COPY build/production/saas/ /usr/share/nginx/html/
+COPY set-token.html /usr/share/nginx/html/

+ 0 - 1
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanel.js

@@ -233,7 +233,6 @@ Ext.define('saas.view.purchase.purchaseIn.QueryPanel', {
         },{
             text: '相关单号',
             dataIndex: 'pd_ordercode',
-            xtype:'numbercolumn',
             width: 120
         }]
     }