Commit bbde52ee by zhiwj

添加字段

parent f7a909c7
......@@ -2,6 +2,7 @@ package com.gic.evaluate.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
......@@ -61,6 +62,7 @@ public class EvaluateReplyDTO implements Serializable {
*
*/
private String userName;
private List<String> imgList;
public Integer getEvaluateReplyId() {
return evaluateReplyId;
......@@ -141,4 +143,12 @@ public class EvaluateReplyDTO implements Serializable {
public void setUserName(String userName) {
this.userName = userName;
}
public void setImgList(List<String> imgList) {
this.imgList = imgList;
}
public List<String> getImgList() {
return imgList;
}
}
package com.gic.evaluate.qo;
import java.io.Serializable;
import java.util.List;
/**
*
* @Description:
* @author zhiwj
* @date 2019-12-10 17:51
*/
public class ExportQO implements Serializable {
private static final long serialVersionUID = -3181637428893459483L;
private String fileName;
private Integer excelExtension;
private List<String> fieldCodeList;
private Integer dataType;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getExcelExtension() {
return excelExtension;
}
public void setExcelExtension(Integer excelExtension) {
this.excelExtension = excelExtension;
}
public List<String> getFieldCodeList() {
return fieldCodeList;
}
public void setFieldCodeList(List<String> fieldCodeList) {
this.fieldCodeList = fieldCodeList;
}
public Integer getDataType() {
return dataType;
}
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
}
......@@ -111,4 +111,15 @@ public interface EvaluateManageApiService {
* @throws
*/
ServiceResponse<List<EvaluateQuickDTO>> listEvaluateQuickReply(Integer enterpriseId, Integer quickReplyType);
/**
* 按个数求
* @Title: countEvaluate
* @Description:
* @author zhiwj
* @param evaluateQO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> countEvaluate(EvaluateQO evaluateQO);
}
package com.gic.evaluate.dao.mapper;
import com.gic.evaluate.entity.TabEvaluateImg;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabEvaluateImgMapper {
/**
* 根据主键删除
*
* @param evaluateImgId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer evaluateImgId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabEvaluateImg record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabEvaluateImg record);
/**
* 根据主键查询
*
* @param evaluateImgId 主键
* @return 实体对象
*/
TabEvaluateImg selectByPrimaryKey(Integer evaluateImgId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabEvaluateImg record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabEvaluateImg record);
List<TabEvaluateImg> listImageByEvaluateId(@Param("evaluateId") Integer evaluateId);
List<TabEvaluateImg> listImageByEvaluateReplyId(@Param("evaluateReplyId") Integer evaluateReplyId);
}
\ No newline at end of file
......@@ -64,6 +64,8 @@ public interface TabEvaluateMapper {
Page<TabEvaluate> listEvaluate(EvaluateQO evaluateQO);
Integer countEvaluate(EvaluateQO evaluateQO);
void updateShowStatus(@Param("enterpriseId") Integer enterpriseId, @Param("evaluateId") List<Integer> evaluateId, @Param("showStatus") Integer showStatus);
void updateTopHotStatus(@Param("enterpriseId") Integer enterpriseId, @Param("evaluateId") Integer evaluateId, @Param("topHotStatus") Integer topHotStatus);
......
package com.gic.evaluate.entity;
import java.util.Date;
/**
* tab_evaluate_img
*/
public class TabEvaluateImg {
/**
*
*/
private Integer evaluateImgId;
/**
*
*/
private Integer enterpriseId;
/**
*
*/
private Integer evaluateId;
/**
*
*/
private Integer evaluateReplyId;
/**
*
*/
private Integer sortNum;
/**
* 图片地址
*/
private String imgUrl;
/**
*
*/
private String fieldCode;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getEvaluateImgId() {
return evaluateImgId;
}
public void setEvaluateImgId(Integer evaluateImgId) {
this.evaluateImgId = evaluateImgId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getEvaluateId() {
return evaluateId;
}
public void setEvaluateId(Integer evaluateId) {
this.evaluateId = evaluateId;
}
public Integer getEvaluateReplyId() {
return evaluateReplyId;
}
public void setEvaluateReplyId(Integer evaluateReplyId) {
this.evaluateReplyId = evaluateReplyId;
}
public Integer getSortNum() {
return sortNum;
}
public void setSortNum(Integer sortNum) {
this.sortNum = sortNum;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getFieldCode() {
return fieldCode;
}
public void setFieldCode(String fieldCode) {
this.fieldCode = fieldCode;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.evaluate.service;
import com.gic.evaluate.entity.TabEvaluateImg;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-01-02 11:10
*/
public interface EvaluateImgService {
List<TabEvaluateImg> listImageByEvaluateId(Integer evaluateId);
List<TabEvaluateImg> listImageByEvaluateReplyId(Integer evaluateReplyId);
void saveList(Integer enterpriseId, Integer evaluateId, List<String> imgUrlList);
void saveList(Integer enterpriseId, Integer evaluateId, Integer evaluateReplyId, List<String> imgUrlList);
}
......@@ -20,6 +20,8 @@ import java.util.Set;
public interface EvaluateService {
Page<TabEvaluate> listEvaluate(EvaluateQO evaluateQO);
Integer countEvaluate(EvaluateQO evaluateQO);
TabEvaluate getEvaluate(Integer enterpriseId, Integer evaluateId);
void saveEvaluate(EvaluateDTO evaluateDTO);
......@@ -67,4 +69,5 @@ public interface EvaluateService {
List<Integer> listAllEvaluateId(Integer enterpriseId);
Set<Integer> getStoreIdHasTopHot(Integer enterpriseId, List<Integer> storeIdList);
}
package com.gic.evaluate.service.impl;
import com.gic.evaluate.constant.Constants;
import com.gic.evaluate.dao.mapper.TabEvaluateImgMapper;
import com.gic.evaluate.entity.TabEvaluateImg;
import com.gic.evaluate.service.EvaluateImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-01-15 10:20
*/
@Service
public class EvaluateImgServiceImpl implements EvaluateImgService {
@Autowired
private TabEvaluateImgMapper tabEvaluateImgMapper;
@Override
public List<TabEvaluateImg> listImageByEvaluateId(Integer evaluateId) {
return tabEvaluateImgMapper.listImageByEvaluateId(evaluateId);
}
@Override
public List<TabEvaluateImg> listImageByEvaluateReplyId(Integer evaluateReplyId) {
return tabEvaluateImgMapper.listImageByEvaluateReplyId(evaluateReplyId);
}
@Override
public void saveList(Integer enterpriseId, Integer problemId, List<String> imgUrlList) {
this.saveList(enterpriseId, problemId, null, imgUrlList);
}
@Override
public void saveList(Integer enterpriseId, Integer problemId, Integer problemReplyId, List<String> imgUrlList) {
for (int i = 0; i < imgUrlList.size(); i++) {
TabEvaluateImg tabProblemImg = new TabEvaluateImg();
tabProblemImg.setEnterpriseId(enterpriseId);
tabProblemImg.setEvaluateId(problemId);
tabProblemImg.setEvaluateReplyId(problemReplyId);
tabProblemImg.setSortNum(i);
tabProblemImg.setImgUrl(imgUrlList.get(i));
tabProblemImg.setStatus(Constants.OPEN);
tabProblemImg.setCreateTime(new Date());
tabEvaluateImgMapper.insertSelective(tabProblemImg);
}
}
}
......@@ -53,6 +53,20 @@ public class EvaluateServiceImpl implements EvaluateService {
}
@Override
public Integer countEvaluate(EvaluateQO evaluateQO) {
if (evaluateQO.getGoodsType() != null) {
evaluateQO.setGoodsCompute(ComputeEnum.parseCodeToCompute(evaluateQO.getGoodsType()));
}
if (evaluateQO.getStoreType() != null) {
evaluateQO.setStoreCompute(ComputeEnum.parseCodeToCompute(evaluateQO.getStoreType()));
}
if (evaluateQO.getServiceType() != null) {
evaluateQO.setServiceCompute(ComputeEnum.parseCodeToCompute(evaluateQO.getServiceType()));
}
return tabEvaluateMapper.countEvaluate(evaluateQO);
}
@Override
public TabEvaluate getEvaluate(Integer enterpriseId, Integer evaluateId) {
TabEvaluate evaluate = this.tabEvaluateMapper.selectByPrimaryKey(evaluateId);
if (evaluate != null && Constants.NORMAL_STATUS.equals(evaluate.getStatus()) && evaluate.getEnterpriseId().equals(enterpriseId)) {
......
......@@ -11,14 +11,9 @@ import com.gic.evaluate.dto.EvaluateDTO;
import com.gic.evaluate.dto.EvaluateQuickDTO;
import com.gic.evaluate.dto.EvaluateReplyDTO;
import com.gic.evaluate.dto.UserReplyDTO;
import com.gic.evaluate.entity.TabEvaluate;
import com.gic.evaluate.entity.TabEvaluateQuick;
import com.gic.evaluate.entity.TabEvaluateReply;
import com.gic.evaluate.entity.*;
import com.gic.evaluate.qo.EvaluateQO;
import com.gic.evaluate.service.EvaluateManageApiService;
import com.gic.evaluate.service.EvaluateQuickService;
import com.gic.evaluate.service.EvaluateReplyService;
import com.gic.evaluate.service.EvaluateService;
import com.gic.evaluate.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -42,6 +37,8 @@ public class EvaluateManageApiServiceImpl implements EvaluateManageApiService {
private EvaluateReplyService evaluateReplyService;
@Autowired
private EvaluateQuickService evaluateQuickService;
@Autowired
private EvaluateImgService evaluateImgService;
@Override
public ServiceResponse<Page<EvaluateDTO>> listEvaluateForManage(EvaluateQO evaluateQO) {
......@@ -67,6 +64,11 @@ public class EvaluateManageApiServiceImpl implements EvaluateManageApiService {
EvaluateDTO evaluateDTO = EntityUtil.changeEntityByJSON(EvaluateDTO.class, evaluate);
List<TabEvaluateReply> tabReplyList = evaluateReplyService.listEvaluateReply(enterpriseId, evaluateId);
List<EvaluateReplyDTO> replyDTOList = EntityUtil.changeEntityListByJSON(EvaluateReplyDTO.class, tabReplyList);
for (EvaluateReplyDTO evaluateReplyDTO : replyDTOList) {
List<TabEvaluateImg> tabEvaluateImgs = evaluateImgService.listImageByEvaluateReplyId(evaluateReplyDTO.getEvaluateReplyId());
List<String> replyImgList = Optional.ofNullable(tabEvaluateImgs).orElse(Collections.emptyList()).stream().map(TabEvaluateImg::getImgUrl).collect(Collectors.toList());
evaluateReplyDTO.setImgList(replyImgList);
}
evaluateDTO.setReplyList(replyDTOList);
return EnterpriseServiceResponse.success(evaluateDTO);
}
......@@ -144,4 +146,10 @@ public class EvaluateManageApiServiceImpl implements EvaluateManageApiService {
return EnterpriseServiceResponse.success(EntityUtil.changeEntityListByJSON(EvaluateQuickDTO.class, evaluateQuickList));
}
@Override
public ServiceResponse<Integer> countEvaluate(EvaluateQO evaluateQO) {
Integer count = evaluateService.countEvaluate(evaluateQO);
return EnterpriseServiceResponse.success(count);
}
}
<?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.gic.evaluate.dao.mapper.TabEvaluateImgMapper">
<resultMap id="BaseResultMap" type="com.gic.evaluate.entity.TabEvaluateImg">
<id column="evaluate_img_id" jdbcType="INTEGER" property="evaluateImgId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="evaluate_id" jdbcType="INTEGER" property="evaluateId" />
<result column="evaluate_reply_id" jdbcType="INTEGER" property="evaluateReplyId" />
<result column="sort_num" jdbcType="INTEGER" property="sortNum" />
<result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
<result column="field_code" jdbcType="VARCHAR" property="fieldCode" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
evaluate_img_id, enterprise_id, evaluate_id, evaluate_reply_id, sort_num, img_url,
field_code, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_evaluate_img
where evaluate_img_id = #{evaluateImgId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_evaluate_img
where evaluate_img_id = #{evaluateImgId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.evaluate.entity.TabEvaluateImg">
insert into tab_evaluate_img (evaluate_img_id, enterprise_id, evaluate_id,
evaluate_reply_id, sort_num, img_url,
field_code, status, create_time,
update_time)
values (#{evaluateImgId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{evaluateId,jdbcType=INTEGER},
#{evaluateReplyId,jdbcType=INTEGER}, #{sortNum,jdbcType=INTEGER}, #{imgUrl,jdbcType=VARCHAR},
#{fieldCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.evaluate.entity.TabEvaluateImg">
insert into tab_evaluate_img
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="evaluateImgId != null">
evaluate_img_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="evaluateId != null">
evaluate_id,
</if>
<if test="evaluateReplyId != null">
evaluate_reply_id,
</if>
<if test="sortNum != null">
sort_num,
</if>
<if test="imgUrl != null">
img_url,
</if>
<if test="fieldCode != null">
field_code,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="evaluateImgId != null">
#{evaluateImgId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="evaluateId != null">
#{evaluateId,jdbcType=INTEGER},
</if>
<if test="evaluateReplyId != null">
#{evaluateReplyId,jdbcType=INTEGER},
</if>
<if test="sortNum != null">
#{sortNum,jdbcType=INTEGER},
</if>
<if test="imgUrl != null">
#{imgUrl,jdbcType=VARCHAR},
</if>
<if test="fieldCode != null">
#{fieldCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.evaluate.entity.TabEvaluateImg">
update tab_evaluate_img
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="evaluateId != null">
evaluate_id = #{evaluateId,jdbcType=INTEGER},
</if>
<if test="evaluateReplyId != null">
evaluate_reply_id = #{evaluateReplyId,jdbcType=INTEGER},
</if>
<if test="sortNum != null">
sort_num = #{sortNum,jdbcType=INTEGER},
</if>
<if test="imgUrl != null">
img_url = #{imgUrl,jdbcType=VARCHAR},
</if>
<if test="fieldCode != null">
field_code = #{fieldCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where evaluate_img_id = #{evaluateImgId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.evaluate.entity.TabEvaluateImg">
update tab_evaluate_img
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
evaluate_id = #{evaluateId,jdbcType=INTEGER},
evaluate_reply_id = #{evaluateReplyId,jdbcType=INTEGER},
sort_num = #{sortNum,jdbcType=INTEGER},
img_url = #{imgUrl,jdbcType=VARCHAR},
field_code = #{fieldCode,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where evaluate_img_id = #{evaluateImgId,jdbcType=INTEGER}
</update>
<select id="listImageByEvaluateId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_evaluate_img
where evaluate_id = #{evaluateId} and evaluate_reply_id is null
and status = 1
</select>
<select id="listImageByEvaluateReplyId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_evaluate_img
where evaluate_reply_id = #{evaluateReplyId}
and status = 1
</select>
</mapper>
\ No newline at end of file
......@@ -46,6 +46,86 @@
review_status, top_hot_status, malicious_status, show_status, visit_status, reply_status,
status, create_time, update_time
</sql>
<sql id="querySql">
<where>
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="null != storeIdList and storeIdList.size > 0">
and store_id in
<foreach collection="storeIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="search != null and search != '' ">
and ( order_number like concat('%', #{search}, '%')
or member_name like concat('%', #{search}, '%')
or member_phone like concat('%', #{search}, '%')
or evaluate_content like concat('%', #{search}, '%')
or store_name like concat('%', #{search}, '%')
)
</if>
<if test="startTime != null and startTime != '' ">
and evaluate_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != '' ">
and evaluate_time &lt;= #{endTime}
</if>
and ( 1=1
<if test="badEvaluateStatus != null ">
or bad_evaluate_status = #{badEvaluateStatus}
</if>
<if test="goodEvaluateStatus != null ">
or good_evaluate_status = #{goodEvaluateStatus}
</if>
<if test="reviewStatus != null ">
or review_status = #{reviewStatus}
</if>
<if test="topHotStatus != null ">
or top_hot_status = #{topHotStatus}
</if>
<if test="maliciousStatus != null ">
or malicious_status = #{maliciousStatus}
</if>
or ( 1=1
<if test="goodsCompute != null and goodsCompute != '' and goodsScore != null ">
and goods_score ${goodsCompute} #{goodsScore}
</if>
<if test="storeCompute != null and storeCompute != '' and storeScore != null ">
and store_score ${storeCompute} #{storeScore}
</if>
<if test="serviceCompute != null and serviceCompute != '' and serviceScore != null ">
and service_score ${serviceCompute} #{serviceScore}
</if>
)
)
<if test="replyStatus != null ">
and reply_status = #{replyStatus}
</if>
<if test="visitStatus != null ">
and visit_status = #{visitStatus}
</if>
<if test="showStatus != null ">
and show_status = #{showStatus}
</if>
</where>
<if test="orderByField != null ">
<if test="orderByField == 1 ">
order by evaluate_time
</if>
<if test="orderByField == 2 ">
order by receipts_date
</if>
<if test="orderByType != null ">
<if test="orderByType == 1 ">
asc
</if>
<if test="orderByType == 2 ">
desc
</if>
</if>
</if>
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......@@ -451,85 +531,15 @@
select
<include refid="Base_Column_List" />
from tab_evaluate
<where>
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
<if test="null != storeIdList and storeIdList.size > 0">
and store_id in
<foreach collection="storeIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="search != null and search != '' ">
and ( order_number like concat('%', #{search}, '%')
or member_name like concat('%', #{search}, '%')
or member_phone like concat('%', #{search}, '%')
or evaluate_content like concat('%', #{search}, '%')
or store_name like concat('%', #{search}, '%')
)
</if>
<if test="startTime != null and startTime != '' ">
and evaluate_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != '' ">
and evaluate_time &lt;= #{endTime}
</if>
and ( 1=1
<if test="badEvaluateStatus != null ">
or bad_evaluate_status = #{badEvaluateStatus}
</if>
<if test="goodEvaluateStatus != null ">
or good_evaluate_status = #{goodEvaluateStatus}
</if>
<if test="reviewStatus != null ">
or review_status = #{reviewStatus}
</if>
<if test="topHotStatus != null ">
or top_hot_status = #{topHotStatus}
</if>
<if test="maliciousStatus != null ">
or malicious_status = #{maliciousStatus}
</if>
or ( 1=1
<if test="goodsCompute != null and goodsCompute != '' and goodsScore != null ">
and goods_score ${goodsCompute} #{goodsScore}
</if>
<if test="storeCompute != null and storeCompute != '' and storeScore != null ">
and store_score ${storeCompute} #{storeScore}
</if>
<if test="serviceCompute != null and serviceCompute != '' and serviceScore != null ">
and service_score ${serviceCompute} #{serviceScore}
</if>
)
)
<if test="replyStatus != null ">
and reply_status = #{replyStatus}
</if>
<if test="visitStatus != null ">
and visit_status = #{visitStatus}
</if>
<if test="showStatus != null ">
and show_status = #{showStatus}
</if>
</where>
<if test="orderByField != null ">
<if test="orderByField == 1 ">
order by evaluate_time
</if>
<if test="orderByField == 2 ">
order by receipts_date
</if>
<if test="orderByType != null ">
<if test="orderByType == 1 ">
asc
</if>
<if test="orderByType == 2 ">
desc
</if>
</if>
</if>
<include refid="querySql"/>
</select>
<select id="countEvaluate" resultType="int">
select
count(*)
from tab_evaluate
<include refid="querySql"/>
</select>
<update id="updateShowStatus">
update tab_evaluate set show_status = #{showStatus} where enterprise_id = #{enterpriseId}
<if test="null != evaluateId and evaluateId.size &gt; 0">
......
package com.gic.evaluate.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.DataDownloadUtils;
import com.gic.download.utils.DownloadReport;
import com.gic.download.utils.DownloadUtils;
import com.gic.download.utils.ExecutorPoolSingleton;
import com.gic.enterprise.context.RequestContext;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.evaluate.constant.ReplyerTypeEnum;
import com.gic.evaluate.dto.EvaluateDTO;
import com.gic.evaluate.dto.EvaluateReplyDTO;
import com.gic.evaluate.qo.EvaluateQO;
import com.gic.evaluate.qo.ExportQO;
import com.gic.evaluate.service.EvaluateManageApiService;
import com.gic.evaluate.web.utils.DataContentUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhiwj
* @Description:
......@@ -11,41 +38,131 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class EvaluateExportController extends DownloadUtils {
@Autowired
private EvaluateManageApiService evaluateManageApiService;
private Logger logger = LogManager.getLogger(EvaluateExportController.class);
@RequestMapping("/list-evaluate-field")
public RestResponse listEvaluateField() {
EvaluateFieldEnum[] values = EvaluateFieldEnum.values();
List<Map<String, Object>> arrayList = new ArrayList<>(values.length);
for (EvaluateFieldEnum value : values) {
Map<String, Object> hashMap = new HashMap<>(4);
hashMap.put("fieldCode", value.getFieldCode());
hashMap.put("fieldName", value.getFieldName());
hashMap.put("needEncrypt", value.getNeedEncrypt());
arrayList.add(hashMap);
}
return RestResponse.success(arrayList);
}
@RequestMapping("/export-evaluate")
public RestResponse exportSmsPackageRecord(HttpServletRequest request, EvaluateQO evaluateQO, ExportQO exportQO) {
evaluateQO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
ServiceResponse<Integer> serviceResponse = evaluateManageApiService.countEvaluate(evaluateQO);
List<String> fieldCodeList = exportQO.getFieldCodeList();
List<String> fieldNameList = new ArrayList<>(fieldCodeList.size());
for (String fieldCode: fieldCodeList) {
String fieldName = EvaluateFieldEnum.valueOf(fieldCode).getFieldName();
fieldNameList.add(fieldName);
}
// 开始下载
String dataContent = DataContentUtils.getDataContent();
// 生成入参数据
DownloadReport report = new DownloadReport();
//申请人ID
report.setApplyUserId(UserDetailUtils.getUserDetail().getUserId());
//数据源(频道页),用 "-" 隔开上级和本级
report.setDataContent(dataContent);
//待下载数据的数据总量
report.setDataCount(serviceResponse.getResult());
//报告类型 1:完整数据, 2:脱敏数据, 3:二维码
report.setDataType(exportQO.getDataType());
//数据源超链接,用于点击跳转对应频道页面
report.setDataUrl((String) RequestContext.getContext().getRequest().getAttribute("moduleMenuUrl"));
report.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
//待下载文件名
report.setFileName(exportQO.getFileName());
//待下载数据的结束时间
if (StringUtils.isNotBlank(evaluateQO.getEndTime())) {
report.setReportEndTime(DateUtil.strToDate(evaluateQO.getEndTime(), DateUtil.FORMAT_DATETIME_19));
}
//待下载数据的开始时间
if (StringUtils.isNotBlank(evaluateQO.getStartTime())) {
report.setReportStartTime(DateUtil.strToDate(evaluateQO.getStartTime(), DateUtil.FORMAT_DATETIME_19));
}
//调用生成方法,获取reportId
Integer reportId = DataDownloadUtils.createDownloadReport(report);
String path = request.getSession().getServletContext().getRealPath("/excel/csv/collaborator/file/");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.FORMAT_DATETIME_19);
ExecutorPoolSingleton.getInstance().executeTask(() -> {
DownloadDataLoader<EvaluateDTO> loader = new DownloadDataLoader<EvaluateDTO>() {
@Override
protected List<EvaluateDTO> getDownloadData(Integer pageNum) throws Exception {
//调用分页查询接口
evaluateQO.setCurrentPage(pageNum);
evaluateQO.setPageSize(1000);
ServiceResponse<Page<EvaluateDTO>> result = evaluateManageApiService.listEvaluateForManage(evaluateQO);
// todo 这里还要处理特殊数据
boolean hasReplyTime = fieldCodeList.contains("replyTime");
boolean hasReplyMemberContent = fieldCodeList.contains("replyMemberContent");
boolean hasReplyUserContent = fieldCodeList.contains("replyUserContent");
if (CollectionUtils.isNotEmpty(result.getResult().getResult())) {
for(EvaluateDTO evaluateDTO : result.getResult().getResult()) {
if (hasReplyTime || hasReplyMemberContent || hasReplyUserContent) {
evaluateDTO = evaluateManageApiService.getEvaluate(evaluateDTO.getEnterpriseId(), evaluateDTO.getEnterpriseId()).getResult();
}
// todo 追评时间
if (hasReplyTime) {
List<EvaluateReplyDTO> replyList = evaluateDTO.getReplyList();
List<String> replyDateList = Optional.ofNullable(replyList).orElse(Collections.emptyList()).stream()
.filter(e -> ReplyerTypeEnum.MEMBER.getCode().equals(e.getReplyerType()))
.map(e -> simpleDateFormat.format(e.getReplyDate()))
.collect(Collectors.toList());
}
// todo 追评内容
// todo 商家回复
}
}
return result.getResult().getResult();
}
};
try {
//参数说明:excelExtensionCode,Excel后缀名code ,枚举类:ExcelExtensionEnum, Arrays.asList("phone")这个phone是需要加密的字段
download(path, reportId, exportQO.getFileName(), exportQO.getExcelExtension(), fieldNameList, fieldCodeList, loader, Arrays.asList("memberPhone"), null);
} catch (Exception e) {
logger.warn("下载错误", e);
}
});
return RestResponse.success(reportId);
}
private enum EvaluateFieldEnum{
evaluateTime("evaluateTime", "首次评价时间", 0),
memberName("memberName", "会员姓名", 0),
memberPhone("memberPhone", "会员手机号", 0),
memberPhone("memberPhone", "会员手机号", 1),
goodsScore("goodsScore", "商品质量评分", 0),
storeScore("storeScore", "门店环境评分", 0),
serviceScore("serviceScore", "服务能力评分", 0),
evaluateContent("evaluateContent", "评语", 0),
evaluateId("evaluateId", "费用", 0),
storeId("storeId", "费用", 0),
clerkName("clerkName", "费用", 0),
memberId("memberId", "费用", 0),
orderId("orderId", "费用", 0),
memberImgUrl("memberImgUrl", "费用", 0),
goodsId("goodsId", "费用", 0),
goodsInfo("goodsInfo", "费用", 0),
storeName("storeName", "费用", 0),
storeCode("storeCode", "费用", 0),
storePhone("storePhone", "费用", 0),
storeGroupId("storeGroupId", "费用", 0),
storeGroupName("storeGroupName", "费用", 0),
orderNumber("orderNumber", "费用", 0),
receiptsDate("receiptsDate", "费用", 0),
clerkId("clerkId", "费用", 0),
badEvaluateStatus("badEvaluateStatus", "费用", 0),
goodEvaluateStatus("goodEvaluateStatus", "费用", 0),
reviewStatus("reviewStatus", "费用", 0),
topHotStatus("topHotStatus", "费用", 0),
maliciousStatus("maliciousStatus", "费用", 0),
showStatus("showStatus", "费用", 0),
visitStatus("visitStatus", "费用", 0),
replyStatus("replyStatus", "费用", 0),
replyTime("replyTime", "追评时间", 0),
replyMemberContent("replyMemberContent", "追评内容", 0),
replyUserContent("replyUserContent", "商家回复", 0),
receiptsDate("receiptsDate", "下单时间", 0),
orderNumber("orderNumber", "订单号", 0),
orderMount("orderMount", "订单金额", 0),
goodsInfo("goodsInfo", "商品信息", 0),
storeName("storeName", "门店名称", 0),
storePhone("storePhone", "门店电话", 0),
;
private String fieldCode;
private String fieldName;
......
package com.gic.evaluate.web.utils;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.service.MenuApiService;
import com.gic.enterprise.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* @Description:
* @author zhiwj
* @date 2019-12-10 18:05
*/
@Component
public class DataContentUtils {
private static MenuApiService menuApiService;
@Autowired
public void setMenuApiService(MenuApiService menuApiService) {
this.menuApiService = menuApiService;
}
public static String getDataContent() {
String dataContent;
Integer moduleMenuId = (Integer) RequestContext.getContext().getRequest().getAttribute("moduleMenuId");
ServiceResponse<MenuDTO> response = menuApiService.getDetailById(moduleMenuId);
MenuDTO menuDTO = response.getResult();
ServiceResponse<MenuDTO> parentResponse = menuApiService.getDetailById(menuDTO.getParentId());
MenuDTO parentMenuDTO = parentResponse.getResult();
if (parentMenuDTO != null) {
dataContent = parentMenuDTO.getMenuName() + "-" + menuDTO.getMenuName();
} else {
dataContent = menuDTO.getMenuName();
}
return dataContent;
}
}
......@@ -25,4 +25,5 @@
<dubbo:reference interface="com.gic.log.api.service.LogApiService" id="logApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.DownloadReportApiService" id="downloadReportApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.auth.service.MenuApiService" id="menuApiService" timeout="6000" retries="0"/>
</beans>
\ No newline at end of file
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