Browse Source

Merge branch 'dev_question_naire' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev

dev_shibei_match
jianjun 4 years ago
parent
commit
5d5c89c9e2
  1. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java
  2. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmettduck/PrVistRecordEntity.java
  3. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrVistRecordService.java
  4. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  5. 25
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrVistRecordServiceImpl.java
  6. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  7. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java

@ -4,8 +4,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -69,6 +67,7 @@ public class TDuckListResultDTO implements Serializable {
private String client;
private String createdTime;
private String updatedTime;
/**
* 是否填写问卷truefalse
@ -107,6 +106,7 @@ public class TDuckListResultDTO implements Serializable {
this.status = NumConstant.ONE;
this.client = "";
this.createdTime = "";
this.updatedTime = "";
this.fillStatus = false;
this.isFillQuestion = true;
this.orgName = "";

17
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmettduck/PrVistRecordEntity.java

@ -17,14 +17,13 @@
package com.epmet.dataaggre.entity.epmettduck;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户访问问卷记录表
*
@ -38,9 +37,10 @@ public class PrVistRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
/**
*
*/
@TableId(type = IdType.ID_WORKER_STR)
private String id;
/**
@ -58,9 +58,4 @@ public class PrVistRecordEntity extends BaseEpmetEntity {
*/
private String userType;
/**
* 项目key
*/
private String projectKey;
}

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrVistRecordService.java

@ -101,4 +101,10 @@ public interface PrVistRecordService extends BaseService<PrVistRecordEntity> {
* @Date 2021/9/23 14:16
*/
PrVistRecordDTO getNewestRecord(String staffId);
/**
* desc:插入或更新记录
* @param param
*/
void insertOrUpdate(PrVistRecordDTO param);
}

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

@ -190,7 +190,10 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
}
orgIds = joint(pids,agencyId,gridList);
}else {
String selfOrg = pids + ":" + agencyId;
String selfOrg = agencyId;
if (StringUtils.isNotBlank(pids)){
selfOrg = pids + ":" + agencyId;
}
orgIds.add(selfOrg);
}
}else {
@ -251,6 +254,13 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
}
r.setOrgName(orgName);
});
PrVistRecordDTO param = new PrVistRecordDTO();
param.setCustomerId(formDTO.getCustomerId());
param.setUserId(formDTO.getUserId());
param.setUserType(formDTO.getClient());
param.setCustomerId(formDTO.getCustomerId());
prVistRecordService.insertOrUpdate(param);
return result;
}
@ -580,8 +590,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
}
//按照星星大小升序排列
this.sortMap(starMap, true);
//2、平均分
detail.put("avgStarNum", new BigDecimal((float)totalStarNum / validTotal).setScale(0, BigDecimal.ROUND_HALF_UP));
//2、平均分 (09.30,产品需求:直接显示平均星数,保留小数点后两位,无需四舍五入)
detail.put("avgStarNum", new BigDecimal((float)totalStarNum / validTotal).setScale(2, BigDecimal.ROUND_DOWN));
//3、几条有效记录
detail.put("validTotal", validTotal);
//4、得分列表
@ -794,7 +804,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
result.setRedPoint(NumConstant.ONE_STR);
return result;
}
if (list.get(0).getCreatedTime().compareTo(visitRecord.getCreatedTime()) > 0) {
if (list.get(0).getCreatedTime().compareTo(visitRecord.getUpdatedTime()) > 0) {
result.setRedPoint(NumConstant.ONE_STR);
} else {
result.setRedPoint(NumConstant.ZERO_STR);

25
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrVistRecordServiceImpl.java

@ -115,12 +115,33 @@ public class PrVistRecordServiceImpl extends BaseServiceImpl<PrVistRecordDao, Pr
public PrVistRecordDTO getNewestRecord(String staffId) {
LambdaQueryWrapper<PrVistRecordEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PrVistRecordEntity::getUserId, staffId);
wrapper.orderByDesc(PrVistRecordEntity::getCreatedTime);
wrapper.orderByDesc(PrVistRecordEntity::getUpdatedTime);
wrapper.last("limit 1");
List<PrVistRecordEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return ConvertUtils.sourceToTarget(list, PrVistRecordDTO.class).get(0);
return ConvertUtils.sourceToTarget(list.get(0), PrVistRecordDTO.class);
}
@Override
public void insertOrUpdate(PrVistRecordDTO param) {
//Executors.newCachedThreadPool().submit(()-> {
try {
PrVistRecordDTO newestRecord = this.getNewestRecord(param.getUserId());
if (newestRecord == null) {
PrVistRecordEntity entity = ConvertUtils.sourceToTarget(param, PrVistRecordEntity.class);
this.insert(entity);
} else {
PrVistRecordEntity entity = new PrVistRecordEntity();
entity.setId(newestRecord.getId());
this.updateById(entity);
}
} catch (Exception e) {
log.error("insertPrVistRecord excption", e);
}
//});
}
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml

@ -92,7 +92,7 @@
#{key}
</foreach>
)
ORDER BY up.created_time DESC
ORDER BY up.updated_time DESC
</select>
</mapper>

14
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -165,7 +165,7 @@
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
IF(PIDS = '', ID, CONCAT( PIDS,':', ID )) AS orgPids
FROM
customer_agency a
WHERE
@ -175,7 +175,7 @@
cd.ID AS orgId,
DEPARTMENT_NAME AS orgName,
'dept' AS orgType,
CONCAT( PIDS, ca.ID, cd.ID ) AS orgPids
CONCAT( PIDS, ':', ca.ID, ':', cd.ID ) AS orgPids
FROM
customer_department cd
INNER JOIN customer_agency ca ON cd.AGENCY_ID = ca.ID
@ -186,7 +186,7 @@
ID AS orgId,
GRID_NAME AS orgName,
'grid' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
CONCAT( PIDS,':', ID ) AS orgPids
FROM
customer_grid
WHERE
@ -202,7 +202,7 @@
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT(PIDS,ID) AS orgPids
IF(PIDS = '', ID, CONCAT( PIDS,':', ID )) AS orgPids
from
customer_agency
@ -228,7 +228,7 @@
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
IF(PIDS = '', ID, CONCAT( PIDS,':', ID )) AS orgPids
FROM
customer_agency a
WHERE
@ -238,7 +238,7 @@
ID AS orgId,
GRID_NAME AS orgName,
'grid' AS orgType,
CONCAT( PIDS, ID ) AS orgPids
CONCAT( PIDS, ':', ID ) AS orgPids
FROM
customer_grid
WHERE
@ -254,7 +254,7 @@
ID AS orgId,
ORGANIZATION_NAME AS orgName,
'agency' AS orgType,
CONCAT(PIDS,ID) AS orgPids
IF(PIDS = '', ID, CONCAT( PIDS,':', ID )) AS orgPids
from
customer_agency

Loading…
Cancel
Save