Parcourir la source

submit:小程序二维码刷新

yangdamao il y a 2 ans
Parent
commit
190d9335ab

+ 18 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -153,6 +153,24 @@ public class GoodsController extends BaseController {
         return toAjax(iGoodsService.updateByEditBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 商品批量上下架
+     */
+    @ApiOperation("商品批量上下架")
+    @PostMapping("/batch/updateStatus")
+    public AjaxResult<Void> batchUpdateStatus(@RequestBody GoodsBatchUpdateStatusBo bo) {
+        return toAjax(iGoodsService.GoodsBatchUpdateStatusBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 商品批量删除
+     */
+    @ApiOperation("商品批量删除")
+    @PostMapping("/batch/del")
+    public AjaxResult<Void> batchDelGoods(@RequestBody GoodsBatchDelBo bo) {
+        return toAjax(iGoodsService.batchDelGoods(bo) ? 1 : 0);
+    }
+
     /**
      * 删除商品
      */

+ 1 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/http/HttpUtils.java

@@ -14,6 +14,7 @@ import javax.net.ssl.X509TrustManager;
 
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import org.apache.http.Consts;
 import org.apache.http.Header;
 import cn.hutool.core.lang.Validator;

+ 35 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.google.zxing.BarcodeFormat;
 import com.google.zxing.client.j2se.MatrixToImageWriter;
@@ -38,10 +39,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.ByteArrayOutputStream;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -531,6 +529,17 @@ public class WxLoginService implements IWxLoginService {
         obj.put("scene",sceneParam.toString());
         obj.put("env_version",enCodeVersion);
         String result = HttpUtils.sendPost(url, obj);
+        List<String> codes = Arrays.asList("40001", "42001");
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        if(ObjectUtils.isNotNull(jsonObject.get("errcode")) && codes.contains(jsonObject.get("errcode").toString())){
+            //微信access_token 过期或者失效,刷新access_token
+            String key = "WX_SMALL_ACCESS_TOKEN";
+            redisCache.deleteObject(key);
+            String wxGzhAccessTokenTo = getWxSmallAccessToken();
+            String paramTo = String.format(small_wxEnCodeParam, wxGzhAccessTokenTo);
+            String urlTo = small_wxEnCodeUrl + "?" + paramTo;
+            return HttpUtils.sendPost(urlTo, obj);
+        }
         return result;
     }
 
@@ -880,6 +889,17 @@ public class WxLoginService implements IWxLoginService {
         obj.put("scene",String.format("tid=%s",activityId));
         obj.put("env_version",enCodeVersion);
         String result = HttpUtils.sendPost(url, obj);
+        List<String> codes = Arrays.asList("40001", "42001");
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        if(ObjectUtils.isNotNull(jsonObject.get("errcode")) && codes.contains(jsonObject.get("errcode").toString())){
+            //微信access_token 过期或者失效,刷新access_token
+            String key = "WX_SMALL_ACCESS_TOKEN";
+            redisCache.deleteObject(key);
+            String wxGzhAccessTokenTo = getWxSmallAccessToken();
+            String paramTo = String.format(small_wxEnCodeParam, wxGzhAccessTokenTo);
+            String urlTo = small_wxEnCodeUrl + "?" + paramTo;
+            return HttpUtils.sendPost(urlTo, obj);
+        }
         return result;
     }
 
@@ -894,6 +914,17 @@ public class WxLoginService implements IWxLoginService {
         obj.put("env_version",enCodeVersion);
 //        obj.put("env_version","trial");
         String result = HttpUtils.sendPost(url, obj);
+        List<String> codes = Arrays.asList("40001", "42001");
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        if(ObjectUtils.isNotNull(jsonObject.get("errcode")) && codes.contains(jsonObject.get("errcode").toString())){
+            //微信access_token 过期或者失效,刷新access_token
+            String key = "WX_SMALL_ACCESS_TOKEN";
+            redisCache.deleteObject(key);
+            String wxGzhAccessTokenTo = getWxSmallAccessToken();
+            String paramTo = String.format(small_wxEnCodeParam, wxGzhAccessTokenTo);
+            String urlTo = small_wxEnCodeUrl + "?" + paramTo;
+            return HttpUtils.sendPost(urlTo, obj);
+        }
         return result;
     }
 

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsBatchDelBo.java

@@ -0,0 +1,25 @@
+package com.zhongzheng.modules.goods.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 批量删除
+ *
+ * @author  hjl
+ * @date 2021-10-28
+ */
+@Data
+@ApiModel("批量删除")
+public class GoodsBatchDelBo {
+
+    @ApiModelProperty("商品id集合")
+    private List<Long> goodsIds;
+
+    @ApiModelProperty("状态 1有效 0无效")
+    private Integer status;
+}

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsBatchUpdateStatusBo.java

@@ -0,0 +1,25 @@
+package com.zhongzheng.modules.goods.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 批量处理上下架
+ *
+ * @author  hjl
+ * @date 2021-10-28
+ */
+@Data
+@ApiModel("批量处理上下架")
+public class GoodsBatchUpdateStatusBo {
+
+    @ApiModelProperty("商品id集合")
+    private List<Long> goodsIds;
+
+    @ApiModelProperty("1上架 0未上架")
+    private Integer goodsStatus;
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -93,4 +93,7 @@ public interface IGoodsService extends IService<Goods> {
 
 	List<SyncGoodsExport> selectRjJzsList(GoodsQueryBo bo);
 
+	boolean GoodsBatchUpdateStatusBo(GoodsBatchUpdateStatusBo bo);
+
+	boolean batchDelGoods(GoodsBatchDelBo bo);
 }

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -730,6 +730,26 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return exportList;
     }
 
+    @Override
+    public boolean GoodsBatchUpdateStatusBo(GoodsBatchUpdateStatusBo bo) {
+        if (CollectionUtils.isEmpty(bo.getGoodsIds())){
+            throw new CustomException("商品ID不能为空");
+        }
+        return update(new LambdaUpdateWrapper<Goods>()
+                .set(Goods::getGoodsStatus,bo.getGoodsStatus())
+                .in(Goods::getGoodsId,bo.getGoodsIds()));
+    }
+
+    @Override
+    public boolean batchDelGoods(GoodsBatchDelBo bo) {
+        if (CollectionUtils.isEmpty(bo.getGoodsIds())){
+            throw new CustomException("商品ID不能为空");
+        }
+        return update(new LambdaUpdateWrapper<Goods>()
+                .set(Goods::getStatus,bo.getStatus())
+                .in(Goods::getGoodsId,bo.getGoodsIds()));
+    }
+
     /**
      * 获取商品规格模板列表
      * @author change

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="QuestionResultVo">
         SELECT
         DISTINCT q.*,
-        cq.question_id as collect_question_id,
+        cq.collect_question_id as collect_question_id,
         cq.exam_id as collect_exam_id,
         cq.goods_id as collect_goods_id,
         cq.order_goods_id as collect_order_goods_id

+ 6 - 0
zhongzheng-system/src/main/resources/mapper/modules/mock/MockApplyMapper.xml

@@ -122,6 +122,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="mockActivity != null and mockActivity != ''">
             and ma.mock_activity = #{mockActivity}
         </if>
+        <if test="mockActivity != null and mockActivity != '' and mockActivity == 1">
+            and ma.apply_id not in (select mock_apply_id from exam_activity where status = 1 )
+        </if>
         <if test="educationTypeId != null and educationTypeId != ''">
             and ma.education_type_id = #{educationTypeId}
         </if>
@@ -185,6 +188,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="endTime != null and endTime != ''">
             and mmst.exam_time &lt; #{endTime}
         </if>
+        <if test="searchKey != null and searchKey != ''">
+            and ma.apply_name like CONCAT('%',#{searchKey},'%')
+        </if>
         ORDER BY mmst.exam_time
     </select>
     <select id="listApplyBusiness" resultType="com.zhongzheng.modules.mock.vo.MockApplyVo">