Commit 98478996 authored by 姬鋆屾's avatar 姬鋆屾
parents 2289c0bf 4c816ee1
package com.mortals.xhx.module.bussinesscard.service.impl; package com.mortals.xhx.module.bussinesscard.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
...@@ -14,6 +15,7 @@ import com.mortals.xhx.module.position.model.PositionEntity; ...@@ -14,6 +15,7 @@ import com.mortals.xhx.module.position.model.PositionEntity;
import com.mortals.xhx.module.position.service.PositionService; import com.mortals.xhx.module.position.service.PositionService;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
...@@ -26,6 +28,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -26,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -70,6 +73,21 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc ...@@ -70,6 +73,21 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc
entity.setCompanyName(companyEntity.getCompanyName()); entity.setCompanyName(companyEntity.getCompanyName());
} }
} }
checkSetting(entity);
if(entity.getPositionId()!=null){
PositionEntity positionEntity = positionService.get(entity.getPositionId());
if(positionEntity!=null){
entity.setPositionName(positionEntity.getPositionName());
}
}
StaffEntity staffEntity = staffService.getCache(String.valueOf(entity.getStaffId()));
if(staffEntity!=null){
entity.setStaffName(staffEntity.getName());
entity.setStaffStatus(staffEntity.getStaffStatus());
}
}
private void checkSetting(BussinesscardEntity entity){
if(StringUtils.isEmpty(entity.getSetting())){ if(StringUtils.isEmpty(entity.getSetting())){
JSONObject setting = new JSONObject(); JSONObject setting = new JSONObject();
setting.put("photoPath",true); setting.put("photoPath",true);
...@@ -81,18 +99,41 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc ...@@ -81,18 +99,41 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc
setting.put("companyIntro",true); setting.put("companyIntro",true);
setting.put("companyProduct",true); setting.put("companyProduct",true);
setting.put("txtColor","#FFFFFF"); setting.put("txtColor","#FFFFFF");
setting.put("companyNews",true);
entity.setSetting(setting.toJSONString()); entity.setSetting(setting.toJSONString());
} }else {
if(entity.getPositionId()!=null){ JSONObject setting = JSONObject.parseObject(entity.getSetting());
PositionEntity positionEntity = positionService.get(entity.getPositionId()); if(!setting.containsKey("photoPath")){
if(positionEntity!=null){ setting.put("photoPath",true);
entity.setPositionName(positionEntity.getPositionName());
} }
} if(!setting.containsKey("companyName")){
StaffEntity staffEntity = staffService.getCache(String.valueOf(entity.getStaffId())); setting.put("companyName",true);
if(staffEntity!=null){ }
entity.setStaffName(staffEntity.getName()); if(!setting.containsKey("positionName")){
entity.setStaffStatus(staffEntity.getStaffStatus()); setting.put("positionName",true);
}
if(!setting.containsKey("phoneNumber")){
setting.put("phoneNumber",true);
}
if(!setting.containsKey("email")){
setting.put("email",true);
}
if(!setting.containsKey("companyAdress")){
setting.put("companyAdress",true);
}
if(!setting.containsKey("companyIntro")){
setting.put("companyIntro",true);
}
if(!setting.containsKey("companyProduct")){
setting.put("companyProduct",true);
}
if(!setting.containsKey("txtColor")){
setting.put("txtColor","#FFFFFF");
}
if(!setting.containsKey("companyNews")){
setting.put("companyNews",true);
}
entity.setSetting(setting.toJSONString());
} }
} }
...@@ -116,6 +157,7 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc ...@@ -116,6 +157,7 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc
}else { }else {
entity.setFavoriteStatus(0); entity.setFavoriteStatus(0);
} }
checkSetting(entity);
} }
return entity; return entity;
} }
...@@ -146,4 +188,14 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc ...@@ -146,4 +188,14 @@ public class BussinesscardServiceImpl extends AbstractCRUDServiceImpl<Bussinessc
} }
} }
} }
@Override
protected void findAfter(BussinesscardEntity params, PageInfo pageInfo, Context context, List<BussinesscardEntity> list) throws AppException {
super.findAfter(params, pageInfo, context, list);
if(CollectionUtils.isNotEmpty(list)){
for (BussinesscardEntity item:list){
checkSetting(item);
}
}
}
} }
\ No newline at end of file
...@@ -88,6 +88,10 @@ public class NewsEntity extends NewsVo { ...@@ -88,6 +88,10 @@ public class NewsEntity extends NewsVo {
* 关联公司 * 关联公司
*/ */
private String relatedCompany; private String relatedCompany;
/**
* 视频地址
*/
private String videoUrl;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -122,5 +126,6 @@ public class NewsEntity extends NewsVo { ...@@ -122,5 +126,6 @@ public class NewsEntity extends NewsVo {
this.source = ""; this.source = "";
this.remark = ""; this.remark = "";
this.relatedCompany = ""; this.relatedCompany = "";
this.videoUrl = "";
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.news.model.NewsEntity; ...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.news.model.NewsEntity;
* 新闻查询对象 * 新闻查询对象
* *
* @author zxfei * @author zxfei
* @date 2025-01-08 * @date 2025-01-09
*/ */
public class NewsQuery extends NewsEntity { public class NewsQuery extends NewsEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -213,6 +213,11 @@ public class NewsQuery extends NewsEntity { ...@@ -213,6 +213,11 @@ public class NewsQuery extends NewsEntity {
/** 关联公司排除列表 */ /** 关联公司排除列表 */
private List <String> relatedCompanyNotList; private List <String> relatedCompanyNotList;
/** 视频地址 */
private List<String> videoUrlList;
/** 视频地址排除列表 */
private List <String> videoUrlNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<NewsQuery> orConditionList; private List<NewsQuery> orConditionList;
...@@ -1366,6 +1371,38 @@ public class NewsQuery extends NewsEntity { ...@@ -1366,6 +1371,38 @@ public class NewsQuery extends NewsEntity {
this.relatedCompanyNotList = relatedCompanyNotList; this.relatedCompanyNotList = relatedCompanyNotList;
} }
/**
* 获取 视频地址
* @return videoUrlList
*/
public List<String> getVideoUrlList(){
return this.videoUrlList;
}
/**
* 设置 视频地址
* @param videoUrlList
*/
public void setVideoUrlList(List<String> videoUrlList){
this.videoUrlList = videoUrlList;
}
/**
* 获取 视频地址
* @return videoUrlNotList
*/
public List<String> getVideoUrlNotList(){
return this.videoUrlNotList;
}
/**
* 设置 视频地址
* @param videoUrlNotList
*/
public void setVideoUrlNotList(List<String> videoUrlNotList){
this.videoUrlNotList = videoUrlNotList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -2045,6 +2082,25 @@ public class NewsQuery extends NewsEntity { ...@@ -2045,6 +2082,25 @@ public class NewsQuery extends NewsEntity {
return this; return this;
} }
/**
* 设置 视频地址
* @param videoUrl
*/
public NewsQuery videoUrl(String videoUrl){
setVideoUrl(videoUrl);
return this;
}
/**
* 设置 视频地址
* @param videoUrlList
*/
public NewsQuery videoUrlList(List<String> videoUrlList){
this.videoUrlList = videoUrlList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
package com.mortals.xhx.module.news.service.impl; package com.mortals.xhx.module.news.service.impl;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
...@@ -24,10 +25,7 @@ import com.mortals.xhx.module.news.dao.NewsDao; ...@@ -24,10 +25,7 @@ import com.mortals.xhx.module.news.dao.NewsDao;
import com.mortals.xhx.module.news.service.NewsService; import com.mortals.xhx.module.news.service.NewsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -57,6 +55,12 @@ public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity ...@@ -57,6 +55,12 @@ public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity
@Value("${domain.name:https://oa.xinhx.co}") @Value("${domain.name:https://oa.xinhx.co}")
private String domain; private String domain;
@Override
protected NewsEntity findBefore(NewsEntity params, PageInfo pageInfo, Context context) throws AppException {
params.setOrderColList(Arrays.asList(new OrderCol("publishTime", OrderCol.DESCENDING)));
return params;
}
@Override @Override
protected void findAfter(NewsEntity params, PageInfo pageInfo, Context context, List<NewsEntity> list) throws AppException { protected void findAfter(NewsEntity params, PageInfo pageInfo, Context context, List<NewsEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<result property="source" column="source" /> <result property="source" column="source" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="relatedCompany" column="relatedCompany" /> <result property="relatedCompany" column="relatedCompany" />
<result property="videoUrl" column="videoUrl" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
...@@ -98,23 +99,26 @@ ...@@ -98,23 +99,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('relatedCompany') or colPickMode == 1 and data.containsKey('relatedCompany')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('relatedCompany') or colPickMode == 1 and data.containsKey('relatedCompany')))">
a.relatedCompany, a.relatedCompany,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('videoUrl') or colPickMode == 1 and data.containsKey('videoUrl')))">
a.videoUrl,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="NewsEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="NewsEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_news insert into mortals_xhx_news
(categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark,relatedCompany) (categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark,relatedCompany,videoUrl)
VALUES VALUES
(#{categoryId},#{categoryName},#{title},#{titleLogoPath},#{content},#{top},#{viewNums},#{publishTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{upNums},#{editor},#{shareNums},#{deptId},#{deptName},#{statement},#{source},#{remark},#{relatedCompany}) (#{categoryId},#{categoryName},#{title},#{titleLogoPath},#{content},#{top},#{viewNums},#{publishTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{upNums},#{editor},#{shareNums},#{deptId},#{deptName},#{statement},#{source},#{remark},#{relatedCompany},#{videoUrl})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_news insert into mortals_xhx_news
(categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark,relatedCompany) (categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark,relatedCompany,videoUrl)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.categoryId},#{item.categoryName},#{item.title},#{item.titleLogoPath},#{item.content},#{item.top},#{item.viewNums},#{item.publishTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.upNums},#{item.editor},#{item.shareNums},#{item.deptId},#{item.deptName},#{item.statement},#{item.source},#{item.remark},#{item.relatedCompany}) (#{item.categoryId},#{item.categoryName},#{item.title},#{item.titleLogoPath},#{item.content},#{item.top},#{item.viewNums},#{item.publishTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.upNums},#{item.editor},#{item.shareNums},#{item.deptId},#{item.deptName},#{item.statement},#{item.source},#{item.remark},#{item.relatedCompany},#{item.videoUrl})
</foreach> </foreach>
</insert> </insert>
...@@ -211,6 +215,9 @@ ...@@ -211,6 +215,9 @@
<if test="(colPickMode==0 and data.containsKey('relatedCompany')) or (colPickMode==1 and !data.containsKey('relatedCompany'))"> <if test="(colPickMode==0 and data.containsKey('relatedCompany')) or (colPickMode==1 and !data.containsKey('relatedCompany'))">
a.relatedCompany=#{data.relatedCompany}, a.relatedCompany=#{data.relatedCompany},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('videoUrl')) or (colPickMode==1 and !data.containsKey('videoUrl'))">
a.videoUrl=#{data.videoUrl},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -410,6 +417,13 @@ ...@@ -410,6 +417,13 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="videoUrl=(case" suffix="ELSE videoUrl end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('videoUrl')) or (colPickMode==1 and !item.containsKey('videoUrl'))">
when a.id=#{item.id} then #{item.videoUrl}
</if>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -1028,6 +1042,27 @@ ...@@ -1028,6 +1042,27 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('videoUrl')">
<if test="conditionParamRef.videoUrl != null and conditionParamRef.videoUrl != ''">
${_conditionType_} a.videoUrl like #{${_conditionParam_}.videoUrl}
</if>
<if test="conditionParamRef.videoUrl == null">
${_conditionType_} a.videoUrl is null
</if>
</if>
<if test="conditionParamRef.containsKey('videoUrlList') and conditionParamRef.videoUrlList.size() > 0">
${_conditionType_} a.videoUrl in
<foreach collection="conditionParamRef.videoUrlList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('videoUrlNotList') and conditionParamRef.videoUrlNotList.size() > 0">
${_conditionType_} a.videoUrl not in
<foreach collection="conditionParamRef.videoUrlNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -1277,6 +1312,11 @@ ...@@ -1277,6 +1312,11 @@
<if test='orderCol.relatedCompany != null and "DESC".equalsIgnoreCase(orderCol.relatedCompany)'>DESC</if> <if test='orderCol.relatedCompany != null and "DESC".equalsIgnoreCase(orderCol.relatedCompany)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('videoUrl')">
a.videoUrl
<if test='orderCol.videoUrl != null and "DESC".equalsIgnoreCase(orderCol.videoUrl)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment