| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.util.*;
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo.CommonShareInfoEnum;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | | import com.yeshi.fanli.vo.homemodule.SpecialVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | private SpecialMapper specialMapper;
|
| | |
|
| | | @Resource
|
| | | private SpecialPlaceService specialPlaceService;
|
| | |
|
| | | @Resource
|
| | | private SpecialCardService specialCardService;
|
| | |
|
| | | private CommonShareInfoService commonShareInfoService;
|
| | | |
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | | |
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @Resource
|
| | | private AdActivityVersionControlService adActivityVersionControlService;
|
| | |
| | |
|
| | | @Override
|
| | | public void saveObject(MultipartFile file, MultipartFile file2, MultipartFile file3, Special record,
|
| | | String jumpType) throws SpecialException, Exception {
|
| | | String jumpType, CommonShareInfo shareInfo) throws SpecialException, Exception {
|
| | |
|
| | | Long cardId = record.getCardId();
|
| | | if (cardId == null) {
|
| | |
| | | record.setUpdatetime(new Date());
|
| | | specialMapper.insert(record);
|
| | |
|
| | | shareInfo.setPid(record.getId());
|
| | | |
| | | Special s = new Special();
|
| | | s.setId(record.getId());
|
| | | s.setOrderby(Integer.parseInt(s.getId() + ""));
|
| | |
| | |
|
| | | record.setUpdatetime(new Date());
|
| | | specialMapper.updateByPrimaryKey(record);
|
| | | |
| | | shareInfo.setPid(record.getId());
|
| | | }
|
| | | |
| | | // 添加补充信息
|
| | | shareInfo.setType(CommonShareInfoEnum.special);
|
| | | commonShareInfoService.save(shareInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | /**
|
| | | * 删除图片-不更新数据库
|
| | | * |
| | | * @param record
|
| | | * @param picture
|
| | | * @throws Exception
|
| | | */
|
| | | public void removePicture(String picture) throws Exception {
|
| | |
| | | if (!StringUtil.isNullOrEmpty(subPicture)) {
|
| | | COSManager.getInstance().deleteFile(subPicture);
|
| | | }
|
| | | |
| | | commonShareInfoService.deleteByPidAndType(special.getId(), CommonShareInfoEnum.special.name());
|
| | | }
|
| | |
|
| | | if (listSpecial != null)
|
| | |
| | | if (!StringUtil.isNullOrEmpty(subPicture)) {
|
| | | COSManager.getInstance().deleteFile(subPicture);
|
| | | }
|
| | | |
| | | commonShareInfoService.deleteByPidAndType(special.getId(), CommonShareInfoEnum.special.name());
|
| | | }
|
| | |
|
| | | return specialMapper.deleteBatchByCardID(list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Special> listQueryByCard(long start, int count, Long card, String key, Integer sex) {
|
| | |
|
| | | public List<SpecialVO> listQueryByCard(long start, int count, Long card, String key, Integer sex) {
|
| | | List<Special> list = specialMapper.listQueryByCard(start, count, card, key, sex);
|
| | | if (list == null || list.size() == 0) {
|
| | | return list;
|
| | | if (list == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | // 跳转链接
|
| | | List<SpecialVO> listvo = new ArrayList<SpecialVO>();
|
| | | for (Special special : list) {
|
| | |
|
| | | Date startTime = special.getStartTime();
|
| | | Date endTime = special.getEndTime();
|
| | |
|
| | | SpecialVO specialVO = new SpecialVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(specialVO, special);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | |
| | | if (specialVO.getState() != null && specialVO.getState().longValue() == 0) {
|
| | | specialVO.setState(1L);
|
| | | } else {
|
| | | specialVO.setState(0L);
|
| | | }
|
| | | |
| | | Date startTime = specialVO.getStartTime();
|
| | | Date endTime = specialVO.getEndTime();
|
| | | if (startTime == null && endTime == null) {
|
| | | special.setStartTime_str("");
|
| | | special.setEndTime_str("");
|
| | | specialVO.setStartTime_str("");
|
| | | specialVO.setEndTime_str("");
|
| | | } else {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | if (startTime == null) {
|
| | | special.setStartTime_str("");
|
| | | specialVO.setStartTime_str("");
|
| | | } else {
|
| | | special.setStartTime_str(sdf.format(startTime));
|
| | | specialVO.setStartTime_str(sdf.format(startTime));
|
| | | }
|
| | |
|
| | | if (endTime == null) {
|
| | | special.setEndTime_str("");
|
| | | specialVO.setEndTime_str("");
|
| | | } else {
|
| | | special.setEndTime_str(sdf.format(endTime));
|
| | | specialVO.setEndTime_str(sdf.format(endTime));
|
| | | }
|
| | | }
|
| | |
|
| | | String params = special.getParams();
|
| | | String params = specialVO.getParams();
|
| | | if (StringUtil.isNullOrEmpty(params)) {
|
| | | special.setParams("");
|
| | | specialVO.setParams("");
|
| | | }
|
| | |
|
| | | String remark = special.getRemark();
|
| | | String remark = specialVO.getRemark();
|
| | | if (StringUtil.isNullOrEmpty(remark)) {
|
| | | special.setRemark("");
|
| | | specialVO.setRemark("");
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | JumpDetailV2 jumpDetail = specialVO.getJumpDetail();
|
| | | if (jumpDetail == null) {
|
| | | // 默认未选择
|
| | | JumpDetailV2 jumpDetailV2 = new JumpDetailV2();
|
| | | jumpDetailV2.setName("-未选择-");
|
| | | jumpDetailV2.setType("default");
|
| | | special.setJumpDetail(jumpDetailV2);
|
| | | specialVO.setJumpDetail(jumpDetailV2);
|
| | | }
|
| | | |
| | | // 分享补充信息
|
| | | CommonShareInfo info = commonShareInfoService.getByPidAndType(specialVO.getId(),
|
| | | CommonShareInfoEnum.special.name());
|
| | | if (info == null) {
|
| | | specialVO.setNeedSpin(false);
|
| | | specialVO.setComment("");
|
| | | } else {
|
| | | specialVO.setNeedSpin(info.getNeedSpin());
|
| | | if (StringUtil.isNullOrEmpty(info.getComment())) {
|
| | | specialVO.setComment("");
|
| | | } else {
|
| | | specialVO.setComment(info.getComment());
|
| | | }
|
| | | }
|
| | | listvo.add(specialVO);
|
| | | }
|
| | | return list;
|
| | | return listvo;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "specialCache", key = "'listBySystemAndCard-'+#card+'-'+#systemId")
|
| | | public List<Special> listBySystemAndCard(String card, Long systemId) {
|
| | | return specialMapper.listBySystemAndCard(card, systemId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @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 = "specialCache", key = "'listByVersion-'+#start+'-'+#count+'-'+#card+'-'+#platform+'-'+#versionCode")
|
| | | public List<Special> listByVersion(long start, int count, String card, String platform, Integer versionCode) {
|
| | | List<Special> specialList = specialMapper.listByPlaceKey(card, null, null, null);
|
| | | filterSpecial(specialList, platform, versionCode);
|
| | | return specialList;
|
| | | @Cacheable(value = "specialCache", key = "'listByVersion-'+#start+'-'+#count+'-'+#card+'-'+#platform+'-'+#versionCode+'-'+#system")
|
| | | public List<SpecialVO> listByVersion(long start, int count, String card, String platform, Integer versionCode,SystemEnum system) {
|
| | | List<Special> specialList = specialMapper.listByPlaceKey(card, null, null, null, system);
|
| | | filterSpecial(specialList, platform, versionCode,system);
|
| | | return transformVO(specialList,system);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param platform
|
| | | * @param versionCode
|
| | | */
|
| | | private void filterSpecial(List<Special> list, String platform, int versionCode) {
|
| | | private void filterSpecial(List<Special> list, String platform, int versionCode,SystemEnum system) {
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode);
|
| | | AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode,system);
|
| | | if (app == null) {
|
| | | list.clear();
|
| | | return;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "specialCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version+'-'+#sex")
|
| | | public JSONObject listCacheSpecialToIndex(AcceptData acceptData, Integer sex) throws Exception {
|
| | | @Cacheable(value = "specialCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version+'-'+#sex+'-'+#system")
|
| | | public JSONObject listCacheSpecialToIndex(AcceptData acceptData, Integer sex,SystemEnum system) throws Exception {
|
| | |
|
| | | // 首页-5圆形2排区域
|
| | | JSONObject arcMap = new JSONObject();
|
| | |
| | | int platformCode = Constant.getPlatformCode(platform);
|
| | | int version = Integer.parseInt(acceptData.getVersion());
|
| | |
|
| | | List<Special> listArc = specialMapper.listByPlaceKey(indexArc, sex, platformCode, version);
|
| | | filterSpecial(listArc, platform, version);
|
| | | List<Special> listArc = specialMapper.listByPlaceKey(indexArc, sex, platformCode, version,system);
|
| | | filterSpecial(listArc, platform, version,system);
|
| | | if (listArc == null) {
|
| | | listArc = new ArrayList<Special>();
|
| | | } else if (listArc.size() > 0) {
|
| | |
| | | if (hour < 6) {// 0-6点之间不进入自购立减的页面
|
| | | s.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get(ConfigKeyEnum.tljOwnBuyNogoods.getKey()));
|
| | | params.put("url", configService.getValue(ConfigKeyEnum.tljOwnBuyNogoods.getKey(), SystemInfoUtil.getSystem(acceptData)));
|
| | | s.setParams(params.toString());
|
| | | } else {
|
| | | // 查询专题详情
|
| | |
| | |
|
| | | // 数据处理
|
| | | // handlelist(listArc);
|
| | | arcMap.put("list", JsonUtil.getApiCommonGson().toJson(listArc));
|
| | | arcMap.put("list", JsonUtil.getApiCommonGson().toJson(transformVO(listArc,SystemInfoUtil.getSystem(acceptData))));
|
| | |
|
| | | // 首页-活动区域(女王节)
|
| | | JSONObject activityMap = new JSONObject();
|
| | | List<Special> listActivity = null;
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), SystemInfoUtil.getSystem(acceptData))) {
|
| | | // 如果IOS当前版本处于审核状态就不返回
|
| | | } else {
|
| | | listActivity = specialMapper.listByPlaceKey("index_activity", null, platformCode, version);
|
| | | listActivity = specialMapper.listByPlaceKey("index_activity", null, platformCode, version,system);
|
| | | }
|
| | |
|
| | | filterSpecial(listActivity, platform, version);
|
| | | filterSpecial(listActivity, platform, version,system);
|
| | |
|
| | | if (listActivity == null) {
|
| | | listActivity = new ArrayList<Special>();
|
| | |
| | |
|
| | | handlelist(listActivity);
|
| | |
|
| | | activityMap.put("list", JsonUtil.getApiCommonGson().toJson(listActivity));
|
| | | activityMap.put("list", JsonUtil.getApiCommonGson().toJson(transformVO(listActivity,system)));
|
| | |
|
| | | // 首页-方形专题(品牌券、母婴...)
|
| | | String indexBlock = "index_block";
|
| | |
| | | indexBlock = "index_block_1.5.6";
|
| | |
|
| | | JSONObject blockJsonMap = new JSONObject();
|
| | | List<Special> listBlock = specialMapper.listByPlaceKey(indexBlock, sex, platformCode, version);
|
| | | filterSpecial(listBlock, platform, version);
|
| | | List<Special> listBlock = specialMapper.listByPlaceKey(indexBlock, sex, platformCode, version,system);
|
| | | filterSpecial(listBlock, platform, version,system);
|
| | | if (listBlock == null) {
|
| | | listBlock = new ArrayList<Special>();
|
| | | } else if (listBlock.size() > 0) {
|
| | |
| | |
|
| | | // 数据处理
|
| | | handlelist(listBlock);
|
| | | blockJsonMap.put("list", JsonUtil.getApiCommonGson().toJson(listBlock));
|
| | | blockJsonMap.put("list", JsonUtil.getApiCommonGson().toJson(transformVO(listBlock,system)));
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("arcArea", arcMap);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Special> listByPlaceKey(String placeKey, Integer platform, Integer versionCode) {
|
| | | return specialMapper.listByPlaceKey(placeKey, null, platform, versionCode);
|
| | | public List<Special> listByPlaceKey(String placeKey, Integer platform, Integer versionCode,SystemEnum system) {
|
| | | return specialMapper.listByPlaceKey(placeKey, null, platform, versionCode,system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Special> listByPlaceKeyList(long start, int count, List<String> list, Integer platform,
|
| | | Integer versionCode) {
|
| | | return specialMapper.listByPlaceKeyList(start, count, list, null, platform, versionCode);
|
| | | Integer versionCode,SystemEnum system) {
|
| | | return specialMapper.listByPlaceKeyList(start, count, list, null, platform, versionCode,system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByPlaceKeyList(List<String> list, Integer platform, Integer versionCode) {
|
| | | return specialMapper.countByPlaceKeyList(list, null, platform, versionCode);
|
| | | public long countByPlaceKeyList(List<String> list, Integer platform, Integer versionCode,SystemEnum system) {
|
| | | return specialMapper.countByPlaceKeyList(list, null, platform, versionCode,system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "specialCache", key = "'listByPlaceKeyHasLabel'+#start+'-'+#platform+'-'+#versionCode+'-'+#list")
|
| | | public List<Special> listByPlaceKeyHasLabel(long start, int count, List<String> list, Integer platform,
|
| | | Integer versionCode) {
|
| | | return specialMapper.listByPlaceKeyHasLabel(start, count, list, null, platform, versionCode);
|
| | | public List<SpecialVO> listByPlaceKeyHasLabel(long start, int count, List<String> list, Integer platform,
|
| | | Integer versionCode,SystemEnum system) {
|
| | | List<Special> listSpecial = specialMapper.listByPlaceKeyHasLabel(start, count, list, null,
|
| | | platform, versionCode,system);
|
| | | return transformVO(listSpecial,system);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 转换VO
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | private List<SpecialVO> transformVO(List<Special> list, SystemEnum system) {
|
| | | List<SpecialVO> listVo = new ArrayList<SpecialVO>();
|
| | | if (list != null && list.size() > 0) {
|
| | | for (Special special: list) {
|
| | | SpecialVO specialVO = new SpecialVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(specialVO, special);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | |
| | | // 跳转活动过渡页
|
| | | CommonShareInfo info = commonShareInfoService.getByPidAndType(specialVO.getId(), |
| | | CommonShareInfoEnum.special.name());
|
| | | if (info != null && !StringUtil.isNullOrEmpty(info.getComment())) {
|
| | | String link = configService.getValue(ConfigKeyEnum.activityDetailLink.getKey(),system) + "?type=%s&id=%s";
|
| | | link = String.format(link, CommonShareInfoEnum.special.name(),specialVO.getId());
|
| | | |
| | | // 跳转链接
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", link);
|
| | | |
| | | // 替换淘宝官方活动
|
| | | String comment = info.getComment();
|
| | | List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(comment);
|
| | | for (String st : activityIdList)
|
| | | comment = comment.replace(st, "");
|
| | |
|
| | | specialVO.setComment(comment);
|
| | | specialVO.setParams(params.toString());
|
| | | specialVO.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | }
|
| | | listVo.add(specialVO);
|
| | | }
|
| | | }
|
| | | return listVo;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 处理 数据
|
| | |
| | | Special updateObj = new Special();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | updateObj.setJumpLogin(resultObj.isJumpLogin());
|
| | | specialMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | |
|