From 3824cbcaec6e6c67418d5280a53e9c2fedeef6f9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 11 七月 2019 16:34:13 +0800 Subject: [PATCH] 订单bug,分享爆款自购修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java | 95 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 67 insertions(+), 28 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java index 4a29026..3e61581 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java @@ -69,6 +69,11 @@ throw new SpecialException(1, "涓撻鍚嶇О涓嶈兘涓虹┖"); } + Integer sex = record.getSex(); + if (sex == null) { + throw new SpecialException(1, "鎬у埆涓嶈兘涓虹┖"); + } + String params = record.getParams(); if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { record.setParams(null); @@ -112,12 +117,21 @@ record.setPicture(picture); record.setSubPicture(subPicture); - int maxOrder = specialMapper.getMaxOrderByCard(cardId); - record.setOrderby(maxOrder + 1); + // 鎺掑簭 + record.setOrderby(specialMapper.getDefaultMaxOrder(cardId) + 1); + record.setOrderMan(specialMapper.getManMaxOrder(cardId) + 1); + record.setOrderWoman(specialMapper.getWomanMaxOrder(cardId) + 1); record.setCreatetime(new Date()); record.setUpdatetime(new Date()); specialMapper.insert(record); + + Special s = new Special(); + s.setId(record.getId()); + s.setOrderby(Integer.parseInt(s.getId() + "")); + s.setOrderMan(Integer.parseInt(s.getId() + "")); + s.setOrderWoman(Integer.parseInt(s.getId() + "")); + specialMapper.updateByPrimaryKeySelective(s); } else { // 淇敼 Special resultObj = specialMapper.selectByPrimaryKey(id); @@ -170,7 +184,10 @@ } record.setOrderby(resultObj.getOrderby()); + record.setOrderMan(resultObj.getOrderMan()); + record.setOrderWoman(resultObj.getOrderWoman()); record.setCreatetime(resultObj.getCreatetime()); + record.setUpdatetime(new Date()); specialMapper.updateByPrimaryKey(record); } @@ -212,9 +229,9 @@ @Override @Transactional - public void updateOrder(Long id, Integer moveType) throws SpecialException { + public void updateOrder(Long id, Integer moveType, Integer sex) throws SpecialException { - if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) { + if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1)) || sex == null) { throw new SpecialException(1, "璇蜂紶閫掓纭弬鏁�"); } @@ -223,21 +240,40 @@ throw new SpecialException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�"); } - Integer order = resultObj.getOrderby(); Long cardId = resultObj.getCardId(); - // 鑾峰彇浜ゆ崲瀵硅薄 - Special exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, order); - if (exchangeObject == null) { - if (moveType == 1) { - throw new SpecialException(1, "鍦ㄧ浉鍚屼娇鐢ㄥ湴鏂逛腑浼樺厛绾у凡缁忔渶浣庝簡"); - } else { - throw new SpecialException(1, "鍦ㄧ浉鍚屼娇鐢ㄥ湴鏂逛腑浼樺厛绾у凡缁忔渶楂樹簡"); + Special exchangeObject = null; + if (Special.SEX_ALL == sex || Special.SEX_DEFAULT == sex) { + Integer orderby = resultObj.getOrderby(); + exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderby, sex); + if (exchangeObject == null) { + throw new SpecialException(1, "娌℃湁鎵惧埌鍙氦鎹㈢殑浣嶇疆"); } - } - resultObj.setOrderby(exchangeObject.getOrderby()); - exchangeObject.setOrderby(order); + resultObj.setOrderby(exchangeObject.getOrderby()); + exchangeObject.setOrderby(orderby); + } else if (Special.SEX_MAN == sex) { + Integer orderMan = resultObj.getOrderMan(); + exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderMan, sex); + if (exchangeObject == null) { + throw new SpecialException(1, "娌℃湁鎵惧埌鍙氦鎹㈢殑浣嶇疆"); + } + + resultObj.setOrderMan(exchangeObject.getOrderMan()); + exchangeObject.setOrderMan(orderMan); + } else if (Special.SEX_WOMAN == sex) { + Integer orderWoman = resultObj.getOrderWoman(); + exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderWoman, sex); + + if (exchangeObject == null) { + throw new SpecialException(1, "娌℃湁鎵惧埌鍙氦鎹㈢殑浣嶇疆"); + } + + resultObj.setOrderWoman(exchangeObject.getOrderWoman()); + exchangeObject.setOrderWoman(orderWoman); + } else { + throw new SpecialException(1, "sex鍙傛暟涓嶆纭�"); + } specialMapper.updateByPrimaryKey(resultObj); specialMapper.updateByPrimaryKey(exchangeObject); @@ -280,9 +316,9 @@ } @Override - public List<Special> listQueryByCard(long start, int count, Long card, String key) { + public List<Special> listQueryByCard(long start, int count, Long card, String key, Integer sex) { - List<Special> list = specialMapper.listQueryByCard(start, count, card, key); + List<Special> list = specialMapper.listQueryByCard(start, count, card, key, sex); if (list == null || list.size() == 0) { return list; } @@ -312,33 +348,36 @@ } @Override - public long countlistQueryByCard(Long card, String key) { - return specialMapper.countlistQueryByCard(card, key); + public long countlistQueryByCard(Long card, String key, Integer sex) { + return specialMapper.countlistQueryByCard(card, key, sex); } @Override - @Cacheable(value = "configCache", key = "'listBySystemAndCard-'+#card+'-'+#systemId") + @Cacheable(value = "specialCache", key = "'listBySystemAndCard-'+#card+'-'+#systemId") public List<Special> listBySystemAndCard(String card, Long systemId) { return specialMapper.listBySystemAndCard(card, systemId); } @Override - @Cacheable(value = "configCache", key = "'listPageBySystemAndCard-'+#start+'-'+#count+'-'+#card+'-'+#systemId") + @Cacheable(value = "specialCache", key = "'listPageBySystemAndCard-'+#start+'-'+#count+'-'+#card+'-'+#systemId") public List<Special> listPageBySystemAndCard(long start, int count, String card, Long systemId) { return specialMapper.listPageBySystemAndCard(start, count, card, systemId); } @Override - @Cacheable(value = "configCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version") - public JSONObject listCacheSpecialToIndex(AcceptData acceptData) throws Exception { + @Cacheable(value = "specialCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version+'-'+#sex") + public JSONObject listCacheSpecialToIndex(AcceptData acceptData, Integer sex) throws Exception { // 棣栭〉-5鍦嗗舰2鎺掑尯鍩� JSONObject arcMap = new JSONObject(); + String indexArc = "index_arc"; - if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) + if (VersionUtil.greaterThan_1_5_70(acceptData.getPlatform(), acceptData.getVersion())) + indexArc = "index_arc_1.5.7"; + else if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) indexArc = "index_arc_1.5.6"; - List<Special> listArc = specialMapper.listByPlaceKey(indexArc); + List<Special> listArc = specialMapper.listByPlaceKey(indexArc, sex); if (listArc == null) { listArc = new ArrayList<Special>(); } else if (listArc.size() > 0) { @@ -373,7 +412,7 @@ && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) { // 濡傛灉IOS褰撳墠鐗堟湰澶勪簬瀹℃牳鐘舵�佸氨涓嶈繑鍥� } else { - listActivity = specialMapper.listByPlaceKey("index_activity"); + listActivity = specialMapper.listByPlaceKey("index_activity", null); } if (listActivity == null) { @@ -396,7 +435,7 @@ indexBlock = "index_block_1.5.6"; JSONObject blockJsonMap = new JSONObject(); - List<Special> listBlock = specialMapper.listByPlaceKey(indexBlock); + List<Special> listBlock = specialMapper.listByPlaceKey(indexBlock, sex); if (listBlock == null) { listBlock = new ArrayList<Special>(); } else if (listBlock.size() > 0) { @@ -431,7 +470,7 @@ @Override public List<Special> listByPlaceKey(String placeKey) { - return specialMapper.listByPlaceKey(placeKey); + return specialMapper.listByPlaceKey(placeKey, null); } /** -- Gitblit v1.8.0