yujian
2019-03-27 a335dae46e684c9d3a729d4d21629689e30402ba
系统参数Dao改造(config/clientParams/helpList等)
5个文件已删除
19个文件已修改
2个文件已添加
1088 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/config/SystemClientParamsAdminController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/web/WebSearchController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/xcx/XcxSearchController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/xcx/XcxSystemMiniController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemClientParamsDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemConfigDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemHelpListDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemSecondProblemDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemZnxDao.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemClientParamsMapper.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemConfigMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/SystemZnxMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemClientParams.java 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemZnx.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/SystemClientParamsMapper.xml 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/SystemConfigMapper.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/SystemZnxMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemConfigServiceImpl.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SystemZnxServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemClientParamsService.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemConfigService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SystemZnxService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/config/SystemClientParamsAdminController.java
@@ -136,14 +136,11 @@
        
        try {
            
            List<SystemClientParams> list =
                    systemClientParamsService.getById(systemClientParams.getId());
            if (list == null || list.size() == 0) {
            SystemClientParams resultObject= systemClientParamsService.selectByPrimaryKey(systemClientParams.getId());
            if (resultObject == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
                return;    
            }
            SystemClientParams resultObject = list.get(0);
            
            systemClientParams.setSystem(resultObject.getSystem());
            systemClientParams.setUpdatetime(java.lang.System.currentTimeMillis());
fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.entity.system.SystemClientParams;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.CustomerContentService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
@@ -45,6 +46,9 @@
    @Resource
    private DeviceActiveService deviceActiveService;
    @Resource
    private CustomerContentService customerContentService;
    @RequestMapping("getsystemclientparams")
    public void getSystemClientParams(AcceptData acceptData, PrintWriter out) {
@@ -121,7 +125,7 @@
    @RequestMapping("contactCustomerService")
    public void contactCustomerService(AcceptData acceptData, PrintWriter out) {
        String title = "联系客服";
        List<CustomerContent> contentList = systemClientParamsService.contactCustomerService(title);
        List<CustomerContent> contentList = customerContentService.contactCustomerService(title);
        JSONObject data = new JSONObject();
        data.put("contentList", JsonUtil.getSimpleGsonWithDate().toJson(contentList));
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/controller/web/WebSearchController.java
@@ -10,12 +10,10 @@
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -28,13 +26,16 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.service.inter.config.CustomerContentService;
import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.user.HistorySearchService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import org.yeshi.utils.JsonUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/web/v1/webSearch")
@@ -54,6 +55,9 @@
    @Resource
    private SuperHotSearchService superHotSearchSerivce;
    @Resource
    private CustomerContentService customerContentService;
    // 优惠券
    /*
@@ -275,7 +279,7 @@
    @RequestMapping(value = "contactCustomer", method = RequestMethod.GET)
    public void contactCustomerService(PrintWriter out) {
        String title = "联系客服";
        List<CustomerContent> contentList = systemClientParamsService.contactCustomerService(title);
        List<CustomerContent> contentList = customerContentService.contactCustomerService(title);
        JSONObject data = new JSONObject();
        data.put("contentList", JsonUtil.getSimpleGsonWithDate().toJson(contentList));
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/controller/xcx/XcxSearchController.java
@@ -177,7 +177,7 @@
            return;
        }
        String kw = goodsClassService.getKwById(id);
        String kw = goodsClassService.getKeysById(id);
        filter = "[{\"type\": \"quantype\"}]";
        JSONObject data = search(kw, pagesize, filter, order, startprice, endprice);
        // if (StringUtil.isNullOrEmpty(kw)) {
fanli/src/main/java/com/yeshi/fanli/controller/xcx/XcxSystemMiniController.java
@@ -9,17 +9,18 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.wx.WXUtil;
import org.yeshi.utils.wx.XCXKeFuUtil;
import com.yeshi.fanli.entity.system.CustomerContent;
import com.yeshi.fanli.entity.xcx.XCXSettingConfig;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.CustomerContentService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.wx.WXUtil;
import org.yeshi.utils.wx.XCXKeFuUtil;
import net.sf.json.JSONObject;
@@ -32,6 +33,9 @@
    @Resource
    private ConfigService configService;
    @Resource
    private CustomerContentService customerContentService;
    /**
     * 
@@ -43,7 +47,7 @@
    @RequestMapping("contactCustomerService")
    public void contactCustomerService(PrintWriter out) {
        String title = "联系客服";
        List<CustomerContent> contentList = systemClientParamsService.contactCustomerService(title);
        List<CustomerContent> contentList = customerContentService.contactCustomerService(title);
        JSONObject data = new JSONObject();
        data.put("contentList", JsonUtil.getSimpleGsonWithDate().toJson(contentList));
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemClientParamsDao.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemConfigDao.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemHelpListDao.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemSecondProblemDao.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/dao/config/SystemZnxDao.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemClientParamsMapper.java
@@ -2,17 +2,26 @@
import java.util.List;
import com.yeshi.fanli.entity.system.CustomerContent;
import com.yeshi.fanli.entity.system.CustomerName;
import org.apache.ibatis.annotations.Param;
public interface SystemClientParamsMapper {
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.system.SystemClientParams;
    Integer getCount(int type);
    CustomerName getHelpCenter(long id);
    Integer getProblemCount(long id);
    List<CustomerContent> contactCustomerService(String title);
public interface SystemClientParamsMapper extends BaseMapper<SystemClientParams>{
    /**
     *  根据系统id查询
     * @param systemId
     * @return
     */
    List<SystemClientParams> listBySystemId(@Param("systemId") Long systemId);
    SystemClientParams getSystemClientParamsBySystemAndKey(@Param("systemId") Long systemId, @Param("key") String key);
    List<SystemClientParams> listQuery( @Param("start") long start,  @Param("count") int count,
            @Param("systemId") Long systemId, @Param("key") String key);
    long countQuery(@Param("systemId") Long systemId, @Param("key") String key);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemConfigMapper.java
New file
@@ -0,0 +1,14 @@
package com.yeshi.fanli.dao.mybatis;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.system.SystemConfig;
public interface SystemConfigMapper extends BaseMapper<SystemConfig>{
    SystemConfig getByKey(@Param("key") String key);
    SystemConfig getByKeyAndSystemId(@Param("key") String key, @Param("systemId") Long systemId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/SystemZnxMapper.java
@@ -1,8 +1,16 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.system.SystemZnx;
public interface SystemZnxMapper extends BaseMapper<SystemZnx>{
    List<SystemZnx> listbyCreateTime(@Param("createTime")long createTime);
    List<SystemZnx> listbyUidAndCreateTime(@Param("uid")long uid, @Param("createTime")long createTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemClientParams.java
@@ -2,27 +2,18 @@
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
/**
 * �?��返回给客户端的参�?
 * �?��返回给客户端的参�?
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "yeshi_ec_system_clientparams",uniqueConstraints={@UniqueConstraint(columnNames={"`name`","`key`", "systemid"})})
@Table("yeshi_ec_system_clientparams")
public class SystemClientParams implements Serializable{
    /**
     * 
@@ -30,27 +21,30 @@
    private static final long serialVersionUID = 1L;
    
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private long id;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "systemid")
    private Long id;
    @Column(name = "systemid")
    private BusinessSystem system;
    @Column(name = "`key`", length = 50)
    @Column(name = "key")
    @Expose
    private String key;
    @Column(name = "`value`", length = 1024)
    @Expose
    @Column(name = "value")
    private String value;
    @Column(name = "`name`", length = 50)
    @Expose
    @Column(name = "name")
    private String name;
    @Expose
    private long updatetime;
    @Column(name = "updatetime")
    private Long updatetime;
    public SystemClientParams() {
        // TODO Auto-generated constructor stub
    }
    
    public SystemClientParams(BusinessSystem system, String key, String value) {
@@ -60,11 +54,11 @@
        this.value = value;
    }
    public long getId() {
    public Long getId() {
        return id;
    }
    public void setId(long id) {
    public void setId(Long id) {
        this.id = id;
    }
@@ -100,49 +94,11 @@
        this.name = name;
    }
    public long getUpdatetime() {
    public Long getUpdatetime() {
        return updatetime;
    }
    public void setUpdatetime(long updatetime) {
    public void setUpdatetime(Long updatetime) {
        this.updatetime = updatetime;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        SystemClientParams other = (SystemClientParams) obj;
        if (key == null) {
            if (other.key != null)
                return false;
        } else if (!key.equals(other.key))
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        if (value == null) {
            if (other.value != null)
                return false;
        } else if (!value.equals(other.value))
            return false;
        return true;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java
@@ -3,16 +3,8 @@
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 系统配置参数
@@ -20,47 +12,40 @@
 * @author Administrator
 *
 */
@Entity
@Table(name = "yeshi_ec_system_config")
@Table("yeshi_ec_system_config")
public class SystemConfig {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private long id;
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name="yeshi_ec_system_systemconfig",joinColumns=@JoinColumn(name="scid",referencedColumnName="id"),inverseJoinColumns=@JoinColumn(name="sid",referencedColumnName="id"))
    private Set<BusinessSystem> systems=new HashSet<BusinessSystem>();
    @Column(name = "`key`", length = 50)
    private Long id;
    @Column(name = "key")
    private String key;
    @Column(name = "`value`", length = 1024)
    @Column(name = "value")
    private String value;
    @Column(name = "`name`", length = 50)
    @Column(name = "name")
    private String name;
    private long updatetime;
    @Column(name = "updatetime")
    private Long updatetime;
    private Set<BusinessSystem> systems=new HashSet<BusinessSystem>();
    
    public SystemConfig() {
        // TODO Auto-generated constructor stub
    }
    public SystemConfig(long id) {
    public SystemConfig(Long id) {
        super();
        this.id = id;
    }
    public long getId() {
    public Long getId() {
        return id;
    }
    public void setId(long id) {
    public void setId(Long id) {
        this.id = id;
    }
    public Set<BusinessSystem> getSystems() {
        return systems;
    }
    public void setSystems(Set<BusinessSystem> systems) {
        this.systems = systems;
    }
    public String getKey() {
@@ -87,11 +72,19 @@
        this.name = name;
    }
    public long getUpdatetime() {
    public Long getUpdatetime() {
        return updatetime;
    }
    public void setUpdatetime(long updatetime) {
    public void setUpdatetime(Long updatetime) {
        this.updatetime = updatetime;
    }
    public Set<BusinessSystem> getSystems() {
        return systems;
    }
    public void setSystems(Set<BusinessSystem> systems) {
        this.systems = systems;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemZnx.java
@@ -1,32 +1,22 @@
package com.yeshi.fanli.entity.system;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
@Entity
@Table(name = "yeshi_ec_system_msg")
@org.yeshi.utils.mybatis.Table("yeshi_ec_system_msg")
@Table("yeshi_ec_system_msg")
public class SystemZnx {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    @org.yeshi.utils.mybatis.Column(name="id")
    private Long id;
    
    @Column(name = "`title`", length = 128)
    @org.yeshi.utils.mybatis.Column(name="title")
    @Column(name = "title")
    private String title;
    
    @Column(name = "`content`", length = 128)
    @org.yeshi.utils.mybatis.Column(name="content")
    @Column(name = "content")
    private String content;
    
    @Column(name = "`createTime`", length = 128)
    @org.yeshi.utils.mybatis.Column(name="createTime")
    @Column(name = "createTime")
    private Long createTime;
    public Long getId() {
fanli/src/main/java/com/yeshi/fanli/mapping/SystemClientParamsMapper.xml
@@ -1,29 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper">
      <!-- 返回实体 -->
      <resultMap id="ParamsResultMap" type="com.yeshi.fanli.entity.system.CustomerName" >
          <id column="id" property="id" jdbcType="BIGINT"/>
          <result column="name" property="name" jdbcType="VARCHAR"/>
          <result column="createtime" property="createtime" jdbcType="DATE"/>
      </resultMap>
    <!-- 根据type查询问题数量  -->
    <select id="getCount" resultType="Integer">
        SELECT COUNT(1) FROM yeshi_ec_customer_name yecn WHERE yecn.`type` = #{type};
    </select>
    <!-- 根据id查询二级问题列表数量 -->
    <select id="getProblemCount" resultType="Integer">
        SELECT COUNT(1) FROM `yeshi_ec_customer_content` yecc WHERE cn_id = #{id};
    </select>
    <!-- 查询联系客服信息 -->
    <select id="contactCustomerService" resultType="String">
        SELECT yecc.`content` FROM `yeshi_ec_customer_content` yecc WHERE yecc.`title` = #{title};
    </select>
</mapper>
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemClientParams">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="key" property="key" jdbcType="VARCHAR"/>
    <result column="value" property="value" jdbcType="VARCHAR"/>
    <result column="name" property="name" jdbcType="VARCHAR"/>
    <result column="updatetime" property="updatetime" jdbcType="BIGINT"/>
     <association property="system" column="systemid" javaType="com.yeshi.fanli.entity.system.BusinessSystem">
        <id column="systemid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">id,`systemid`,`key`,`value`,`name`,updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_system_clientparams where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_system_clientparams where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemClientParams" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_clientparams (id,`systemid`,`key`,`value`,`name`,updatetime) values (#{id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{updatetime,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemClientParams" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_clientparams
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="system != null">`systemid`,</if>
      <if test="key != null">`key`,</if>
      <if test="value != null">`value`,</if>
      <if test="name != null">`name,</if>
      <if test="updatetime != null">updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="system != null">#{system.id,jdbcType=BIGINT},</if>
      <if test="key != null">#{`key`,jdbcType=VARCHAR},</if>
      <if test="value != null">#{`value`,jdbcType=VARCHAR},</if>
      <if test="name != null">#{name`,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=BIGINT},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemClientParams">update yeshi_ec_system_clientparams set systemid = #{system.id,jdbcType=BIGINT},`key` = #{key,jdbcType=VARCHAR},`value` = #{value,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},updatetime = #{updatetime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemClientParams">update yeshi_ec_system_clientparams
    <set>
      <if test="system != null">systemid=#{system.id,jdbcType=BIGINT},</if>
      <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">`value`=#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">updatetime=#{updatetime,jdbcType=BIGINT},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="listBySystemId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_clientparams cp
    WHERE cp.`systemid` = #{systemId}
  </select>
  <select id="getSystemClientParamsBySystemAndKey" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_clientparams cp
    WHERE cp.`systemid` =  #{systemId}  AND cp.`key` = #{key}
    LIMIT 1
  </select>
  <select id="listQuery" resultMap="BaseResultMap">
     SELECT * FROM yeshi_ec_system_clientparams cp
    WHERE 1=1
        <if test="systemId != null">
            AND cp.`systemid` =  #{systemId}
        </if>
        <if test="key != null and key != '' ">
            AND (cp.`name` LIKE '%${key}%' or  cp.`key` LIKE  '%${key}%' )
        </if>
    LIMIT #{start},#{count}
  </select>
  <select id="countQuery" resultType="java.lang.Long">
     SELECT IFNULL(COUNT(cp.`id`),0)  FROM yeshi_ec_system_clientparams cp
    WHERE 1=1
        <if test="systemId != null">
            AND cp.`systemid` =  #{systemId}
        </if>
        <if test="key != null and key != '' ">
            AND (cp.`name` LIKE '%${key}%' or  cp.`key` LIKE  '%${key}%' )
        </if>
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/SystemConfigMapper.xml
New file
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.SystemConfigMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemConfig">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="key" property="key" jdbcType="VARCHAR"/>
    <result column="value" property="value" jdbcType="VARCHAR"/>
    <result column="name" property="name" jdbcType="VARCHAR"/>
    <result column="updatetime" property="updatetime" jdbcType="BIGINT"/>
  </resultMap>
  <sql id="Base_Column_List">id,`key`,`value`,`name`,updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_config (id,`key`,`value`,`name`,updatetime) values (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{updatetime,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="key != null">`key`,</if>
      <if test="value != null">`value`,</if>
      <if test="name != null">`name`,</if>
      <if test="updatetime != null">updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=BIGINT},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemConfig">update yeshi_ec_system_config set `key` = #{key,jdbcType=VARCHAR},`value` = #{value,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},updatetime = #{updatetime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig">update yeshi_ec_system_config
    <set>
      <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">`value`=#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">updatetime=#{updatetime,jdbcType=BIGINT},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getByKey" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_config  t
    WHERE t.`key` = #{key}
    LIMIT 1
  </select>
  <select id="getByKeyAndSystemId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_config  t
    LEFT JOIN `yeshi_ec_system_systemconfig` g ON g.`scid` = t.`id`
    WHERE t.`key` = #{key} AND g.`sid` = #{systemId}
    LIMIT 1
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/SystemZnxMapper.xml
@@ -54,4 +54,17 @@
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <select id="listbyCreateTime" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_system_msg  t
        WHERE t.`createTime` <![CDATA[ >= ]]> #{createTime}
    </select>
    <select id="listbyUidAndCreateTime" resultMap="BaseResultMap">
        SELECT sm.* FROM `yeshi_ec_system_msg` sm
        LEFT JOIN  (SELECT * FROM `yeshi_ec_account_message` a
            WHERE a.`uid`= #{uid}  AND a.`system_msg_id` IS NOT NULL)s ON s.`system_msg_id`=sm.`id`
        WHERE s.`system_msg_id` IS NULL AND sm.createTime<![CDATA[ >= ]]> #{createTime}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemClientParamsServiceImpl.java
@@ -1,362 +1,50 @@
package com.yeshi.fanli.service.impl.config;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.config.SystemClientParamsDao;
import com.yeshi.fanli.dao.config.SystemHelpListDao;
import com.yeshi.fanli.dao.config.SystemSecondProblemDao;
import com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper;
import com.yeshi.fanli.entity.admin.SystemClientParamsAdmin;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.CustomerContent;
import com.yeshi.fanli.entity.system.CustomerName;
import com.yeshi.fanli.entity.system.SystemClientParams;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@Service
public class SystemClientParamsServiceImpl implements SystemClientParamsService {
    @Resource
    private SystemClientParamsDao systemClientParamsDao;
    @Resource
    private SystemClientParamsMapper systemClientParamsMapper;
    
    @Resource
    private SystemHelpListDao systemHelpListDao;
    
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private SystemSecondProblemDao systemSecondProblemDao;
    @Cacheable(value = "clientParamCache", key = "#id")
    public List<SystemClientParams> getSystemClientParamsBySystemId(long id) {
        return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
                new Serializable[] { id });
    }
    @Cacheable(value = "clientParamCache", key = "#id+'-'+#version")
    public List<SystemClientParams> getSystemClientParamsBySystemId(long id,int version) {
        return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
                new Serializable[] { id });
    @Cacheable(value = "clientParamCache", key = "#systemId+'-'+#version")
    public List<SystemClientParams> getSystemClientParamsBySystemId(long systemId, int version) {
        return systemClientParamsMapper.listBySystemId(systemId);
    }
    public List<SystemClientParamsAdmin> getAdminList(BusinessSystem system, String key) {
        List<SystemClientParams> list;
        List<SystemClientParamsAdmin> adminList = new ArrayList<SystemClientParamsAdmin>();
        if (system == null) {
            list = systemClientParamsDao.list("from SystemClientParams scp where scp.name like ? ",
                    new Serializable[] { "%" + key + "%" });
        } else {
            list = systemClientParamsDao.list(
                    "from SystemClientParams scp where scp.system.id = ? and scp.name like ? ",
                    new Serializable[] { system.getId(), "%" + key + "%" });
            StringBuffer hqlb = new StringBuffer("from SystemClientParams scp ");
            int ii = 0;
            if (list.size() > 0) {
                for (SystemClientParams scp : list) {
                    if (ii == 0) {
                        hqlb.append(" where ( scp.name = '" + scp.getName() + "'  and scp.key = '" + scp.getKey()
                                + "' and scp.value = '" + scp.getValue() + "' ) ");
                    } else {
                        hqlb.append(" or ( scp.name = '" + scp.getName() + "'  and scp.key = '" + scp.getKey()
                                + "' and scp.value = '" + scp.getValue() + "' ) ");
                    }
                    ii++;
                }
                list = systemClientParamsDao.list(hqlb.toString());
            }
        }
        SystemClientParamsAdmin scpa = null;
        for (SystemClientParams scp : list) {
            scpa = new SystemClientParamsAdmin(scp);
            if (adminList.contains(scpa)) {
                int indexof = adminList.indexOf(scpa);
                SystemClientParamsAdmin systemClientParamsAdmin = adminList.get(indexof);
                systemClientParamsAdmin.getSystemList().add(scp.getSystem());
            } else {
                scpa.getSystemList().add(scp.getSystem());
                adminList.add(scpa);
            }
        }
        return adminList;
    }
    @Transactional
    public void addSystemClientParamsList(SystemClientParams scp, List<BusinessSystem> list) throws Exception {
        SystemClientParams nscp = null;
        for (BusinessSystem system : list) {
            nscp = new SystemClientParams();
            nscp.setKey(scp.getKey());
            nscp.setName(scp.getName());
            nscp.setValue(scp.getValue());
            nscp.setSystem(system);
            nscp.setUpdatetime(java.lang.System.currentTimeMillis());
            systemClientParamsDao.create(nscp);
        }
    }
    @Transactional
    public void deleteSystemClientParams(final SystemClientParams scp, final BusinessSystem system) {
        systemClientParamsDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                Query query = session.createQuery(
                        "delete from SystemClientParams scp where scp.name = ? and scp.key =? and scp.value = ? and scp.system.id = ?");
                query.setParameter(0, scp.getName());
                query.setParameter(1, scp.getKey());
                query.setParameter(2, scp.getValue());
                query.setParameter(3, system.getId());
                return query.executeUpdate();
            }
        });
    }
    public void addSystemClientParams(SystemClientParams scp, BusinessSystem system) {
        scp.setSystem(system);
        systemClientParamsDao.create(scp);
    }
    @Transactional
    public void deleteSystemClientParams(final SystemClientParams scp) {
        systemClientParamsDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                Query query = session.createQuery(
                        "delete from SystemClientParams scp where scp.name=? and scp.key = ?  and scp.value = ? ");
                query.setParameter(0, scp.getName());
                query.setParameter(1, scp.getKey());
                query.setParameter(2, scp.getValue());
                return query.executeUpdate();
            }
        });
    }
    public SystemClientParamsAdmin getSystemClientParamsAdmin(final SystemClientParams scp) {
        return (SystemClientParamsAdmin) systemClientParamsDao.excute(new HibernateCallback<SystemClientParamsAdmin>() {
            public SystemClientParamsAdmin doInHibernate(Session session) throws HibernateException {
                Query query = session
                        .createQuery("from SystemClientParams s where s.key = ?");
                query.setParameter(0, scp.getKey());
                List<SystemClientParams> list = query.list();
                SystemClientParamsAdmin scpa = new SystemClientParamsAdmin(scp);
                for (SystemClientParams fscp : list) {
                    BusinessSystem system = fscp.getSystem();
                    if (scpa.getSystemList().contains(system)) {
                        continue;
                    }
                    scpa.getSystemList().add(fscp.getSystem());
                    scpa.setSystemClientParams(fscp);
                }
                return scpa;
            }
        });
    }
    @Transactional
    public void update(final SystemClientParams oscp, final SystemClientParams nscp) {
        systemClientParamsDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                Query query = session.createQuery(
                        "update SystemClientParams s set s.name=? , s.key=? , s.value=? where s.name=? and s.key = ? ");
                query.setParameter(0, nscp.getName());
                query.setParameter(1, nscp.getKey());
                query.setParameter(2, nscp.getValue());
                query.setParameter(3, oscp.getName());
                query.setParameter(4, oscp.getKey());
                return query.executeUpdate();
            }
        });
    }
    @Override
    public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key) {
        List<SystemClientParams> list = systemClientParamsDao.list(
                "from SystemClientParams scp where scp.system.id=? and scp.key=?",
                new Serializable[] { system.getId(), key });
        if (list == null || list.size() == 0)
        if (system == null) {
            return null;
        else
            return list.get(0);
    }
    @Override
    public Integer getCount(int type) {
        return systemClientParamsMapper.getCount(type);
    }
    @Override
    public List<CustomerName> customerNameList(int page, String key, int type) {
        int start = page * Constant.PAGE_SIZE;
        return systemHelpListDao.list(
            "from CustomerName cn where cn.type = ? and cn.name like ? order by cn.createTime asc", start,
            Constant.PAGE_SIZE, new Serializable[] {type, "%"+key+"%"});
    }
    @Override
    public void deleteHelp(long id) {
        systemHelpListDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session)
                                throws HibernateException {
                Query query = session.createQuery("delete from CustomerName cn where cn.id = ?");
                query.setParameter(0, id);
                query.executeUpdate();
                return null;
            }
        });
    }
    @Override
    public CustomerName getHelpCenter(int type) {
        return systemClientParamsMapper.getHelpCenter(type);
    }
    @Override
    public Integer getProblemCount(long id) {
        return systemClientParamsMapper.getProblemCount(id);
    }
    @Override
    public List<CustomerContent> getSecondProblemList(int index, String key, long id) {
        int start = index * Constant.PAGE_SIZE;
        return systemSecondProblemDao.list(
                "from CustomerContent cc where cc.cnId = ? and cc.title like ? order by cc.createTime asc", start,
                Constant.PAGE_SIZE, new Serializable[] {id, "%"+key+"%"});
    }
    @Override
    public void deleteSecondProblem(long id) {
        systemSecondProblemDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session)
                                throws HibernateException {
                Query query = session.createQuery("delete from CustomerContent cc where cc.id = ?");
                query.setParameter(0, id);
                query.executeUpdate();
                return null;
            }
        });
    }
    @Override
    public CustomerContent getCustomerContent(long id) {
        return systemSecondProblemDao.find(CustomerContent.class, id);
    }
    @Override
    public void updateAnswerDetail(CustomerContent customerContent) {
        CustomerContent find = systemSecondProblemDao.find(CustomerContent.class, customerContent.getId());
        if(find == null ){
            return;
        }
        find.setTitle(customerContent.getTitle());
        find.setContent(customerContent.getContent());
        systemSecondProblemDao.update(find);
        return systemClientParamsMapper.getSystemClientParamsBySystemAndKey(system.getId(), key);
    }
    @Override
    public void addFirstMenu(CustomerName customerName, int type) {
        customerName.setName(customerName.getName());
        customerName.setCreateTime(new Date());
        customerName.setType(type);
        systemHelpListDao.save(customerName);
    }
    @Override
    public void addSecondMenu(CustomerContent customerContent, long cnId) {
        customerContent.setCnId(cnId);
        customerContent.setTitle(customerContent.getTitle());
        customerContent.setContent(customerContent.getContent());
        customerContent.setCreateTime(new Date());
        systemSecondProblemDao.save(customerContent);
    }
    @Override
    public List<CustomerContent> contactCustomerService(String title) {
        return systemClientParamsMapper.contactCustomerService(title);
    }
    
    @Override
    public List<SystemClientParams> listQuery(int start, int count, String key, Long systemId) {
        List<SystemClientParams> list = null;
        if (systemId == null) {
            if (StringUtil.isNullOrEmpty(key)) {
                list = systemClientParamsDao.list("from SystemClientParams scp", start, count, null);
            } else {
                list = systemClientParamsDao.list("from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
                        start, count, new Serializable[] { "%" + key + "%" ,"%" + key + "%"});
            }
        } else {
            if (StringUtil.isNullOrEmpty(key)) {
                list = systemClientParamsDao.list("from SystemClientParams scp where scp.system.id = ? ",
                        start, count, new Serializable[] {systemId});
            } else {
                list = systemClientParamsDao.list(
                        "from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
                        start, count, new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
            }
        }
        return list;
        return systemClientParamsMapper.listQuery(start, count, systemId, key);
    }
    
    @Override
    public long countQuery(String key, Long systemId) {
        if (systemId == null) {
            if (StringUtil.isNullOrEmpty(key)) {
                return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp");
            } else {
                return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
                        new Serializable[] { "%" + key + "%" ,"%" + key + "%"});
            }
        } else {
            if (StringUtil.isNullOrEmpty(key)) {
                return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where scp.system.id = ? ",
                         new Serializable[] {systemId});
            } else {
                return systemClientParamsDao.getCount(
                        " select count(id) from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
                        new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
            }
        }
        return systemClientParamsMapper.countQuery(systemId, key);
    }
    
    
@@ -377,32 +65,26 @@
            nscp.setValue(scp.getValue());
            nscp.setSystem(system);
            nscp.setUpdatetime(java.lang.System.currentTimeMillis());
            systemClientParamsDao.create(nscp);
            systemClientParamsMapper.insertSelective(nscp);
        }
    }
    
    @Override
    public void update(SystemClientParams systemClientParams) {
        systemClientParamsDao.update(systemClientParams);
        systemClientParamsMapper.updateByPrimaryKeySelective(systemClientParams);
    }
    
    @Override
    public List<SystemClientParams> getById(long id) {
        return systemClientParamsDao.list("from SystemClientParams scp where scp.id=?",
                new Serializable[] { id });
    public  SystemClientParams selectByPrimaryKey(long id) {
        return systemClientParamsMapper.selectByPrimaryKey(id);
    }
    
    @Transactional
    @Override
    public void deleteBatchByPrimaryKey(List<Long> ids) {
        for (Long id: ids) {
            systemClientParamsDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    Query query = session.createQuery("delete from SystemClientParams scp where scp.id= ?");
                    query.setParameter(0, id);
                    return query.executeUpdate();
                }
            });
            systemClientParamsMapper.deleteByPrimaryKey(id);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemConfigServiceImpl.java
