admin
2019-12-16 0cbdd620aac13ac8b06599294183cf1246626f0e
专题版本控制
14个文件已修改
2个文件已添加
495 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/AppVersionCodeController.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SpecialCardAdminController.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/AppVersionInfoMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/AdActivityVersionControlMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/AppVersionInfo.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/AppVersionInfoMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/AdActivityVersionControlMapper.xml 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/config/AppVersionServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeOrderProcessServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/AdActivityVersionControlServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/config/AppVersionService.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/AdActivityVersionControlService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/homemodule/AdActivityTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/AppVersionCodeController.java
New file
@@ -0,0 +1,46 @@
package com.yeshi.fanli.controller.admin;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.util.StringUtil;
@Controller(value = "appVersionCodeController")
@RequestMapping("admin/new/api/v1/appversion")
public class AppVersionCodeController {
    @Resource
    private AppVersionService appVersionService;
    /**
     * 获取版本列表
     *
     * @param url
     * @param out
     * @throws Exception
     */
    @RequestMapping(value = "listVersions")
    public void listVersions(String callback, String platform, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(platform)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传平台"));
            return;
        }
        try {
            List<AppVersionInfo> list = appVersionService.getAppVersionInfoListByPlatform(platform);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(list));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取失败"));
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SpecialCardAdminController.java
@@ -2,7 +2,9 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -15,16 +17,22 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
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.Special;
import com.yeshi.fanli.entity.bus.homemodule.SpecialCard;
import com.yeshi.fanli.exception.homemodule.FloatADException;
import com.yeshi.fanli.exception.homemodule.SpecialException;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
import com.yeshi.fanli.service.inter.homemodule.SpecialService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@@ -36,6 +44,12 @@
    @Resource
    private SpecialCardService specialCardService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    /**
     * 保存信息
@@ -247,8 +261,8 @@
     */
    @RequestMapping(value = "querySpecial")
    public void querySpecial(String callback, Integer pageIndex, Integer pageSize, String key, Long cardId, Integer sex,
            PrintWriter out) {
            String version, String platform, PrintWriter out) {
        pageSize = 100;
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
@@ -262,16 +276,65 @@
            return;
        }
        List<AppVersionInfo> versionList = null;
        if (!StringUtil.isNullOrEmpty(version) || !StringUtil.isNullOrEmpty(platform)) {
            versionList = new ArrayList<>();
            if (!StringUtil.isNullOrEmpty(version) && !StringUtil.isNullOrEmpty(platform)) {
                AppVersionInfo appVersion = appVersionService.getByPlatformAndVersion(platform, version);
                if (appVersion != null)
                    versionList.add(appVersion);
            } else if (!StringUtil.isNullOrEmpty(version)) {
                List<AppVersionInfo> appVersionList = appVersionService.listByVersion(version);
                if (appVersionList != null) {
                    versionList.addAll(appVersionList);
                }
            } else {
                List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
                if (appVersionList != null) {
                    versionList.addAll(appVersionList);
                }
            }
        }
        try {
            List<Special> list = specialService.listQueryByCard((pageIndex - 1) * pageSize, pageSize, cardId, key, sex);
            long count = specialService.countlistQueryByCard(cardId, key, sex);
            // 获取有效的专题
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            long count = specialService.countlistQueryByCard(cardId, key, sex);
            // 过滤
            if (versionList != null) {
                if (versionList.size() > 0) {
                    List<Long> sourceIdList = new ArrayList<>();
                    for (Special special : list) {
                        sourceIdList.add(special.getId());
                    }
                    List<Long> versionIdList = new ArrayList<>();
                    for (AppVersionInfo versionInfo : versionList)
                        versionIdList.add(versionInfo.getId());
                    List<Long> sourceIds = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
                            AdActivityType.special, versionIdList);
                    Set<Long> sets = new HashSet<>();
                    if (sourceIds != null)
                        for (Long sourceId : sourceIds) {
                            sets.add(sourceId);
                        }
                    for (int i = 0; i < list.size(); i++) {
                        if (!sets.contains(list.get(i).getId())) {
                            list.remove(i--);
                        }
                    }
                    count = list.size();
                } else {
                    list.clear();
                    count = 0;
                }
            }
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -290,7 +353,43 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            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) {
        JSONArray versionArray = JSONArray.fromObject(versions);
        List<Long> versionIds = new ArrayList<>();
        for (int i = 0; i < versionArray.size(); i++) {
            Long version = versionArray.optLong(i);
            versionIds.add(version);
        }
        try {
            specialService.setVersions(id, versionIds);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(""));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
        }
    }
    @RequestMapping(value = "getVersions")
    public void getVersions(String callback, Long id, PrintWriter out) {
        List<AdActivityVersionControl> list = adActivityVersionControlService
                .listByTypeAndSourceId(AdActivityType.special, id);
        List<Long> versionList = new ArrayList<>();
        if (list != null)
            for (AdActivityVersionControl control : list)
                versionList.add(control.getId());
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(versionList));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/AppVersionInfoMapper.java
@@ -31,10 +31,8 @@
     * @param versionCode
     * @return
     */
    AppVersionInfo selectByPlatformAndVersion(@Param("platform") String platform,
            @Param("version") String version);
    AppVersionInfo selectByPlatformAndVersion(@Param("platform") String platform, @Param("version") String version);
    /**
     * 根据平台和版本号获取版本信息
     * 
@@ -68,5 +66,12 @@
     */
    List<AppVersionInfo> listByPlatformAndMaxVersionCode(@Param("platform") String platform,
            @Param("maxVersionCode") int maxVersionCode);
    /**
     * 根据版本检索
     *
     * @param version
     * @return
     */
    List<AppVersionInfo> listByVersion(@Param("version") String version);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/AdActivityVersionControlMapper.java
