| @@ -0,0 +1,56 @@ | |||||
| package com.iformall.controller.base; | |||||
| import java.beans.PropertyEditorSupport; | |||||
| import java.text.ParseException; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.enums.yqzj.EnumYqzjPageType; | |||||
| import com.iformall.service.YqzjService; | |||||
| import com.iformall.shiro.UserSession; | |||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.IPUtil; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.apache.shiro.session.Session; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.WebDataBinder; | |||||
| import org.springframework.web.bind.annotation.InitBinder; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.context.request.RequestContextHolder; | |||||
| import org.springframework.web.context.request.ServletRequestAttributes; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| @RestController | |||||
| public class YqzjBaseController extends BaseController{ | |||||
| @Autowired | |||||
| public YqzjService yqzjService; | |||||
| public PageInfo<YqzjLunBoTu> lunbotuPageList(YqzjLunBoTu record,int pageType,Integer pageNum, Integer pageSize) { | |||||
| record.setSortColumns("serial_number asc"); | |||||
| record.setType(pageType); | |||||
| return yqzjService.listLunBoTuAsPage(record, pageNum, pageSize); | |||||
| } | |||||
| public void saveOrUpdateLunbotu(YqzjLunBoTu record,int pageType) { | |||||
| record.setType(pageType); | |||||
| yqzjService.saveOrUpdateLunBoTu(record); | |||||
| } | |||||
| public PageInfo<YqzjPageNews> pageNewsList(YqzjPageNews record,int pageType,int newsType,Integer pageNum, Integer pageSize) { | |||||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||||
| record.setType(pageType); | |||||
| record.setNewsType(newsType); | |||||
| return yqzjService.pageNewsAsPage(record, pageNum, pageSize); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,159 @@ | |||||
| package com.iformall.controller.yqzj; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.controller.base.YqzjBaseController; | |||||
| import com.iformall.domain.po.TtPoiTakeRate; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjGuangGaoWei; | |||||
| import com.iformall.domain.po.yqzj.YqzjHotNews; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.enums.EnumCpsPlanContentType; | |||||
| import com.iformall.enums.EnumCpsPlanStatus; | |||||
| import com.iformall.enums.EnumCpsPlanType; | |||||
| import com.iformall.enums.yqzj.EnumYqzjGuangGaoWeiType; | |||||
| import com.iformall.enums.yqzj.EnumYqzjHotNewsType; | |||||
| import com.iformall.enums.yqzj.EnumYqzjNewsType; | |||||
| import com.iformall.enums.yqzj.EnumYqzjPageType; | |||||
| import com.iformall.service.TtCouponGoodsService; | |||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.YqzjService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * @author | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("index") | |||||
| public class YqzjIndexController extends YqzjBaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @ApiOperation("首页轮播列表") | |||||
| @GetMapping("lunboList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData indexLunboList(@ModelAttribute YqzjLunBoTu record, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<YqzjLunBoTu> page = this.lunbotuPageList(record, EnumYqzjPageType.INDEX.getCode(), pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("更新轮播") | |||||
| @PostMapping("saveLunbo") | |||||
| public ResultData saveLunbo(@RequestBody YqzjLunBoTu record) { | |||||
| this.saveOrUpdateLunbotu(record,EnumYqzjPageType.INDEX.getCode()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("删除轮播") | |||||
| @PostMapping("delLunbo") | |||||
| public ResultData deleteLunbo(@RequestBody YqzjLunBoTu record) { | |||||
| if (null == record.getId()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| yqzjService.deleteLunBoTu(record.getId()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("汽车资讯热门") | |||||
| @GetMapping("carNewsHotList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData carNewsHotList(@ModelAttribute YqzjPageNews record, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<YqzjPageNews> page = this.pageNewsList(record, EnumYqzjPageType.INDEX.getCode(),EnumYqzjNewsType.CAR.getCode(), pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("更新汽车资讯热门") | |||||
| @PostMapping("carNewsHotSave") | |||||
| public ResultData carNewsHotSave(@RequestBody YqzjPageNews record) { | |||||
| yqzjService.savePageNews(EnumYqzjPageType.INDEX.getCode(), EnumYqzjNewsType.CAR.getCode(), record.getNewsIdList()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("热门新闻") | |||||
| @GetMapping("hotNewsConfig") | |||||
| public ResultData hotNewsConfig() { | |||||
| return new ResultData(yqzjService.findHotNewsConfigByTpye(EnumYqzjHotNewsType.INDEX.getCode())); | |||||
| } | |||||
| @ApiOperation("广告位1") | |||||
| @GetMapping("guanggao1") | |||||
| public ResultData guanggao() { | |||||
| return new ResultData(yqzjService.findGuangGaoWeiByType(EnumYqzjGuangGaoWeiType.INDEX_1.getCode())); | |||||
| } | |||||
| @ApiOperation("元宇宙热门") | |||||
| @GetMapping("yuanyuzhouHotList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData yuanyuzhouHotList(@ModelAttribute YqzjPageNews record, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<YqzjPageNews> page = this.pageNewsList(record, EnumYqzjPageType.INDEX.getCode(),EnumYqzjNewsType.YUNYUZHOU.getCode(), pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("更新汽车资讯热门") | |||||
| @PostMapping("yuanyuzhouHotSave") | |||||
| public ResultData yuanyuzhouHotSave(@RequestBody YqzjPageNews record) { | |||||
| yqzjService.savePageNews(EnumYqzjPageType.INDEX.getCode(), EnumYqzjNewsType.YUNYUZHOU.getCode(), record.getNewsIdList()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("广告位2") | |||||
| @GetMapping("guanggao2") | |||||
| public ResultData guanggao2() { | |||||
| return new ResultData(yqzjService.findGuangGaoWeiByType(EnumYqzjGuangGaoWeiType.INDEX_2.getCode())); | |||||
| } | |||||
| @ApiOperation("外链") | |||||
| @GetMapping("link") | |||||
| public ResultData link() { | |||||
| return new ResultData(yqzjService.findGuangGaoWeiByType(EnumYqzjGuangGaoWeiType.INDEX_3.getCode())); | |||||
| } | |||||
| @ApiOperation("热门新闻更新(通用)") | |||||
| @PostMapping("saveHotNewsConfig") | |||||
| public ResultData saveHotNewsConfig(@RequestBody YqzjHotNews record) { | |||||
| if (null == record.getId()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| yqzjService.saveHotNewsConfig(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("广告位更新(通用)") | |||||
| @PostMapping("saveGuangGao") | |||||
| public ResultData saveGuangGao(@RequestBody YqzjGuangGaoWei record) { | |||||
| if (null == record.getId()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| yqzjService.saveGuangGaoWei(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.domain.po.yqzj; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| @TableName(value = "yqzj_guanggao") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class YqzjGuangGaoWei extends TenantEntity { | |||||
| private static final long serialVersionUID = 7896943199531322661L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumYqzjPageType 类型",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="image") | |||||
| private String image; | |||||
| @io.swagger.annotations.ApiModelProperty(value="标题",name="title") | |||||
| private String title; | |||||
| @io.swagger.annotations.ApiModelProperty(value="多封面图",name="link") | |||||
| private String link; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否新开页 EnumYesOrNo",name="newOpen") | |||||
| private Integer newOpen; | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package com.iformall.domain.po.yqzj; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @TableName(value = "yqzj_hot_news") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class YqzjHotNews extends TenantEntity { | |||||
| private static final long serialVersionUID = 7896943199531322661L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumYqzjHotNewsType 类型",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否显示 EnumYesOrNo",name="display") | |||||
| private Integer display; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.domain.po.yqzj; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| @TableName(value = "yqzj_lunbotu") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class YqzjLunBoTu extends TenantEntity { | |||||
| private static final long serialVersionUID = 7896943199531322661L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumYqzjPageType 类型",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="image") | |||||
| private String image; | |||||
| @io.swagger.annotations.ApiModelProperty(value="序号",name="serialNumber") | |||||
| private Integer serialNumber; | |||||
| @io.swagger.annotations.ApiModelProperty(value="多封面图",name="link") | |||||
| private String link; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否新开页 EnumYesOrNo",name="newOpen") | |||||
| private Integer newOpen; | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.domain.po.yqzj; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @TableName(value = "yqzj_page_news") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class YqzjPageNews extends TenantEntity { | |||||
| private static final long serialVersionUID = 7896943199531322661L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumYqzjPageType 类型",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="新闻编号",name="newsId") | |||||
| private Long newsId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> newsIdList; | |||||
| @io.swagger.annotations.ApiModelProperty(value="新闻类型 EnumYqzjNewsType",name="newsId") | |||||
| private Integer newsType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.enums.yqzj; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumYqzjGuangGaoWeiType { | |||||
| INDEX_1(1, "首页-广告位1"), | |||||
| INDEX_2(2, "首页-广告位2"), | |||||
| INDEX_3(3, "首页-外链"), | |||||
| CAR_1(4,"汽车资讯广告位1"), | |||||
| CAR_2(5,"汽车资讯广告位2"), | |||||
| YUNYUZHOU_1(6, "元宇宙日爆广告位1"), | |||||
| YUNYUZHOU_2(7, "元宇宙日爆广告位2"), | |||||
| AIGC_1(8,"AIGC广告位1"), | |||||
| AIGC_2(9,"AIGC广告位2") | |||||
| ; | |||||
| public static EnumYqzjGuangGaoWeiType getEnum(Integer code) { | |||||
| for (EnumYqzjGuangGaoWeiType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public static List<Integer> getAllCodes(){ | |||||
| List<Integer> codes = new ArrayList<>(); | |||||
| for (EnumYqzjGuangGaoWeiType value : values()) { | |||||
| codes.add(value.getCode()); | |||||
| } | |||||
| return codes; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumYqzjGuangGaoWeiType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,51 @@ | |||||
| package com.iformall.enums.yqzj; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumYqzjHotNewsType { | |||||
| INDEX(1, "首页-热点新闻"), | |||||
| CAR_NEWS(2, "汽车资讯-热点新闻"), | |||||
| YUNYUZHOU_NEWS(3, "元宇宙资讯-热点新闻") | |||||
| ; | |||||
| public static EnumYqzjHotNewsType getEnum(Integer code) { | |||||
| for (EnumYqzjHotNewsType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public static List<Integer> getAllCodes(){ | |||||
| List<Integer> codes = new ArrayList<>(); | |||||
| for (EnumYqzjHotNewsType value : values()) { | |||||
| codes.add(value.getCode()); | |||||
| } | |||||
| return codes; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumYqzjHotNewsType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,51 @@ | |||||
| package com.iformall.enums.yqzj; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumYqzjNewsType { | |||||
| CAR(1, "汽车资讯"), | |||||
| HOT(2, "热点新闻"), | |||||
| YUNYUZHOU(3, "元宇宙资讯") | |||||
| ; | |||||
| public static EnumYqzjNewsType getEnum(Integer code) { | |||||
| for (EnumYqzjNewsType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public static List<Integer> getAllCodes(){ | |||||
| List<Integer> codes = new ArrayList<>(); | |||||
| for (EnumYqzjNewsType value : values()) { | |||||
| codes.add(value.getCode()); | |||||
| } | |||||
| return codes; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumYqzjNewsType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,53 @@ | |||||
| package com.iformall.enums.yqzj; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumYqzjPageType { | |||||
| INDEX(1, "首页"), | |||||
| CAR_NEWS(2, "汽车资讯"), | |||||
| YUNYUZHOU_NEWS(3, "元宇宙资讯"), | |||||
| AIGC(4, "AIGC"), | |||||
| ABOUT_US(5, "关于我们") | |||||
| ; | |||||
| public static EnumYqzjPageType getEnum(Integer code) { | |||||
| for (EnumYqzjPageType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public static List<Integer> getAllCodes(){ | |||||
| List<Integer> codes = new ArrayList<>(); | |||||
| for (EnumYqzjPageType value : values()) { | |||||
| codes.add(value.getCode()); | |||||
| } | |||||
| return codes; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumYqzjPageType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjGuangGaoWei; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.vo.TtCouponVo; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| public interface YqzjGuangGaoWeiMapper extends CommonMapper<YqzjGuangGaoWei, Long> { | |||||
| YqzjGuangGaoWei findByType(@Param("type") Integer type); | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjHotNews; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.domain.vo.TtCouponVo; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| public interface YqzjHotNewsMapper extends CommonMapper<YqzjHotNews, Long> { | |||||
| YqzjHotNews findByType(@Param("type") Integer hotNewsType); | |||||
| void deleteByType(); | |||||
| } | |||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.vo.TtCouponVo; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| public interface YqzjLunBoTuMapper extends CommonMapper<YqzjLunBoTu, Long> { | |||||
| List<YqzjLunBoTu> findList(YqzjLunBoTu lunbotu); | |||||
| } | |||||
| @@ -0,0 +1,19 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.domain.vo.TtCouponVo; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| public interface YqzjPageNewsMapper extends CommonMapper<YqzjPageNews, Long> { | |||||
| List<YqzjPageNews> findList(YqzjPageNews pageNews); | |||||
| void deleteByType(@Param("type") Integer type); | |||||
| } | |||||
| @@ -0,0 +1,45 @@ | |||||
| package com.iformall.service; | |||||
| import java.util.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.yqzj.YqzjGuangGaoWei; | |||||
| import com.iformall.domain.po.yqzj.YqzjHotNews; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.domain.vo.TtCouponVo; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||||
| import com.iformall.domain.vo.WxMerchantVo; | |||||
| public interface YqzjService { | |||||
| PageInfo<YqzjLunBoTu> listLunBoTuAsPage(YqzjLunBoTu record, Integer pageIndex, Integer pageSize); | |||||
| void saveOrUpdateLunBoTu(YqzjLunBoTu record); | |||||
| void deleteLunBoTu(Long id); | |||||
| PageInfo<YqzjPageNews> pageNewsAsPage(YqzjPageNews record, Integer pageIndex, Integer pageSize); | |||||
| void savePageNews(Integer type,Integer newsType,List<Long> newsId); | |||||
| YqzjHotNews findHotNewsConfigByTpye(Integer hotNewsType); | |||||
| void saveHotNewsConfig(YqzjHotNews hotNews); | |||||
| YqzjGuangGaoWei findGuangGaoWeiByType(Integer guanggaoweiType); | |||||
| void saveGuangGaoWei(YqzjGuangGaoWei guanggaowei); | |||||
| } | |||||
| @@ -0,0 +1,106 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.yqzj.YqzjGuangGaoWei; | |||||
| import com.iformall.domain.po.yqzj.YqzjHotNews; | |||||
| import com.iformall.domain.po.yqzj.YqzjLunBoTu; | |||||
| import com.iformall.domain.po.yqzj.YqzjPageNews; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| @Service | |||||
| public class YqzjServiceImpl implements YqzjService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| YqzjLunBoTuMapper yqzjLunBoTuMapper; | |||||
| @Autowired | |||||
| YqzjPageNewsMapper yqzjPageNewsMapper; | |||||
| @Autowired | |||||
| YqzjHotNewsMapper yqzjHotNewsMapper; | |||||
| @Autowired | |||||
| YqzjGuangGaoWeiMapper yqzjGuangGaoWeiMapper; | |||||
| @Override | |||||
| public PageInfo<YqzjLunBoTu> listLunBoTuAsPage(YqzjLunBoTu record, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> yqzjLunBoTuMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdateLunBoTu(YqzjLunBoTu record) { | |||||
| if (null == record.getId()) { | |||||
| IdWorker idworker = IdWorker.get(); | |||||
| record.setId(idworker.nextId()); | |||||
| record.setCreateDate(new Date()); | |||||
| record.setUpdateDate(new Date()); | |||||
| yqzjLunBoTuMapper.insert(record); | |||||
| }else { | |||||
| record.setUpdateDate(new Date()); | |||||
| yqzjLunBoTuMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteLunBoTu(Long id) { | |||||
| yqzjLunBoTuMapper.deleteById(id); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<YqzjPageNews> pageNewsAsPage(YqzjPageNews record, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> yqzjPageNewsMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void savePageNews(Integer type, Integer newsType, List<Long> newsId) { | |||||
| yqzjPageNewsMapper.deleteByType(type); | |||||
| if (null != newsId) { | |||||
| for (int i = 0 ; i < newsId.size(); i++) { | |||||
| YqzjPageNews pn = new YqzjPageNews(); | |||||
| pn.setNewsId(newsId.get(i)); | |||||
| pn.setNewsType(newsType); | |||||
| pn.setType(type); | |||||
| IdWorker idworker = IdWorker.get(); | |||||
| pn.setId(idworker.nextId()); | |||||
| pn.setCreateDate(new Date()); | |||||
| pn.setUpdateDate(new Date()); | |||||
| yqzjPageNewsMapper.insert(pn); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public YqzjHotNews findHotNewsConfigByTpye(Integer hotNewsType) { | |||||
| return yqzjHotNewsMapper.findByType(hotNewsType); | |||||
| } | |||||
| @Override | |||||
| public void saveHotNewsConfig(YqzjHotNews hotNews) { | |||||
| hotNews.setUpdateDate(new Date()); | |||||
| yqzjHotNewsMapper.updateById(hotNews); | |||||
| } | |||||
| @Override | |||||
| public YqzjGuangGaoWei findGuangGaoWeiByType(Integer guanggaoweiType) { | |||||
| return yqzjGuangGaoWeiMapper.findByType(guanggaoweiType); | |||||
| } | |||||
| @Override | |||||
| public void saveGuangGaoWei(YqzjGuangGaoWei guanggaowei) { | |||||
| yqzjGuangGaoWeiMapper.updateById(guanggaowei); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,56 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.YqzjGuangGaoWeiMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.yqzj.YqzjGuangGaoWei"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="image" jdbcType="VARCHAR" property="image"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="link" jdbcType="VARCHAR" property="link"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="new_open" jdbcType="INTEGER" property="serialNumber"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`image`,`title`,`link`,`create_date`,`update_date`,`new_open` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findByType" parameterType="java.util.map" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from yqzj_guanggao where `type` = #{type} | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,53 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.YqzjHotNewsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.yqzj.YqzjHotNews"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="display" jdbcType="BIGINT" property="newsId"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`display`,`create_date`,`update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findByType" parameterType="java.util.map" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from yqzj_hot_news where type = #{type} | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,57 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.YqzjLunBoTuMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.yqzj.YqzjLunBoTu"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="image" jdbcType="VARCHAR" property="image"/> | |||||
| <result column="serial_number" jdbcType="INTEGER" property="serialNumber"/> | |||||
| <result column="link" jdbcType="VARCHAR" property="link"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="new_open" jdbcType="INTEGER" property="serialNumber"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`image`,`serial_number`,`link`,`create_date`,`update_date`,`new_open` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.yqzj.YqzjLunBoTu" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from yqzj_lunbotu | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,67 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.YqzjPageNewsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.yqzj.YqzjPageNews"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="news_id" jdbcType="BIGINT" property="newsId"/> | |||||
| <result column="news_type" jdbcType="INTEGER" property="newsType"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`news_id`,`news_type`,`create_date`,`update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != newsId "> | |||||
| and `news_id` = #{newsId} | |||||
| </if> | |||||
| <if test=" null != newsType "> | |||||
| and `news_type` = #{newsType} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.yqzj.YqzjPageNews" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from yqzj_page_news | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <delete id="deleteByType" parameterType="java.util.map"> | |||||
| delete from yqzj_page_news where `type` = #{type} | |||||
| </delete> | |||||
| </mapper> | |||||