Browse Source

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

FengChaoYu 5 tháng trước cách đây
mục cha
commit
fbd34486bd

+ 13 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/order/OrderController.java

@@ -96,6 +96,19 @@ public class OrderController {
         return ResponseHelper.success(buy);
     }
 
+
+    @PostMapping("/buytest")
+    @ApiOperation("立即购买")
+    public ResponseHelper<PayDetail> buytest(
+            @ApiParam(value = "订单号",required = false) @RequestParam(required = false) String orderId,
+            @ApiParam(value = "金额",required = true) @RequestParam BigDecimal amount,
+            HttpServletRequest request
+    ) throws Exception {
+
+        PayDetail buy = orderLogic.buytest(orderId,amount ,request);
+        return ResponseHelper.success(buy);
+    }
+
     @PostMapping("/wait/pay")
     @ApiOperation("支付待支付订单")
     public ResponseHelper<PayDetail> waitPayOrder(

+ 6 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/common/WorkerComListLogic.java

@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
 
 import com.gree.mall.miniapp.bean.es.CommonListES;
 import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
+import com.gree.mall.miniapp.exception.RemoteServiceException;
 import com.gree.mall.miniapp.logic.es.EsLogic;
 import com.gree.mall.miniapp.plus.entity.WorkerComList;
 import com.gree.mall.miniapp.plus.entity.WorkerComListWebsit;
@@ -15,6 +16,7 @@ import com.gree.mall.miniapp.plus.service.AdminWebsitService;
 import com.gree.mall.miniapp.plus.service.WorkerComListService;
 import com.gree.mall.miniapp.plus.service.WorkerComListWebsitService;
 import com.gree.mall.miniapp.plus.service.WorkerComListWorkerService;
+import com.gree.mall.miniapp.utils.StringUtil;
 import com.gree.mall.miniapp.utils.oss.OSSUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -67,6 +69,8 @@ public class WorkerComListLogic {
                 return new Page<>(pageNum, pageSize);
             }
             comListIds = worker.stream().map(WorkerComListWorker::getWorkerComListId).distinct().collect(Collectors.toList());
+        }else {
+            throw new RemoteServiceException("师傅编号未传");
         }
         IPage<WorkerComList> page = workerComListService.lambdaQuery()
                 .like(StringUtils.isNotEmpty(title), WorkerComList::getTitle, title)
@@ -87,6 +91,8 @@ public class WorkerComListLogic {
      * @param workerNumber
      */
     public List<CommonListES> record(String comListId, String workerNumber) {
+        if (StringUtil.isEmpty(workerNumber))
+         throw new RemoteServiceException("师傅编号未传");
         List<CommonListES> list = esLogic.list(Arrays.asList(workerNumber), workerNumber, comListId);
         return list;
     }

+ 2 - 2
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/es/EsLogic.java

@@ -51,10 +51,10 @@ public class EsLogic {
             must.must(QueryBuilders.termQuery("comListId", comId));
         }
         if(StringUtils.isNotEmpty(workerNumber)){
-            must.must(QueryBuilders.termQuery("workerNumber", workerNumber));
+            must.must(QueryBuilders.matchPhraseQuery("workerNumber", workerNumber));
         }
         if(CollectionUtils.isNotEmpty(websitNumbers)){
-            must.must(QueryBuilders.termsQuery("websitNumber",websitNumbers));
+            must.must(QueryBuilders.termsQuery("websitNumber.keyword",websitNumbers));
         }
         NativeSearchQuery titleBuild = new NativeSearchQueryBuilder().withQuery(titleQueryBuilder).build();
         NativeSearchQuery dataBuild = new NativeSearchQueryBuilder().withQuery(must).build();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 187 - 184
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/OrderLogic.java


+ 4 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/comlist/ComListAllLogic.java

@@ -86,6 +86,7 @@ public class ComListAllLogic {
                 .eq(isNotice != null, ComList::getIsNotice, isNotice)
                 .like(StringUtils.isNotEmpty(title), ComList::getTitle, title)
                 .like(StringUtils.isNotEmpty(remark), ComList::getRemark, remark)
+                .eq( ComList::getType, "FILE")
                 .orderByDesc(ComList::getCreateTime)
                 .page(new Page<>(pageNo, pageSize));
         //不返回密码
@@ -119,6 +120,7 @@ public class ComListAllLogic {
         comList.setOperatorUserName(adminUser.getUserName());
         comList.setOperatorNickName(adminUser.getNickName());
         comList.setCreateTime(new Date());
+        comList.setType("FILE");
         comList.insert();
 
         //新增拆分的附件明细表
@@ -128,7 +130,7 @@ public class ComListAllLogic {
         bean.setTitle(title);
         bean.setComListId(comList.getId());
         bean.setFileName(title);
-        bean.setWebsitId(adminUser.getAdminWebsitIds().get(0));
+        bean.setWebsitId(adminUser.getUserName());
         bean.setFileUrl(file);
         bean.setIsDownload(false);
         bean.setCreateTime(new Date());
@@ -368,9 +370,8 @@ public class ComListAllLogic {
             if (StringUtils.isEmpty(comDetail.getWebsitId())) {
                 continue;
             }
-            String fileUrl = ossUtil.getUrlWw(comDetail.getFileUrl());
             Map<String, Object> map = new HashMap<>();
-            map.put("fileUrl", fileUrl);
+            map.put("fileUrl", comDetail.getFileUrl());
             map.put("fileName", comDetail.getWebsitId() + "-(" + comDetail.getTitle() + ").xlsx");
             files.add(map);
         }

+ 7 - 7
mall-server-api/src/main/java/com/gree/mall/manager/logic/comlist/ComListLogic.java

@@ -88,7 +88,7 @@ public class ComListLogic {
                 .eq(isNotice != null, ComList::getIsNotice, isNotice)
                 .like(StringUtils.isNotEmpty(title), ComList::getTitle, title)
                 .like(StringUtils.isNotEmpty(remark), ComList::getRemark, remark)
-                .like(StringUtils.isNotEmpty(remark), ComList::getRemark, remark)
+                .eq( ComList::getType, "CENTER")
                 .orderByDesc(ComList::getCreateTime)
                 .page(new Page<>(pageNo, pageSize));
         //不返回密码
@@ -132,7 +132,7 @@ public class ComListLogic {
         bean.setTitle(title);
         bean.setComListId(comList.getId());
         bean.setFileName(title);
-        bean.setWebsitId(adminUser.getAdminWebsitIds().get(0));
+        bean.setWebsitId(adminUser.getUserName());
         bean.setFileUrl(file);
         bean.setIsDownload(false);
         bean.setCreateTime(new Date());
@@ -143,8 +143,7 @@ public class ComListLogic {
         //上传主文件到oss,并记录
         //CommonFile commonFile = commonLogic.uploadFile(file);
 
-        String url = ossUtil.getUrl(file);
-        InputStream inputStream = commonLogic.getFileInputStreamByUrl(url);
+        InputStream inputStream = commonLogic.getFileInputStreamByUrl(file);
         List<Object> objects = ExcelUtils.importExcel(inputStream);
         //拆分excel并上传oss
         List<Map<String, Object>> fileUrls = this.createExcel(objects);
@@ -221,9 +220,8 @@ public class ComListLogic {
             if (StringUtils.isEmpty(comDetail.getWebsitId())) {
                 continue;
             }
-            String fileUrl = ossUtil.getUrlWw(comDetail.getFileUrl());
             Map<String, Object> map = new HashMap<>();
-            map.put("fileUrl", fileUrl);
+            map.put("fileUrl", comDetail.getFileUrl());
             map.put("fileName", comDetail.getWebsitId() + "-(" + comDetail.getTitle() + ").xlsx");
             files.add(map);
         }
@@ -334,9 +332,11 @@ public class ComListLogic {
 //                        log.error("上传文件失败",e);
 //                    }
                 //});
+
+                String ossUrl = ossUtil.getAccessUrl() + filePath;
                 Map<String, Object> mp = new HashMap<>();
                 mp.put("websitNumber", websitNumber);
-                mp.put("filePath", filePath);
+                mp.put("filePath", ossUrl);
                 fileUrls.add(mp);
             }
             log.info("【中心下发文件3】" + DateUtils.formatDate(new Date()));

+ 13 - 9
mall-server-api/src/main/java/com/gree/mall/manager/logic/comlist/WorkerComListLogic.java

@@ -10,14 +10,8 @@ import com.gree.mall.manager.bean.es.CommonListES;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.logic.es.EsLogic;
-import com.gree.mall.manager.plus.entity.AdminWebsit;
-import com.gree.mall.manager.plus.entity.WorkerComList;
-import com.gree.mall.manager.plus.entity.WorkerComListWebsit;
-import com.gree.mall.manager.plus.entity.WorkerComListWorker;
-import com.gree.mall.manager.plus.service.AdminWebsitService;
-import com.gree.mall.manager.plus.service.WorkerComListService;
-import com.gree.mall.manager.plus.service.WorkerComListWebsitService;
-import com.gree.mall.manager.plus.service.WorkerComListWorkerService;
+import com.gree.mall.manager.plus.entity.*;
+import com.gree.mall.manager.plus.service.*;
 import com.gree.mall.manager.utils.CommonUtils;
 import com.gree.mall.manager.utils.excel.ExcelUtils;
 import com.gree.mall.manager.utils.oss.OSSUtil;
@@ -56,6 +50,8 @@ public class WorkerComListLogic {
     WorkerComListWebsitService workerComListWebsitService;
     @Autowired
     AdminWebsitService adminWebsitService;
+    @Autowired
+    WebsitUserService websitUserService;
 
 
     /**
@@ -74,8 +70,14 @@ public class WorkerComListLogic {
             comListIds = worker.stream().map(WorkerComListWorker::getWorkerComListId).distinct().collect(Collectors.toList());
         } else {
             //以登录人为准
+            List<WebsitUser> websitUsers = websitUserService.lambdaQuery()
+                    .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),WebsitUser::getWebsitId, adminUser.getAdminWebsitIds())
+                    .isNotNull(WebsitUser::getWorkerNumber)
+                    .select(WebsitUser::getWorkerNumber).list();
+            List<String> collect = websitUsers.stream().map(WebsitUser::getWorkerNumber).collect(Collectors.toList());
+
             List<WorkerComListWebsit> websit = workerComListWebsitService.lambdaQuery()
-                    .in(WorkerComListWebsit::getWebsitId, adminUser.getAdminWebsitIds())
+                    .in(!CollectionUtils.isEmpty(collect),WorkerComListWebsit::getWebsitId,collect)
                     .list();
             if (CollectionUtils.isEmpty(websit)) {
                 return new Page<>(pageNum, pageSize);
@@ -126,6 +128,8 @@ public class WorkerComListLogic {
         workerComList.setFileUrl(fileUrl);
         workerComList.setCreateTime(new Date());
         workerComList.setUpdateTime(new Date());
+        workerComList.setCompanyWechatId(adminUser.getCompanyWechatId());
+        workerComList.setCompanyWechatName(adminUser.getCompanyName());
         workerComList.insert();
 
        // String url = ossUtil.getUrl(fileUrl);

+ 4 - 6
mall-server-api/src/main/java/com/gree/mall/manager/logic/es/EsLogic.java

@@ -49,15 +49,13 @@ public class EsLogic {
             CommonUtils.initList2(rows,rows.size());
             List<Object> row = (List<Object>) rows.get(i);
             String workerNumber = (String)row.get(0);
-            if(StringUtils.isEmpty(workerNumber) || (i > 0 && workerNumber.length() < 8)){
+            if(StringUtils.isEmpty(workerNumber)){
                 break;
             }
             CommonListES commonListES = new CommonListES();
             commonListES.setType(i==0?"1":"2");
             commonListES.setWorkerNumber(workerNumber);
-            if(workerNumber.length() >= 8) {
-                commonListES.setWebsitNumber(workerNumber.substring(0, 8));
-            }
+            commonListES.setWebsitNumber(workerNumber);
             commonListES.setComListId(comListId);
             
             for(int x = start;x <= row.size();x++) {
@@ -89,10 +87,10 @@ public class EsLogic {
             must.must(QueryBuilders.termQuery("comListId", comId));
         }
         if(StringUtils.isNotEmpty(workerNumber)){
-            must.must(QueryBuilders.termQuery("workerNumber", workerNumber));
+            must.must(QueryBuilders.matchPhraseQuery("workerNumber", workerNumber));
         }
         if(CollectionUtils.isNotEmpty(websitNumbers)){
-            must.must(QueryBuilders.termsQuery("websitNumber",websitNumbers));
+            must.must(QueryBuilders.termsQuery("websitNumber.keyword",websitNumbers));
         }
         NativeSearchQuery titleBuild = new NativeSearchQueryBuilder().withQuery(titleQueryBuilder).build();
         NativeSearchQuery dataBuild = new NativeSearchQueryBuilder().withQuery(must).build();

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác