| | |
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
|
| | | import com.yeshi.fanli.exception.homemodule.SpecialException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | |
| | | record.setParams(params.trim());
|
| | | }
|
| | |
|
| | | String startTime_str = record.getStartTime_str();
|
| | | if (record.isTimeTask() && (startTime_str == null || startTime_str.length() == 0)) {
|
| | | throw new SpecialException(1, "控制时间不能为空");
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(jumpType)) {
|
| | | List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType);
|
| | | if (listByType != null && listByType.size() > 0) {
|
| | |
| | | }
|
| | |
|
| | | // 时间转换
|
| | | conversionTime(record);
|
| | | handleTime(record);
|
| | |
|
| | | Long state = record.getState();
|
| | | if (state == null) {
|
| | |
| | | *
|
| | | * @param record
|
| | | */
|
| | | public void conversionTime(Special record) throws SpecialException, Exception {
|
| | | // 是否时间控制
|
| | | if (!record.isTimeTask()) {
|
| | | record.setStartTime(null);
|
| | | record.setEndTime(null);
|
| | | } else {
|
| | | String startTime_str = record.getStartTime_str();
|
| | | String endTime_str = record.getEndTime_str();
|
| | |
|
| | | if ((startTime_str == null || startTime_str.trim().length() == 0)
|
| | | && (endTime_str == null || endTime_str.trim().length() == 0)) {
|
| | | throw new HomeNavbarException(1, "请输入控制时间");
|
| | | } else {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | | if (startTime_str != null && startTime_str.trim().length() > 0) {
|
| | | startTime_str = startTime_str.replaceAll("T", " ");
|
| | | record.setStartTime(format.parse(startTime_str));
|
| | | }
|
| | |
|
| | | if (endTime_str != null && endTime_str.trim().length() > 0) {
|
| | | endTime_str = endTime_str.replaceAll("T", " ");
|
| | | record.setEndTime(format.parse(endTime_str));
|
| | | }
|
| | | }
|
| | | private void handleTime(Special record) throws SpecialException, Exception {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | | |
| | | String startTime_str = record.getStartTime_str();
|
| | | if (!StringUtil.isNullOrEmpty(startTime_str)) {
|
| | | startTime_str = startTime_str.replaceAll("T", " ");
|
| | | record.setStartTime(format.parse(startTime_str));
|
| | | }
|
| | | |
| | | String endTime_str = record.getEndTime_str();
|
| | | if (!StringUtil.isNullOrEmpty(endTime_str)) {
|
| | | endTime_str = endTime_str.replaceAll("T", " ");
|
| | | record.setEndTime(format.parse(endTime_str));
|
| | | }
|
| | | |
| | | if (record.getEndTime() != null && record.getStartTime() != null
|
| | | && record.getStartTime().getTime() > record.getEndTime().getTime()) {
|
| | | throw new SpecialException(1, "起始时间不能小于结束时间");
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | |
|
| | | // 文件路径
|
| | | String filePath =FilePathEnum.special.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String filePath = FilePathEnum.special.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void updateOrder(Long id, Integer moveType, Integer sex) throws SpecialException {
|
| | |
|
| | | if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1)) || sex == null) {
|
| | |
| | | COSManager.getInstance().deleteFile(subPicture);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (listSpecial != null)
|
| | | for (Special special : listSpecial) {
|
| | | List<AdActivityVersionControl> versionList = adActivityVersionControlService
|
| | |
| | |
|
| | | // 跳转链接
|
| | | for (Special special : list) {
|
| | |
|
| | | if (special.getState() != null && special.getState().longValue() == 0) {
|
| | | special.setState(1L);
|
| | | } else {
|
| | | special.setState(0L);
|
| | | }
|
| | | |
| | | Date startTime = special.getStartTime();
|
| | | Date endTime = special.getEndTime();
|
| | |
|
| | | if (startTime == null && endTime == null) {
|
| | | special.setTimeTask(false);
|
| | | special.setStartTime_str("");
|
| | | special.setEndTime_str("");
|
| | | } else {
|
| | | special.setTimeTask(true);
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | if (startTime == null) {
|
| | | special.setStartTime_str("");
|
| | |
| | | s.setParams(special.getParams());
|
| | | }
|
| | | }
|
| | |
|
| | | if (s.getJumpDetail() != null) {
|
| | | s.getJumpDetail().setNeedLogin(s.isJumpLogin()
|
| | | | (s.getJumpDetail().getNeedLogin() != null && s.getJumpDetail().getNeedLogin()));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // 数据处理
|
| | | handlelist(listArc);
|
| | | // handlelist(listArc);
|
| | | arcMap.put("list", JsonUtil.getApiCommonGson().toJson(listArc));
|
| | |
|
| | | // 首页-活动区域(女王节)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void switchState(Long id) throws SpecialException {
|
| | | if (id == null) {
|
| | | throw new SpecialException(1, "请传递正确参数");
|
| | | }
|
| | | |
| | | Special resultObj = specialMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new SpecialException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Long state = resultObj.getState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1L;
|
| | | } else {
|
| | | state = 0L;
|
| | | }
|
| | | |
| | | Special updateObj = new Special();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | updateObj.setJumpLogin(resultObj.isJumpLogin());
|
| | | specialMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | | |
| | | }
|