Browse Source

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

heqinwei 7 years ago
parent
commit
db8ca75707

+ 5 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -552,6 +552,11 @@ public class SaleServiceImpl implements SaleService{
     @Override
     public DocBaseDTO saleTurnPurchase(Long id) {
         Sale sale = saleMapper.selectByPrimaryKey(id);
+
+        //检查销售订单是否关闭
+        if(sale.getSa_sendstatuscode().equals("CLOSE")){
+            throw new BizException(BizExceptionCode.SALE_CLOSE.getCode(),BizExceptionCode.SALE_CLOSE.getMessage());
+        }
         List<SaleList> dateilList = saleListMapper.selectSaleListByCondition("sa_id="+id,BaseContextHolder.getCompanyId());
 
         //判断是否已转采购单

+ 2 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java

@@ -128,6 +128,7 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
                 prodInDetail.setCompanyId(companyId);
                 prodInDetail.setCreateTime(new Date());
                 prodInDetail.setCreatorId(userId);
+                prodInDetail.setPd_remark("盘盈单");
                 prodIODetailMapper.insertSelective(prodInDetail);
             }
             DocBaseDTO baseDTOIN = new DocBaseDTO(inid,piInno,"其它入库单");
@@ -167,6 +168,7 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
                 prodOutDetail.setCompanyId(companyId);
                 prodOutDetail.setCreateTime(new Date());
                 prodOutDetail.setCreatorId(userId);
+                prodOutDetail.setPd_remark("盘亏单");
                 prodIODetailMapper.insertSelective(prodOutDetail);
             }
             DocBaseDTO baseDTOOUT = new DocBaseDTO(outid,piOutno,"其它出库单");

+ 4 - 4
base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/CompanyApi.java

@@ -39,7 +39,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "name")
-    Result<CompanyDTO> getCompanyByName(@RequestParam String name);
+    Result<CompanyDTO> getCompanyByName(@RequestParam("name") String name);
 
     /**
      * 按商业登记证号查找
@@ -48,7 +48,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "businessCode")
-    Result<CompanyDTO> getCompanyByBusinessCode(@RequestParam String businessCode);
+    Result<CompanyDTO> getCompanyByBusinessCode(@RequestParam("businessCode") String businessCode);
 
     /**
      * 按企业uu查找
@@ -57,7 +57,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "uu")
-    Result<CompanyDTO> getCompanyByUu(@RequestParam Long uu);
+    Result<CompanyDTO> getCompanyByUu(@RequestParam("uu") Long uu);
 
     /**
      * 按ID查找
@@ -66,5 +66,5 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read/{id}")
-    Result<CompanyDTO> getCompanyById(@PathVariable Long id);
+    Result<CompanyDTO> getCompanyById(@PathVariable("id") Long id);
 }

+ 13 - 0
base-servers/auth/auth-dto/src/main/java/com/usoftchina/saas/auth/dto/AuthDTO.java

@@ -11,6 +11,19 @@ import java.io.Serializable;
 public class AuthDTO implements Serializable{
     private TokenDTO token;
     private AccountDTO account;
+    /**
+     * 用户登录优软云后,直接地址栏上进入saas系统.
+     * 通过cookie中的企业UU判断saas是否已开通,开通则返回companyId给前端直接登录该企业
+     */
+    private Long companyId;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
 
     public AuthDTO() {
     }

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

@@ -2,14 +2,11 @@ package com.usoftchina.saas.auth.controller;
 
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.account.api.AccountApi;
+import com.usoftchina.saas.account.api.CompanyApi;
 import com.usoftchina.saas.account.constant.AccountType;
-import com.usoftchina.saas.account.dto.AccountCopyDTO;
-import com.usoftchina.saas.account.dto.AccountDTO;
-import com.usoftchina.saas.account.dto.AccountUpdateDTO;
-import com.usoftchina.saas.account.dto.CompanyBaseDTO;
+import com.usoftchina.saas.account.dto.*;
 import com.usoftchina.saas.auth.common.cookie.CookieHelper;
 import com.usoftchina.saas.auth.common.cookie.CookieInfo;
