|
@@ -4,18 +4,14 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.extra.cglib.CglibUtil;
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.pj.current.dto.PCLoginUserInfo;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.enummj.ReleaseStatus;
|
|
|
import com.pj.tb_port_news.vo.TbPortNewsVo;
|
|
|
-import com.pj.utils.cache.RedisUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
@@ -42,6 +38,12 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
|
|
|
* 增
|
|
|
*/
|
|
|
void add(TbPortNews t) {
|
|
|
+ PCLoginUserInfo userInfo = StpUserUtil.getPCLoginInfo();
|
|
|
+ t.setIsRelease(0)
|
|
|
+ .setStatus(0)
|
|
|
+ .setCreateBy(userInfo.getLoginId())
|
|
|
+ .setCreateName(userInfo.getLoginName())
|
|
|
+ .setCreateTime(new Date());
|
|
|
save(t);
|
|
|
}
|
|
|
|
|
@@ -56,6 +58,10 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
|
|
|
* 改
|
|
|
*/
|
|
|
void update(TbPortNews t) {
|
|
|
+ PCLoginUserInfo userInfo = StpUserUtil.getPCLoginInfo();
|
|
|
+ t.setUpdateBy(userInfo.getLoginId())
|
|
|
+ .setUpdateName(userInfo.getLoginName())
|
|
|
+ .setUpdateTime(new Date());
|
|
|
updateById(t);
|
|
|
|
|
|
}
|
|
@@ -82,11 +88,7 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
|
|
|
*/
|
|
|
int updateRelease(Long id, int isRelease) {
|
|
|
|
|
|
- // 获取当前登录者信息
|
|
|
- String str = RedisUtil.get("pc:" + StpUtil.getLoginIdAsString());
|
|
|
- JSONObject jsonObject = JSONUtil.parseObj(str);
|
|
|
- String loginId = (String) jsonObject.get("loginId");
|
|
|
- String loginName = (String) jsonObject.get("loginName");
|
|
|
+ PCLoginUserInfo userInfo = StpUserUtil.getPCLoginInfo();
|
|
|
// 获取口岸咨询
|
|
|
TbPortNews tbPortNews = tbPortNewsMapper.selectById(id);
|
|
|
// 口岸咨询不存在抛异常
|
|
@@ -95,19 +97,12 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
|
|
|
}
|
|
|
// 口岸咨询被禁用抛异常
|
|
|
if (tbPortNews.getStatus() == DeleteStatus.DELETE_STATUS_OFF.getCode()) {
|
|
|
- throw new RuntimeException("口岸咨询已被禁用");
|
|
|
+ throw new RuntimeException("当前口岸咨询已被禁用,不允许发布!");
|
|
|
}
|
|
|
- // 设置口岸咨询发布状态
|
|
|
- tbPortNews.setIsRelease(isRelease);
|
|
|
- // 设置口岸咨询发布时间
|
|
|
- tbPortNews.setReleaseTime(new Date());
|
|
|
- // 设置口岸咨询更新者id
|
|
|
- tbPortNews.setUpdateBy(loginId);
|
|
|
- // 设置口岸咨询更新者名称
|
|
|
- tbPortNews.setUpdateName(loginName);
|
|
|
- // 更新口岸咨询
|
|
|
- int line = tbPortNewsMapper.updateById(tbPortNews);
|
|
|
- return line;
|
|
|
+ tbPortNews.setIsRelease(isRelease).setReleaseTime(new Date());
|
|
|
+ tbPortNews.setUpdateBy(userInfo.getLoginId()).setUpdateName(userInfo.getLoginName()).setUpdateTime(new Date());
|
|
|
+
|
|
|
+ return tbPortNewsMapper.updateById(tbPortNews);
|
|
|
}
|
|
|
|
|
|
|