admin
2019-12-20 c96375400afce5cd0be41e8af0eb7e8deb484994
Merge remote-tracking branch 'origin/div' into div
16个文件已修改
1212 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/HelpCenterAdminController.java 559 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/help/HelpCenterMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpCenter.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpClass.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/AdActivityVersionControl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpCenterMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpClassMapper.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpCenterServiceImpl.java 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpClassServiceImpl.java 143 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/help/HelpCenterService.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/help/HelpClassService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/TimeUtil.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/HelpCenterAdminController.java
@@ -4,30 +4,39 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.yeshi.utils.JsonUtil;
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.help.HelpCenter;
import com.yeshi.fanli.entity.bus.help.HelpClass;
import com.yeshi.fanli.entity.bus.help.HelpInfo;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.exception.config.HelpCenterException;
import com.yeshi.fanli.exception.config.HelpClassException;
import com.yeshi.fanli.exception.homemodule.FloatADException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.help.HelpCenterService;
import com.yeshi.fanli.service.inter.help.HelpClassService;
import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@@ -36,13 +45,19 @@
    @Resource
    private HelpCenterService helpCenterService;
    @Resource
    private HelpClassService helpClassService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    /**
     * 保存帮助信息
     *
     * @param callback
     * @param title
     * @param content
@@ -51,19 +66,13 @@
     * @param out
     */
    @RequestMapping(value = "save")
    public void save(String callback,HelpCenter helpCenter, String acction ,String content, String html,
             PrintWriter out) {
    public void save(String callback, HelpCenter helpCenter, String acction, String content, String html,
            PrintWriter out) {
        try {
            String title = helpCenter.getTitle();
            if (StringUtil.isNullOrEmpty(title)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("标题不能为空"));
                return;
            }
            helpCenterService.save(helpCenter, content, html);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpCenterException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            try {
@@ -72,44 +81,57 @@
                e1.printStackTrace();
            }
        }
    }
    @RequestMapping(value = "getInfo")
    public void getInfo(String callback, Long id, PrintWriter out){
        try {
            if (id == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
                return;
            }
             HelpCenter    crrent = helpCenterService.selectByPrimaryKey(id);
            if (crrent == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
                return;
            }
            HelpInfo helpInfo = helpCenterService.getHelpInfo(id);
            JSONObject data = new JSONObject();
            data.put("id",crrent.getId());
            data.put("title",crrent.getTitle());
            if (helpInfo != null){
                data.put("html",helpInfo.getHtml());
            } else {
                data.put("html", "");
            }
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (HelpCenterException e) {
            e.printStackTrace();
    public void getInfo(String callback, Long id, PrintWriter out) {
        if (id == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
            return;
        }
        HelpCenter crrent = helpCenterService.selectByPrimaryKey(id);
        if (crrent == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
            return;
        }
        HelpInfo helpInfo = helpCenterService.getHelpInfo(id);
        JSONObject data = new JSONObject();
        data.put("id", crrent.getId());
        data.put("title", crrent.getTitle());
        if (crrent.getStartTime() != null) {
            data.put("startTime", TimeUtil.getWholeTime(crrent.getStartTime().getTime()));
        } else {
            data.put("startTime", "");
        }
        if (crrent.getEndTime() != null) {
            data.put("endTime", TimeUtil.getWholeTime(crrent.getEndTime().getTime()));
        } else {
            data.put("endTime", "");
        }
        if (helpInfo != null) {
            data.put("html", helpInfo.getHtml());
        } else {
            data.put("html", "");
        }
        if (crrent.getHelpClass() != null) {
            data.put("cid", crrent.getHelpClass().getId());
        } else {
            data.put("cid", 0);
        }
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * 查找所有标签
     *
     * @param callback
     * @param pageIndex
     * @param key
@@ -118,94 +140,162 @@
     * @param out
     */
    @RequestMapping(value = "query")
    public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid,
            Integer orderMode, PrintWriter out) {
    public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, Integer orderMode,
            String version, String platform, PrintWriter out) {
        try {
            if (orderMode == null)
            if (orderMode == null)
                orderMode = 1;
            if (pageIndex == null)
            if (pageIndex == null)
                pageIndex = 1;
            if (pageSize == null)
            if (pageSize == null)
                pageSize = Constant.PAGE_SIZE;
            List<HelpCenter> helpCenterList =
                    helpCenterService.query((pageIndex - 1) * pageSize, pageSize, key, cid, orderMode);
            if (helpCenterList == null || helpCenterList.size() == 0) {
            List<HelpCenter> list = helpCenterService.query(0, Integer.MAX_VALUE, key, cid, orderMode);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            for (HelpCenter helpCenter: helpCenterList) {
            }
            int count = list.size();
            List<AppVersionInfo> versionList = null;
            if (!StringUtil.isNullOrEmpty(version) || !StringUtil.isNullOrEmpty(platform)) {
                versionList = new ArrayList<>();
                if (!StringUtil.isNullOrEmpty(version)) {
                    AppVersionInfo appVersion = appVersionService.selectByPrimaryKey(Long.parseLong(version));
                    if (appVersion != null)
                        versionList.add(appVersion);
                } else {
                    List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
                    if (appVersionList != null) {
                        versionList.addAll(appVersionList);
                    }
                }
            }
            if (versionList != null) {
                if (versionList.size() > 0) {
                    List<Long> sourceIdList = new ArrayList<>();
                    for (HelpCenter helpCenter : list) {
                        sourceIdList.add(helpCenter.getId());
                    }
                    List<Long> versionIdList = new ArrayList<>();
                    for (AppVersionInfo versionInfo : versionList)
                        versionIdList.add(versionInfo.getId());
                    Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
                            AdActivityType.helpCenter, versionIdList);
                    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 = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            List<HelpCenter> listResult = null;
            if (pageIndex < totalPage) {
                int start = (pageIndex - 1) * pageSize;
                listResult = list.subList(start, start + pageSize);
            } else if (pageIndex == totalPage) {
                listResult = list.subList((pageIndex - 1) * pageSize, list.size());
            } else {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("没有更多了"));
                return;
            }
            for (HelpCenter helpCenter : listResult) {
                HelpClass helpClass = helpCenter.getHelpClass();
                if (helpClass == null ) {
                if (helpClass == null) {
                    helpClass = new HelpClass();
                    helpClass.setId(0L);
                    helpClass.setName("-未选择-");
                    helpCenter.setHelpClass(helpClass);
                }
                }
            }
            long count = helpCenterService.countQuery(key, cid);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count    / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", gson.toJson(helpCenterList));
            data.put("result_list", gson.toJson(listResult));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
            e.printStackTrace();
        }
    }
    /**
     * 设置版本
     *
     * @param callback
     * @param id
     * @param moveType
     * @param sex
     * @param out
     */
    @RequestMapping(value = "setCenterVersions")
    public void setCenterVersions(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 {
            helpCenterService.setVersions(id, versionIds);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(""));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
        }
    }
    @RequestMapping(value = "getCenterVersions")
    public void getCenterVersions(String callback, Long id, PrintWriter out) {
        List<AdActivityVersionControl> list = adActivityVersionControlService
                .listByTypeAndSourceId(AdActivityType.helpCenter, id);
        List<Long> versionList = new ArrayList<>();
        if (list != null)
            for (AdActivityVersionControl control : list)
                versionList.add(control.getVersion().getId());
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(versionList));
    }
    /**
     * 修改
     *
     * @param callback
     * @param idArray
     * @param out
     */
    @RequestMapping(value = "saveModify")
    public void saveModify(String callback, HelpCenter helpCenter, PrintWriter out) {
        try {
            Long id = helpCenter.getId();
            if (id == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
                return;
            }
            HelpCenter crrent = helpCenterService.selectByPrimaryKey(id);
            if (crrent == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
                return;
            }
            helpCenterService.updateByPrimaryKeySelective(helpCenter);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpCenterException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
    @RequestMapping(value = "setWeight")
    public void setWeight(String callback, Long id, Integer weight, PrintWriter out) {
        if (id == null || weight == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
            return;
        }
        HelpCenter crrent = new HelpCenter();
        crrent.setId(id);
        crrent.setWeight(weight);
        helpCenterService.updateByPrimaryKeySelective(crrent);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
    }
    /**
     * 批量删除
     *
     * @param callback
     * @param idArray
     * @param out
@@ -213,120 +303,61 @@
    @RequestMapping(value = "deleteBatch")
    public void deleteBatch(String callback, String idArray, PrintWriter out) {
        try {
            if (StringUtil.isNullOrEmpty(idArray)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未选择操作的数据"));
                return;
            }
            Gson gson = new Gson();
            List<String> idList = gson.fromJson(idArray, new TypeToken<ArrayList<String>>() {}.getType());
            List<String> idList = gson.fromJson(idArray, new TypeToken<ArrayList<String>>() {
            }.getType());
            if (idList == null || idList.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
                return;
            }
            }
            // 删除帮助标题信息
            helpCenterService.deleteBatchById(idList);
            // 删除帮助具体详情
            helpCenterService.deleteInfoBatchById(idList);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
        } catch (HelpCenterException e) {
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
        }
    }
    /**
     * 设置分类
     * @param callback
     * @param out
     */
    @RequestMapping(value = "setClass")
    public void saveModify(String callback, Long id, Long cid, PrintWriter out) {
        try {
            if (id == null || cid == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
                return;
            }
            HelpCenter crrent = helpCenterService.selectByPrimaryKey(id);
            if (crrent == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
                return;
            }
            if (cid == 0) {
                crrent.setHelpClass(null);
            } else {
                crrent.setHelpClass(new HelpClass(cid));
            }
            crrent.setUpdatetime(new Date());
            helpCenterService.updateByPrimaryKey(crrent);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpCenterException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
        }
    }
    /**
     * 分类保存-新增、修改
     * 保存信息
     *
     * @param callback
     * @param special
     * @param out
     */
    @RequestMapping(value = "saveClass")
    public void saveClass(String callback, HelpClass helpClass, PrintWriter out) {
    public void saveClass(String callback, HelpClass helpClass, HttpServletRequest request, PrintWriter out) {
        try {
            String name = helpClass.getName();
            if (StringUtil.isNullOrEmpty(name)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("名称不能为空"));
                return;
            // 1. 先判断httpRequest 是否含有文件类型
            if (request instanceof MultipartHttpServletRequest) {
                MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
                helpClassService.save(helpClass, fileRequest.getFile("file"));
            } else {
                helpClassService.save(helpClass, null);
            }
            helpClassService.save(helpClass);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpClassException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
        } catch (FloatADException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
            e.printStackTrace();
        }
    }
    /**
     * 修改系统状态
     * @param callback
     * @param id
     * @param out
     */
    @RequestMapping(value = "updateShowState")
    public void updateShowState(String callback, Long id, PrintWriter out) {
        try {
            int state = helpClassService.updateShowState(id);
            JSONObject data = new JSONObject();
            data.put("showState", state);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (HelpClassException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e1) {
            e1.printStackTrace();
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
        }
    }
    /**
     * 修改排序
     *
     * @param callback
     * @param out
     */
@@ -342,30 +373,11 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
        }
    }
    /**
     *  上传图片
     * @param callback
     * @param out
     */
    @RequestMapping(value = "uploadClassPic")
    public void uploadClassPic(String callback, @RequestParam("file") CommonsMultipartFile file,
            Long id,PrintWriter out) {
        try {
            helpClassService.uploadPic(file, id);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpClassException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e1) {
            e1.printStackTrace();
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
        }
    }
    /**
     * 删除
     *
     * @param callback
     * @param idArray
     * @param out
@@ -378,62 +390,114 @@
        }
        try {
            Gson gson = new Gson();
            List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
            List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
            }.getType());
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
                return;
            }
            int count = helpClassService.deleteByPrimaryKeyBatch(list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除["+ count +"]条数据"));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
        }
    }
    /**
     * 查询
     *
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param key  模糊查询:说明、标识
     * @param key       模糊查询:说明、标识
     * @param out
     */
    @RequestMapping(value = "queryClass")
    public void queryClass(String callback, Integer pageIndex, Integer pageSize, String key,
            Integer showState, PrintWriter out) {
    public void queryClass(String callback, Integer pageIndex, Integer pageSize, String key, Integer showState,
            String version, String platform, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = Constant.PAGE_SIZE;
        }
        pageSize = Integer.MAX_VALUE;
        try {
            List<HelpClass> list = helpClassService.query((pageIndex - 1) * pageSize, pageSize, key, showState);
            List<HelpClass> list = helpClassService.query(0, pageSize, key, showState);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            long count = helpClassService.countQuery(key, showState);
            List<AppVersionInfo> versionList = null;
            if (!StringUtil.isNullOrEmpty(version) || !StringUtil.isNullOrEmpty(platform)) {
                versionList = new ArrayList<>();
                if (!StringUtil.isNullOrEmpty(version)) {
                    AppVersionInfo appVersion = appVersionService.selectByPrimaryKey(Long.parseLong(version));
                    if (appVersion != null)
                        versionList.add(appVersion);
                } else {
                    List<AppVersionInfo> appVersionList = appVersionService.getAppVersionInfoListByPlatform(platform);
                    if (appVersionList != null) {
                        versionList.addAll(appVersionList);
                    }
                }
            }
            for (HelpClass helpClass : list) {
                Date startTime = helpClass.getStartTime();
                if (startTime == null) {
                    helpClass.setStartTime_str("");
                } else {
                    helpClass.setStartTime_str(TimeUtil.formatDateAddT(startTime));
                }
                Date endTime = helpClass.getEndTime();
                if (endTime == null) {
                    helpClass.setEndTime_str("");
                } else {
                    helpClass.setEndTime_str(TimeUtil.formatDateAddT(endTime));
                }
            }
            // 过滤
            long count = 0;
            if (versionList != null) {
                if (versionList.size() > 0) {
                    List<Long> sourceIdList = new ArrayList<>();
                    for (HelpClass helpClass : list) {
                        sourceIdList.add(helpClass.getId());
                    }
                    List<Long> versionIdList = new ArrayList<>();
                    for (AppVersionInfo versionInfo : versionList)
                        versionIdList.add(versionInfo.getId());
                    Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
                            AdActivityType.helpClass, versionIdList);
                    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);
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            gsonBuilder.serializeNulls();
            Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", gson.toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
@@ -442,25 +506,25 @@
    /**
     * 查询所有分类
     *
     * @param out
     */
    @RequestMapping(value = "getProvidedClass")
    public void getAllClass(String callback, PrintWriter out) {
        try {
            HelpClass helpClass = new HelpClass();
            helpClass.setId(0L);
            helpClass.setName("-未选择-");
            List<HelpClass> reslut_list = new ArrayList<HelpClass>();
            reslut_list.add(helpClass);
            List<HelpClass> list = helpClassService.getProvidedClass();
            if (list != null && list.size() > 0) {
                reslut_list.addAll(list);
            }
            JSONObject data = new JSONObject();
            data.put("class_list", reslut_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
@@ -469,4 +533,41 @@
            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 {
            helpClassService.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.helpClass, id);
        List<Long> versionList = new ArrayList<>();
        if (list != null)
            for (AdActivityVersionControl control : list)
                versionList.add(control.getVersion().getId());
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(versionList));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java
@@ -1,7 +1,9 @@
package com.yeshi.fanli.controller.apph5;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
@@ -9,14 +11,18 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.help.HelpCenter;
import com.yeshi.fanli.entity.bus.help.HelpClass;
import com.yeshi.fanli.entity.bus.help.HelpInfo;
import com.yeshi.fanli.exception.config.HelpCenterException;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.help.HelpCenterService;
import com.yeshi.fanli.service.inter.help.HelpClassService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import net.sf.json.JSONObject;
@@ -30,6 +36,14 @@
    @Resource
    private HelpClassService helpClassService;
    
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    /**
     * 查询帮助列表
     * @param callback
@@ -39,47 +53,64 @@
     * @param out
     */
    @RequestMapping(value = "query")
    public void query(String callback, Integer pageIndex, Integer pageSize,    String key, Long cid,
    public void query(String callback,AcceptData acceptData, Long pageId, Integer pageSize, String key,    Long cid,
            PrintWriter out) {
        try {
            if (pageIndex == null)
                pageIndex = 1;
            if (pageSize == null) 
                pageSize = Constant.PAGE_SIZE;
            
            if (cid != null && cid == 0) {
            if (cid != null && cid == 0)
                cid = null; // 查询全部
            if (!StringUtil.isNullOrEmpty(key))
                key = key.trim();
            if (pageId == null)
                pageId = 0L;
            List<HelpCenter> list = helpCenterService.listValid(pageId, pageSize, key, cid);
            if (list == null) {
                pageId = 0L;
                list = new ArrayList<HelpCenter>();
            } else if (list.size() == 0) {
                pageId = 0L;
            } else {
                pageId = list.get(list.size()-1).getId();
                // 版本过滤
                int version = Integer.parseInt(acceptData.getVersion());
                String platform = acceptData.getPlatform().toLowerCase();
                List<AppVersionInfo> versionList = appVersionService.listByPlatformAndMinVersionCode(platform,version);
                if (versionList == null || versionList.size() <= 0) {
                    list.clear();
                } else {
                    List<Long> sourceIdList = new ArrayList<>();
                    for (HelpCenter record : list) {
                        sourceIdList.add(record.getId());
                    }
                    List<Long> versionIdList = new ArrayList<>();
                    for (AppVersionInfo versionInfo : versionList)
                        versionIdList.add(versionInfo.getId());
                    Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
                            AdActivityType.helpCenter, versionIdList);
                    for (int i = 0; i < list.size(); i++) {
                        if (!sets.contains(list.get(i).getId())) {
                            list.remove(i--);
                        }
                    }
                }
            }
            
            List<HelpCenter> helpCenterList =
                    helpCenterService.queryIdAndTitle((pageIndex - 1) * pageSize, pageSize, key, cid);
            if (helpCenterList == null || helpCenterList.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
                return;
            }
            long count = helpCenterService.countQuery(key, cid);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count    / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", helpCenterList);
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
            data.put("pageId", pageId);
            data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("暂未数据")));
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            e.printStackTrace();
        }
    }
    
    
    /**
@@ -92,20 +123,16 @@
    public void getInfo(String callback, Long id, PrintWriter out){
        try {
            if (id == null) {
                out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("该内容不存在")));
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该内容不存在"));
                return;
            }
            HelpCenter crrent = helpCenterService.selectByPrimaryKeyCache(id);
            if (crrent == null) {
                out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("该内容已不存在")));
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该内容已不存在"));
                return;
            }
            
            String html = null;
            HelpInfo helpInfo = helpCenterService.getHelpInfoCache(id);
            if (helpInfo != null) {
                html = helpInfo.getHtml();
@@ -115,11 +142,9 @@
            data.put("id",crrent.getId());
            data.put("title",crrent.getTitle());
            data.put("html", html);
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
        } catch (HelpCenterException e) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未获取到内容")));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据失败"));
            e.printStackTrace();
        }
    }
@@ -131,19 +156,40 @@
     * @param out
     */
    @RequestMapping(value = "getClass")
    public void getClass(String callback, PrintWriter out) {
    public void getClass(String callback, AcceptData acceptData, PrintWriter out) {
        try {
            List<HelpClass> list = helpClassService.getClassByState(1);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
                list = new ArrayList<>();
            }
            // 版本过滤
            int version = Integer.parseInt(acceptData.getVersion());
            String platform = acceptData.getPlatform().toLowerCase();
            List<AppVersionInfo> versionList = appVersionService.listByPlatformAndMinVersionCode(platform,version);
            if (versionList == null || versionList.size() <= 0) {
                list.clear();
            } else {
                List<Long> sourceIdList = new ArrayList<>();
                for (HelpClass record : list) {
                    sourceIdList.add(record.getId());
                }
                List<Long> versionIdList = new ArrayList<>();
                for (AppVersionInfo versionInfo : versionList)
                    versionIdList.add(versionInfo.getId());
                Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
                        AdActivityType.helpClass, versionIdList);
                for (int i = 0; i < list.size(); i++) {
                    if (!sets.contains(list.get(i).getId())) {
                        list.remove(i--);
                    }
                }
            }
            JSONObject data = new JSONObject();
            data.put("class_list", list);
            data.put("class_list", JsonUtil.getApiCommonGson().toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/help/HelpCenterMapper.java
@@ -4,25 +4,21 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.help.HelpCenter;
import com.yeshi.fanli.exception.config.HelpCenterException;
public interface HelpCenterMapper {
public interface HelpCenterMapper extends BaseMapper<HelpCenter> {
    int deleteByPrimaryKey(Long id);
    int insert(HelpCenter record);
    int insertSelective(HelpCenter record);
    HelpCenter selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(HelpCenter record);
    int updateByPrimaryKey(HelpCenter record);
    List<HelpCenter> queryIdAndTitle(@Param("start") int start, @Param("count") int count,
    /**
     * 查询有效
     * @param pageId
     * @param count
     * @param title
     * @param cid
     * @return
     */
    List<HelpCenter> listValid(@Param("pageId") Long pageId, @Param("count") int count,
            @Param("key") String title, @Param("cid") Long cid);
    
    
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpCenter.java
@@ -3,7 +3,10 @@
import java.io.Serializable;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import org.yeshi.utils.mybatis.Column;
import com.google.gson.annotations.Expose;
/**
 * 帮助中心标题
@@ -20,9 +23,11 @@
     */
    private static final long serialVersionUID = 1L;
    @Expose
    @Column(name = "h_id")
    private Long id;
    @Expose
    @Column(name = "h_title")
    private String title;// 名称
@@ -32,12 +37,22 @@
    @Column(name = "h_cid")
    private HelpClass helpClass; // 分类
    
    //起始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "h_start_time")
    private Date startTime;
    //结束时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "h_end_time")
    private Date endTime;
    @Column(name = "h_createtime")
    private Date createtime; // 创建时间
    @Column(name = "h_updatetime")
    private Date updatetime; // 更新时间(修改时间)
    public Long getId() {
        return id;
@@ -87,4 +102,20 @@
        this.helpClass = helpClass;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpClass.java
@@ -5,6 +5,8 @@
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
/**
 * 帮助中心分类
 * 
@@ -16,14 +18,17 @@
@Table("yeshi_ec_help_class")
public class HelpClass {
    @Expose
    @Column(name = "hc_id")
    private Long id;
    // 名称
    @Expose
    @Column(name = "hc_name")
    private String name;
    // 图片链接
    @Expose
    @Column(name = "hc_picture")
    private String picture;
@@ -34,6 +39,14 @@
    // 显示状态  1显示  0 不显示
    @Column(name = "hc_show_state")
    private Integer showState;
    //起始时间
    @Column(name = "hc_start_time")
    private Date startTime;
    //结束时间
    @Column(name = "hc_end_time")
    private Date endTime;
    // 创建时间
    @Column(name = "hc_create_time")
@@ -42,6 +55,10 @@
    // 更新时间
    @Column(name = "hc_update_time")
    private Date updateTime;
    private String startTime_str;
    private String endTime_str;
    
    public HelpClass() {}
    
@@ -105,4 +122,36 @@
        this.updateTime = updateTime;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getStartTime_str() {
        return startTime_str;
    }
    public void setStartTime_str(String startTime_str) {
        this.startTime_str = startTime_str;
    }
    public String getEndTime_str() {
        return endTime_str;
    }
    public void setEndTime_str(String endTime_str) {
        this.endTime_str = endTime_str;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/AdActivityVersionControl.java
@@ -17,8 +17,10 @@
public class AdActivityVersionControl {
    public enum AdActivityType {
        banner// 轮播图
        , special// 专题
        banner,// 轮播图
        special,// 专题
        helpClass,// 帮助中心分类
        helpCenter;// 帮助中心文档
    }
    @Column(name = "vc_id")
fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java
@@ -28,7 +28,8 @@
    public void updateGoods() {
        if (!Constant.IS_TASK)
            return;
        long startTime = java.lang.System.currentTimeMillis();
        LogHelper.test("开始执行品牌更新---updateGoods" + startTime);
        long count = brandInfoService.countValidByCid(null);
        if (count == 0)
            return;
@@ -41,6 +42,8 @@
               LogHelper.errorDetailInfo(e);
            }
        }
        long endTime = java.lang.System.currentTimeMillis();
        LogHelper.test("结束执行品牌更新---updateGoods" + endTime + ",总耗时:" +(endTime -startTime) / 1000);
    }
    
}
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpCenterMapper.xml
@@ -6,28 +6,31 @@
    <id column="h_id" property="id" jdbcType="BIGINT"/>
    <result column="h_title" property="title" jdbcType="VARCHAR"/>
    <result column="h_weight" property="weight" jdbcType="INTEGER"/>
    <result column="h_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="h_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="h_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="h_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
    <association property="helpClass" column="h_cid"
            javaType="com.yeshi.fanli.entity.bus.help.HelpClass">
            <id column="h_cid" property="id" jdbcType="BIGINT" />
            <id column="hc_name" property="name" jdbcType="VARCHAR" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">h_id,h_title,h_weight,h_cid,h_createtime,h_updatetime</sql>
  <sql id="Base_Column_List">h_id,h_title,h_weight,h_cid,h_start_time,h_end_time,h_createtime,h_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_help_center where h_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_help_center where h_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_center (h_id,h_title,h_weight,h_cid,h_createtime,h_updatetime) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{helpClass.id,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_center (h_id,h_title,h_weight,h_cid,h_start_time,h_end_time,h_createtime,h_updatetime) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{helpClass.id,jdbcType=BIGINT},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_center
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">h_id,</if>
      <if test="title != null">h_title,</if>
      <if test="weight != null">h_weight,</if>
      <if test="helpClass != null">h_cid,</if>
      <if test="startTime != null">h_start_time,</if>
      <if test="endTime != null">h_end_time,</if>
      <if test="createtime != null">h_createtime,</if>
      <if test="updatetime != null">h_updatetime,</if>
    </trim>values
@@ -36,16 +39,20 @@
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
      <if test="weight != null">#{weight,jdbcType=INTEGER},</if>
      <if test="helpClass != null">#{helpClass.id,jdbcType=BIGINT},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter">update yeshi_ec_help_center set h_title = #{title,jdbcType=VARCHAR},h_weight = #{weight,jdbcType=INTEGER},h_cid = #{helpClass.id,jdbcType=BIGINT},h_createtime = #{createtime,jdbcType=TIMESTAMP},h_updatetime = #{updatetime,jdbcType=TIMESTAMP} where h_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter">update yeshi_ec_help_center set h_title = #{title,jdbcType=VARCHAR},h_weight = #{weight,jdbcType=INTEGER},h_cid = #{helpClass.id,jdbcType=BIGINT},h_start_time = #{startTime,jdbcType=TIMESTAMP},h_end_time = #{endTime,jdbcType=TIMESTAMP},h_createtime = #{createtime,jdbcType=TIMESTAMP},h_updatetime = #{updatetime,jdbcType=TIMESTAMP} where h_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpCenter">update yeshi_ec_help_center
    <set>
      <if test="title != null">h_title=#{title,jdbcType=VARCHAR},</if>
      <if test="weight != null">h_weight=#{weight,jdbcType=INTEGER},</if>
      <if test="helpClass != null">h_cid=#{helpClass.id,jdbcType=BIGINT},</if>
      <if test="startTime != null">h_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">h_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createtime != null">h_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">h_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where h_id = #{id,jdbcType=BIGINT}
@@ -98,19 +105,19 @@
       </if>
    </select>
    
     <select id="queryIdAndTitle" resultMap="BaseResultMap">
      <!-- 根据条件查询所有标签 -->
   <select id="listValid" resultMap="BaseResultMap">
    SELECT  h_id, h_title FROM yeshi_ec_help_center    
        WHERE 1=1
       <if test='key != null and key != ""'>
    WHERE h_id > #{pageId}
         AND IF(h_start_time IS NULL,TRUE, h_start_time<![CDATA[<=]]>NOW())
          AND IF(h_end_time IS NULL,TRUE, h_end_time >=NOW())
      <if test='key != null and key != ""'>
              AND h_title like '%${key}%'
       </if>
       <if test='cid != null'>
              AND h_cid  = #{cid}
       </if>
        ORDER BY  h_weight  DESC, h_createtime
        LIMIT ${start},${count}
        ORDER BY h_weight DESC
        LIMIT ${count}
   </select>
    
   <delete id="deleteBatchById" parameterType="int">
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpClassMapper.xml
@@ -8,15 +8,17 @@
    <result column="hc_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="hc_sort" property="sort" jdbcType="INTEGER"/>
    <result column="hc_show_state" property="showState" jdbcType="INTEGER"/>
    <result column="hc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="hc_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="hc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="hc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_create_time,hc_update_time</sql>
  <sql id="Base_Column_List">hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_start_time,hc_end_time,hc_create_time,hc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_help_class where hc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_help_class where hc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_class (hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_create_time,hc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER},#{showState,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_class (hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_start_time,hc_end_time,hc_create_time,hc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER},#{showState,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">hc_id,</if>
@@ -24,6 +26,8 @@
      <if test="picture != null">hc_picture,</if>
      <if test="sort != null">hc_sort,</if>
      <if test="showState != null">hc_show_state,</if>
      <if test="startTime != null">hc_start_time,</if>
      <if test="endTime != null">hc_end_time,</if>
      <if test="createTime != null">hc_create_time,</if>
      <if test="updateTime != null">hc_update_time,</if>
    </trim>values
@@ -33,17 +37,21 @@
      <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="sort != null">#{sort,jdbcType=INTEGER},</if>
      <if test="showState != null">#{showState,jdbcType=INTEGER},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass">update yeshi_ec_help_class set hc_name = #{name,jdbcType=VARCHAR},hc_picture = #{picture,jdbcType=VARCHAR},hc_sort = #{sort,jdbcType=INTEGER},hc_show_state = #{showState,jdbcType=INTEGER},hc_create_time = #{createTime,jdbcType=TIMESTAMP},hc_update_time = #{updateTime,jdbcType=TIMESTAMP} where hc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass">update yeshi_ec_help_class set hc_name = #{name,jdbcType=VARCHAR},hc_picture = #{picture,jdbcType=VARCHAR},hc_sort = #{sort,jdbcType=INTEGER},hc_show_state = #{showState,jdbcType=INTEGER},hc_start_time = #{startTime,jdbcType=TIMESTAMP},hc_end_time = #{endTime,jdbcType=TIMESTAMP},hc_create_time = #{createTime,jdbcType=TIMESTAMP},hc_update_time = #{updateTime,jdbcType=TIMESTAMP} where hc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass">update yeshi_ec_help_class
    <set>
      <if test="name != null">hc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">hc_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="sort != null">hc_sort=#{sort,jdbcType=INTEGER},</if>
      <if test="showState != null">hc_show_state=#{showState,jdbcType=INTEGER},</if>
      <if test="startTime != null">hc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">hc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">hc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">hc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where hc_id = #{id,jdbcType=BIGINT}
@@ -100,7 +108,9 @@
   
   <select id="getClassByState" resultMap="BaseResultMap">
        SELECT hc_id,hc_name,hc_picture FROM yeshi_ec_help_class
        WHERE  hc_show_state = #{state}
        WHERE  hc_show_state = #{state}
            AND IF(hc_start_time IS NULL,TRUE, hc_start_time<![CDATA[<=]]>NOW())
              AND IF(hc_end_time IS NULL,TRUE, hc_end_time >=NOW())
           ORDER BY hc_sort 
   </select>
   
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -376,6 +376,9 @@
        if (list == null || list.size() == 0)
            return;
        long startTime = java.lang.System.currentTimeMillis();
        LogHelper.test(start + "品牌更新service---addShopAndGoods" + startTime);
        for (BrandInfo brandInfo : list) {
            try {
                String name = brandInfo.getName();
@@ -395,8 +398,10 @@
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
            }
        }
        long endTime = java.lang.System.currentTimeMillis();
        LogHelper.test(start + "品牌更新service---addShopAndGoods" + endTime + ",本次总耗时:" +(endTime -startTime) / 1000);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpCenterServiceImpl.java
@@ -3,8 +3,10 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Resource;
@@ -12,15 +14,19 @@
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.dao.mybatis.help.HelpCenterMapper;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.help.HelpCenter;
import com.yeshi.fanli.entity.bus.help.HelpInfo;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.exception.config.HelpCenterException;
import com.yeshi.fanli.service.inter.help.HelpCenterService;
import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.db.MongoDBManager;
import org.yeshi.utils.tencentcloud.COSManager;
@Service
public class HelpCenterServiceImpl implements HelpCenterService {
@@ -31,60 +37,62 @@
    @Resource
    private MongoDBManager mongoDBManager;
    
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    @Override
    public int insertSelective(HelpCenter record) throws HelpCenterException {
        return helpCenterMapper.insertSelective(record);
    }
    @Override
    public int updateByPrimaryKey(HelpCenter record) throws HelpCenterException {
    public int updateByPrimaryKey(HelpCenter record) {
        return helpCenterMapper.updateByPrimaryKey(record);
    }
    @Override
    public int updateByPrimaryKeySelective(HelpCenter record) throws HelpCenterException {
    public int updateByPrimaryKeySelective(HelpCenter record) {
        return helpCenterMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public HelpCenter selectByPrimaryKey(Long id) throws HelpCenterException {
    public HelpCenter selectByPrimaryKey(Long id) {
        return helpCenterMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public HelpCenter selectByPrimaryKeyCache(Long id) throws HelpCenterException {
    public HelpCenter selectByPrimaryKeyCache(Long id) {
        return selectByPrimaryKey(id);
    }
    @Override
    public String save(HelpCenter helpCenter, String content, String html) throws Exception {
    public String save(HelpCenter helpCenter, String content, String html) throws HelpCenterException,Exception {
        if (StringUtil.isNullOrEmpty(helpCenter.getTitle()))
            throw new HelpCenterException(1,"标题不能为空");
        if (helpCenter.getHelpClass() == null || helpCenter.getHelpClass().getId() <= 0)
            throw new HelpCenterException(1,"分类题不能为空");
        helpCenter.setUpdatetime(new Date());
        Long id = helpCenter.getId();
        if (id == null) {
            helpCenter.setCreatetime(new Date());
            helpCenter.setUpdatetime(new Date());
            helpCenterMapper.insert(helpCenter);
        } else {
            helpCenter.setUpdatetime(new Date());
            helpCenterMapper.updateByPrimaryKeySelective(helpCenter);
            HelpCenter result = helpCenterMapper.selectByPrimaryKey(id);
            if (result == null)
                throw new HelpCenterException(1,"此类内容已不存在,请刷新");
            
            helpCenter.setCreatetime(result.getCreatetime());
            helpCenter.setWeight(result.getWeight());
            helpCenterMapper.updateByPrimaryKey(helpCenter);
        }
        
        List<Map<String, Object>> positions = getPosition(html);
        if (positions != null && positions.size() > 0) {
            @SuppressWarnings("restriction")
            sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
            for (int i = 0; i < positions.size(); i++) {
                Map<String, Object> map = positions.get(i);
                String base64Img = (String) map.get("base64Img");
                byte[] b = decoder.decodeBuffer(base64Img);
                for (int j = 0; j < b.length; ++j) {
                    if (b[j] < 0) {
@@ -93,7 +101,6 @@
                }
                String type = (String) map.get("type");
                // 上传文件相对位置
                String fileUrl = "helpInfo/" + UUID.randomUUID().toString().replace("-", "") + "." +type;
                /* 上传新图片 */
@@ -102,24 +109,16 @@
                if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
                    String header = (String) map.get("header");
                    html = html.replace(header, uploadFilePath);
                    //System.out.println("uploadFilePath: " + uploadFilePath);
                    //content = content.replace(header, uploadFilePath);
                }
            }
        }
    
        
        String replaceHtml = replaceIframe(html);
        Long backId = helpCenter.getId();
        HelpInfo helpInfo = new HelpInfo(backId, content, replaceHtml);
        mongoDBManager.saveHelpInfo(helpInfo);
        return html;
    }
    public List<Map<String, Object>> getPosition(String content) {
@@ -228,36 +227,35 @@
    }
    @Override
    public List<HelpCenter> query(int pageIndex, int pageSize, String key, Long cid, Integer orderMode) throws HelpCenterException {
    public List<HelpCenter> query(int pageIndex, int pageSize, String key, Long cid, Integer orderMode) {
        return helpCenterMapper.query(pageIndex, pageSize, key, cid, orderMode);
    }
    @Override
    public long countQuery(String key, Long cid) throws HelpCenterException {
    public long countQuery(String key, Long cid) {
        return helpCenterMapper.countQuery(key, cid);
    }
    
    @Override
    @Cacheable(value = "helpCenterCache",key="'queryIdAndTitle-'+#pageIndex+'-'+#key+'-'+#cid")
    public List<HelpCenter> queryIdAndTitle(int pageIndex, int pageSize, String key, Long cid)
            throws HelpCenterException {
        return helpCenterMapper.queryIdAndTitle(pageIndex, pageSize, key, cid);
    @Cacheable(value = "helpCenterCache",key="'queryIdAndTitle-'+#pageId+'-'+#key+'-'+#cid")
    public List<HelpCenter> listValid(long pageId, int pageSize, String key, Long cid) {
        return helpCenterMapper.listValid(pageId, pageSize, key, cid);
    }
    
    @Override
    public int deleteBatchById(List<String> idList) throws HelpCenterException {
    public int deleteBatchById(List<String> idList) {
        return helpCenterMapper.deleteBatchById(idList);
    }
    @Override
    public HelpInfo getHelpInfo(Long id) throws HelpCenterException {
    public HelpInfo getHelpInfo(Long id) {
        return mongoDBManager.getHelpInfo(id);
    }
    
    @Override
    @Cacheable(value = "helpCenterCache",key="'getHelpInfoCache-'+#id")
    public HelpInfo getHelpInfoCache(Long id) throws HelpCenterException {
    public HelpInfo getHelpInfoCache(Long id) {
        return getHelpInfo(id);
    }
    
@@ -265,11 +263,58 @@
    
    @Override
    @Transactional(rollbackFor=Exception.class)
    public void deleteInfoBatchById(List<String> idList) throws HelpCenterException {
    public void deleteInfoBatchById(List<String> idList)  {
        if (idList != null) {
            for (String id : idList) {
                mongoDBManager.removeHelpInfo(Long.parseLong(id));
            }
        }
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void setVersions(Long id, List<Long> versions) throws HelpCenterException {
        HelpCenter helpCenter = helpCenterMapper.selectByPrimaryKey(id);
        if (helpCenter == null) {
            throw new HelpCenterException(1, "此信息不存在,请刷新重试");
        }
        Set<Long> oldSet = new HashSet<>();
        List<AdActivityVersionControl> versionList = adActivityVersionControlService
                .listByTypeAndSourceId(AdActivityType.helpCenter, id);
        if (versionList != null) {
            for (AdActivityVersionControl control : versionList)
                oldSet.add(control.getVersion().getId());
        }
        Set<Long> newSet = new HashSet<>();
        for (Long version : versions) {
            newSet.add(version);
        }
        Set<Long> delSet = new HashSet<>();
        delSet.addAll(oldSet);
        delSet.removeAll(newSet);
        for (Long versionId : delSet) {
            adActivityVersionControlService.deleteBySourceAndVersion(id, AdActivityType.helpCenter, versionId);
        }
        Set<Long> addSet = new HashSet<>();
        addSet.addAll(newSet);
        addSet.removeAll(oldSet);
        // 添加映射
        for (Long versionId : addSet) {
            AdActivityVersionControl control = new AdActivityVersionControl();
            control.setCreateTime(new Date());
            control.setSourceId(id);
            control.setType(AdActivityType.helpCenter);
            control.setVersion(new AppVersionInfo(versionId));
            try {
                adActivityVersionControlService.addVersionControl(control);
            } catch (Exception e) {
                throw new HelpCenterException(2, e.getMessage());
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpClassServiceImpl.java
@@ -2,20 +2,33 @@
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.dao.mybatis.help.HelpClassMapper;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.help.HelpClass;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
import com.yeshi.fanli.exception.banner.SwiperPictureException;
import com.yeshi.fanli.exception.config.HelpClassException;
import com.yeshi.fanli.exception.homemodule.FloatADException;
import com.yeshi.fanli.service.inter.help.HelpClassService;
import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
import com.yeshi.fanli.util.StringUtil;
@Service
@@ -24,6 +37,9 @@
    @Resource
    private HelpClassMapper helpClassMapper;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    @Override
    public int deleteByPrimaryKeyBatch(List<Long> list) {
        return helpClassMapper.deleteByPrimaryKeyBatch(list);
@@ -35,32 +51,71 @@
    }
    
    @Override
    public void save(HelpClass helpClass) throws HelpClassException {
        if (helpClass == null) {
    public void save(HelpClass record, MultipartFile file) throws HelpClassException, Exception{
        if (record == null)
            throw new HelpClassException(1, "参数不能为空");
        }
        
        if (helpClass.getId() == null) {
            String name = helpClass.getName();
            if (StringUtil.isNullOrEmpty(name)) {
                throw new HelpClassException(1, "名称不能为空");
        String name = record.getName();
        if (StringUtil.isNullOrEmpty(name))
            throw new HelpClassException(1, "名称不能为空");
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            String startTime_str = record.getStartTime_str();
            if (startTime_str != null && startTime_str.trim().length() > 0) {
                startTime_str = startTime_str.replaceAll("T", " ");
                record.setStartTime(format.parse(startTime_str));
            }
            
            // 默认不显示
            helpClass.setShowState(0);
            // 排序-末尾
            String endTime_str = record.getEndTime_str();
            if (endTime_str != null && endTime_str.trim().length() > 0) {
                endTime_str = endTime_str.replaceAll("T", " ");
                record.setEndTime(format.parse(endTime_str));
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
        // 图片上传
        String picture = null;
        if (file != null) {
            InputStream inputStream = file.getInputStream();
            String contentType = file.getContentType();
            String type = contentType.substring(contentType.indexOf("/") + 1);
            String filePath ="/img/HelpClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
            picture = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
        }
        Integer showState = record.getShowState();
        if (showState == null)
            record.setShowState(0);
        record.setUpdateTime(new Date());
        if (record.getId() == null) {
            int maxOrder = helpClassMapper.getMaxOrder();
            helpClass.setSort(maxOrder + 1);
            helpClass.setCreateTime(new Date());
            helpClass.setUpdateTime(new Date());
            helpClassMapper.insertSelective(helpClass);
            record.setSort(maxOrder + 1);
            record.setCreateTime(new Date());
            helpClassMapper.insertSelective(record);
        } else {
            helpClass.setUpdateTime(new Date());
            helpClassMapper.updateByPrimaryKeySelective(helpClass);
            // 修改
            HelpClass resultObj = helpClassMapper.selectByPrimaryKey(record.getId());
            if (resultObj == null)
                throw new FloatADException(1, "修改内容已不存在");
            if (picture != null && picture.trim().length() > 0) {
                String pictureOld = resultObj.getPicture();
                if (pictureOld != null && pictureOld.trim().length() > 0) {
                    COSManager.getInstance().deleteFile(pictureOld);
                }
                // 存储新图
                record.setPicture(picture);
            } else {
                record.setPicture(resultObj.getPicture());
            }
            record.setSort(resultObj.getSort());
            record.setCreateTime(resultObj.getCreateTime());
            helpClassMapper.updateByPrimaryKey(record);
        }
    }
    
@@ -180,4 +235,52 @@
    }
    
    
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void setVersions(Long id, List<Long> versions) throws HelpClassException {
        HelpClass helpClass = helpClassMapper.selectByPrimaryKey(id);
        if (helpClass == null) {
            throw new HelpClassException(1, "此信息不存在,请刷新重试");
        }
        Set<Long> oldSet = new HashSet<>();
        List<AdActivityVersionControl> versionList = adActivityVersionControlService
                .listByTypeAndSourceId(AdActivityType.helpClass, id);
        if (versionList != null) {
            for (AdActivityVersionControl control : versionList)
                oldSet.add(control.getVersion().getId());
        }
        Set<Long> newSet = new HashSet<>();
        for (Long version : versions) {
            newSet.add(version);
        }
        Set<Long> delSet = new HashSet<>();
        delSet.addAll(oldSet);
        delSet.removeAll(newSet);
        for (Long versionId : delSet) {
            adActivityVersionControlService.deleteBySourceAndVersion(id, AdActivityType.helpClass, versionId);
        }
        Set<Long> addSet = new HashSet<>();
        addSet.addAll(newSet);
        addSet.removeAll(oldSet);
        // 添加映射
        for (Long versionId : addSet) {
            AdActivityVersionControl control = new AdActivityVersionControl();
            control.setCreateTime(new Date());
            control.setSourceId(id);
            control.setType(AdActivityType.helpClass);
            control.setVersion(new AppVersionInfo(versionId));
            try {
                adActivityVersionControlService.addVersionControl(control);
            } catch (Exception e) {
                throw new HelpClassException(2, e.getMessage());
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -109,7 +109,7 @@
        
        // 同一队员只记录一次
        int totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid,
                RedPackWinInviteTypeEnum.oneStageReward.name());
                RedPackWinInviteTypeEnum.zeroStageReward.name());
        if (totalReward > 0)
            return;
                
@@ -119,7 +119,7 @@
        winInvite.setTeamUid(teamUid);
        winInvite.setMoney(new BigDecimal(0));
        winInvite.setType(RedPackWinInviteTypeEnum.zeroStageReward);
        winInvite.setIdentifyCode(StringUtil.Md5(RedPackWinInviteTypeEnum.oneStageReward.name() + ":" + teamUid));
        winInvite.setIdentifyCode(StringUtil.Md5(RedPackWinInviteTypeEnum.zeroStageReward.name() + ":" + teamUid));
        winInvite.setCreateTime(new Date());
        winInvite.setUpdateTime(new Date());
        redPackWinInviteMapper.insertSelective(winInvite);
fanli/src/main/java/com/yeshi/fanli/service/inter/help/HelpCenterService.java
@@ -11,21 +11,14 @@
public interface HelpCenterService {
    
    /**
     * 插入对象
     * @param record
     * @return
     * @throws HelpCenterException
     */
    public int insertSelective(HelpCenter record) throws HelpCenterException;
    /**
     * 更新当前对象所有数据
     * @param record
     * @return
     * @throws HelpCenterException
     */
    public int updateByPrimaryKey(HelpCenter record) throws HelpCenterException;
    public int updateByPrimaryKey(HelpCenter record) ;
    
    /**
     * 选择性更新内容——不为空则更新该字段
@@ -33,7 +26,7 @@
     * @return
     * @throws HelpCenterException
     */
    public int updateByPrimaryKeySelective(HelpCenter record) throws HelpCenterException;
    public int updateByPrimaryKeySelective(HelpCenter record);
    
    
@@ -43,10 +36,10 @@
     * @return
     * @throws HelpCenterException
     */
    public HelpCenter selectByPrimaryKey(Long id) throws HelpCenterException;
    public HelpCenter selectByPrimaryKey(Long id) ;
    
    @Cacheable(value = "helpCenterCache")
    public HelpCenter selectByPrimaryKeyCache(Long id) throws HelpCenterException;
    public HelpCenter selectByPrimaryKeyCache(Long id);
    
    
    /**
@@ -58,10 +51,9 @@
     * @param endTime   结束时间
     * @return
     */
    public List<HelpCenter> query(int pageIndex, int pageSize, String key, Long cid,
            Integer orderMode) throws HelpCenterException;
    public List<HelpCenter> query(int pageIndex, int pageSize, String key, Long cid, Integer orderMode) ;
    
    public long countQuery(String key, Long cid) throws HelpCenterException;
    public long countQuery(String key, Long cid);
    
    /**
@@ -72,7 +64,7 @@
     * @return 
     * @throws Exception
     */
    public String save(HelpCenter helpCenter, String content, String html) throws Exception;
    public String save(HelpCenter helpCenter, String content, String html) throws HelpCenterException, Exception;
    
    /**
@@ -81,7 +73,7 @@
     * @return
     * @throws HelpCenterException
     */
    public int deleteBatchById(List<String> idList) throws HelpCenterException;
    public int deleteBatchById(List<String> idList);
    /**
     * 
@@ -89,7 +81,7 @@
     * @return
     * @throws HelpCenterException
     */
    public HelpInfo getHelpInfo(Long id) throws HelpCenterException;
    public HelpInfo getHelpInfo(Long id);
    /**
     * 查询 只返回id、title
@@ -99,7 +91,7 @@
     * @return
     * @throws HelpCenterException
     */
    public List<HelpCenter> queryIdAndTitle(int pageIndex, int pageSize, String key, Long cid) throws HelpCenterException;
    public List<HelpCenter> listValid(long pageId, int pageSize, String key, Long cid);
    
    /**
@@ -107,10 +99,18 @@
     * @param idList
     * @throws HelpCenterException
     */
    public void deleteInfoBatchById(List<String> idList) throws HelpCenterException;
    public void deleteInfoBatchById(List<String> idList);
    
    
    public HelpInfo getHelpInfoCache(Long id) throws HelpCenterException;
    public HelpInfo getHelpInfoCache(Long id);
    /**
     * 版本设置
     * @param id
     * @param versions
     * @throws HelpCenterException
     */
    public void setVersions(Long id, List<Long> versions) throws HelpCenterException;
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/help/HelpClassService.java
@@ -26,7 +26,7 @@
     * @return
     * @throws HelpCenterException
     */
    public void save(HelpClass helpClass) throws HelpClassException;
    public void save(HelpClass helpClass, MultipartFile file) throws HelpClassException,Exception;
    
    /**
     * 查询
@@ -89,5 +89,14 @@
     */
    public List<HelpClass> getProvidedClass() throws HelpClassException;
    /**
     * 版本设置
     * @param id
     * @param versions
     * @throws HelpClassException
     */
    public void setVersions(Long id, List<Long> versions) throws HelpClassException;
    
}
fanli/src/main/java/com/yeshi/fanli/util/TimeUtil.java
@@ -121,6 +121,16 @@
        return date;
    }
    
    public static String formatDateAddT(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        try {
            return sdf.format(date);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public static long convertToTimeTemp(String st, String format) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat(format);
@@ -144,6 +154,7 @@
        }
        return 0;
    }
    public static long convertDateToTemp2(String st) {
        Date date = new Date();