@@ -2,6 +2,8 @@
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
@@ -16,7 +18,8 @@
     * @param versionId
     * @return
     */
    AdActivityVersionControl selectBySourceIdAndTypeAndVersion(Long sourceId, AdActivityType type, Long versionId);
    AdActivityVersionControl selectBySourceIdAndTypeAndVersion(@Param("sourceId") Long sourceId,
            @Param("type") AdActivityType type, @Param("versionId") Long versionId);
    /**
     * 
@@ -24,7 +27,8 @@
     * @param sourceId
     * @return
     */
    List<AdActivityVersionControl> listByTypeAndSourceId(AdActivityType type, Long sourceId);
    List<AdActivityVersionControl> listByTypeAndSourceId(@Param("type") AdActivityType type,
            @Param("sourceId") Long sourceId);
    /**
     * 根据内容与版本ID检索
@@ -34,7 +38,6 @@
     * @param appVersionId
     * @return
     */
    List<AdActivityVersionControl> listByVersionAndSourceId(List<Long> sourceIdList, AdActivityType type,
            Long appVersionId);
    List<AdActivityVersionControl> listByVersionAndSourceId(@Param("sourceIdList") List<Long> sourceIdList,
            @Param("type") AdActivityType type, @Param("versionIdList") List<Long> versionIdList);
}
fanli/src/main/java/com/yeshi/fanli/entity/AppVersionInfo.java
@@ -16,6 +16,15 @@
    public final static String PLATFORM_ANDROID = "android";
    public final static String PLATFORM_IOS = "ios";
    public final static String PLATFORM_XCX = "小程序";
    public AppVersionInfo(Long id) {
        super();
        this.id = id;
    }
    public AppVersionInfo() {
        super();
    }
    @Column(name = "avcm_id")
    private Long id;
fanli/src/main/java/com/yeshi/fanli/mapping/AppVersionInfoMapper.xml
@@ -67,8 +67,12 @@
    </select>
    <select id="listByVersion" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_app_version_code_map where avcm_version=#{version}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_app_version_code_map where avcm_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/AdActivityVersionControlMapper.xml
@@ -6,10 +6,14 @@
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">
        <id column="vc_id" property="id" jdbcType="BIGINT" />
        <result column="vc_type" property="type" jdbcType="VARCHAR" />
        <result column="vc_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.homemodule.AdActivityTypeEnumHandler" />
        <result column="vc_source_id" property="sourceId" jdbcType="BIGINT" />
        <result column="vc_version" property="version" jdbcType="VARCHAR" />
        <result column="vc_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <association property="version" column="vc_version"
            javaType="com.yeshi.fanli.entity.AppVersionInfo">
            <id column="vc_version" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">vc_id,vc_type,vc_source_id,vc_version,vc_create_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