-import com.usoftchina.saas.auth.common.cookie.CookieUtils;
 import com.usoftchina.saas.auth.common.jwt.JwtHelper;
 import com.usoftchina.saas.auth.common.jwt.JwtInfo;
 import com.usoftchina.saas.auth.common.jwt.JwtToken;
@@ -34,8 +31,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.http.server.reactive.ServerHttpResponse;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -57,6 +52,9 @@ public class AuthController {
     @Autowired
     private AccountApi accountApi;
 
+    @Autowired
+    private CompanyApi companyApi;
+
     @Value("${auth.public-key}")
     private String publicKeyPath;
 
@@ -203,7 +201,12 @@ public class AuthController {
             JwtInfo jwtInfo = new JwtInfo(appId, companyId, accountDTO.getId(), accountDTO.getUsername(), accountDTO.getRealname());
             JwtToken jwtToken = JwtHelper.generateToken(jwtInfo, privateKeyPath, expire);
             TokenDTO tokenDTO = BeanMapper.map(jwtToken, TokenDTO.class);
-            return Result.success(new AuthDTO(tokenDTO, accountDTO));
+            AuthDTO authDTO = new AuthDTO(tokenDTO, accountDTO);
+            CompanyDTO companyDTO = companyApi.getCompanyByUu(info.getSpaceUU()).getData();
+            if (null != companyDTO){
+                authDTO.setCompanyId(companyDTO.getId());
+            }
+            return Result.success(authDTO);
         }
         return Result.error(ExceptionCode.COOKIE_ILLEGAL_ARGUMENT);
     }

+ 5 - 0
frontend/saas-web/app/Application.scss

@@ -465,4 +465,9 @@ div::-webkit-scrollbar-track {
       background-size: 16px 16px;
       background-position: center;
   }
+}
+
+/** tab **/
+.x-tab-default.x-tab-active .x-tab-close-btn {
+  color: #34BAF6;
 }

