From 1e92eff67b997263ecefa255c63eb6641c47b57f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 14 六月 2019 10:22:33 +0800 Subject: [PATCH] 设备消息BUG解决,品牌 --- fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java | 2 fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml | 2 fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java | 135 ++++++++++++++++++++++---------------------- fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java | 6 +- fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java | 2 fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml | 4 fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java | 4 + fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java | 4 fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java | 2 9 files changed, 81 insertions(+), 80 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java b/fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java index 22dea80..57cd286 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java @@ -71,6 +71,8 @@ } catch (IOException e) { e.printStackTrace(); } + + LogHelper.test("缇庢唇:body----" + sb.toString()); String sign = ""; try { @@ -99,7 +101,7 @@ "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg, new Date()); } - LogHelper.test("缇庢唇:body----" + sb.toString()); + } public String sign(String raw_body) throws java.security.SignatureException { diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java index 1d8bcfd..ed79a50 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java @@ -37,14 +37,13 @@ @Controller @RequestMapping("admin/new/api/v1/brand") public class BrandShopAdminController { - + @Resource private BrandClassService brandClassService; - + @Resource private BrandClassShopService brandClassShopService; - - + /** * 淇濆瓨淇℃伅 * @@ -55,7 +54,7 @@ @RequestMapping(value = "save") public void save(String callback, BrandClass brandClass, PrintWriter out) { try { - brandClassService.saveObject(brandClass); + brandClassService.saveObject(brandClass); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); } catch (BrandClassException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); @@ -65,8 +64,6 @@ } } - - /** * 淇敼鎺掑簭 * @@ -86,20 +83,20 @@ e.printStackTrace(); } } - - /** * 鏌ヨ + * * @param callback * @param pageIndex * @param pageSize - * @param key 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� + * @param key + * 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� * @param out */ @RequestMapping(value = "query") - public void query(String callback, Integer pageIndex, Integer pageSize, String key, - Integer state, PrintWriter out) { + public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, + PrintWriter out) { if (pageIndex == null || pageIndex < 1) { pageIndex = 1; @@ -116,14 +113,14 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); return; } - + long count = brandClassService.countQuery(key, state); - + int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); + gsonBuilder.serializeNulls(); Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); JSONObject data = new JSONObject(); @@ -138,9 +135,9 @@ } } - /** * 鍒犻櫎 + * * @param callback * @param idArray * @param out @@ -154,22 +151,24 @@ return; } Gson gson = new Gson(); - List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType()); + List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() { + }.getType()); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏈娴嬪埌鍒犻櫎鐨勬暟鎹�")); return; } int count = brandClassService.deleteBatchByPrimaryKey(list); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎴愬姛鍒犻櫎["+ count +"]鏉℃暟鎹�")); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎴愬姛鍒犻櫎[" + count + "]鏉℃暟鎹�")); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒犻櫎澶辫触")); e.printStackTrace(); } } - + /** * 绛涢�夊垪琛� + * * @param callback * @param out */ @@ -184,14 +183,14 @@ List<Object> result_list = new ArrayList<Object>(); if (list != null && list.size() > 0) { - for (BrandClass record: list) { - Map<String,Object> map =new HashMap<String,Object>(); + for (BrandClass record : list) { + Map<String, Object> map = new HashMap<String, Object>(); map.put("key", record.getId()); map.put("value", record.getName()); result_list.add(map); } } - + JSONObject data = new JSONObject(); data.put("result_list", result_list); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); @@ -201,14 +200,14 @@ } } - - /** * 鏌ヨ + * * @param callback * @param pageIndex * @param pageSize - * @param key 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� + * @param key + * 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� * @param out */ @RequestMapping(value = "queryTaoBaoShop") @@ -217,59 +216,58 @@ if (pageIndex == null || pageIndex < 1) { pageIndex = 1; } - + if (pageSize == null || pageSize < 1) { pageSize = Constant.PAGE_SIZE; } - + try { - TaoBaoShopInfoDTO taoBaoShopInfoDTO = TaoKeApiUtil.searchShop(key, pageIndex, pageSize); - + TaoBaoShopInfoDTO taoBaoShopInfoDTO = TaoKeApiUtil.searchShop(key, pageIndex, pageSize); + List<TaoBaoShopInfo> listInfo = taoBaoShopInfoDTO.getListInfo(); if (listInfo == null || listInfo.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); return; } - + List<Long> listShopId = new ArrayList<Long>(); - for (TaoBaoShopInfo taoBaoShopInfo: listInfo) { + for (TaoBaoShopInfo taoBaoShopInfo : listInfo) { listShopId.add(taoBaoShopInfo.getUserId()); } - + // 宸插瓨鍦ㄦ暟鎹簱涓� List<BrandClassShop> listExist = brandClassShopService.getExistByShopIds(listShopId); - + JSONArray array = new JSONArray(); - for (TaoBaoShopInfo taoBaoShopInfo: listInfo) { + for (TaoBaoShopInfo taoBaoShopInfo : listInfo) { String name = ""; if (listExist != null && listExist.size() > 0) { Long userId = taoBaoShopInfo.getUserId(); - for (BrandClassShop brandClassShop: listExist) { + for (BrandClassShop brandClassShop : listExist) { TaoBaoShop shop = brandClassShop.getShop(); - if (shop !=null && userId == shop.getId() || userId.equals(shop.getId()) ) { + if (shop != null && userId == shop.getId() || userId.equals(shop.getId())) { BrandClass brandClass = brandClassShop.getBrandClass(); name = brandClass.getName(); } } } - + JSONObject innerData = new JSONObject(); innerData.put("cname", name); innerData.put("shopInfo", taoBaoShopInfo); array.add(innerData); } - + JSONObject data = new JSONObject(); data.put("pe", taoBaoShopInfoDTO.getPage()); - data.put("result_list",array); + data.put("result_list", array); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); e.printStackTrace(); } } - - + /** * 娣诲姞搴楅摵鍏ュ簱 * @@ -278,20 +276,21 @@ * @param out */ @RequestMapping(value = "saveShopInfo") - public void saveShopInfo(String callback,Long cid, String idArray, PrintWriter out) { + public void saveShopInfo(String callback, Long cid, String idArray, PrintWriter out) { try { if (StringUtil.isNullOrEmpty(idArray)) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨鎿嶄綔鐨勬暟鎹�")); return; } Gson gson = new Gson(); - List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType()); + List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() { + }.getType()); - String shopIds = brandClassShopService.saveShopInfo(cid,list); + String shopIds = brandClassShopService.saveShopInfo(cid, list); if (StringUtil.isNullOrEmpty(shopIds)) { JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); } else { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浠ヤ笅搴楅摵ID:"+ shopIds + ",鏈坊鍔犳垚鍔�")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浠ヤ笅搴楅摵ID:" + shopIds + ",鏈坊鍔犳垚鍔�")); } } catch (BrandClassShopException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); @@ -300,20 +299,20 @@ e.printStackTrace(); } } - - /** * 鏌ヨ + * * @param callback * @param pageIndex * @param pageSize - * @param key 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� + * @param key + * 妯$硦鏌ヨ锛氳鏄庛�佹爣璇� * @param out */ @RequestMapping(value = "queryClassShop") - public void queryClassShop(String callback, Integer pageIndex, Integer pageSize, String key, - Long cid , Integer state, PrintWriter out) { + public void queryClassShop(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, + Integer state, PrintWriter out) { if (pageIndex == null || pageIndex < 1) { pageIndex = 1; @@ -324,20 +323,21 @@ } try { - List<BrandClassShop> list = brandClassShopService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, state); + List<BrandClassShop> list = brandClassShopService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, + state); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); return; } - + long count = brandClassShopService.countQuery(key, cid, state); - + int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); + gsonBuilder.serializeNulls(); Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); JSONObject data = new JSONObject(); @@ -352,7 +352,6 @@ } } - /** * 淇濆瓨淇℃伅 * @@ -362,14 +361,14 @@ */ @RequestMapping(value = "saveClassShop") public void saveClassShop(String callback, Long id, Long cid, String shopName, Integer state, Integer top, - HttpServletRequest request, PrintWriter out) { + String key, HttpServletRequest request, PrintWriter out) { try { if (request instanceof MultipartHttpServletRequest) { - MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; - brandClassShopService.changeShopInfo(fileRequest.getFile("file"), id, cid, shopName, state, top); - }else{ - brandClassShopService.changeShopInfo(null, id, cid, shopName, state, top); - } + MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; + brandClassShopService.changeShopInfo(fileRequest.getFile("file"), id, cid, shopName, state, top, key); + } else { + brandClassShopService.changeShopInfo(null, id, cid, shopName, state, top, key); + } JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); } catch (BrandClassShopException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); @@ -378,8 +377,7 @@ e.printStackTrace(); } } - - + /** * 淇敼鎺掑簭 * @@ -399,10 +397,10 @@ e.printStackTrace(); } } - - + /** * 鍒犻櫎 + * * @param callback * @param idArray * @param out @@ -415,15 +413,16 @@ return; } Gson gson = new Gson(); - List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType()); + List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() { + }.getType()); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏈娴嬪埌鍒犻櫎鐨勬暟鎹�")); return; } - + brandClassShopService.deleteBatchByPrimaryKey(list); - + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛")); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒犻櫎澶辫触")); diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml index 673498e..4ab340e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml @@ -76,7 +76,7 @@ <if test="unReadCount != null">#{unReadCount,jdbcType=INTEGER},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> - <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR}</if> + <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR},</if> <if test="latestContentTime != null">#{latestContentTime,jdbcType=TIMESTAMP}</if> </trim> </insert> diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml index 8a9ffd6..0148741 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml @@ -204,11 +204,11 @@ <select id="getShopByKey" resultMap="BaseResultVOMap" > SELECT * FROM (SELECT COUNT(t.`id`) AS totalGoods,po.* FROM yeshi_ec_taobao_shop_info po LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id` - WHERE <![CDATA[t.`couponAmount` > 0 AND po.`tsi_key` LIKE '%${key}%' + WHERE <![CDATA[t.`couponAmount` > 0 AND FIND_IN_SET(#{key},po.`tsi_key`) GROUP BY t.`sellerId` HAVING totalGoods> 2]]>)A LEFT JOIN (SELECT t.*,po.`tsi_id` FROM yeshi_ec_taobao_shop_info po LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id` - WHERE<![CDATA[ t.`couponAmount` > 0 ]]>AND po.`tsi_key` LIKE '%${key}%' + WHERE<![CDATA[ t.`couponAmount` > 0 ]]>AND FIND_IN_SET(#{key},po.`tsi_key`) ORDER BY t.`biz30day` DESC LIMIT 3)B ON B.`tsi_id` = A.`tsi_id` </select> diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java index 597b7df..26c4a66 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java @@ -126,7 +126,7 @@ @Override @Transactional - public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top) + public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,String key) throws BrandClassShopException { if (id == null) { @@ -148,7 +148,7 @@ } // 鑷畾涔夊浘鐗� - taoBaoShopService.changeInfo(file, shop.getId(), shopName); + taoBaoShopService.changeInfo(file, shop.getId(), shopName,key); BrandClassShop updateshop = new BrandClassShop(); updateshop.setState(state); diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java index b6d9cae..1cc4323 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java @@ -35,7 +35,7 @@ @Resource private TaoBaoShopMapper taoBaoShopMapper; - + @Resource private HongBaoManageService hongBaoManageService; @@ -81,7 +81,7 @@ } @Override - public void changeInfo(MultipartFile file, Long id, String shopName) { + public void changeInfo(MultipartFile file, Long id, String shopName, String key) { TaoBaoShop taoBaoShop = taoBaoShopMapper.selectByPrimaryKey(id); if (taoBaoShop == null) { return; @@ -113,6 +113,7 @@ updateShop.setId(id); updateShop.setShopNameCustom(shopName); + updateShop.setKey(key); taoBaoShopMapper.updateByPrimaryKeySelective(updateShop); } @@ -161,7 +162,6 @@ return shop; } - @Override @Cacheable(value = "brandCache", key = "'getShopByKey-'+#key") public List<TaoBaoShopVO> getShopByKey(String key) { diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java index 77df820..0bd8287 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java @@ -55,7 +55,7 @@ * @param state * @throws BrandClassShopException */ - public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top) + public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,String key) throws BrandClassShopException; diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java index 1ed5859..6ec17a0 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java @@ -47,7 +47,7 @@ * @param id * @param shopName */ - public void changeInfo(MultipartFile file, Long id, String shopName); + public void changeInfo(MultipartFile file, Long id, String shopName,String key); /** * 鏌ヨ搴楅摵淇℃伅銆佸苟杩斿洖閽�3涓晢鍝佹暟閲� diff --git a/fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java index efe9679..20b95e8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java @@ -12,7 +12,7 @@ public static boolean greaterThan_1_5_50(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 42)) - || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 51))) + || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 52))) return true; else return false; -- Gitblit v1.8.0