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. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrVistRecordService.java
  4. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  5. 27
      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 com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -69,6 +67,7 @@ public class TDuckListResultDTO implements Serializable {
private String client; private String client;
private String createdTime; private String createdTime;
private String updatedTime;
/** /**
* 是否填写问卷truefalse * 是否填写问卷truefalse
@ -107,6 +106,7 @@ public class TDuckListResultDTO implements Serializable {
this.status = NumConstant.ONE; this.status = NumConstant.ONE;
this.client = ""; this.client = "";
this.createdTime = ""; this.createdTime = "";
this.updatedTime = "";
this.fillStatus = false; this.fillStatus = false;
this.isFillQuestion = true; this.isFillQuestion = true;
this.orgName = ""; 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; 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.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 用户访问问卷记录表 * 用户访问问卷记录表
* *
@ -38,9 +37,10 @@ public class PrVistRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
@TableId(type = IdType.ID_WORKER_STR)
private String id; private String id;
/** /**
@ -58,9 +58,4 @@ public class PrVistRecordEntity extends BaseEpmetEntity {
*/ */
private String userType; private String userType;
/**
* 项目key
*/
private String projectKey;
} }

8
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 * @Date 2021/9/23 14:16
*/ */
PrVistRecordDTO getNewestRecord(String staffId); PrVistRecordDTO getNewestRecord(String staffId);
}
/**
* desc:插入或更新记录
* @param param
*/
void insertOrUpdate(PrVistRecordDTO param);
}

20
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); orgIds = joint(pids,agencyId,gridList);
}else { }else {
String selfOrg = pids + ":" + agencyId; String selfOrg = agencyId;
if (StringUtils.isNotBlank(pids)){
selfOrg = pids + ":" + agencyId;
}
orgIds.add(selfOrg); orgIds.add(selfOrg);
} }
}else { }else {
@ -251,6 +254,13 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
} }
r.setOrgName(orgName); 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; return result;
} }
@ -580,8 +590,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
} }
//按照星星大小升序排列 //按照星星大小升序排列
this.sortMap(starMap, true); this.sortMap(starMap, true);
//2、平均分 //2、平均分 (09.30,产品需求:直接显示平均星数,保留小数点后两位,无需四舍五入)
detail.put("avgStarNum", new BigDecimal((float)totalStarNum / validTotal).setScale(0, BigDecimal.ROUND_HALF_UP)); detail.put("avgStarNum", new BigDecimal((float)totalStarNum / validTotal).setScale(2, BigDecimal.ROUND_DOWN));
//3、几条有效记录 //3、几条有效记录
detail.put("validTotal", validTotal); detail.put("validTotal", validTotal);
//4、得分列表 //4、得分列表
@ -794,7 +804,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
result.setRedPoint(NumConstant.ONE_STR); result.setRedPoint(NumConstant.ONE_STR);
return result; 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); result.setRedPoint(NumConstant.ONE_STR);
} else { } else {
result.setRedPoint(NumConstant.ZERO_STR); result.setRedPoint(NumConstant.ZERO_STR);
@ -808,4 +818,4 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
query.eq(PrUserProjectEntity::getKey, key); query.eq(PrUserProjectEntity::getKey, key);
return baseDao.selectOne(query); return baseDao.selectOne(query);
} }
} }

27
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) { public PrVistRecordDTO getNewestRecord(String staffId) {
LambdaQueryWrapper<PrVistRecordEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PrVistRecordEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PrVistRecordEntity::getUserId, staffId); wrapper.eq(PrVistRecordEntity::getUserId, staffId);
wrapper.orderByDesc(PrVistRecordEntity::getCreatedTime); wrapper.orderByDesc(PrVistRecordEntity::getUpdatedTime);
wrapper.last("limit 1");
List<PrVistRecordEntity> list = baseDao.selectList(wrapper); List<PrVistRecordEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return null; 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} #{key}
</foreach> </foreach>
) )
ORDER BY up.created_time DESC ORDER BY up.updated_time DESC
</select> </select>
</mapper> </mapper>

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

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

Loading…
Cancel
Save