| | |
| | | package com.yeshi.fanli.service.impl.homemodule;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SpecialPlace;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private SpecialMapper specialMapper;
|
| | | |
| | | @Resource
|
| | | private SpecialPlaceService specialPlaceService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "configCache", key = "'listBySystemAndCard-'+#card+'-'+#systemId")
|
| | | public List<Special> listBySystemAndCard( String card, Long systemId) {
|
| | | public List<Special> listBySystemAndCard(String card, Long systemId) {
|
| | | return specialMapper.listBySystemAndCard(card, systemId);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "configCache", 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 = "'getSpecialListCache-'+#card+'-'+#systemId")
|
| | | public JSONObject getSpecialListCache(String card, Long systemId) throws Exception{
|
| | | |
| | | // 两行圆形专题
|
| | | List<Special> arcList = new ArrayList<Special>();
|
| | | // 活动列表
|
| | | List<Special> activityList = new ArrayList<Special>();
|
| | | // 方块部分
|
| | | List<Special> blockList = new ArrayList<Special>();
|
| | | |
| | | |
| | | List<Special> list = specialMapper.listBySystemAndCard(card, systemId);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (Special special : list) {
|
| | | if (Special.SHOWTYPE_ARC.equals(special.getShowType())) {
|
| | | // 两行圆形专题
|
| | | arcList.add(special);
|
| | | } else if (Special.SHOWTYPE_BLOCK.equals(special.getShowType())) {
|
| | | // 方块部分
|
| | | blockList.add(special);
|
| | | } else if (Special.SHOWTYPE_ACTIVITY.equals(special.getShowType())) {
|
| | | // 动态
|
| | | activityList.add(special);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject arcMap = new JSONObject();
|
| | | arcMap.put("list", JsonUtil.getApiCommonGson().toJson(arcList));
|
| | | |
| | | JSONObject activityMap = new JSONObject();
|
| | | activityMap.put("list", JsonUtil.getApiCommonGson().toJson(activityList));
|
| | | |
| | | JSONObject blockJsonMap = new JSONObject();
|
| | | blockJsonMap.put("list", JsonUtil.getApiCommonGson().toJson(blockList));
|
| | | |
| | | // 背景图片
|
| | | List<SpecialPlace> listPlace = specialPlaceService.getList();
|
| | | if (listPlace != null && listPlace.size() > 0) {
|
| | | for (SpecialPlace specialPlace: listPlace) {
|
| | | String bottomPicture = specialPlace.getBottomPicture();
|
| | | if (bottomPicture != null && bottomPicture.trim().length() > 0) {
|
| | | if (Special.SHOWTYPE_ARC.equals(specialPlace.getKey())) {
|
| | | arcMap.put("bottomPicture", bottomPicture);
|
| | | } else if (Special.SHOWTYPE_BLOCK.equals(specialPlace.getKey())) {
|
| | | blockJsonMap.put("bottomPicture", bottomPicture);
|
| | | } else if (Special.SHOWTYPE_ACTIVITY.equals(specialPlace.getKey())) {
|
| | | activityMap.put("bottomPicture", bottomPicture);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject rootMap = new JSONObject();
|
| | | rootMap.put("arcArea", arcMap);
|
| | | rootMap.put("activityArea", activityMap);
|
| | | rootMap.put("blockArea", blockJsonMap);
|
| | | |
| | | return rootMap;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void uploadPicture(MultipartFile file, Special record, Long cardId) throws Exception {
|
| | |
|
| | | InputStream inputStream = file.getInputStream();
|