| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData;
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | 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;
|
| | |
| | | public class SwiperBannerAdminController {
|
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | @Resource
|
| | | private SwiperBannerService swiperBannerService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | @Resource
|
| | | private SystemConfigService systemConfigService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveAdd")
|
| | | public void saveAdd(String callback, SwiperBanner swiperBanner, PrintWriter out) {
|
| | | public void saveAdd(AdminAcceptData acceptData, String callback, SwiperBanner swiperBanner, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | String title = swiperBanner.getTitle();
|
| | |
| | | Date nowTime = new Date();
|
| | | swiperBanner.setCreatetime(nowTime);
|
| | | swiperBanner.setUpdatetime(nowTime);
|
| | | swiperBanner.setSystem(acceptData.getSystem());
|
| | | swiperBannerService.insertSelective(swiperBanner);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, SwiperBanner swiperBanner, PrintWriter out) {
|
| | | public void saveModify(AdminAcceptData acceptData, String callback, SwiperBanner swiperBanner, PrintWriter out) {
|
| | | try {
|
| | | Long id = swiperBanner.getId();
|
| | | if (id == null) {
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "switchState")
|
| | | public void switchState(String callback, Long id, PrintWriter out) {
|
| | | public void switchState(AdminAcceptData acceptData, String callback, Long id, PrintWriter out) {
|
| | | try {
|
| | | swiperBannerService.switchState(id);
|
| | | 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();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param acceptData
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * 模糊查询:说明、标识
|
| | | * @param sort
|
| | | * 排序 : 创建时间倒序1 默认正序
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param sort 排序 : 创建时间倒序1 默认正序
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort, PrintWriter out) {
|
| | | public void query(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, String key, Integer sort, PrintWriter out) {
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | | try {
|
| | | List<SwiperBanner> list = swiperBannerService.query((pageIndex - 1) * pageSize, pageSize, key, sort);
|
| | | List<SwiperBanner> list = swiperBannerService.query((pageIndex - 1) * pageSize, pageSize, key, sort,acceptData.getSystem());
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | |
| | | swiperBanne.setTotalPic(TotalPic);
|
| | | }
|
| | |
|
| | | long count = swiperBannerService.countQuery(key);
|
| | | long count = swiperBannerService.countQuery(key,acceptData.getSystem());
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "delete")
|
| | | public void delete(String callback, String idArray, PrintWriter out) {
|
| | | public void delete(AdminAcceptData acceptData, String callback, String idArray, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getEffectiveOption")
|
| | | public void getEffectiveOption(String callback, PrintWriter out) {
|
| | | public void getEffectiveOption(AdminAcceptData acceptData, String callback, PrintWriter out) {
|
| | | try {
|
| | | List<Object> list = new ArrayList<Object>();
|
| | | Map<String, Object> mapDefalut = new HashMap<String, Object>();
|
| | |
| | | mapDefalut.put("value", "--未选择--");
|
| | | list.add(mapDefalut);
|
| | |
|
| | | List<SwiperBanner> listBanner = swiperBannerService.getEffectiveOption();
|
| | | List<SwiperBanner> listBanner = swiperBannerService.getEffectiveOption(acceptData.getSystem());
|
| | | if (listBanner != null && listBanner.size() > 0) {
|
| | | for (SwiperBanner swiperBanner : listBanner) {
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryPicInfo")
|
| | | public void queryPicInfo(String callback, Integer pageIndex, Integer pageSize, Long bannerId, String version,
|
| | | public void queryPicInfo(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, Long bannerId, String version,
|
| | | String platform, PrintWriter out) {
|
| | | if (bannerId == null) {
|
| | | out.print(JsonUtil.loadFalseResult("轮播图管理ID不能为空"));
|
| | |
| | | if (appVersion != null)
|
| | | versionList.add(appVersion);
|
| | | } else {
|
| | | List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
|
| | | List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform,acceptData.getSystem());
|
| | | if (appVersionList != null) {
|
| | | versionList.addAll(appVersionList);
|
| | | }
|
| | |
| | | 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, CommonShareInfo extra, |
| | | public void savePicInfo(AdminAcceptData acceptData, String callback, SwiperPicture record, String jumpType, CommonShareInfo extra,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | record.setSystem(acceptData.getSystem());
|
| | | // 1. 先判断httpRequest 是否含有文件类型
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "switchStatePic")
|
| | | public void switchStatePic(String callback, Long id, PrintWriter out) {
|
| | | public void switchStatePic(AdminAcceptData acceptData, String callback, Long id, PrintWriter out) {
|
| | | try {
|
| | | swiperPictureService.switchState(id);
|
| | | 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();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deletePicInfo")
|
| | | public void deletePicInfo(String callback, String idArray, PrintWriter out) {
|
| | | public void deletePicInfo(AdminAcceptData acceptData, String callback, String idArray, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveOrder")
|
| | | public void saveOrder(String callback, Long id, Integer moveType, PrintWriter out) {
|
| | | public void saveOrder(AdminAcceptData acceptData, String callback, Long id, Integer moveType, PrintWriter out) {
|
| | | if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递的类型不正确"));
|
| | | return;
|
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | *
|
| | | * @param callback
|
| | | * @param id
|
| | | * @param moveType
|
| | | * @param sex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setVersions")
|
| | | public void setVersions(String callback, Long id, String versions, PrintWriter out) {
|
| | | public void setVersions(AdminAcceptData acceptData, String callback, Long id, String versions, PrintWriter out) {
|
| | | JSONArray versionArray = JSONArray.fromObject(versions);
|
| | | List<Long> versionIds = new ArrayList<>();
|
| | | for (int i = 0; i < versionArray.size(); i++) {
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping(value = "getVersions")
|
| | | public void getVersions(String callback, Long id, PrintWriter out) {
|
| | | public void getVersions(AdminAcceptData acceptData, String callback, Long id, PrintWriter out) {
|
| | | List<AdActivityVersionControl> list = adActivityVersionControlService
|
| | | .listByTypeAndSourceId(AdActivityType.banner, id);
|
| | |
|