+ 9 - 9
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -52,15 +52,6 @@ Ext.define('saas.view.core.form.FormPanel', {
         me.initFormItems();
 
         me.defaultBtns = me.defaultBtns || [{
-            cls: 'x-formpanel-btn-blue',
-            xtype: 'button',
-            text: '刷新',
-            hidden: true,
-            bind: {
-                hidden: '{!id}'
-            },
-            handler: 'refresh'
-        }, {
             cls: 'x-formpanel-btn-blue',
             xtype: 'button',
             text: '新增',
@@ -104,6 +95,15 @@ Ext.define('saas.view.core.form.FormPanel', {
                 hidden:'{!showAuditBtn}'
             },
             handler: "auditBtnClick",
+        }, {
+            cls: 'x-formpanel-btn-white',
+            xtype: 'button',
+            text: '刷新',
+            hidden: true,
+            bind: {
+                hidden: '{!id}'
+            },
+            handler: 'refresh'
         }, {
             cls:'x-formpanel-btn-white',
             text:'打印',

+ 46 - 16
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -410,10 +410,47 @@ Ext.define('saas.view.core.form.FormPanelController', {
         caller = form.caller,
         id = viewModel.get(form._idField);
 
-        saas.util.BaseUtil.request({
-            url: '/api/commons/jasperReport/printByDefault',
-            // url: 'http://192.168.253.58:8920/jasperReport/printByDefault',
-            method: 'POST',
+        me.beforePrint(caller).then(function(flag) {
+            if(!flag) {
+                return false;
+            }
+            saas.util.BaseUtil.request({
+                url: '/api/commons/jasperReport/printByDefault',
+                // url: 'http://192.168.253.58:8920/jasperReport/printByDefault',
+                method: 'POST',
+                headers: {
+                    "Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8'
+                },
+                params: {
+                    caller: caller,
+                    id: id
+                }
+            }).then(function(res) {
+                var data = res.data,
+                printurl = data.printurl,
+                printtype = data.printtype,
+                reportName = data.reportName,
+                title = data.title,
+                whereCondition = data.whereCondition,
+                companyId = saas.util.BaseUtil.getCurrentUser().companyId;
+    
+                var url = printurl + '?' + 'reportName=' + reportName + '&' + 'companyId=' + companyId + '&whereCondition=' + whereCondition
+    
+                window.open(url);
+            }).catch(function(res) {
+                console.error(res.message);
+                saas.util.BaseUtil.showErrorToast('获取打印报表错误:' + res.message);
+            });
+        });
+    },
+
+    /**
+     * 判断权限
+     */
+    beforePrint: function(caller) {
+        return saas.util.BaseUtil.request({
+            url: '/api/commons/' + caller + '/print',
+            method: 'GET',
             headers: {
                 "Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8'
             },
@@ -422,17 +459,10 @@ Ext.define('saas.view.core.form.FormPanelController', {
                 id: id
             }
         }).then(function(res) {
-            var data = res.data,
-            printurl = data.printurl,
-            printtype = data.printtype,
-            reportName = data.reportName,
-            title = data.title,
-            whereCondition = data.whereCondition,
-            companyId = saas.util.BaseUtil.getCurrentUser().companyId;
-
-            var url = printurl + '?' + 'reportName=' + reportName + '&' + 'companyId=' + companyId + '&whereCondition=' + whereCondition
-
-            window.open(url);
+            return res.success;
+        }).catch(function(res) {
+            console.error(res.message);
+            saas.util.BaseUtil.showErrorToast('未通过权限验证:' + res.message);
         });
-    },
+    }
 });

+ 33 - 27
frontend/saas-web/app/view/core/report/ReportPanel.js

@@ -84,42 +84,48 @@ Ext.define('saas.view.core.report.ReportPanel', {
                                     includeSummary: true
                                 }
                             }, {
-                                text: 'Excel xml',
-                                cfg: {
-                                    type: 'excel03',
-                                    ext: 'xml'
-                                }
-                            }, {
-                                text: 'Excel xml (包含分组合计)',
-                                cfg: {
-                                    type: 'excel03',
-                                    ext: 'xml',
-                                    includeGroups: true,
-                                    includeSummary: true
-                                }
-                            }, {
+                            //     text: 'Excel xml',
+                            //     cfg: {
+                            //         type: 'excel03',
+                            //         ext: 'xml'
+                            //     }
+                            // }, {
+                            //     text: 'Excel xml (包含分组合计)',
+                            //     cfg: {
+                            //         type: 'excel03',
+                            //         ext: 'xml',
+                            //         includeGroups: true,
+                            //         includeSummary: true
+                            //     }
+                            // }, {
                                 text: 'CSV',
                                 cfg: {
                                     type: 'csv'
                                 }
                             }, {
-                                text: 'TSV',
-                                cfg: {
-                                    type: 'tsv',
-                                    ext: 'csv'
-                                }
-                            }, {
-                                text: 'HTML',
-                                cfg: {
-                                    type: 'html'
-                                }
-                            }, {
-                                text: 'HTML (包含分组合计)',
+                                text: 'CSV (包含分组合计)',
                                 cfg: {
-                                    type: 'html',
+                                    type: 'csv',
                                     includeGroups: true,
                                     includeSummary: true
                                 }
+                            //     text: 'TSV',
+                            //     cfg: {
+                            //         type: 'tsv',
+                            //         ext: 'csv'
+                            //     }
+                            // }, {
+                            //     text: 'HTML',
+                            //     cfg: {
+                            //         type: 'html'
+                            //     }
+                            // }, {
+                            //     text: 'HTML (包含分组合计)',
+                            //     cfg: {
+                            //         type: 'html',
+                            //         includeGroups: true,
+                            //         includeSummary: true
+                            //     }
                             }]
                         }
                     }]

+ 1 - 1
frontend/saas-web/app/view/core/report/ReportPanelController.js

@@ -30,7 +30,7 @@ Ext.define('saas.view.core.report.ReportPanelController', {
                 }
                 //font:
             },
-            fileName: title + Ext.Date.format(new Date(),'Y-m-d_H-i-s') +'.' + (btn.cfg.ext || btn.cfg.type)
+            fileName: title + Ext.Date.format(new Date(),'Y-m-d H-i-s') +'.' + (btn.cfg.ext || btn.cfg.type)
         }, btn.cfg);
         grid.store.exportPageSize = 5000;
         grid.store.exportNumber = 1;