liangpeile 1 year ago
parent
commit
5b355a0389

+ 10 - 1
crmeb-admin/src/main/java/com/zbkj/admin/controller/merchant/NewMerchantApi.java

@@ -351,7 +351,7 @@ public class NewMerchantApi {
             String tempId = merchantSmsTemplate.getTempId();
             MerchantSmsTiming merchantSmsTiming = merchantSmsTimingService.selectByTempId(tempId);
             Integer isStatus = merchantSmsTiming.getIsStatus();
-            merchantSmsTemplate.setStatus(String.valueOf(isStatus));
+            merchantSmsTemplate.setIsStatus(isStatus);
             merchantSmsTemplateService.updateById(merchantSmsTemplate);
         }
 
@@ -544,4 +544,13 @@ public class NewMerchantApi {
         }
         return CommonResult.success("操作成功");
     }
+
+
+    @ApiOperation(value = "获取定时任务信息")
+    @RequestMapping(value = "/getTaskMessage", method = RequestMethod.POST)
+    public CommonResult<MerchantSmsTiming> getTaskMessage( @RequestParam(value = "tempId", required = false) String tempId) {
+        MerchantSmsTiming merchantSmsTiming = merchantSmsTimingService.selectByTempId(tempId);
+
+        return CommonResult.success(merchantSmsTiming);
+    }
 }

+ 1 - 0
crmeb-common/src/main/java/com/zbkj/common/model/merchant/MerchantSmsTemplate.java

@@ -44,6 +44,7 @@ public class MerchantSmsTemplate implements Serializable {
     @ApiModelProperty(value = "状态")
     private String status;
 
+
     @ApiModelProperty(value = "短息内容")
     private String content;
 

+ 31 - 0
crmeb-common/src/main/java/com/zbkj/common/response/CartShareMerchantResponse.java

@@ -0,0 +1,31 @@
+package com.zbkj.common.response;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 购物车商户响应对象
+
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="CartShareMerchantResponse对象", description="购物车商户响应对象")
+public class CartShareMerchantResponse implements Serializable {
+
+    private static final long serialVersionUID = 3558884699193209193L;
+
+
+
+    @ApiModelProperty(value = "购物车商品信息")
+    private List<CartMerchantResponse> cartInfoList;
+
+    @ApiModelProperty(value = "购物车是否有效 0无效 1有效")
+    private Integer isInvalid;
+}

+ 40 - 17
crmeb-front/src/main/java/com/zbkj/front/controller/NewFrontApi.java