@@ -1,149 +1,41 @@
package com.yeshi.fanli.service.impl.config;
import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.config.SystemConfigDao;
import com.yeshi.fanli.dao.mybatis.SystemConfigMapper;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.SystemConfig;
import com.yeshi.fanli.exception.NotExistObjectException;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.Utils;
@Service
public class SystemConfigServiceImpl implements SystemConfigService{
    @Resource
    private SystemConfigDao systemConfigDao;
    private SystemConfigMapper systemConfigMapper;
    
    @Resource
    private BusinessSystemService businessSystemService;
    public int getCount(BusinessSystem system,String key) {
        Long lcount;
        if(system!=null){
            lcount = systemConfigDao.getCount("select count(sc.id) from SystemConfig sc left join sc.systems s  where s.id=? and sc.name like ?",new Serializable[]{system.getId(),"%"+key+"%"});
        }else{
            lcount = systemConfigDao.getCount("select count(sc.id) from SystemConfig sc where sc.name like ?",new Serializable[]{"%"+key+"%"});
        }
        return lcount.intValue();
    }
    public List<SystemConfig> getSystemConfigList(int index,BusinessSystem system, String key) {
        int start =index * Constant.PAGE_SIZE;
        List<SystemConfig> list;
        if(system != null){
            list = systemConfigDao.list("from SystemConfig sc left outer join fetch sc.systems s where s.id = ? and sc.name like ?",start,Constant.PAGE_SIZE,new Serializable[]{system.getId(),"%"+key+"%"});
            StringBuffer hql=new StringBuffer("from SystemConfig sc ");
            Serializable[] params = new Serializable[list.size()];
            int ii=0;
            for (SystemConfig sc : list) {
                if(ii==0){
                    hql.append(" where sc. id = ? ");
                }else{
                    hql.append(" or sc. id = ? ");
                }
                params[ii]=sc.getId();
                ii++;
            }
            list=systemConfigDao.list(hql.toString(),params);
        }else{
            list = systemConfigDao.list("from SystemConfig sc where sc.name like ?",start,Constant.PAGE_SIZE,new Serializable[]{"%"+key+"%"});
        }
        return list;
    }
    public void addSystemConfig(SystemConfig sc) {
        Set<BusinessSystem> systems = sc.getSystems();
        Set<BusinessSystem> newSystems=new HashSet<BusinessSystem>();
        for (BusinessSystem system : systems) {
            String platform = Utils.getMap().get(String.valueOf(system.getPlatform()));
            String packages = system.getPackageName();
            BusinessSystem find = businessSystemService.getBusinessSystem(platform, packages);
            if(find != null){
                newSystems.add(find);
            }
        }
        sc.setSystems(newSystems);
        sc.setUpdatetime(java.lang.System.currentTimeMillis());
        systemConfigDao.save(sc);
    }
    public void deleteSystem(long id, BusinessSystem system) throws NotExistObjectException {
        SystemConfig find = systemConfigDao.find(SystemConfig.class, id);
        if(find==null){
            throw new NotExistObjectException("不存在该子系统");
        }
        find.getSystems().remove(system);
        find.setUpdatetime(java.lang.System.currentTimeMillis());
        systemConfigDao.update(find);
    }
    public void addSystem(long id, BusinessSystem system) throws NotExistObjectException {
        SystemConfig find = systemConfigDao.find(SystemConfig.class, id);
        if(find==null){
            throw new NotExistObjectException("不存在该子系统");
        }
        find.getSystems().add(system);
        find.setUpdatetime(java.lang.System.currentTimeMillis());
        systemConfigDao.update(find);
    }
    public SystemConfig getSystemConfig(long id) {
        return systemConfigDao.find(SystemConfig.class, id);
    }
    public void updateSystemConfig(SystemConfig sc) throws NotExistObjectException {
        SystemConfig find = systemConfigDao.find(SystemConfig.class, sc.getId());
        if(find==null){
            throw new NotExistObjectException("不存在该对象");
        }
        sc.setUpdatetime(java.lang.System.currentTimeMillis());
        Set<BusinessSystem> newSystems=new HashSet<BusinessSystem>();
        Set<BusinessSystem> systems = sc.getSystems();
        for (BusinessSystem system : systems) {
            String platform = Utils.getMap().get(String.valueOf(system.getPlatform()));
            String packages = system.getPackageName();
            BusinessSystem sfind = businessSystemService.getBusinessSystem(platform, packages);
            if(sfind != null){
                newSystems.add(sfind);
            }
        }
        sc.setSystems(newSystems);
        systemConfigDao.update(sc);
    }
    public void deleteSystemConfig(long id) {
        systemConfigDao.delete(new SystemConfig(id));
    }
    @Cacheable(value={"childSystemCache"}, key="#p0")
    public String get(String sigkey) throws NotExistObjectException {
        List<SystemConfig> list = systemConfigDao.list("from SystemConfig sc where sc.key = ?", new Serializable[]{sigkey});
        if(list.size() ==0 ){
         SystemConfig systemConfig = systemConfigMapper.getByKey(sigkey);
         if(systemConfig == null ){
            throw new NotExistObjectException("不存在该参数"); 
        }
        return list.get(0).getValue();
        return systemConfig.getValue();
    }
    @Cacheable(value={"childSystemCache"}, key="#p0+#system.id")
    public String get(String key, BusinessSystem system) {
        if(system==null || system.getId()==0){
            return "";
        }
        List<SystemConfig> list = systemConfigDao.list("select sc from SystemConfig sc join sc.systems syss where sc.key = ? and syss.id=?", new Serializable[]{key,system.getId()});
        if(list.size() != 0){
            return list.get(0).getValue();
        SystemConfig systemConfig = systemConfigMapper.getByKeyAndSystemId(key, system.getId());
        if(systemConfig != null){;
            return systemConfig.getValue();
        }
        return "";
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java
@@ -7,7 +7,6 @@
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.config.SystemZnxDao;
import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
import com.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
@@ -17,6 +16,7 @@
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.service.inter.user.SystemZnxService;
import com.yeshi.fanli.util.StringUtil;
@Service
@@ -32,7 +32,7 @@
    private UserInfoMapper userInfoMapper;
    @Resource
    private SystemZnxDao systemZnxDao;
    private SystemZnxService systemZnxService;
    @Override
    public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag,
@@ -117,8 +117,8 @@
        UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
        if (user == null)
            return;
        long createtTime = user.getCreatetime();
        List<SystemZnx> list = systemZnxDao.list("from SystemZnx s where s.createTime>=" + createtTime);
        long createTime = user.getCreatetime();
        List<SystemZnx> list = systemZnxService.listbyCreateTime(createTime);
        if (list != null && list.size() > 0) {
            for (SystemZnx znx : list) {
                UserSystemMsg msg = userSystemMsgMapper.selectBySystemZNXId(znx.getId());
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SystemZnxServiceImpl.java
@@ -1,28 +1,35 @@
package com.yeshi.fanli.service.impl.user;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.config.SystemZnxDao;
import com.yeshi.fanli.dao.mybatis.msg.SystemZnxMapper;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.service.inter.user.SystemZnxService;
@Service
public class SystemZnxServiceImpl implements SystemZnxService{
    
    @Resource
    private SystemZnxDao systemZnxDao;
    private SystemZnxMapper systemZnxMapper;
    
    /**
     * 插入数据
     */
    @Override
    public void save(SystemZnx systemZnx) {
        Serializable id = systemZnxDao.save(systemZnx);
        if(id!=null) {
            systemZnx.setId(Long.parseLong(id+""));
        }
        systemZnxMapper.insertSelective(systemZnx);
    }
    @Override
    public List<SystemZnx> listbyCreateTime(long createTime){
        return systemZnxMapper.listbyCreateTime(createTime);
    }
    @Override
    public List<SystemZnx> listbyUidAndCreateTime(long uid, long createTime) {
        return systemZnxMapper.listbyUidAndCreateTime(uid, createTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemClientParamsService.java
@@ -2,31 +2,13 @@
import java.util.List;
import com.yeshi.fanli.entity.admin.SystemClientParamsAdmin;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.CustomerContent;
import com.yeshi.fanli.entity.system.CustomerName;
import com.yeshi.fanli.entity.system.SystemClientParams;
public interface SystemClientParamsService {
    
    public List<SystemClientParams> getSystemClientParamsBySystemId(long id);
    
    public List<SystemClientParams> getSystemClientParamsBySystemId(long id,int version);
    public List<SystemClientParamsAdmin> getAdminList(BusinessSystem system, String key);
    public void addSystemClientParamsList(SystemClientParams scp, List<BusinessSystem> list) throws Exception;
    public void deleteSystemClientParams(SystemClientParams scp, BusinessSystem system);
    public void addSystemClientParams(SystemClientParams scp, BusinessSystem system);
    public void deleteSystemClientParams(SystemClientParams scp);
    public SystemClientParamsAdmin getSystemClientParamsAdmin(SystemClientParams scp);
    public void update(SystemClientParams oscp, SystemClientParams nscp);
    /**
     * 按照系统和关键字获取客户端参数
@@ -37,29 +19,6 @@
     */
    public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key);
    public Integer getCount(int type);
    public List<CustomerName> customerNameList(int i, String key, int type);
    public void deleteHelp(long id);
    public CustomerName getHelpCenter(int type);
    public Integer getProblemCount(long id);
    public List<CustomerContent> getSecondProblemList(int i, String key, long id);
    public void deleteSecondProblem(long id);
    public CustomerContent getCustomerContent(long id);
    public void updateAnswerDetail(CustomerContent customerContent);
    public void addFirstMenu(CustomerName customerName, int type);
    public void addSecondMenu(CustomerContent customerContent, long cnId);
    public List<CustomerContent> contactCustomerService(String title);
    /**
     * 新版后台查询
@@ -84,7 +43,7 @@
     * @param id
     * @return
     */
    public List<SystemClientParams> getById(long id);
    public SystemClientParams selectByPrimaryKey(long id);
    /**
     * 根据id批量删除
@@ -92,6 +51,7 @@
     */
    public void deleteBatchByPrimaryKey(List<Long> ids);
    public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemConfigService.java
@@ -1,31 +1,9 @@
package com.yeshi.fanli.service.inter.config;
import java.util.List;
import org.springframework.cache.annotation.CacheEvict;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.SystemConfig;
import com.yeshi.fanli.exception.NotExistObjectException;
public interface SystemConfigService {
    public int getCount(BusinessSystem system,String key);
    public List<SystemConfig> getSystemConfigList(int index,BusinessSystem system, String key);
    public void addSystemConfig(SystemConfig sc);
    @CacheEvict(value="childSystemCache",allEntries=true)
    public void deleteSystem(long id, BusinessSystem system) throws NotExistObjectException;
    @CacheEvict(value="childSystemCache",allEntries=true)
    public void addSystem(long id, BusinessSystem system)  throws NotExistObjectException;
    public SystemConfig getSystemConfig(long id);
    public void updateSystemConfig(SystemConfig sc) throws NotExistObjectException;
    public void deleteSystemConfig(long id);
    
    public String get(String key) throws NotExistObjectException;
    
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SystemZnxService.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.inter.user;
import java.util.List;
import com.yeshi.fanli.entity.system.SystemZnx;
public interface SystemZnxService {
@@ -13,4 +15,10 @@
     */
    public void save(SystemZnx systemZnx);
    public List<SystemZnx> listbyCreateTime(long createTime);
    public List<SystemZnx> listbyUidAndCreateTime(long uid, long createTime);
}