| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | |
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | 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.SwiperBanner;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.exception.banner.SwiperBannerException;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperBannerService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.vo.homemodule.BannerVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private AdActivityVersionControlService adActivityVersionControlService;
|
| | | |
| | | @Resource
|
| | | private CommonShareInfoService commonShareInfoService;
|
| | | |
| | |
|
| | | /**
|
| | | * 新增
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | List<SwiperPicture> list = swiperPictureService.queryByBannerID((pageIndex - 1) * pageSize, pageSize,
|
| | | List<SwiperPicture> listPic = swiperPictureService.queryByBannerID((pageIndex - 1) * pageSize, pageSize,
|
| | | bannerId);
|
| | | if (list == null || list.size() == 0) {
|
| | | if (listPic == null || listPic.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<BannerVO> list = new ArrayList<BannerVO>();
|
| | | // 跳转链接
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | for (SwiperPicture swiperPicture : list) {
|
| | | if (swiperPicture.getState() != null && swiperPicture.getState() == 0) {
|
| | | swiperPicture.setState(1);
|
| | | } else {
|
| | | swiperPicture.setState(0);
|
| | | for (SwiperPicture swiperPicture : listPic) {
|
| | | BannerVO bannerVO = new BannerVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(bannerVO, swiperPicture);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | |
|
| | |
|
| | | Date startTime = swiperPicture.getStartTime();
|
| | | if (bannerVO.getState() != null && bannerVO.getState() == 0) {
|
| | | bannerVO.setState(1);
|
| | | } else {
|
| | | bannerVO.setState(0);
|
| | | }
|
| | | |
| | | |
| | | Date startTime = bannerVO.getStartTime();
|
| | | if (startTime == null) {
|
| | | swiperPicture.setStartTime_str("");
|
| | | bannerVO.setStartTime_str("");
|
| | | } else {
|
| | | swiperPicture.setStartTime_str(sdf.format(startTime));
|
| | | bannerVO.setStartTime_str(sdf.format(startTime));
|
| | | }
|
| | |
|
| | | Date endTime = swiperPicture.getEndTime();
|
| | | Date endTime = bannerVO.getEndTime();
|
| | | if (endTime == null) {
|
| | | swiperPicture.setEndTime_str("");
|
| | | bannerVO.setEndTime_str("");
|
| | | } else {
|
| | | swiperPicture.setEndTime_str(sdf.format(endTime));
|
| | | bannerVO.setEndTime_str(sdf.format(endTime));
|
| | | }
|
| | |
|
| | | String params = swiperPicture.getParams();
|
| | | String params = bannerVO.getParams();
|
| | | if (params == null) {
|
| | | swiperPicture.setParams("");
|
| | | bannerVO.setParams("");
|
| | | }
|
| | |
|
| | | String remark = swiperPicture.getRemark();
|
| | | String remark = bannerVO.getRemark();
|
| | | if (remark == null) {
|
| | | swiperPicture.setRemark("");
|
| | | bannerVO.setRemark("");
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = swiperPicture.getJumpDetail();
|
| | | JumpDetailV2 jumpDetail = bannerVO.getJumpDetail();
|
| | | if (jumpDetail == null) {
|
| | | // 默认未选择
|
| | | JumpDetailV2 jumpDetailV2 = new JumpDetailV2();
|
| | | jumpDetailV2.setName("-未选择-");
|
| | | jumpDetailV2.setType("default");
|
| | | swiperPicture.setJumpDetail(jumpDetailV2);
|
| | | bannerVO.setJumpDetail(jumpDetailV2);
|
| | | }
|
| | | |
| | | // 分享补充信息
|
| | | CommonShareInfo info = commonShareInfoService.getByPidAndType(bannerVO.getId(),
|
| | | CommonShareInfoEnum.banner.name());
|
| | | if (info == null) {
|
| | | bannerVO.setNeedSpin(false);
|
| | | bannerVO.setComment("");
|
| | | } else {
|
| | | bannerVO.setNeedSpin(info.getNeedSpin());
|
| | | if (StringUtil.isNullOrEmpty(info.getComment())) {
|
| | | bannerVO.setComment("");
|
| | | } else {
|
| | | bannerVO.setComment(info.getComment());
|
| | | }
|
| | | }
|
| | | list.add(bannerVO);
|
| | | }
|
| | |
|
| | | long count = swiperPictureService.countQueryByBannerID(bannerId);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (SwiperPictureException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "savePicInfo")
|
| | | public void savePicInfo(String callback, SwiperPicture record, String jumpType, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | public void savePicInfo(String callback, SwiperPicture record, String jumpType, CommonShareInfo extra, |
| | | HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | // 1. 先判断httpRequest 是否含有文件类型
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | swiperPictureService.saveObject(fileRequest.getFile("file"), record, jumpType);
|
| | | swiperPictureService.saveObject(fileRequest.getFile("file"), record, jumpType, extra);
|
| | | } else {
|
| | | swiperPictureService.saveObject(null, record, jumpType);
|
| | | swiperPictureService.saveObject(null, record, jumpType, extra);
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | swiperPictureService.updateByPrimaryKeySelective(resultObj);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|