Browse Source

Merge branch 'dev' of ssh://10.10.101.21/source/platform-b2b into feature-hejq-20190109

hejq 7 years ago
parent
commit
10a7c5480d

+ 15 - 9
src/main/java/com/uas/platform/b2b/controller/PurcInquiryController.java

@@ -223,7 +223,7 @@ public class PurcInquiryController {
 	 * @return
 	 */
 	@RequestMapping(value = "/info/search", params = RequestState.TODO, method = RequestMethod.GET)
-	public SPage<PurchaseInquiryDetail> getTodoInquiries(PageParams params, String searchFilter) {
+	public SPage<PurchaseInquiryDetail> getTodoInquiries(PageParams params, String searchFilter, String type) {
 		logger.log("客户询价单", "查看收到的客户询价单列表(待回复)");
 		JSONObject jsonObject = JSON.parseObject(searchFilter);
 		String keyword = jsonObject.getString("keyword");
@@ -239,13 +239,15 @@ public class PurcInquiryController {
             if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
                 filter.setDistribute(distribute.getDistribute());
             }
-            return detailService.findTodoByPageInfo(pageInfo, null, filter);
+            return detailService.findTodoByPageInfo(pageInfo, null, filter, type);
         } else {
             com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
             // 当前登录企业作为供应商
             pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
             pageParams.getFilters().put("id_status", Status.NOT_REPLY.value());
-            pageParams.getFilters().put("id_overdue", Constant.NO);
+            if (!"APP".equals(type)) {
+				pageParams.getFilters().put("id_overdue", Constant.NO);
+			}
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("id_id", false, Type.INT, new Long(1)));
             pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
@@ -293,7 +295,7 @@ public class PurcInquiryController {
 	 * @return
 	 */
 	@RequestMapping(value = "/info/search", params = RequestState.DONE, method = RequestMethod.GET)
-	public SPage<PurchaseInquiryDetail> getDoneInquiries(PageParams params, String searchFilter) {
+	public SPage<PurchaseInquiryDetail> getDoneInquiries(PageParams params, String searchFilter, String type) {
 		logger.log("客户询价单", "查看收到的客户询价单列表(已回复)");
 		JSONObject jsonObject = JSON.parseObject(searchFilter);
 		String keyword = jsonObject.getString("keyword");
@@ -301,8 +303,10 @@ public class PurcInquiryController {
             PageInfo pageInfo = new PageInfo(params);
             pageInfo.filter("inquiry.enUU", SystemSession.getUser().getEnterprise().getUu());
             pageInfo.filter("status", Status.REPLIED.value());
-            pageInfo.filter("invalid", Constant.NO);
-            pageInfo.filter("overdue", Constant.NO);
+            if (!"APP".equals(type)) {
+				pageInfo.filter("invalid", Constant.NO);
+				pageInfo.filter("overdue", Constant.NO);
+			}
             SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
             return detailService.findByPageInfo(pageInfo, keyword, filter);
         } else {
@@ -311,7 +315,9 @@ public class PurcInquiryController {
             pageParams.getFilters().put("id_inid", SystemSession.getUser().getEnterprise().getUu());
             pageParams.getFilters().put("id_status", Status.REPLIED.value());
 			HashMap<String, Object> map = new HashMap<>();
-			map.put("id_invalid", Constant.YES);
+			if (!"APP".equals(type)) {
+				map.put("id_invalid", Constant.YES);
+			}
 			pageParams.setNotEqualFilters(map);
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("id_id", false, Type.INT, new Long(1)));
@@ -609,7 +615,7 @@ public class PurcInquiryController {
 		ModelAndView modelAndView = new ModelAndView();
 		modelAndView.addObject("dateFormat", dateFormat);
 		modelAndView.addObject("state", "待报价");
-		modelAndView.addObject("data", getTodoInquiries(params, searchFilter).getContent());
+		modelAndView.addObject("data", getTodoInquiries(params, searchFilter, null).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purchaseInquiry", "采购询价单列表(待报价)"));
 		logger.log("采购询价单", "导出Excel列表", "导出待报价Excel列表");
 		return modelAndView;
@@ -629,7 +635,7 @@ public class PurcInquiryController {
 		ModelAndView modelAndView = new ModelAndView();
 		modelAndView.addObject("dateFormat", dateFormat);
 		modelAndView.addObject("state", "已报价");
-		modelAndView.addObject("data", getTodoInquiries(params, searchFilter).getContent());
+		modelAndView.addObject("data", getTodoInquiries(params, searchFilter, null).getContent());
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purchaseInquiry", "采购询价单列表(已报价)"));
 		logger.log("采购询价单", "导出Excel列表", "导出已报价Excel列表");
 		return modelAndView;

+ 1 - 1
src/main/java/com/uas/platform/b2b/controller/SaleInquiryController.java

@@ -405,7 +405,7 @@ public class SaleInquiryController {
 		if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
 			filter.setDistribute(distribute.getDistribute());
 		}
-		return detailService.findTodoByPageInfo(pageInfo, null, filter);
+		return detailService.findTodoByPageInfo(pageInfo, null, filter, null);
 	}
 
 	/**

+ 10 - 0
src/main/java/com/uas/platform/b2b/dao/VendorDao.java

@@ -125,4 +125,14 @@ public interface VendorDao extends JpaSpecificationExecutor<Vendor>, GenericRepo
 	 */
     List<Vendor> findByMyEnUUAndErpstatus(Long myEnuu, Integer status);
 
+    /**
+     * 通过客户UU,供应商UU,对账状态查询是否开启对账
+     *
+     * @param customerUU 客户UU
+     * @param vendorUU 供应商UU
+     * @param checkStatus 对账状态
+     * @return 符合条件的数量
+     */
+    Integer countByMyEnUUAndVendEnUUAndApcheck(Long customerUU, Long vendorUU, Short checkStatus);
+
 }

+ 1 - 1
src/main/java/com/uas/platform/b2b/mobile/controller/AppInquiryController.java

@@ -159,7 +159,7 @@ public class AppInquiryController {
             if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
                 filter.setDistribute(distribute.getDistribute());
             }
-            return toPage(detailService.findTodoByPageInfo(pageInfo, null, filter));
+            return toPage(detailService.findTodoByPageInfo(pageInfo, null, filter, null));
         }
     }
 

+ 24 - 2
src/main/java/com/uas/platform/b2b/model/PurchaseInquiryItem.java

@@ -6,6 +6,7 @@ import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.Status;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import javax.persistence.*;
 import java.util.*;
@@ -583,7 +584,11 @@ public class PurchaseInquiryItem extends AbstractOrderProduct {
 	}
 
 	public Short getOverdue() {
-		return overdue;
+		if (StringUtils.isEmpty(this.inquiry.getEndDate())) {
+			return 0;
+		} else {
+			return check(this.inquiry.getEndDate());
+		}
 	}
 
 	public void setOverdue(Short overdue) {
@@ -591,7 +596,11 @@ public class PurchaseInquiryItem extends AbstractOrderProduct {
 	}
 
 	public Short getInvalid() {
-		return invalid;
+		if(StringUtils.isEmpty(this.toDate)) {
+			return 0;
+		} else {
+			return check(this.toDate);
+		}
 	}
 
 	public void setInvalid(Short invalid) {
@@ -705,4 +714,17 @@ public class PurchaseInquiryItem extends AbstractOrderProduct {
 		}
 		return inquiries;
     }
+
+	private Short check(Date date) {
+		Short num = 0;
+		Date now = new Date();
+		Calendar calendar = new GregorianCalendar();
+		calendar.setTime(date);
+		calendar.add(Calendar.DATE,1);
+		date=calendar.getTime();
+		if (date.before(now)) {
+			num = 1;
+		}
+		return num;
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/PurchaseInquiryDetailService.java

@@ -46,7 +46,7 @@ public interface PurchaseInquiryDetailService {
      * @param filter 搜索过滤条件
      * @return
      */
-    SPage<PurchaseInquiryDetail> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter filter);
+    SPage<PurchaseInquiryDetail> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter filter, String type);
 
 	/**
 	 * 通过id查询详情

+ 1 - 2
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApBillServiceImpl.java

@@ -266,11 +266,10 @@ public class PurchaseApBillServiceImpl implements PurchaseApBillService {
         /*
          * 过滤条件
          * 1、 当前企业为客户
-         * 2、 开启B2B对账
+         * 2、 开启B2B对账 (去除该条件 @date: 2019-01-14 @author: hejq)
          * 3、 需要对账价格不为空
          */
         pageInfo.filter("myEnUU", SystemSession.getUser().getEnterprise().getUu());
-        pageInfo.filter("apcheck", Constant.YES);
         pageInfo.expression(PredicateUtils.ne("totalCountString", StringConstant.BLANK, true));
         pageInfo.expression(PredicateUtils.isNotNull("totalCountString"));
         if (!com.uas.ps.core.util.StringUtils.isEmpty(keyword)) {

+ 7 - 4
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -618,7 +618,6 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
      */
     @Override
     public SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate, Long fromDate, Long endDate) throws InterruptedException {
-        Long start = System.currentTimeMillis();
         List<Vendor> vendors = findCustomerByPage(params, keyword);
         SPage<Vendor> vendorSPage = new SPage<>();
         if (!CollectionUtils.isEmpty(vendors)) {
@@ -627,7 +626,6 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
             resultVendors.parallelStream().forEach(customer -> this.countApCheck(customer, checkDate, fromDate, endDate));
             setVendorSPage(params, resultVendors, vendorSPage);
         }
-        System.out.println("并行方法: " + (System.currentTimeMillis() - start));
         return vendorSPage;
     }
 
@@ -840,11 +838,10 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
          * 过滤条件
          * 1、 当前企业为供应商
          * 2、 客户已分配
-         * 3、 开启B2B对账
+         * 3、 开启B2B对账(去除该条件 @date: 2019-01-14 @author: hejq)
          * 4、 需要对账价格不为空
          */
         pageInfo.filter("vendEnUU", SystemSession.getUser().getEnterprise().getUu());
-        pageInfo.filter("apcheck", Constant.YES);
         pageInfo.expression(PredicateUtils.ne("totalCountString", StringConstant.BLANK, true));
         pageInfo.expression(PredicateUtils.isNotNull("totalCountString"));
         if (filter != null) {
@@ -1139,10 +1136,16 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
      */
     @Override
     public ModelMap checkCount(PurchaseApCheck apCheck) {
+        // 校验前端数据传入
         if (null == apCheck) {
             LOGGER.log("应收对账单", "生成对账单失败,未选择对账数据");
             throw new IllegalOperatorException("保存失败!");
         }
+        // 判断是否开启B2B对账功能
+        Integer count = vendorDao.countByMyEnUUAndVendEnUUAndApcheck(apCheck.getCustUu(), apCheck.getEnUu(), Constant.YES);
+        if (count == 0) {
+            throw new IllegalOperatorException("无法对账!(该客户未对您启用B2B对账,请让客户在“UAS系统-供应商资料”里启用后再进行对账。)");
+        }
         // 针对当前对账数据进行校验操作
         enableCheck(apCheck.getItems());
         apCheck = this.save(apCheck);

+ 5 - 3
src/main/java/com/uas/platform/b2b/service/impl/PurchaseInquiryDetailServiceImpl.java

@@ -82,11 +82,13 @@ public class PurchaseInquiryDetailServiceImpl implements PurchaseInquiryDetailSe
      * @return
      */
     @Override
-    public SPage<PurchaseInquiryDetail> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter filter) {
+    public SPage<PurchaseInquiryDetail> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter filter, String type) {
         // 提交状态不为1
         pageInfo.expression(PredicateUtils.or(PredicateUtils.isNull("inquiry.check"), PredicateUtils.eq("inquiry.check", Constant.NO, false)));
-        pageInfo.expression(PredicateUtils.eq("overdue", Constant.NO, false));
-        pageInfo.expression(PredicateUtils.eq("invalid", Constant.NO, false));
+        if (!"APP".equals(type)) {
+			pageInfo.expression(PredicateUtils.eq("overdue", Constant.NO, false));
+			pageInfo.expression(PredicateUtils.eq("invalid", Constant.NO, false));
+		}
         return findByPageInfo(pageInfo, keyword, filter);
     }
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

@@ -618,7 +618,7 @@ public class VendorsServiceImpl implements VendorService {
                             distribute = distributes.get(0);
                             boolean isNotTransfer = null == distribute.getDistribute() || Constant.NO == distribute.getDistribute();
                             if (!Objects.equals(distribute.getLeaderUU(), currentUserUU) || isNotTransfer) {
-                                distribute.setLeaderUU(SystemSession.getUser().getUserUU());
+                                distribute.setLeaderUU(currentUserUU);
                                 distribute.setIsTransfer(Constant.YES);
                                 saveList.add(distribute);
                             }

+ 1 - 1
src/main/java/com/uas/platform/b2b/task/ApCheckTask.java

@@ -28,7 +28,7 @@ public class ApCheckTask {
     /**
      * 查询待更新处理数据的供应商客户关系
      */
-    private static final String TODO_CUSTOMER_SQL = "select ve_id id,ve_myenuu custuu,ve_vendenuu venduu from `purc$vendors` where ve_apcheck = 1 and coalesce(update_time, '') < current_date() limit 500";
+    private static final String TODO_CUSTOMER_SQL = "select ve_id id,ve_myenuu custuu,ve_vendenuu venduu from `purc$vendors` where coalesce(update_time, '') < current_date() limit 500";
 
     /**
      * 更新对账金额语句

+ 1 - 1
src/main/resources/dev/sys.properties

@@ -3,7 +3,7 @@ b2b=https://test-b2b.uuzcc.cn
 manage=http://218.17.158.219:9090/platform-manage
 manageInner=http://192.168.253.60:9090/platform-manage
 im=http://113.105.74.131:8092
-b2c=https://test-b2c.uuzcc.cn
+b2c=https://test-mall.uuzcc.cn
 registerUrl=https://test-sso.uuzcc.cn/register/enterpriseRegistration
 
 #report url

+ 4 - 10
src/main/webapp/resources/css/index.css

@@ -1815,18 +1815,11 @@ img.new-animate{
 	overflow-y: auto;
 	overflow-x: hidden;
 }
-.feed-wrap .pane:first-child, .feed-wrap .pane:nth-child(2) {
-	height: 275px;
-}
+
 .feed-wrap .notice .pane-body{
 	width: 202px;
-	/*background: #fff;*/
-	/*box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
-	/*-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
-	/*-o-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
-	/*-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);*/
-	/*border-bottom-left-radius: 5px;*/
-	/*border-bottom-right-radius: 5px;*/
+	height:255px;
+	overflow: hidden;
 }
 .pane.addon {
 	height: 185px;
@@ -1857,6 +1850,7 @@ img.new-animate{
 }
 .notice .detail>li a{
 	font-size: 14px;
+	vertical-align: middle;
 }
 /*公告非当日*/
 .notice .pane-body ul li.nonday a{

+ 24 - 7
src/main/webapp/resources/js/index/app.js

@@ -2023,22 +2023,39 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             };
         });
     }]);
-    app.controller('NoticeCtrl', ['$scope', 'SnapshotService', 'AuthenticationService', function ($scope, SnapshotService, AuthenticationService) {
+    app.controller('NoticeCtrl', ['$scope', 'SnapshotService', 'AuthenticationService', 'AccountEnterprise', function ($scope, SnapshotService, AuthenticationService, AccountEnterprise) {
         AuthenticationService.getAuthentication().success(function (data) {
             $scope.loading = false;
-            $scope.useruu = data.userUU;
+            $scope.noticesId = 325; // 帮助中心指定平台ID号
 
-            SnapshotService.getNotice(7, $scope.useruu, function (data) {	//5表示首页显示的公告条数
-                $scope.notices = data;
+            // SnapshotService.getNotice(7, $scope.useruu, function (data) {	//5表示首页显示的公告条数
+            //     $scope.notices = data;
+            // });
+
+            AccountEnterprise.getB2cUrl({}, function(data) {
+                $scope.toB2cLink = data.url;
+                if($scope.toB2cLink) {
+                    $.ajax({
+                        url:$scope.toB2cLink + '/api/help-service/issues?navId=' + $scope.noticesId,
+                        type:"get",
+                        success:function(data){
+                            $scope.notices = data || [];
+                        },
+                        error:function(data){
+                            console.log(data);
+                            $scope.notices = [];
+                        }
+                    });
+                }
             });
 
             /**
              * 设置单据阅读状态
              * @param id
              */
-            $scope.setReadStatus = function(id) {
-                SnapshotService.setNoticeStatusAfterRead(id, $scope.useruu);
-            }
+            // $scope.setReadStatus = function(id) {
+            //     SnapshotService.setNoticeStatusAfterRead(id, $scope.useruu);
+            // }
 
             /**
              * 判断是否当天时间

+ 3 - 3
src/main/webapp/resources/tpl/index/common/leftAll.html

@@ -46,10 +46,10 @@
 		</div>
 		<div class="pane-body">
 			<ul class="list-unstyled detail details">
-				<li ng-repeat="notice in notices"
-					ng-class="isCurrentTime(dateTime, notice.date) && notice.readStatus == 1 ? 'day-read' : isCurrentTime(dateTime, notice.date) && notice.readStatus == 0 ? 'day-unread' : 'nonday'">
-					<a ng-click="setReadStatus(notice.id)" href="public#/notice/{{notice.id}}" class="" ng-bind="::notice.title" target="_blank"></a><img src="static/img/home/new.png" ng-show="isCurrentTime(dateTime, notice.date)">
+				<li ng-repeat="notice in notices">
+					<a href="{{toB2cLink}}/help/helpDetail/{{notice.num}}" class="" ng-bind="::notice.title" target="_blank"></a><img src="static/img/home/new.png" ng-show="isCurrentTime(dateTime, notice.publishtime)">
 				</li>
+				<li ng-if="notices.length === 0">暂无公告信息!</li>
 			</ul>
 		</div>
 	</div>

+ 1 - 1
src/main/webapp/resources/tpl/index/fa/apCheck.html

@@ -164,7 +164,7 @@
     color: #fff;
     border: 1px solid #fff;
     margin-top: 3px;
-    padding: 0 5px;"  ng-click="setActive();changeDateZone(1, true);condition.$open=false;showNotCheck=false">查看对账记录
+    padding: 0 5px;"  ng-click="setActive();changeDateZone(1, true);condition.$open=false;showNotCheck=false">查看/打印对账记录
 				<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
 			</div>
 		</div>

+ 1 - 1
src/main/webapp/resources/tpl/index/fa/arCheck.html

@@ -165,7 +165,7 @@
     color: #fff;
     border: 1px solid #fff;
     margin-top: 3px;
-    padding: 0 5px;"  ng-click="setActive();changeDateZone(1, true);condition.$open=false;showNotCheck=false">查看对账记录
+    padding: 0 5px;"  ng-click="setActive();changeDateZone(1, true);condition.$open=false;showNotCheck=false">查看/打印对账记录
 				<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
 			</div>
 		</div>