yujian
2019-09-03 3d50552f1910a5d30cc5bb322f0f7984bce51624
专题加入版本信息
7个文件已修改
153 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/ConfigAdminController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/SpecialMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/Special.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/SpecialMapper.xml 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ConfigAdminController.java
@@ -121,17 +121,15 @@
        }
    }
    /**
     * 查询列表 - 新后台
     *
     * 版本号信息
     * @param callback
     * @param key
     *            查询词 名称
     * @param pageIndex
     * @param out
     */
    @RequestMapping(value = "getVersionList")
    public void getVersionList(String callback, String key, Integer pageIndex, PrintWriter out) {
    public void getVersionList(String callback, PrintWriter out) {
        try {
            AppVersionInfo appVersionInfo = new AppVersionInfo();
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -2556,23 +2556,12 @@
     */
    @RequestMapping(value = "getSpecialActivities")
    public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
            return;
        }
        try {
            int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
            List<Special> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "special_activities",
                    platformCode, Integer.parseInt(acceptData.getVersion()));
            List<Special> list = new ArrayList<Special>();
            // 专题活动
            String specialCard = "special_activities";
            List<Special> listSpecial = specialService.listPageBySystemAndCard(0, Integer.MAX_VALUE, specialCard,
                    system.getId());
            if (listSpecial != null) {
                list.addAll(listSpecial);
            }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/SpecialMapper.java
@@ -85,6 +85,16 @@
    List<Special> listBySystemAndCard(@Param("card") String card, @Param("systemId") Long systemId);
    
    /**
     * 查询有效专题-版本区分
     * @param card
     * @param systemId
     * @return
     */
    List<Special> listByVersion(@Param("start") long start, @Param("count") int count,
            @Param("card") String card, @Param("platform") Integer platform, @Param("versionCode") Integer versionCode);
    /**
     * 根据标识、系统查询启用专题-分页
     * @param card
     * @param systemId
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/Special.java
@@ -111,6 +111,14 @@
    @Column(name = "b_remark")
    private String remark;
    
    // 平台:1-android 2-IOS
    @Column(name = "b_platform")
    private Integer platform;
    // 版本号
    @Column(name = "b_version_code")
    private Integer versionCode;
    // 创建时间
    @Column(name = "b_createtime")
    private Date createtime;
@@ -119,17 +127,21 @@
    @Column(name = "b_updatetime")
    private Date updatetime;
    
    // 是否弹框
    @Expose
    private boolean elastic;
    // 背景图片
    private String bottomPicture; 
    // 是否删除图片
    private Boolean delIcon;
    private Boolean delPicture;
    private Boolean delSubPicture;
    
    // 是否弹框
    @Expose
    private boolean elastic;
    // 限制最低版本
    private String version;
    
    public Long getId() {
@@ -325,4 +337,27 @@
        this.orderWoman = orderWoman;
    }
    
    public Integer getPlatform() {
        return platform;
    }
    public void setPlatform(Integer platform) {
        this.platform = platform;
    }
    public Integer getVersionCode() {
        return versionCode;
    }
    public void setVersionCode(Integer versionCode) {
        this.versionCode = versionCode;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/SpecialMapper.xml
@@ -19,6 +19,8 @@
        <result column="b_sex" property="sex" jdbcType="INTEGER" />
        <result column="b_show_type" property="showType" jdbcType="VARCHAR" />
        <result column="b_remark" property="remark" jdbcType="VARCHAR" />
        <result column="b_platform" property="platform" jdbcType="INTEGER"/>
        <result column="b_version_code" property="versionCode" jdbcType="INTEGER"/>
        <result column="b_createtime" property="createtime" jdbcType="TIMESTAMP" />
        <result column="b_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
@@ -31,7 +33,7 @@
        </association>
    </resultMap>
    <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_createtime,b_updatetime</sql>
    <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_platform,b_version_code,b_createtime,b_updatetime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
@@ -42,9 +44,9 @@
        yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special
        (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_createtime,b_updatetime)
        (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_platform,b_version_code,b_createtime,b_updatetime)
        values
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{versionCode,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_special
@@ -66,6 +68,8 @@
            <if test="sex != null">b_sex,</if>
            <if test="showType != null">b_show_type,</if>
            <if test="remark != null">b_remark,</if>
            <if test="platform != null">b_platform,</if>
            <if test="versionCode != null">b_version_code,</if>
            <if test="createtime != null">b_createtime,</if>
            <if test="updatetime != null">b_updatetime,</if>
        </trim>
@@ -88,6 +92,8 @@
            <if test="sex != null">#{sex,jdbcType=INTEGER},</if>
            <if test="showType != null">#{showType,jdbcType=VARCHAR},</if>
            <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
            <if test="platform != null">#{platform,jdbcType=INTEGER},</if>
            <if test="versionCode != null">#{versionCode,jdbcType=INTEGER},</if>
            <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
        </trim>
@@ -107,7 +113,8 @@
        #{orderWoman,jdbcType=INTEGER},b_state =
        #{state,jdbcType=BIGINT},b_show_type =
        #{showType,jdbcType=VARCHAR},b_remark =
        #{remark,jdbcType=VARCHAR},b_createtime =
        #{remark,jdbcType=VARCHAR},b_platform = #{platform,jdbcType=INTEGER},b_version_code = #{versionCode,jdbcType=INTEGER},
        b_createtime =
        #{createtime,jdbcType=TIMESTAMP},b_updatetime =
        #{updatetime,jdbcType=TIMESTAMP},b_sex=#{sex,jdbcType=INTEGER} where
        b_id = #{id,jdbcType=BIGINT}</update>
@@ -130,6 +137,8 @@
            <if test="sex != null">b_sex=#{sex,jdbcType=INTEGER},</if>
            <if test="showType != null">b_show_type=#{showType,jdbcType=VARCHAR},</if>
            <if test="remark != null">b_remark=#{remark,jdbcType=VARCHAR},</if>
            <if test="platform != null">b_platform=#{platform,jdbcType=INTEGER},</if>
              <if test="versionCode != null">b_version_code=#{versionCode,jdbcType=INTEGER},</if>
            <if test="createtime != null">b_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="updatetime != null">b_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
        </set>
@@ -298,6 +307,16 @@
        p.`b_orderby`
    </select>
    <select id="listByVersion" resultMap="BaseResultMap">
        SELECT p.* FROM`yeshi_ec_special` p
        LEFT JOIN `yeshi_ec_special_card` c ON p.`b_card_id` = c.`cd_id`
        WHERE p.`b_state` = 0 AND c.`cd_state` = 0 AND c.`cd_card` = #{card}
                 AND IF(p.`b_platform` IS NOT NULL, IF(#{versionCode} <![CDATA[>=]]> p.`b_version_code` AND p.`b_platform`=#{platform}, TRUE,FALSE), TRUE)
        ORDER BY p.`b_orderby`
        LIMIT ${start},${count}
    </select>
    <select id="listPageBySystemAndCard" resultMap="BaseResultMap">
        SELECT p.* FROM
        `yeshi_ec_special` p LEFT JOIN `yeshi_ec_special_card` c ON
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java
@@ -18,11 +18,13 @@
import com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper;
import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.exception.homemodule.SpecialException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
@@ -51,6 +53,10 @@
    @Resource
    private ConfigService configService;
    @Resource
    private AppVersionService appVersionService;
    @Override
    public Special selectByPrimaryKey(Long id) {
        return specialMapper.selectByPrimaryKey(id);
@@ -73,6 +79,26 @@
        Integer sex = record.getSex();
        if (sex == null) {
            throw new SpecialException(1, "性别不能为空");
        }
        String version = record.getVersion();
        Integer platformCode = record.getPlatform();
        if (!StringUtil.isNullOrEmpty(version) && platformCode != null) {
            String platform = "android";
            if (platformCode == 2)
                platform = "ios";
            AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, version);
            if (versionInfo == null)
                throw new SpecialException(1, "版本号信息缺失");
            record.setVersionCode(versionInfo.getVersionCode());
            record.setPlatform(platformCode);
        } else {
            if (!StringUtil.isNullOrEmpty(version))
                throw new SpecialException(1, "平台类型不能为空");
            if (platformCode != null)
                throw new SpecialException(1, "版本号不能为空");
        }
        String params = record.getParams();
@@ -366,6 +392,13 @@
    }
    @Override
    @Cacheable(value = "specialCache", key = "'listByVersion-'+#start+'-'+#count+'-'+#card+'-'+#platform+'-'+#versionCode")
    public List<Special> listByVersion(long start, int count, String card, Integer platform, Integer versionCode) {
        return specialMapper.listByVersion(start, count, card, platform, versionCode);
    }
    @Override
    @Cacheable(value = "specialCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version+'-'+#sex")
    public JSONObject listCacheSpecialToIndex(AcceptData acceptData, Integer sex) throws Exception {
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java
@@ -96,4 +96,17 @@
     */
    public List<Special> listByPlaceKey(String placeKey);
    /**
     * 专题 版本区分
     * @param start
     * @param count
     * @param card
     * @param systemId
     * @param platform
     * @param versionCode
     * @return
     */
    public List<Special> listByVersion(long start, int count, String card, Integer platform, Integer versionCode);
}