| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | List<AppVersionInfo> versionList = appVersionService.getAppVersionInfoListByPlatform("android");
|
| | | Map<Integer, String> androidMapName = new HashMap<>();
|
| | | for (AppVersionInfo version : versionList)
|
| | | androidMapName.put(version.getVersionCode(), version.getVersion());
|
| | |
|
| | | versionList = appVersionService.getAppVersionInfoListByPlatform("ios");
|
| | | Map<Integer, String> iosMapName = new HashMap<>();
|
| | | for (AppVersionInfo version : versionList)
|
| | | iosMapName.put(version.getVersionCode(), version.getVersion());
|
| | |
|
| | | List<Config> list = configService.listObjects(key, pageIndex);
|
| | |
|
| | | for (Config config : list) {
|
| | | config.setMinAndroidVersion(androidMapName.get(config.getMinAndroidVersionCode()));
|
| | | config.setMinIosVersion(iosMapName.get(config.getMinIosVersionCode()));
|
| | | }
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无更多数据"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 版本号信息
|
| | | * |
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/clientParams")
|
| | | public class SystemClientParamsAdminController {
|
| | | |
| | | |
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | /**
|
| | | * 后端查询-新后台
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | |
| | | * @param systemId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value="query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key,
|
| | | Long systemId, PrintWriter out) {
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long systemId,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | |
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | List<AppVersionInfo> versionList = appVersionService.getAppVersionInfoListByPlatform("android");
|
| | | Map<Integer, String> androidMapName = new HashMap<>();
|
| | | for (AppVersionInfo version : versionList)
|
| | | androidMapName.put(version.getVersionCode(), version.getVersion());
|
| | |
|
| | | versionList = appVersionService.getAppVersionInfoListByPlatform("ios");
|
| | | Map<Integer, String> iosMapName = new HashMap<>();
|
| | | for (AppVersionInfo version : versionList)
|
| | | iosMapName.put(version.getVersionCode(), version.getVersion());
|
| | |
|
| | | BusinessSystem businessSystem = businessSystemService.getById(systemId);
|
| | |
|
| | | try {
|
| | |
|
| | | List<SystemClientParams> list = systemClientParamsService.listQuery((pageIndex - 1) * pageSize, pageSize, |
| | | List<SystemClientParams> list = systemClientParamsService.listQuery((pageIndex - 1) * pageSize, pageSize,
|
| | | key, systemId);
|
| | | |
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | for (SystemClientParams params : list) {
|
| | | if (businessSystem.getPlatform() == 1)
|
| | | params.setVersion(androidMapName.get(params.getMinVersion()));
|
| | | else
|
| | | params.setVersion(iosMapName.get(params.getMinVersion()));
|
| | | }
|
| | |
|
| | | long count = systemClientParamsService.countQuery(key, systemId);
|
| | | |
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 新增
|
| | | * |
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveAdd")
|
| | | public void saveAdd(String callback, SystemClientParams systemClientParams, String idArray, PrintWriter out) {
|
| | | |
| | |
|
| | | String key = systemClientParams.getKey();
|
| | | String name = systemClientParams.getName();
|
| | | String value = systemClientParams.getValue();
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key) || StringUtil.isNullOrEmpty(name) |
| | | || StringUtil.isNullOrEmpty(value) || StringUtil.isNullOrEmpty(idArray)) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key) || StringUtil.isNullOrEmpty(name) || StringUtil.isNullOrEmpty(value)
|
| | | || StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("名称、key、value、系统不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | |
|
| | | systemClientParamsService.saveAdd(systemClientParams, list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | /**
|
| | | * 修改
|
| | | * |
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, SystemClientParams systemClientParams, PrintWriter out) {
|
| | | |
| | |
|
| | | String key = systemClientParams.getKey();
|
| | | String name = systemClientParams.getName();
|
| | | String value = systemClientParams.getValue();
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key) || StringUtil.isNullOrEmpty(name) |
| | | || StringUtil.isNullOrEmpty(value)) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key) || StringUtil.isNullOrEmpty(name) || StringUtil.isNullOrEmpty(value)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("名称、key、value不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | | SystemClientParams resultObject= systemClientParamsService.selectByPrimaryKey(systemClientParams.getId());
|
| | |
|
| | | SystemClientParams resultObject = systemClientParamsService.selectByPrimaryKey(systemClientParams.getId());
|
| | | if (resultObject == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
|
| | | return; |
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | systemClientParams.setSystem(resultObject.getSystem());
|
| | | systemClientParams.setUpdatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | |
|
| | | systemClientParamsService.update(systemClientParams);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 删除
|
| | | * |
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | |
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | systemClientParamsService.deleteBatchByPrimaryKey(list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | public void getSpecialChannelActivity(AcceptData acceptData, Long uid, String callback, PrintWriter out) {
|
| | |
|
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
|
| | | |
| | | List<Special> list = specialService.listByPlaceKey("special_channel_activity",platformCode, Integer.parseInt(acceptData.getVersion()));
|
| | | |
| | |
|
| | | List<Special> list = specialService.listByPlaceKey("special_channel_activity", platformCode,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | long time = System.currentTimeMillis();
|
| | | // 删除尚未启用的过期的
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | |
| | | if (special.getState() == 1L) {
|
| | | list.remove(i--);
|
| | | } else {
|
| | | if (special.getStartTime() != null && special.getEndTime() != null)
|
| | | special.setTimeTask(true);
|
| | | else
|
| | | special.setTimeTask(false);
|
| | | |
| | | if (special.isTimeTask()) {
|
| | | if (time < special.getStartTime().getTime() || time > special.getEndTime().getTime()) {
|
| | | list.remove(i--);
|
| | |
| | | long countSearchByName(@Param("key") String key); |
| | | |
| | | /** |
| | | * 根据关键词获取 |
| | | * 根据关键词提取 |
| | | * |
| | | * @param key |
| | | * @param minAndroidVersion |
| | | * @param maxAndroidVersion |
| | | * @return |
| | | */ |
| | | List<Config> listByKey(String key); |
| | | List<Config> listByKey(@Param("key") String key, @Param("minAndroidVersion") Integer minAndroidVersion, |
| | | @Param("minIosVersion") Integer minIosVersion); |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | |
|
| | | public interface SystemClientParamsMapper extends BaseMapper<SystemClientParams>{
|
| | | |
| | | /**
|
| | | * 根据系统id查询
|
| | | * @param systemId
|
| | | * @return
|
| | | */
|
| | | List<SystemClientParams> listBySystemId(@Param("systemId") Long systemId);
|
| | | |
| | | |
| | | public interface SystemClientParamsMapper extends BaseMapper<SystemClientParams> {
|
| | |
|
| | | List<SystemClientParams> listBySystemIdAndMinVersion(@Param("systemId") Long systemId,
|
| | | @Param("minVersion") Integer version);
|
| | |
|
| | | SystemClientParams getSystemClientParamsBySystemAndKey(@Param("systemId") Long systemId, @Param("key") String key);
|
| | | |
| | | |
| | | List<SystemClientParams> listQuery( @Param("start") long start, @Param("count") int count,
|
| | |
|
| | | 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);
|
| | | }
|
| | |
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.Table;
|
| | |
|
| | | //系统总配�? |
| | | @Entity
|
| | | @Table(name = "`yeshi_ec_config`")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_config")
|
| | | public class Config implements Serializable{
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_config")
|
| | | public class Config implements Serializable {
|
| | | /**
|
| | | *
|
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @Column(name = "id")
|
| | | @org.yeshi.utils.mybatis.Column(name="id")
|
| | | private Long id;
|
| | | @Column(name = "`key`", length = 32)
|
| | | @org.yeshi.utils.mybatis.Column(name="key")
|
| | | @Column(name = "key")
|
| | | private String key;
|
| | | @Column(name = "`value`", length = 4096)
|
| | | @org.yeshi.utils.mybatis.Column(name="value")
|
| | | @Column(name = "value")
|
| | | private String value;
|
| | | @Column(name = "`name`", length = 1024)
|
| | | @org.yeshi.utils.mybatis.Column(name="name")
|
| | | @Column(name = "name")
|
| | | private String name;
|
| | | @Column(name = "`beizhu`", length = 1024)
|
| | | @org.yeshi.utils.mybatis.Column(name="beizhu")
|
| | | @Column(name = "beizhu")
|
| | | private String beizhu;
|
| | |
|
| | | @Column(name = "`createtime`", length = 16)
|
| | | @org.yeshi.utils.mybatis.Column(name="createtime")
|
| | | @Column(name = "createtime")
|
| | | private String createtime;
|
| | | @Column(name = "min_android_version")
|
| | | private Integer minAndroidVersionCode;// android最小版本
|
| | | @Column(name = "min_ios_version")
|
| | | private Integer minIosVersionCode;// ios最小版本
|
| | |
|
| | | |
| | | //后台展现
|
| | | private String minAndroidVersion;
|
| | | |
| | | private String minIosVersion;
|
| | | |
| | | |
| | |
|
| | | public String getMinAndroidVersion() {
|
| | | return minAndroidVersion;
|
| | | }
|
| | |
|
| | | public void setMinAndroidVersion(String minAndroidVersion) {
|
| | | this.minAndroidVersion = minAndroidVersion;
|
| | | }
|
| | |
|
| | | public String getMinIosVersion() {
|
| | | return minIosVersion;
|
| | | }
|
| | |
|
| | | public void setMinIosVersion(String minIosVersion) {
|
| | | this.minIosVersion = minIosVersion;
|
| | | }
|
| | |
|
| | | public Integer getMinAndroidVersionCode() {
|
| | | return minAndroidVersionCode;
|
| | | }
|
| | |
|
| | | public void setMinAndroidVersionCode(Integer minAndroidVersionCode) {
|
| | | this.minAndroidVersionCode = minAndroidVersionCode;
|
| | | }
|
| | |
|
| | | public Integer getMinIosVersionCode() {
|
| | | return minIosVersionCode;
|
| | | }
|
| | |
|
| | | public void setMinIosVersionCode(Integer minIosVersionCode) {
|
| | | this.minIosVersionCode = minIosVersionCode;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_system_clientparams")
|
| | | public class SystemClientParams implements Serializable{
|
| | | public class SystemClientParams implements Serializable {
|
| | | /**
|
| | | *
|
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | |
| | |
|
| | | @Column(name = "id")
|
| | | private Long id;
|
| | | |
| | |
|
| | | @Column(name = "systemid")
|
| | | private BusinessSystem system;
|
| | | |
| | |
|
| | | @Column(name = "key")
|
| | | @Expose
|
| | | private String key;
|
| | | |
| | |
|
| | | @Expose
|
| | | @Column(name = "value")
|
| | | private String value;
|
| | | |
| | |
|
| | | @Expose
|
| | | @Column(name = "name")
|
| | | private String name;
|
| | | |
| | |
|
| | | @Expose
|
| | | @Column(name = "updatetime")
|
| | | private Long updatetime;
|
| | |
|
| | | @Column(name = "min_version")
|
| | | private Integer minVersion;
|
| | |
|
| | | |
| | | private String version;
|
| | |
|
| | | public String getVersion() {
|
| | | return version;
|
| | | }
|
| | |
|
| | | public void setVersion(String version) {
|
| | | this.version = version;
|
| | | }
|
| | |
|
| | | public Integer getMinVersion() {
|
| | | return minVersion;
|
| | | }
|
| | |
|
| | | public void setMinVersion(Integer minVersion) {
|
| | | this.minVersion = minVersion;
|
| | | }
|
| | |
|
| | | public SystemClientParams() {
|
| | | }
|
| | | |
| | |
|
| | | public SystemClientParams(BusinessSystem system, String key, String value) {
|
| | | super();
|
| | | this.system = system;
|
| | |
| | | <result column="`name`" property="name" jdbcType="VARCHAR" /> |
| | | <result column="beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="createtime" property="createtime" jdbcType="VARCHAR" /> |
| | | <result column="min_android_version" property="minAndroidVersionCode" |
| | | jdbcType="INTEGER" /> |
| | | <result column="min_ios_version" property="minIosVersionCode" |
| | | jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">`id`,`key`,`value`,`name`,beizhu,createtime</sql> |
| | | <sql id="Base_Column_List">`id`,`key`,`value`,`name`,beizhu,createtime,min_android_version,min_ios_version |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config where `key` = #{0} limit 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="listAll" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config |
| | | </select> |
| | | |
| | | |
| | | <select id="listSearchByName" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config where `name` like '%${key}%' limit #{start},#{count} |
| | | from yeshi_ec_config where `name` like '%${key}%' limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countSearchByName" resultType="java.lang.Long" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_config where `name` like |
| | | '%${key}%' |
| | | </select> |
| | | parameterType="java.lang.String">select count(*) from yeshi_ec_config where `name` like |
| | | '%${key}%'</select> |
| | | |
| | | |
| | | <select id="listByKey" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | <select id="listByKey" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config where `key`=#{0} |
| | | from yeshi_ec_config where `key`=#{key} |
| | | <if test="minAndroidVersion!=null"> |
| | | and #{minAndroidVersion} >= min_android_version |
| | | order by min_android_version desc |
| | | </if> |
| | | <if test="minIosVersion!=null"> |
| | | and #{minIosVersion} >= min_ios_version |
| | | order by min_ios_version desc |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.common.Config" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_config |
| | | (id,key,value,name,beizhu,createtime) values |
| | | (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{beizhu,jdbcType=VARCHAR},#{createtime,jdbcType=VARCHAR}) |
| | | (id,key,value,name,beizhu,createtime,min_android_version,min_ios_version) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{beizhu,jdbcType=VARCHAR},#{createtime,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIosVersionCode,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.common.Config" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="name != null">`name`,</if> |
| | | <if test="beizhu != null">beizhu,</if> |
| | | <if test="createtime != null">createtime,</if> |
| | | <if test="minAndroidVersionCode != null">min_android_version,</if> |
| | | <if test="minIosVersionCode != null">min_ios_version,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=VARCHAR},</if> |
| | | <if test="minAndroidVersionCode != null">#{minAndroidVersionCode,jdbcType=INTEGER},</if> |
| | | <if test="minIosVersionCode != null">#{minIosVersionCode,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.common.Config">update |
| | | yeshi_ec_config set `key` = #{key,jdbcType=VARCHAR},`value` = |
| | | #{value,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},beizhu = |
| | | #{beizhu,jdbcType=VARCHAR},createtime = |
| | | #{createtime,jdbcType=VARCHAR} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | #{beizhu,jdbcType=VARCHAR},createtime = #{createtime,jdbcType=VARCHAR} |
| | | ,min_android_version =#{minAndroidVersionCode,jdbcType=INTEGER} |
| | | ,min_ios_version =#{minIosVersionCode,jdbcType=INTEGER} where id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.common.Config"> |
| | | update yeshi_ec_config |
| | |
| | | <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=VARCHAR},</if> |
| | | <if test="minAndroidVersionCode !=null">min_android_version |
| | | =#{minAndroidVersionCode,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="minIosVersionCode !=null">min_ios_version =#{minIosVersionCode,jdbcType=INTEGER}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | <?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="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>
|
| | | <?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="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" /> |
| | | <result column="min_version" property="minVersion" jdbcType="INTEGER" /> |
| | | <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,min_version |
| | | </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,min_version) |
| | | values |
| | | (#{id,jdbcType=BIGINT}, #{system.id,jdbcType=BIGINT}, |
| | | #{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, |
| | | #{name,jdbcType=VARCHAR}, |
| | | #{updatetime,jdbcType=BIGINT},#{minVersion,jdbcType=INTEGER}) |
| | | </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> |
| | | <if test="minVersion != null">min_version,</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> |
| | | <if test="minVersion != null">#{minVersion,jdbcType=INTEGER}</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} ,min_version |
| | | =#{minVersion,jdbcType=INTEGER} 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> |
| | | <if test="minVersion !=null">min_version =#{minVersion,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listBySystemIdAndMinVersion" resultMap="BaseResultMap"> |
| | | SELECT * FROM ( |
| | | SELECT * FROM |
| | | yeshi_ec_system_clientparams cp WHERE |
| | | cp.`systemid` = |
| | | #{systemId} |
| | | <if test="minVersion!=null"> |
| | | and #{minVersion}>=min_version |
| | | order by min_version desc |
| | | </if> |
| | | )a group by a.key |
| | | </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> |
| | |
| | |
|
| | | @Cacheable(value = "config", key = "#p0+'Str'")
|
| | | public String get(String key) {
|
| | | List<Config> list = configMapper.listByKey(key);
|
| | | List<Config> list = configMapper.listByKey(key, null, null);
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | String value = list.get(0).getValue();
|
| | | return value;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "config", key = "'getByVersion'+'-'+#key+'-'+#platform+'-'+#version ")
|
| | | public String getByVersion(String key, String platform, int version) {
|
| | | Integer minAndroidVersion = null;
|
| | | Integer minIosVersion = null;
|
| | | if ("android".equalsIgnoreCase(platform)) {
|
| | | minAndroidVersion = version;
|
| | | } else
|
| | | minIosVersion = version;
|
| | |
|
| | | List<Config> list = configMapper.listByKey(key, minAndroidVersion, minIosVersion);
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
| | |
|
| | | @Cacheable(value = "config", key = "#p0")
|
| | | public Config getConfig(String key) {
|
| | | List<Config> list = configMapper.listByKey(key);
|
| | | List<Config> list = configMapper.listByKey(key, null, null);
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public void save(Config config) {
|
| | | List<Config> list = configMapper.listByKey(config.getKey());
|
| | | List<Config> list = configMapper.listByKey(config.getKey(), null, null);
|
| | | if (list == null || list.size() == 0) {
|
| | | configMapper.insertSelective(config);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Cacheable(value = "config", key = "'getSearchDiscoveryKeys'")
|
| | | @Override
|
| | | public String getSearchDiscoveryKeys() {
|
| | | List<Config> list = configMapper.listByKey("search_discovery_keys");
|
| | | List<Config> list = configMapper.listByKey("search_discovery_keys", null, null);
|
| | | if (list == null || list.size() == 0)
|
| | | return null;
|
| | | |
| | |
|
| | | Config config = list.get(0);
|
| | | if (config == null)
|
| | | return null;
|
| | | |
| | |
|
| | | // 更新
|
| | | updateSearchDiscoveryKeys(config);
|
| | | |
| | |
|
| | | String value = config.getValue();
|
| | | return value;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 更新搜索发现词
|
| | | * |
| | | * @param config
|
| | | */
|
| | | @Async
|
| | | private void updateSearchDiscoveryKeys(Config config) {
|
| | | long currentTime = java.lang.System.currentTimeMillis();
|
| | | |
| | |
|
| | | String createtime = config.getCreatetime();
|
| | | if (!StringUtil.isNullOrEmpty(createtime)) {
|
| | | long diff = currentTime - Long.parseLong(createtime);
|
| | | if (diff < 1000 * 60 * 60) |
| | | if (diff < 1000 * 60 * 60)
|
| | | return; // 超过一个小时更新
|
| | | }
|
| | | |
| | |
|
| | | String hotWords = DaTaoKeApiUtil.getHotWords();
|
| | | if (StringUtil.isNullOrEmpty(hotWords))
|
| | | return ;
|
| | | |
| | | return;
|
| | |
|
| | | config.setValue(hotWords);
|
| | | config.setCreatetime(currentTime + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | |
| | |
|
| | | @Cacheable(value = "clientParamCache", key = "#systemId+'-'+#version")
|
| | | public List<SystemClientParams> getSystemClientParamsBySystemId(long systemId, int version) {
|
| | | return systemClientParamsMapper.listBySystemId(systemId);
|
| | | |
| | | return systemClientParamsMapper.listBySystemIdAndMinVersion(systemId,version);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | void save(Config config);
|
| | |
|
| | | String get(String string);
|
| | | |
| | | String getByVersion(String key,String platform,int version);
|
| | |
|
| | | Config getConfig(String key);
|
| | |
|