yujian
2019-12-19 626d711cb15896055c13fe344eb7fcc824589715
帮助中心
11个文件已修改
690 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/HelpCenterAdminController.java 318 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpCenter.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/help/HelpClass.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/AdActivityVersionControl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpCenterMapper.xml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/help/HelpClassMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpCenterServiceImpl.java 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/help/HelpClassServiceImpl.java 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/help/HelpCenterService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | 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,41 @@
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.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
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
@@ -39,6 +50,12 @@
    
    @Resource
    private HelpClassService helpClassService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    
    
    /**
@@ -54,16 +71,10 @@
    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,7 +83,6 @@
                e1.printStackTrace();
            }
        }
    }
    
    
@@ -83,9 +93,7 @@
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确参数"));
                return;
            }
             HelpCenter    crrent = helpCenterService.selectByPrimaryKey(id);
            if (crrent == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
                return;
@@ -96,10 +104,28 @@
            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));
@@ -119,10 +145,8 @@
     */
    @RequestMapping(value = "query")
    public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, 
            Integer orderMode, PrintWriter out) {
            Integer orderMode, String version, String platform, PrintWriter out) {
        try {
            if (orderMode == null) 
                orderMode = 1;
            
@@ -132,15 +156,66 @@
            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 ) {
                    helpClass = new HelpClass();
@@ -150,10 +225,6 @@
                } 
            }
            
            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(); 
@@ -161,14 +232,50 @@
            
            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));
    }
    
    
@@ -178,26 +285,19 @@
     * @param idArray
     * @param out
     */
    @RequestMapping(value = "saveModify")
    public void saveModify(String callback, HelpCenter helpCenter, PrintWriter out) {
    @RequestMapping(value = "setWeight")
    public void setWeight(String callback, Long id, Integer weight, PrintWriter out) {
        try {
            Long id = helpCenter.getId();
            if (id == null) {
            if (id == null || weight == 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);
            HelpCenter crrent = new HelpCenter();
            crrent.setId(id);
            crrent.setWeight(weight);
            helpCenterService.updateByPrimaryKeySelective(crrent);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HelpCenterException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
@@ -213,12 +313,10 @@
    @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());
            
@@ -231,9 +329,7 @@
            helpCenterService.deleteBatchById(idList);
            // 删除帮助具体详情
            helpCenterService.deleteInfoBatchById(idList);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
        } catch (HelpCenterException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
@@ -248,7 +344,6 @@
    @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;
@@ -267,37 +362,36 @@
            }
            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();
        }
    }
@@ -402,25 +496,77 @@
     */
    @RequestMapping(value = "queryClass")
    public void queryClass(String callback, Integer pageIndex, Integer pageSize, String key,
            Integer showState, PrintWriter out) {
            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);
@@ -469,4 +615,42 @@
            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/entity/bus/help/HelpCenter.java
@@ -3,6 +3,7 @@
import java.io.Serializable;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import org.yeshi.utils.mybatis.Column;
/**
@@ -32,12 +33,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 +98,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
@@ -35,6 +35,14 @@
    @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")
    private Date createTime;
@@ -42,6 +50,10 @@
    // 更新时间
    @Column(name = "hc_update_time")
    private Date updateTime;
    private String startTime_str;
    private String endTime_str;
    
    public HelpClass() {}
    
@@ -105,4 +117,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/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}
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}
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 {
@@ -30,6 +36,9 @@
    
    @Resource
    private MongoDBManager mongoDBManager;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    
    @Override
@@ -58,33 +67,36 @@
    }
    @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 +105,6 @@
                }
                String type = (String) map.get("type");
                // 上传文件相对位置
                String fileUrl = "helpInfo/" + UUID.randomUUID().toString().replace("-", "") + "." +type;
                /* 上传新图片 */
@@ -102,24 +113,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) {
@@ -272,4 +275,54 @@
            }
        }
    }
    @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
@@ -23,6 +36,9 @@
    @Resource
    private HelpClassMapper helpClassMapper;
    @Resource
    private AdActivityVersionControlService adActivityVersionControlService;
    @Override
    public int deleteByPrimaryKeyBatch(List<Long> 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)) {
        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/inter/help/HelpCenterService.java
@@ -72,7 +72,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;
    
    /**
@@ -112,5 +112,13 @@
    
    public HelpInfo getHelpInfoCache(Long id) throws HelpCenterException;
    /**
     * 版本设置
     * @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;
    
    /**
     * 查询
@@ -90,4 +90,13 @@
    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);
@@ -145,6 +155,7 @@
        return 0;
    }
    public static long convertDateToTemp2(String st) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");