@@ -19,15 +23,48 @@
        from yeshi_ec_ad_activity_version_control where vc_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectBySourceIdAndTypeAndVersion" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_source_id =
        #{sourceId} and vc_type=#{type} and vc_version=#{versionId}
    </select>
    <select id="listByTypeAndSourceId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_source_id =
        #{sourceId} and vc_type=#{type}
    </select>
    <select id="listByVersionAndSourceId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_type=#{type}
        <foreach collection="sourceIdList" item="sourceId" open=" and ("
            close=")" separator=" or ">
            vc_source_id=#{sourceId}
        </foreach>
        <foreach collection="versionIdList" item="versionId" open=" and ("
            close=")" separator=" or ">
            vc_version=#{versionId}
        </foreach>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_ad_activity_version_control where vc_id =
        #{id,jdbcType=BIGINT}</delete>
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_ad_activity_version_control
        (vc_id,vc_type,vc_source_id,vc_version,vc_create_time) values
        (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{sourceId,jdbcType=BIGINT},#{version,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})
        (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{sourceId,jdbcType=BIGINT},#{version.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"
@@ -45,16 +82,19 @@
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="sourceId != null">#{sourceId,jdbcType=BIGINT},</if>
            <if test="version != null">#{version,jdbcType=VARCHAR},</if>
            <if test="version != null">#{version.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">update yeshi_ec_ad_activity_version_control set vc_type
        = #{type,jdbcType=VARCHAR},vc_source_id =
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">update yeshi_ec_ad_activity_version_control set
        vc_type
        =
        #{type,jdbcType=VARCHAR},vc_source_id =
        #{sourceId,jdbcType=BIGINT},vc_version =
        #{version,jdbcType=VARCHAR},vc_create_time =
        #{createTime,jdbcType=TIMESTAMP} where vc_id = #{id,jdbcType=BIGINT}
        #{version.id,jdbcType=BIGINT},vc_create_time =
        #{createTime,jdbcType=TIMESTAMP} where vc_id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">
@@ -62,7 +102,7 @@
        <set>
            <if test="type != null">vc_type=#{type,jdbcType=VARCHAR},</if>
            <if test="sourceId != null">vc_source_id=#{sourceId,jdbcType=BIGINT},</if>
            <if test="version != null">vc_version=#{version,jdbcType=VARCHAR},</if>
            <if test="version != null">vc_version=#{version.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">vc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where vc_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/service/impl/config/AppVersionServiceImpl.java
@@ -65,38 +65,38 @@
    }
    @Override
    public List<Integer> listVersionCodeByVersions(String platform, List<String> listVersion){
    public List<Integer> listVersionCodeByVersions(String platform, List<String> listVersion) {
        List<Integer> listVersionCode = null;
        if (listVersion == null || listVersion.size() == 0) {
            return listVersionCode;
        }
        listVersionCode = new ArrayList<Integer>();
        for (String version: listVersion) {
            AppVersionInfo appVersion= getByPlatformAndVersion(platform, version);
        for (String version : listVersion) {
            AppVersionInfo appVersion = getByPlatformAndVersion(platform, version);
            if (appVersion != null && appVersion.getVersionCode() != null) {
                listVersionCode.add(appVersion.getVersionCode());
            }
        }
        return listVersionCode;
    }
    @Override
    public List<AppVersionInfo> listByVersions(String platform, List<String> listVersion){
    public List<AppVersionInfo> listByVersions(String platform, List<String> listVersion) {
        List<AppVersionInfo> listVersionCode = null;
        if (listVersion == null || listVersion.size() == 0) {
            return listVersionCode;
        }
        listVersionCode = new ArrayList<AppVersionInfo>();
        for (String version: listVersion) {
            AppVersionInfo appVersion= getByPlatformAndVersion(platform, version);
        for (String version : listVersion) {
            AppVersionInfo appVersion = getByPlatformAndVersion(platform, version);
            if (appVersion != null) {
                listVersionCode.add(appVersion);
            }
        }
        return listVersionCode;
    }
@@ -104,4 +104,17 @@
    public List<AppVersionInfo> listByPlatformAndMinVersionCode(String platform, int versionCode) {
        return appVersionInfoMapper.listByPlatformAndMinVersionCode(platform, versionCode);
    }
    @Override
    public AppVersionInfo selectByPrimaryKey(Long id) {
        return appVersionInfoMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<AppVersionInfo> listByVersion(String version) {
        return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeOrderProcessServiceImpl.java
@@ -9,6 +9,7 @@
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
import com.yeshi.fanli.entity.elme.ElmeOrder;
@@ -21,6 +22,7 @@
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
@@ -47,6 +49,9 @@
    @Resource
    private UserOrderMsgNotificationService userOrderMsgNotificationService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Transactional
    @Override
    public void processOrder(ElmeOrder elmeOrder) throws ElmeOrderException {
@@ -62,11 +67,20 @@
        ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByOrderId(elmeOrder.getId());
        if (map == null)// 订单不存在
        {
            String rid = elmeOrder.getRid();
            if (StringUtil.isNullOrEmpty(rid))
            Long uid = null;
            if (StringUtil.isNullOrEmpty(elmeOrder.getChannelId())) {//新版本
                UserExtraTaoBaoInfo extra = userExtraTaoBaoInfoService.getByRelationId(elmeOrder.getRid());
                if (extra != null)
                    uid = extra.getUser().getId();
            } else {//老版本
                uid = Long.parseLong(elmeOrder.getRid());
            }
            if (uid == null)
                return;
            // 查询映射用户
            UserInfo user = userInfoService.selectByPKey(Long.parseLong(rid));
            UserInfo user = userInfoService.selectByPKey(uid);
            if (user == null)
                return;
            // 制造hongbao
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/AdActivityVersionControlServiceImpl.java
@@ -48,20 +48,20 @@
    }
    @Override
    public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, Long appVersionId) {
    public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, List<Long> versionIdList) {
        if (sourceIdList == null || sourceIdList.size() == 0)
            return null;
        if (type == null || appVersionId == null)
        if (type == null || versionIdList == null)
            return null;
        List<AdActivityVersionControl> list = adActivityVersionControlMapper.listByVersionAndSourceId(sourceIdList,
                type, appVersionId);
                type, versionIdList);
        List<Long> resultList = new ArrayList<>();
        if (list != null)
            for (AdActivityVersionControl control : list)
                if(control!=null&&control.getSourceId()!=null)
                resultList.add(control.getSourceId());
                if (control != null && control.getSourceId() != null)
                    resultList.add(control.getSourceId());
        return resultList;
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java
@@ -19,7 +19,10 @@
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.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
@@ -27,6 +30,7 @@
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.AdActivityVersionControlService;
import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
import com.yeshi.fanli.service.inter.homemodule.SpecialService;
@@ -56,6 +60,9 @@
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    @Override
    public Special selectByPrimaryKey(Long id) {
@@ -87,7 +94,7 @@
        } else if (!StringUtil.isJson(params)) {
            throw new SpecialException(1, "跳转参数非JSON格式");
        }
        String startTime_str = record.getStartTime_str();
        if (record.isTimeTask() && (startTime_str == null || startTime_str.length() == 0)) {
            throw new SpecialException(1, "控制时间不能为空");
@@ -99,7 +106,7 @@
                record.setJumpDetail(listByType.get(0));
            }
        }
        // 时间转换
        conversionTime(record);
@@ -210,18 +217,19 @@
    /**
     * web段时间转换
     *
     * @param record
     */
    public void conversionTime(Special record) throws SpecialException, Exception {
        // 是否时间控制
        if(!record.isTimeTask()) {
        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)
            if ((startTime_str == null || startTime_str.trim().length() == 0)
                    && (endTime_str == null || endTime_str.trim().length() == 0)) {
                throw new HomeNavbarException(1, "请输入控制时间");
            } else {
@@ -230,7 +238,7 @@
                    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));
@@ -238,7 +246,7 @@
            }
        }
    }
    /**
     * 上传图片
     * 
@@ -371,32 +379,31 @@
        // 跳转链接
        for (Special special : list) {
            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("");
                } else {
                    special.setStartTime_str(sdf.format(startTime));
                }
                if (endTime == null) {
                    special.setEndTime_str("");
                } else {
                    special.setEndTime_str(sdf.format(endTime));
                }
            }
            String params = special.getParams();
            if (StringUtil.isNullOrEmpty(params)) {
                special.setParams("");
@@ -461,7 +468,7 @@
        int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
        int version = Integer.parseInt(acceptData.getVersion());
        List<Special> listArc = specialMapper.listByPlaceKey(indexArc, sex, platformCode, version);
        if (listArc == null) {
            listArc = new ArrayList<Special>();
@@ -570,26 +577,24 @@
    public List<Special> listByPlaceKey(String placeKey, Integer platform, Integer versionCode) {
        return specialMapper.listByPlaceKey(placeKey, null, platform, versionCode);
    }
    @Override
    public List<Special> listByPlaceKeyList(long start, int count, List<String> list, Integer platform, Integer versionCode) {
    public List<Special> listByPlaceKeyList(long start, int count, List<String> list, Integer platform,
            Integer versionCode) {
        return specialMapper.listByPlaceKeyList(start, count, list, null, platform, versionCode);
    }
    @Override
    public long countByPlaceKeyList(List<String> list, Integer platform, Integer versionCode) {
        return specialMapper.countByPlaceKeyList(list, null, platform, versionCode);
    }
    @Override
    @Cacheable(value = "specialCache", key = "'listByPlaceKeyHasLabel'+#start+'-'+#platform+'-'+#versionCode+'-'+#list")
    public List<Special> listByPlaceKeyHasLabel(long start, int count, List<String> list, Integer platform, Integer versionCode) {
    public List<Special> listByPlaceKeyHasLabel(long start, int count, List<String> list, Integer platform,
            Integer versionCode) {
        return specialMapper.listByPlaceKeyHasLabel(start, count, list, null, platform, versionCode);
    }
    /**
     * 处理 数据
@@ -608,4 +613,28 @@
            }
        }
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void setVersions(Long specialId, List<Long> versions) throws Exception {
        Special special = selectByPrimaryKey(specialId);
        if (special == null) {
            throw new Exception("专题不存在");
        }
        List<AdActivityVersionControl> versionList = adActivityVersionControlService
                .listByTypeAndSourceId(AdActivityType.special, special.getId());
        if (versionList != null) {
            for (AdActivityVersionControl control : versionList)
                adActivityVersionControlService.deleteByPrimaryKey(control.getId());
        }
        // 添加映射
        for (Long versionId : versions) {
            AdActivityVersionControl control = new AdActivityVersionControl();
            control.setCreateTime(new Date());
            control.setSourceId(special.getId());
            control.setType(AdActivityType.special);
            control.setVersion(new AppVersionInfo(versionId));
            adActivityVersionControlService.addVersionControl(control);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -61,6 +61,7 @@
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
import com.yeshi.fanli.service.inter.elme.ElmeOrderProcessService;
import com.yeshi.fanli.service.inter.elme.ElmeOrderService;
import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
import com.yeshi.fanli.service.inter.money.UserMoneyService;
@@ -279,10 +280,11 @@
            for (TaoBaoOrder taoBaoOrder : orderList) {
                ElmeOrder elmeOrder = createElmeOrder(taoBaoOrder);
                try {
                    elmeOrderService.addOrder(elmeOrder);
                    elmeOrderProcessService.processOrder(elmeOrder);
                } catch (ElmeOrderException e) {
                    e.printStackTrace();
                }
            }
        }
    }
@@ -1192,6 +1194,9 @@
    @Resource
    private ElmeOrderService elmeOrderService;
    @Resource
    private ElmeOrderProcessService elmeOrderProcessService;
    /**
     * 获取饿了么可以返利的红包
     * 
fanli/src/main/java/com/yeshi/fanli/service/inter/config/AppVersionService.java
@@ -36,8 +36,7 @@
     * @return
     */
    public AppVersionInfo getAppVersionInfoListByPlatformAndVersion(String platform, int versionCode);
    /**
     * 通过版本号与平台获取详细信息
     * 
@@ -47,25 +46,27 @@
     */
    public List<AppVersionInfo> listByPlatformAndMinVersionCode(String platform, int versionCode);
    /**
     * 根据版本号获取
     *
     * @param platform
     * @param version
     * @return
     */
    public AppVersionInfo getByPlatformAndVersion(String platform, String version);
    /**
     * 根据平台和最小版本号获取版本
     *
     * @param platform
     * @param version
     * @return
     */
    public List<AppVersionInfo> listByPlatformAndMinVersion(String platform,String version);
    public List<AppVersionInfo> listByPlatformAndMinVersion(String platform, String version);
    /**
     * 根据平台、版本号批量查询
     *
     * @param listVersion
     * @return
     */
@@ -73,10 +74,27 @@
    /**
     * 根据平台、版本号批量查询
     *
     * @param platform
     * @param listVersion
     * @return
     */
    public List<AppVersionInfo> listByVersions(String platform, List<String> listVersion);
    /**
     * 根据主键查询
     *
     * @param id
     * @return
     */
    public AppVersionInfo selectByPrimaryKey(Long id);
    /**
     * 按版本检索
     *
     * @param version
     * @return
     */
    public List<AppVersionInfo> listByVersion(String version);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/AdActivityVersionControlService.java
@@ -45,6 +45,6 @@
     * @param appVersionId
     * @return
     */
    public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, Long appVersionId);
    public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, List<Long> versionIdList);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java
@@ -131,6 +131,15 @@
     * @return
     */
    public List<Special> listByPlaceKeyHasLabel(long start, int count, List<String> list, Integer platform, Integer versionCode);
    /**
     * 为专题设置版本
     * @param specialId
     * @param versions
     * @throws Exception
     */
    public void setVersions(Long specialId,List<Long> versions)  throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/homemodule/AdActivityTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.homemodule;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
public class AdActivityTypeEnumHandler extends BaseTypeHandler<AdActivityType> {
    @Override
    public AdActivityType getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return AdActivityType.valueOf(key);
        }
    }
    @Override
    public AdActivityType getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return AdActivityType.valueOf(key);
        }
    }
    @Override
    public AdActivityType getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return AdActivityType.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, AdActivityType arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}