@@ -249,6 +249,7 @@ public class NewFrontApi {
         LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
         //获取登录账号信息
         User user = userService.getInfo();
+        Integer enterpriseId1 =0;
         if (null != user.getIsAllOrders()) {
             if (3 == user.getIsEnterpriseUser() && 1 == user.getIsAllOrders()) {
                 LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
@@ -256,6 +257,10 @@ public class NewFrontApi {
                 UserBypassAccount one = userBypassAccountService.getOne(queryWrapper3);
                 Integer enterpriseId = one.getEnterpriseId();
                 id = String.valueOf(enterpriseId);
+
+                UserEnterprise userEnterprise = userEnterpriseService.getById(id);
+                enterpriseId1 = userEnterprise.getUserId();
+
             }
         }
 
@@ -274,6 +279,9 @@ public class NewFrontApi {
         List<Integer> ids = list.stream()
                 .map(UserBypassAccount::getUserId)
                 .collect(Collectors.toList());
+        ids.add(enterpriseId1);
+
+
 
         return CommonResult.success(CommonPage.restPage(frontOrderService.list2(isRemit, status, pageRequest, ids,
                 Integer.valueOf(id), department
@@ -344,17 +352,17 @@ public class NewFrontApi {
         String image = aaaService.getImage(getwxacodeRequest);
         JSONObject jsonObject = new JSONObject();
         JSONObject jsonObject1 = new JSONObject();
-        if (StringUtils.isNotBlank(image)){
+        if (StringUtils.isNotBlank(image)) {
             String image1 = image.substring(0, image.indexOf("shareId"));
-            String str2 = image.substring(image1.length()+7, image.length());
-            jsonObject.put("shareId",str2);
-            jsonObject1.put("data",jsonObject);
-            jsonObject1.put("message",image1);
-            jsonObject1.put("code",200);
-        }else{
-            jsonObject1.put("data",null);
-            jsonObject1.put("message","请求失败");
-            jsonObject1.put("code",500);
+            String str2 = image.substring(image1.length() + 7, image.length());
+            jsonObject.put("shareId", str2);
+            jsonObject1.put("data", jsonObject);
+            jsonObject1.put("message", image1);
+            jsonObject1.put("code", 200);
+        } else {
+            jsonObject1.put("data", null);
+            jsonObject1.put("message", "请求失败");
+            jsonObject1.put("code", 500);
 
         }
         return jsonObject1;
@@ -362,13 +370,24 @@ public class NewFrontApi {
 
     @ApiOperation(value = "获取购物车信息(分享完购物车后用的)ids 为购物车表id")
     @RequestMapping(value = "/getwxacode1", method = RequestMethod.GET)
-    public CommonResult<List<CartMerchantResponse>> getwxacode1(@RequestParam(name = "jsonIds") String jsonIds) {
+    public CommonResult<?> getwxacode1(@RequestParam(name = "jsonIds") String jsonIds) {
         try {
 //            List<Integer> ids = Arrays.stream(jsonIds.split(","))
 //                    .map(Integer::parseInt)
 //                    .collect(Collectors.toList());
             List<CartMerchantResponse> list2 = cartService.getList2(jsonIds);
-            return CommonResult.success(list2);
+            Integer isInvalid=0;
+            for (CartMerchantResponse cartMerchantResponse : list2) {
+                 isInvalid = cartMerchantResponse.getIsInvalid();
+                 if(1==isInvalid){
+                     isInvalid=1;
+                 }
+            }
+            CartShareMerchantResponse cartShareMerchantResponse = new CartShareMerchantResponse();
+            cartShareMerchantResponse.setCartInfoList(list2);
+            cartShareMerchantResponse.setIsInvalid(isInvalid);
+
+            return CommonResult.success(cartShareMerchantResponse);
         } catch (Exception e) {
             e.printStackTrace();
             return CommonResult.failed();
@@ -514,7 +533,7 @@ public class NewFrontApi {
     public CommonResult<?> departUser(@RequestParam(name = "departmentId", required = false) String departmentId,
                                       @RequestParam(name = "organizationId", required = false) String organizationId
     ) {
-        List<UserBypassAccount> list=null;
+        List<UserBypassAccount> list = new ArrayList<>();
         if (StringUtils.isNotBlank(organizationId)) {
             LambdaQueryWrapper<UserEnterprise> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(UserEnterprise::getOrganizationId, organizationId);
@@ -522,8 +541,8 @@ public class NewFrontApi {
             Integer id = userEnterprise.getId();
             LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
             queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
-            queryWrapper2.eq(UserBypassAccount::getIsDelete,0 );
-             list = userBypassAccountService.list(queryWrapper2);
+            queryWrapper2.eq(UserBypassAccount::getIsDelete, 0);
+            list = userBypassAccountService.list(queryWrapper2);
         }
         if (StringUtils.isNotBlank(departmentId)) {
             String[] split = departmentId.split(",");
@@ -540,8 +559,12 @@ public class NewFrontApi {
                 LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
                 queryWrapper3.eq(UserBypassAccount::getEnterpriseId, id2);
                 queryWrapper3.eq(UserBypassAccount::getDepartment, name);
-                queryWrapper3.eq(UserBypassAccount::getIsDelete,0 );
-                 list = userBypassAccountService.list(queryWrapper3);
+                queryWrapper3.eq(UserBypassAccount::getIsDelete, 0);
+                List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper3);
+                for (UserBypassAccount userBypassAccount : list1) {
+                    list.add(userBypassAccount);
+                }
+
             }
         }
         return CommonResult.success(list);

+ 17 - 5
crmeb-front/src/main/java/com/zbkj/front/service/impl/AAAServiceImpl.java

@@ -15,6 +15,7 @@ import com.zbkj.service.service.CartShareService;
 import com.zbkj.service.service.SystemConfigService;
 import com.zbkj.service.service.SystemFormTempService;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.formula.functions.IDStarAlgorithm;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -73,16 +74,24 @@ public class AAAServiceImpl implements AAAService {
         String substring = cartIdString.substring(cartIdString.indexOf("=")+1);
         String[] cartIds = substring.split(",");
 
+
+
         LambdaQueryWrapper<Cart> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(Cart::getId,cartIds);
 
         List<Cart> cartList = cartService.list(queryWrapper);
         String shareId= UUID.randomUUID().toString().replace("-","");
+        String substring1 = shareId.substring(1, 10);
+        String userId = StringUtils.substringAfterLast(scene, "=");
+
+        String temp ="shareId="+substring1+"&userId="+userId;
+        System.out.println(temp);
+        System.out.println(scene);
         for (Cart cart : cartList) {
             CartShare cartShare = new CartShare();
             BeanUtils.copyProperties(cart,cartShare);
             cartShare.setStartTime(new Date());
-            cartShare.setShareId(shareId);
+            cartShare.setShareId(substring1);
             cartShareService.save(cartShare);
         }
         File outputFile = new File(fileNmaes);
@@ -111,7 +120,10 @@ public class AAAServiceImpl implements AAAService {
             conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
 
             // 构造请求体
-            String jsonRequest = "{\"scene\":\"" + scene + "\",\"shareId\":\"" + shareId + "\",\"env_version\":\"" + env_version + "\", \"page\":\"" + page + "\"}";
+
+
+            String jsonRequest = "{\"scene\":\"" + temp + "\",\"env_version\":\"" + env_version + "\", \"page\":\"" + page + "\"}";
+            System.out.println(jsonRequest);
 
             OutputStream output = conn.getOutputStream();
             output.write(jsonRequest.getBytes("UTF-8"));
@@ -128,19 +140,19 @@ public class AAAServiceImpl implements AAAService {
                     FileOutputStream fos = new FileOutputStream(outputFile);
                     fos.write(qrCodeData);
                     fos.close();
-                    return fileNmae+"shareId"+shareId;
+                    return fileNmae+"shareId"+substring1;
                 } else if (contentType.startsWith("application/json")) {
                     // 返回的是错误信息,读取错误信息
                     InputStream input = conn.getInputStream();  // 修改这里
                     String errorMessage = IOUtils.toString(input, StandardCharsets.UTF_8);
-                    return errorMessage+"shareId"+shareId;
+                    return errorMessage+"shareId"+substring1;
                 }
             } else {
                 // 请求失败,读取错误信息
                 InputStream input = conn.getErrorStream();
                 if (input != null) {  // 额外的 null 检查
                     String errorMessage = IOUtils.toString(input, StandardCharsets.UTF_8);
-                    return errorMessage+"shareId"+shareId;
+                    return errorMessage+"shareId"+substring1;
                 }
             }
         } catch (IOException e) {

+ 0 - 9
crmeb-service/src/main/java/com/zbkj/service/service/impl/CartServiceImpl.java

@@ -171,15 +171,6 @@ public class CartServiceImpl extends ServiceImpl<CartDao, Cart> implements CartS
             CartMerchantResponse merchantResponse = new CartMerchantResponse();
             merchantResponse.setMerId(merId);
             merchantResponse.setIsInvalid(1);
-            for (CartShare cartShare : cartList) {
-                if (null != cartShare.getIsInvalid()) {
-                    if (0 == cartShare.getIsInvalid()) {
-                        merchantResponse.setIsInvalid(0);
-                    }
-                } else {
-                    merchantResponse.setIsInvalid(0);
-                }
-            }
             merchantResponse.setMerName(merchantMap.get(merId).getName());
             List<CartShare> merCartList = cartList.stream().filter(e -> e.getMerId().equals(merId)).collect(Collectors.toList());
             List<CartInfoResponse> infoResponseList = merCartList.stream().map(storeCart -> {