add new columns
This commit is contained in:
parent
0330592c7c
commit
1be38d2d80
|
|
@ -215,6 +215,46 @@ public class AdminUserController {
|
|||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
return adminUserService.create(name, phone);
|
||||
return adminUserService.create(name, phone, adminUserCreateDTO.getUserType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理后台创建用户接口
|
||||
*
|
||||
* @param token 登陆Token
|
||||
* @param adminUserCreateDTO 要创建的用户昵称及手机号
|
||||
* @return 创建结果
|
||||
*/
|
||||
@PostMapping("/h5")
|
||||
public ResultObject<Void> createH5User(@RequestHeader("auth-token") String token,
|
||||
@RequestParam(value = "phone", required = true) String phone) {
|
||||
if (!StringUtils.hasText(token)) {
|
||||
return ResultObject.failed("登陆Token为空!");
|
||||
}
|
||||
|
||||
if (!StringUtils.hasText(phone)) {
|
||||
return ResultObject.failed("手机号不可为空!");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminUser adminUser = AdminJwtService.parseToken(token);
|
||||
if (adminUser == null) {
|
||||
log.warn("解析token {}拿不到AdminUser对象!", token);
|
||||
return ResultObject.failed("登陆Token有误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (!adminUser.isActive()) {
|
||||
log.warn("当前用户已被封禁! id = {}", adminUser.getId());
|
||||
return ResultObject.failed("当前用户已被封禁!请联系系统管理员!");
|
||||
}
|
||||
|
||||
log.info("path: /admin/user/h5, method: POST, request user id: {}, name: {}, phone: {}",
|
||||
adminUser.getId(), adminUser.getName(), phone);
|
||||
} catch (Exception e) {
|
||||
log.error("解析登陆Token出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
|
||||
}
|
||||
|
||||
return adminUserService.createH5User(phone);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,15 +59,22 @@ public interface AdminUserMapper {
|
|||
void delete(@Param("id") long id);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into admin_user(phone, create_time, update_time" +
|
||||
"insert into admin_user(phone, password, userType, create_time, update_time" +
|
||||
"<if test=\"name != null and !name.isEmpty()\">" +
|
||||
", name" +
|
||||
"</if>" +
|
||||
") values (#{phone}, now(), now()" +
|
||||
") values (#{phone}, #{password},#{userType}, now(), now()" +
|
||||
"<if test=\"name != null and !name.isEmpty()\">" +
|
||||
", #{name}" +
|
||||
"</if>" +
|
||||
")" +
|
||||
"</script>")
|
||||
void create(@Param("name") String name, @Param("phone") String phone);
|
||||
void create(@Param("name") String name, @Param("phone") String phone, @Param("password") String password, @Param("userType") String userType);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into allowlist_detail(mobile, create_time, update_time" +
|
||||
") values (#{phone}, now(), now()" +
|
||||
")" +
|
||||
"</script>")
|
||||
void createH5User(@Param("phone") String phone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ public class AdminUserCreateDTO {
|
|||
* 用户手机号 不可为空
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
private String userType;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
@ -30,4 +32,12 @@ public class AdminUserCreateDTO {
|
|||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
|
@ -245,7 +246,7 @@ public class AdminUserService {
|
|||
return ResultObject.success();
|
||||
}
|
||||
|
||||
public ResultObject<Void> create(String name, String phone) {
|
||||
public ResultObject<Void> create(String name, String phone, String userType) {
|
||||
try {
|
||||
AdminUser adminUser = adminUserMapper.getAdminUserByPhone(phone);
|
||||
if (adminUser != null) {
|
||||
|
|
@ -256,9 +257,11 @@ public class AdminUserService {
|
|||
log.error("根据手机号查询用户出错!", e);
|
||||
return ResultObject.failed(500, "服务端错误!请联系系统管理员!");
|
||||
}
|
||||
|
||||
if (ObjectUtils.isEmpty(userType)) {
|
||||
userType = "00";
|
||||
}
|
||||
try {
|
||||
adminUserMapper.create(name, phone);
|
||||
adminUserMapper.create(name, phone, "111111", userType);
|
||||
} catch (Exception e) {
|
||||
log.error("注册用户报错!", e);
|
||||
return ResultObject.failed(500, "服务端错误!请联系系统管理员!");
|
||||
|
|
@ -293,4 +296,14 @@ public class AdminUserService {
|
|||
private static String getLoginLockKey(String phone) {
|
||||
return REDIS_LOGIN_LOCK_KEY + phone;
|
||||
}
|
||||
|
||||
public ResultObject<Void> createH5User(String phone) {
|
||||
try {
|
||||
adminUserMapper.createH5User(phone);
|
||||
} catch (Exception e) {
|
||||
log.error("注册用户报错!", e);
|
||||
return ResultObject.failed(500, "服务端错误!请联系系统管理员!");
|
||||
}
|
||||
return ResultObject.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ public interface NewsMapper {
|
|||
void saveDraft(NewsDraft newsDraft);
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status, publish_time, content_text, newsinfo_id, llm_title, llm_content, rating)" +
|
||||
"values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status}, #{publishTime}, #{contentText}, #{newsinfoId}, #{llmTitle}, #{llmContent}, #{rating})")
|
||||
@Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status, publish_time, content_text, newsinfo_id, llm_title, llm_content, rating, overseas_event, overseas_macro, china_macro, industry_news, company_news, reprint_source, company_name)" +
|
||||
"values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status}, #{publishTime}, #{contentText}, #{newsinfoId}, #{llmTitle}, #{llmContent}, #{rating}, #{overseasEvent}, #{overseasMacro}, #{chinaMacro}, #{industryNews}, #{companyNews}, #{reprintSource}, #{companyName})")
|
||||
void saveNews(News news);
|
||||
|
||||
@Select("<script>" +
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Result;
|
|||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import com.jinrui.reference.core.model.entity.News;
|
||||
import com.jinrui.reference.core.model.entity.NewsTags;
|
||||
import com.jinrui.reference.core.typehandler.JsonArrayTypeHandler;
|
||||
|
||||
|
|
@ -31,6 +30,13 @@ public interface NewsTagsMapper {
|
|||
@Result(column = "deleted", property = "deleted"),
|
||||
@Result(column = "create_time", property = "createTime"),
|
||||
@Result(column = "update_time", property = "updateTime"),
|
||||
@Result(column = "overseas_event", property = "overseasEvent"),
|
||||
@Result(column = "overseas_macro", property = "overseasMacro"),
|
||||
@Result(column = "china_macro", property = "chinaMacro"),
|
||||
@Result(column = "industry_news", property = "industryNews"),
|
||||
@Result(column = "company_news", property = "companyNews"),
|
||||
@Result(column = "reprint_source", property = "reprintSource"),
|
||||
@Result(column = "company_name", property = "companyName"),
|
||||
})
|
||||
@Select("select * from news_tags where newsinfo_id = #{newsId}")
|
||||
NewsTags getNewsTagsByNewsId(@Param("newsId") String newsId);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.jinrui.reference.core.model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.jinrui.reference.core.model.dto.news.SaveNewsDTO;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -87,6 +88,20 @@ public class News {
|
|||
private Byte rating;
|
||||
|
||||
private String revision;
|
||||
|
||||
private Boolean overseasEvent;
|
||||
|
||||
private Boolean overseasMacro;
|
||||
|
||||
private Boolean chinaMacro;
|
||||
|
||||
private Boolean industryNews;
|
||||
|
||||
private Boolean companyNews;
|
||||
|
||||
private String reprintSource;
|
||||
|
||||
private String companyName;
|
||||
|
||||
public News() {}
|
||||
|
||||
|
|
@ -267,4 +282,60 @@ public class News {
|
|||
public String getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
public Boolean getOverseasEvent() {
|
||||
return overseasEvent;
|
||||
}
|
||||
|
||||
public void setOverseasEvent(Boolean overseasEvent) {
|
||||
this.overseasEvent = overseasEvent;
|
||||
}
|
||||
|
||||
public Boolean getOverseasMacro() {
|
||||
return overseasMacro;
|
||||
}
|
||||
|
||||
public void setOverseasMacro(Boolean overseasMacro) {
|
||||
this.overseasMacro = overseasMacro;
|
||||
}
|
||||
|
||||
public Boolean getChinaMacro() {
|
||||
return chinaMacro;
|
||||
}
|
||||
|
||||
public void setChinaMacro(Boolean chinaMacro) {
|
||||
this.chinaMacro = chinaMacro;
|
||||
}
|
||||
|
||||
public Boolean getIndustryNews() {
|
||||
return industryNews;
|
||||
}
|
||||
|
||||
public void setIndustryNews(Boolean industryNews) {
|
||||
this.industryNews = industryNews;
|
||||
}
|
||||
|
||||
public Boolean getCompanyNews() {
|
||||
return companyNews;
|
||||
}
|
||||
|
||||
public void setCompanyNews(Boolean companyNews) {
|
||||
this.companyNews = companyNews;
|
||||
}
|
||||
|
||||
public String getReprintSource() {
|
||||
return reprintSource;
|
||||
}
|
||||
|
||||
public void setReprintSource(String reprintSource) {
|
||||
this.reprintSource = reprintSource;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public class NewsInfo {
|
|||
|
||||
@JsonProperty("news_tags")
|
||||
private NewsTags newsTags;
|
||||
|
||||
|
||||
public NewsInfo() {}
|
||||
|
||||
public String getId() {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,27 @@ public class NewsTags {
|
|||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
private Date updateTime;
|
||||
|
||||
@JsonProperty("overseas_event")
|
||||
private Boolean overseasEvent;
|
||||
|
||||
@JsonProperty("overseas_macro")
|
||||
private Boolean overseasMacro;
|
||||
|
||||
@JsonProperty("china_macro")
|
||||
private Boolean chinaMacro;
|
||||
|
||||
@JsonProperty("industry_news")
|
||||
private Boolean industryNews;
|
||||
|
||||
@JsonProperty("company_news")
|
||||
private Boolean companyNews;
|
||||
|
||||
@JsonProperty("reprint_source")
|
||||
private String reprintSource;
|
||||
|
||||
@JsonProperty("company_name")
|
||||
private String companyName;
|
||||
|
||||
public List<Double> getIndustryScore() {
|
||||
return industryScore;
|
||||
}
|
||||
|
|
@ -217,4 +238,60 @@ public class NewsTags {
|
|||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Boolean getOverseasEvent() {
|
||||
return overseasEvent;
|
||||
}
|
||||
|
||||
public void setOverseasEvent(Boolean overseasEvent) {
|
||||
this.overseasEvent = overseasEvent;
|
||||
}
|
||||
|
||||
public Boolean getOverseasMacro() {
|
||||
return overseasMacro;
|
||||
}
|
||||
|
||||
public void setOverseasMacro(Boolean overseasMacro) {
|
||||
this.overseasMacro = overseasMacro;
|
||||
}
|
||||
|
||||
public Boolean getChinaMacro() {
|
||||
return chinaMacro;
|
||||
}
|
||||
|
||||
public void setChinaMacro(Boolean chinaMacro) {
|
||||
this.chinaMacro = chinaMacro;
|
||||
}
|
||||
|
||||
public Boolean getIndustryNews() {
|
||||
return industryNews;
|
||||
}
|
||||
|
||||
public void setIndustryNews(Boolean industryNews) {
|
||||
this.industryNews = industryNews;
|
||||
}
|
||||
|
||||
public Boolean getCompanyNews() {
|
||||
return companyNews;
|
||||
}
|
||||
|
||||
public void setCompanyNews(Boolean companyNews) {
|
||||
this.companyNews = companyNews;
|
||||
}
|
||||
|
||||
public String getReprintSource() {
|
||||
return reprintSource;
|
||||
}
|
||||
|
||||
public void setReprintSource(String reprintSource) {
|
||||
this.reprintSource = reprintSource;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,13 @@ public class NewsInfoService {
|
|||
relNews.setLlmTitle(llmTitle);
|
||||
String llmContent = Optional.ofNullable(newsTags.getRewriteContent()).filter(s -> !s.isEmpty()).orElse(relNews.getContent());
|
||||
relNews.setLlmContent(llmContent);
|
||||
relNews.setOverseasEvent(newsTags.getOverseasEvent());
|
||||
relNews.setOverseasMacro(newsTags.getOverseasMacro());
|
||||
relNews.setChinaMacro(newsTags.getChinaMacro());
|
||||
relNews.setIndustryNews(newsTags.getIndustryNews());
|
||||
relNews.setCompanyNews(newsTags.getCompanyNews());
|
||||
relNews.setReprintSource(newsTags.getReprintSource());
|
||||
relNews.setCompanyName(newsTags.getCompanyName());
|
||||
}
|
||||
newsMapper.saveNews(relNews);
|
||||
saveNewsRel(id, relNews.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue