From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java | 314 ++++++++++++++++++++++++++-------------------------- 1 files changed, 157 insertions(+), 157 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java index 399339e..52d44f5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java @@ -1,157 +1,157 @@ -package com.yeshi.fanli.service.impl.msg; - -import java.util.Date; - -import javax.annotation.Resource; - -import com.yeshi.fanli.entity.SystemEnum; -import org.springframework.stereotype.Service; - -import com.google.gson.Gson; -import com.yeshi.fanli.dto.msg.MsgCommonDTO; -import com.yeshi.fanli.entity.common.Config; -import com.yeshi.fanli.exception.config.ConfigException; -import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; -import com.yeshi.fanli.service.inter.config.ConfigService; -import com.yeshi.fanli.service.inter.msg.MsgConfigService; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.StringUtil; - -@Service -public class MsgConfigServiceImpl implements MsgConfigService { - - @Resource - private ConfigService configService; - - @Resource - private JumpDetailV2Service jumpDetailV2Service; - - @Override - public void addZhuShouMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { - Config value = configService.getConfig(KEY_ZHUSHOU,systemEnum); - if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) - || dto.getShow() == null) - throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); - if (value != null) { - MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - old.setStartTime(dto.getStartTime()); - old.setShow(dto.getShow()); - old.setParams(dto.getParams()); - old.setEndTime(dto.getEndTime()); - old.setContent(dto.getContent()); - if (!StringUtil.Md5(dto.getContent() + "#" + dto.getParams()).equalsIgnoreCase(old.getContentMd5())) { - old.setUpdateTime(new Date()); - } - Config cf = new Config(); - cf.setId(value.getId()); - cf.setValue(new Gson().toJson(old)); - configService.update(cf); - } else { - dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getParams())); - dto.setIcon("http://img.flqapp.com/resource/msg/icon_zhushou.png"); - dto.setTitle(Constant.systemCommonConfig.getProjectChineseName() + "灏忓姪鎵�"); - dto.setUpdateTime(new Date()); - dto.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - Config config = new Config(); - config.setCreatetime(System.currentTimeMillis() + ""); - config.setKey(KEY_ZHUSHOU); - config.setName("娑堟伅-鏉挎牀蹇渷灏忓姪鎵�"); - config.setValue(new Gson().toJson(dto)); - configService.save(config); - } - } - - @Override - public void addGuanXuanMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { - Config value = configService.getConfig(KEY_GUANXUAN,systemEnum); - if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) - || dto.getShow() == null) - throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); - if (value != null) { - MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - old.setStartTime(dto.getStartTime()); - old.setShow(dto.getShow()); - old.setParams(dto.getParams()); - old.setEndTime(dto.getEndTime()); - old.setContent(dto.getContent()); - if (!StringUtil.Md5(dto.getContent() + "#" + dto.getParams()).equalsIgnoreCase(old.getContentMd5())) { - old.setUpdateTime(new Date()); - } - Config cf = new Config(); - cf.setId(value.getId()); - cf.setValue(new Gson().toJson(old)); - configService.update(cf); - } else { - dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getParams())); - dto.setIcon("http://img.flqapp.com/resource/msg/icon_guanxuan.png"); - dto.setTitle("瀹樺浠诲姟"); - dto.setUpdateTime(new Date()); - dto.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - Config config = new Config(); - config.setCreatetime(System.currentTimeMillis() + ""); - config.setKey(KEY_GUANXUAN); - config.setName("娑堟伅-瀹樺浠诲姟"); - config.setValue(new Gson().toJson(dto)); - configService.save(config); - } - } - - @Override - public MsgCommonDTO getZhuShouMsg( SystemEnum systemEnum) { - Config value = configService.getConfig(KEY_ZHUSHOU,systemEnum); - if (value == null) - return null; - return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - } - - @Override - public MsgCommonDTO getGuanXuanMsg( SystemEnum systemEnum) { - Config value = configService.getConfig(KEY_GUANXUAN,systemEnum); - if (value == null) - return null; - return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - } - - @Override - public void addNotifyMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { - Config value = configService.getConfig(KEY_NOTIFY,systemEnum); - if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) - || dto.getShow() == null) - throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); - if (value != null) { - MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - old.setStartTime(dto.getStartTime()); - old.setShow(dto.getShow()); - old.setParams(dto.getParams()); - old.setEndTime(dto.getEndTime()); - old.setContent(dto.getContent()); - if (!StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams()) - .equalsIgnoreCase(old.getContentMd5())) { - old.setUpdateTime(new Date()); - } - old.setPicture(dto.getPicture()); - Config cf = new Config(); - cf.setId(value.getId()); - cf.setValue(new Gson().toJson(old)); - configService.update(cf); - } else { - dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams())); - dto.setUpdateTime(new Date()); - Config config = new Config(); - config.setCreatetime(System.currentTimeMillis() + ""); - config.setKey(KEY_NOTIFY); - config.setName("娑堟伅-澶у浘閫氱煡"); - config.setValue(new Gson().toJson(dto)); - configService.save(config); - } - } - - @Override - public MsgCommonDTO getNotifyMsg(SystemEnum systemEnum) { - Config value = configService.getConfig(KEY_NOTIFY,systemEnum); - if (value == null) - return null; - return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); - } - -} +package com.yeshi.fanli.service.impl.msg; + +import java.util.Date; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.SystemEnum; +import org.springframework.stereotype.Service; + +import com.google.gson.Gson; +import com.yeshi.fanli.dto.msg.MsgCommonDTO; +import com.yeshi.fanli.entity.common.Config; +import com.yeshi.fanli.exception.config.ConfigException; +import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; +import com.yeshi.fanli.service.inter.config.ConfigService; +import com.yeshi.fanli.service.inter.msg.MsgConfigService; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; + +@Service +public class MsgConfigServiceImpl implements MsgConfigService { + + @Resource + private ConfigService configService; + + @Resource + private JumpDetailV2Service jumpDetailV2Service; + + @Override + public void addZhuShouMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { + Config value = configService.getConfig(KEY_ZHUSHOU,systemEnum); + if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) + || dto.getShow() == null) + throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); + if (value != null) { + MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + old.setStartTime(dto.getStartTime()); + old.setShow(dto.getShow()); + old.setParams(dto.getParams()); + old.setEndTime(dto.getEndTime()); + old.setContent(dto.getContent()); + if (!StringUtil.Md5(dto.getContent() + "#" + dto.getParams()).equalsIgnoreCase(old.getContentMd5())) { + old.setUpdateTime(new Date()); + } + Config cf = new Config(); + cf.setId(value.getId()); + cf.setValue(new Gson().toJson(old)); + configService.update(cf); + } else { + dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getParams())); + dto.setIcon("http://img.flqapp.com/resource/msg/icon_zhushou.png"); + dto.setTitle(Constant.systemCommonConfig.getProjectChineseName() + "灏忓姪鎵�"); + dto.setUpdateTime(new Date()); + dto.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",systemEnum)); + Config config = new Config(); + config.setCreatetime(System.currentTimeMillis() + ""); + config.setKey(KEY_ZHUSHOU); + config.setName("娑堟伅-鏉挎牀蹇渷灏忓姪鎵�"); + config.setValue(new Gson().toJson(dto)); + configService.save(config); + } + } + + @Override + public void addGuanXuanMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { + Config value = configService.getConfig(KEY_GUANXUAN,systemEnum); + if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) + || dto.getShow() == null) + throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); + if (value != null) { + MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + old.setStartTime(dto.getStartTime()); + old.setShow(dto.getShow()); + old.setParams(dto.getParams()); + old.setEndTime(dto.getEndTime()); + old.setContent(dto.getContent()); + if (!StringUtil.Md5(dto.getContent() + "#" + dto.getParams()).equalsIgnoreCase(old.getContentMd5())) { + old.setUpdateTime(new Date()); + } + Config cf = new Config(); + cf.setId(value.getId()); + cf.setValue(new Gson().toJson(old)); + configService.update(cf); + } else { + dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getParams())); + dto.setIcon("http://img.flqapp.com/resource/msg/icon_guanxuan.png"); + dto.setTitle("瀹樺浠诲姟"); + dto.setUpdateTime(new Date()); + dto.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",systemEnum)); + Config config = new Config(); + config.setCreatetime(System.currentTimeMillis() + ""); + config.setKey(KEY_GUANXUAN); + config.setName("娑堟伅-瀹樺浠诲姟"); + config.setValue(new Gson().toJson(dto)); + configService.save(config); + } + } + + @Override + public MsgCommonDTO getZhuShouMsg( SystemEnum systemEnum) { + Config value = configService.getConfig(KEY_ZHUSHOU,systemEnum); + if (value == null) + return null; + return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + } + + @Override + public MsgCommonDTO getGuanXuanMsg( SystemEnum systemEnum) { + Config value = configService.getConfig(KEY_GUANXUAN,systemEnum); + if (value == null) + return null; + return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + } + + @Override + public void addNotifyMsg(MsgCommonDTO dto, SystemEnum systemEnum) throws ConfigException { + Config value = configService.getConfig(KEY_NOTIFY,systemEnum); + if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams()) + || dto.getShow() == null) + throw new ConfigException(1, "鍙傛暟涓嶅畬鏁�"); + if (value != null) { + MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + old.setStartTime(dto.getStartTime()); + old.setShow(dto.getShow()); + old.setParams(dto.getParams()); + old.setEndTime(dto.getEndTime()); + old.setContent(dto.getContent()); + if (!StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams()) + .equalsIgnoreCase(old.getContentMd5())) { + old.setUpdateTime(new Date()); + } + old.setPicture(dto.getPicture()); + Config cf = new Config(); + cf.setId(value.getId()); + cf.setValue(new Gson().toJson(old)); + configService.update(cf); + } else { + dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams())); + dto.setUpdateTime(new Date()); + Config config = new Config(); + config.setCreatetime(System.currentTimeMillis() + ""); + config.setKey(KEY_NOTIFY); + config.setName("娑堟伅-澶у浘閫氱煡"); + config.setValue(new Gson().toJson(dto)); + configService.save(config); + } + } + + @Override + public MsgCommonDTO getNotifyMsg(SystemEnum systemEnum) { + Config value = configService.getConfig(KEY_NOTIFY,systemEnum); + if (value == null) + return null; + return new Gson().fromJson(value.getValue(), MsgCommonDTO.class); + } + +} -- Gitblit v1.8.0