Browse Source

Merge remote-tracking branch 'origin/dev_temp' into dev_temp

# Conflicts:
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
#	epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
dev_shibei_match
liushaowen 5 years ago
parent
commit
1ad642c40e
  1. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  2. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  5. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  6. 23
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  7. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  8. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  9. 85
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  10. 100
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  11. 3
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java
  12. 3
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java
  13. 6
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java
  14. 12
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
  15. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java
  16. 56
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AdviceListFormDTO.java
  17. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java
  18. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java
  19. 54
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java
  20. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java
  21. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java
  22. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java
  23. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java
  24. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java
  25. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java
  26. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java
  27. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java
  28. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java
  29. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java
  30. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java
  31. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java
  32. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
  33. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java
  34. 112
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java
  35. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  36. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
  37. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml
  38. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceImgDao.xml
  39. 24
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -7,7 +7,6 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.GridScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao;
@ -21,7 +20,7 @@ import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyEntity;
@ -35,9 +34,7 @@ import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.todata.ProjectExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.stats.DimAgencyService;
@ -744,4 +741,12 @@ public class DemoController {
return new Result();
}
@Autowired
private ScreenGrassrootsGovernDataAbsorptionService wc;
@PostMapping("wc")
public Result wc(@RequestBody ScreenCentralZoneDataFormDTO param){
wc.difficultyDataHub(param);
return new Result();
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

@ -244,6 +244,7 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
*/
@Override
public List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId, List<String> list) {
if(CollectionUtils.isEmpty(list)) return null;
return baseDao.selectDifficultyBaseInfo(customerId,list);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -406,8 +406,8 @@
project.DEL_FLAG = '0'
AND project.CUSTOMER_ID = #{customerId}
<if test="null != list and list.size() != 0">
<foreach collection="list" item="projectId" open="AND " separator=" AND " >
project.ID <![CDATA[<>]]> #{projectId}
<foreach collection="list" item="projectId" open="AND " separator=" OR " >
project.ID = #{projectId}
</foreach>
</if>
</select>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -118,7 +118,7 @@
AND project.customer_id = #{customerId}
<if test="null != exclude and exclude.size() > 0">
<foreach collection="exclude" item="id" open="AND ( " separator=" OR " close=" ) ">
project.ID <![CDATA[ <> ]]> #{ID}
project.ID <![CDATA[ <> ]]> #{id}
</foreach>
</if>
AND EXISTS (

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -277,4 +277,22 @@ public class CustomerAgencyController {
}
return new Result<Set<String>>().ok(customerAgencyService.getAgencyElementTree(customerId).getDefaultKeys());
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
return new Result<AgencyInfoResultDTO>().ok(customerAgencyService.agencyInfo(formDTO));
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@PostMapping("organizetree/{agencyId}")
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId) {
return new Result<OrganizeTreeResultDTO>().ok(customerAgencyService.organizeTree(agencyId));
}
}

23
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -57,7 +57,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Author sun
* @Description 组织首页-下级机关列表
**/
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId);
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId, @Param("agencyNum") Integer agencyNum);
/**
* @param pId
@ -185,4 +185,25 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Date 2020/11/6 14:57
*/
List<AgencyElementTreeResultDTO.Agency> getAgencyElementTree(@Param("customerId") String customerId,@Param("pid") String pid);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeResultDTO> selectAllSub(@Param("agencyId") String agencyId);
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -214,6 +214,18 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
**/
StaffInAgencyListResultDTO staffInAgencyList(String staffId);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
/**
* @Description 运营端-返回element ui - tree 结构agency列表
* @param customerId

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -994,6 +994,42 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO;
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
AgencyInfoResultDTO resultDTO = new AgencyInfoResultDTO();
String agencyId = formDTO.getOrgId();
//1.判断是否为网格类型,是网格则查询网格基本信息
if("grid".equals(formDTO.getOrgType())){
CustomerGridEntity gridEntity = customerGridDao.selectById(formDTO.getOrgId());
if(null == gridEntity){
logger.error(String.format("根据网格Id未查询到网格数据,网格Id:%s", formDTO.getOrgId()));
throw new RenException("获取网格数据失败,根据网格Id未查询到网格数据");
}
agencyId = gridEntity.getPid();
}
//2.查询组织基本信息
CustomerAgencyEntity entity = baseDao.selectById(agencyId);
if(entity!=null){
resultDTO = ConvertUtils.sourceToTarget(entity, AgencyInfoResultDTO.class);
resultDTO.setAgencyId(entity.getId());
resultDTO.setAgencyName(entity.getOrganizationName());
}
return resultDTO;
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@Override
public OrganizeTreeResultDTO organizeTree(String agencyId) {
return baseDao.selectorganizeTree(agencyId);
}
/**
* @param customerId
* @return com.epmet.dto.result.AgencyElementTreeResultDTO

85
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -62,11 +62,13 @@
<select id="selectSubAgencyById" resultType="com.epmet.dto.result.SubListResultDTO">
SELECT
id AS 'agencyId',
organization_name AS 'agencyName'
organization_name AS 'agencyName',
`level` AS 'agencyLevel'
FROM customer_agency
WHERE del_flag = '0'
AND pid = #{pId}
ORDER BY created_time DESC
LIMIT #{agencyNum}
</select>
<select id="selectAgencyList" resultType="com.epmet.dto.result.AgencyListResultDTO">
@ -290,6 +292,87 @@
AND csa.user_id = #{staffId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 start-->
<resultMap id="organizeTree" type="com.epmet.dto.result.OrganizeTreeResultDTO">
<id column="agencyId" property="agencyId"/>
<result column="agencyName" property="agencyName"/>
<result column="level" property="level"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
<collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeGridResultDTO" select="selectAgencyGridList">
<id column="gridId" property="gridId"/>
<result column="gridName" property="gridName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="departmentList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeDeptResultDTO" select="selectAgencyDeptList">
<id column="deptId" property="deptId"/>
<result column="deptName" property="deptName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="subAgencyList" column="agencyId" ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectAllSub">
</collection>
</resultMap>
<select id="selectorganizeTree" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.id = #{agencyId}
</select>
<select id="selectAgencyGridList" resultType="com.epmet.dto.result.OrganizeTreeGridResultDTO">
SELECT
cg.id AS gridId,
cg.grid_name AS gridName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_grid cg
LEFT JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
<select id="selectAgencyDeptList" resultType="com.epmet.dto.result.OrganizeTreeDeptResultDTO">
SELECT
cd.id AS deptId,
cd.department_name AS deptName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_department cd
LEFT JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
cd.del_flag = '0'
AND ca.del_flag = '0'
AND cd.agency_id = #{agencyId}
</select>
<select id="selectAllSub" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.pid = #{agencyId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 end-->
<resultMap id="elementTreeAgency" type="com.epmet.dto.result.AgencyElementTreeResultDTO$Agency">
<id column="ID" property="id"></id>
<result column="ORGANIZATION_NAME" property="label"></result>

100
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -1002,58 +1002,60 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
}
//获取工作人员未处理的节点
List<StaffUnHandledDTO> unHandledList = projectStaffService.getStaffUnHandledList(customerId);
List<CostDayFormDTO> form = unHandledList.stream().map(item -> {
CostDayFormDTO dto = new CostDayFormDTO();
dto.setId(item.getId());
dto.setStaffId(item.getStaffId());
if (null != item.getUpdatedTime()) {
dto.setStartDate(item.getUpdatedTime());
if (CollectionUtils.isNotEmpty(unHandledList)) {
List<CostDayFormDTO> form = unHandledList.stream().map(item -> {
CostDayFormDTO dto = new CostDayFormDTO();
dto.setId(item.getId());
dto.setStaffId(item.getStaffId());
if (null != item.getUpdatedTime()) {
dto.setStartDate(item.getUpdatedTime());
} else {
dto.setStartDate(item.getCreatedTime());
}
dto.setEndDate(new Date());
return dto;
}).collect(Collectors.toList());
List<CostDayResultDTO> costDayList;
if (ParameterKeyConstant.WORK.equals(calculation)) {
//工作日计算
Result<List<CostDayResultDTO>> result = epmetCommonServiceOpenFeignClient.costWorkDays(form);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
costDayList = result.getData();
} else {
dto.setStartDate(item.getCreatedTime());
}
dto.setEndDate(new Date());
return dto;
}).collect(Collectors.toList());
List<CostDayResultDTO> costDayList;
if (ParameterKeyConstant.WORK.equals(calculation)) {
//工作日计算
Result<List<CostDayResultDTO>> result = epmetCommonServiceOpenFeignClient.costWorkDays(form);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
//日历日计算
Result<List<CostDayResultDTO>> result = epmetCommonServiceOpenFeignClient.costCalendarDays(form);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
costDayList = result.getData();
}
costDayList = result.getData();
} else {
//日历日计算
Result<List<CostDayResultDTO>> result = epmetCommonServiceOpenFeignClient.costCalendarDays(form);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
//即将超期项目
List<StaffUnHandledDTO> overdueList = new ArrayList<>();
//滞留项目
List<StaffUnHandledDTO> delayList = new ArrayList<>();
List<CostDayResultDTO> finalCostDayList = costDayList;
List<OverdueAndDelayDTO> list = new ArrayList<>();
int finalDetentionDays = detentionDays;
int finalRemindTime = remindTime;
unHandledList.forEach(unHandle -> finalCostDayList.stream().filter(cost ->
unHandle.getId().equals(cost.getId())).forEach(item -> {
int diff = finalDetentionDays - item.getDetentionDays();
OverdueAndDelayDTO dto = new OverdueAndDelayDTO();
if (diff < 0) {
dto.setStaffId(unHandle.getStaffId());
list.add(dto);
delayList.add(unHandle);
} else if (diff <= finalRemindTime) {
dto.setStaffId(unHandle.getStaffId());
overdueList.add(unHandle);
list.add(dto);
}
}));
if (CollectionUtils.isNotEmpty(list)) {
setMessage(customerId, overdueList, delayList, list);
}
costDayList = result.getData();
}
//即将超期项目
List<StaffUnHandledDTO> overdueList = new ArrayList<>();
//滞留项目
List<StaffUnHandledDTO> delayList = new ArrayList<>();
List<CostDayResultDTO> finalCostDayList = costDayList;
List<OverdueAndDelayDTO> list = new ArrayList<>();
int finalDetentionDays = detentionDays;
int finalRemindTime = remindTime;
unHandledList.forEach(unHandle -> finalCostDayList.stream().filter(cost ->
unHandle.getId().equals(cost.getId())).forEach(item -> {
int diff = finalDetentionDays - item.getDetentionDays();
OverdueAndDelayDTO dto = new OverdueAndDelayDTO();
if (diff < 0) {
dto.setStaffId(unHandle.getStaffId());
list.add(dto);
delayList.add(unHandle);
} else if (diff <= finalRemindTime) {
dto.setStaffId(unHandle.getStaffId());
overdueList.add(unHandle);
list.add(dto);
}
}));
if (CollectionUtils.isNotEmpty(list)) {
setMessage(customerId, overdueList, delayList, list);
}
}

3
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java

@ -64,8 +64,7 @@ public class BadgeController {
@PostMapping("certification/add")
public Result certificationAdd(@LoginUser TokenDto tokenDto,@RequestBody CertificationAddFormDTO certificationAddFormDTO){
ValidatorUtils.validateEntity(certificationAddFormDTO, CertificationAddFormDTO.CertificationAdd.class);
badgeService.certificationAdd(tokenDto,certificationAddFormDTO);
return new Result();
return badgeService.certificationAdd(tokenDto,certificationAddFormDTO);
}
/**

3
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java

@ -1,6 +1,7 @@
package com.epmet.modules.badege.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.OpenedOrClosedFormDTO;
import com.epmet.resi.mine.dto.from.BadgeListFormDTO;
import com.epmet.dto.form.CertificationAddFormDTO;
@ -39,7 +40,7 @@ public interface BadgeService {
* @author zxc
* @date 2020/11/4 11:16 上午
*/
void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO);
Result certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO);
/**
* @Description 个人中心-取消/点亮徽章

6
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java

@ -86,12 +86,10 @@ public class BadgeServiceImpl implements BadgeService {
* @date 2020/11/4 11:16 上午
*/
@Override
public void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) {
public Result certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) {
certificationAddFormDTO.setUserId(tokenDto.getUserId());
Result result = epmetUserOpenFeignClient.authBadgeRecord(certificationAddFormDTO);
if (!result.success()){
throw new RenException("提交徽章认证失败......");
}
return result;
}
/**

12
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java

@ -30,4 +30,16 @@ public interface BadgeConstant {
String OFFLINE ="offline";
String RESI = "resi";
String AUTH_TITLE = "您有一条认证消息";
String GET_BADGE_NAME_FAILURE = "获取徽章名称失败......";
String MESSAGE_CONTENT = "您好,您的%s因认证失败未成功点亮,请查看";
String READ_FLAG = "unread";
String DEFAULT = "default";
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java

@ -43,6 +43,11 @@ public class UserAdviceImgDTO implements Serializable {
*/
private String adviceId;
/**
* 类型resi为用户上传,oper为运营上传
*/
private String type;
/**
* 图片url
*/

56
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AdviceListFormDTO.java

@ -0,0 +1,56 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import java.util.Date;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/9 10:37
*/
@Data
public class AdviceListFormDTO {
/**
* 客户id 不填查询所有
*/
private String customerId;
/**
* 组织id 不填查询所有
*/
private String agencyId;
/**
* 是否被回复,0未回复1回复, 传空查询所有
*/
private String isReply;
/**
* 问题类型 gov政府,software软件 ,传空查询全部单选
*/
private String adviceType;
/**
* 开始时间 可不填
*/
private Date startTime;
/**
* 结束时间 可不填
*/
private Date endTime;
/**
* 页码
*/
@Min(1)
private int pageNo;
/**
* 页大小
*/
@Min(1)
private int pageSize;
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java

@ -16,9 +16,9 @@ public class BadgeFormDTO implements Serializable {
/**
* 页码
*/
private Integer pageNo;
private Integer pageNo = 1;
/**
* 每页显示数量
*/
private Integer pageSize;
private Integer pageSize = 20;
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java

@ -37,7 +37,7 @@ public class CertificationAddFormDTO implements Serializable {
/**
*
*/
private String subName;
private String surname;
/**
*
@ -52,7 +52,7 @@ public class CertificationAddFormDTO implements Serializable {
/**
* 认证证件图片url
*/
private String certificate;
private String certificationImg;
/**
* 认证说明

54
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java

@ -1,8 +1,10 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -18,20 +20,51 @@ public class AdviceDetailResultDTO implements Serializable {
*/
private String adviceId;
/**
* 客户名
*/
private String customerName;
/**
* 组织名
*/
private String agencyName;
/**
* 网格名
*/
private String gridName;
/**
* 注册电话
*/
private String regPhone;
/**
* 意见类型
*/
private String adviceType;
/**
* 提建议人姓名
*/
private String userName;
/**
* 建议内容
*/
private String adviceContent;
/**
* 电话
* 填写的电话
*/
private String phone;
/**
* 建议时间
*/
private String adviceTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date adviceTime;
/**
* 回复内容
@ -41,15 +74,26 @@ public class AdviceDetailResultDTO implements Serializable {
/**
* 回复时间
*/
private String replyTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date replyTime;
/**
* 回复人
* 回复人姓名
*/
private String replyUser;
private String replyUserName;
/**
* 建议图片列表
*/
private List<String> imgList;
/**
* 政府回应图片
*/
private List<String> govImgList;
/**
* 政府回应文字
*/
private String govContent;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java

@ -26,7 +26,7 @@ public class CertificationDetailResultDTO implements Serializable {
/**
* 身份证号
*/
private String idNum;
private String idCard;
/**
* 是否认证 yes 认证 no 已认证

23
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/BadgeMessageConstant.java

@ -0,0 +1,23 @@
package com.epmet.constant;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/9 10:32
*/
public interface BadgeMessageConstant {
/**
* 消息标题
*/
String TITLE = "您有一条认证消息";
/**
* 审核通过消息模板
*/
String APPROVED_MSG = "您好,您提交的%s申请已通过,请查看。";
/**
* 审核驳回消息模板
*/
String REJECTED_MSG = "您好,您提交的%s申请,由于%s,已被驳回。";
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserAdviceConstant.java

@ -0,0 +1,7 @@
package com.epmet.constant;
public interface UserAdviceConstant {
String GOV_TYPE_TEXT = "政府业务建议";
String SOFTWARE_TYPE_TEXT = "软件功能及体验问题";
}

25
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -26,9 +28,12 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.UserAdviceDTO;
import com.epmet.dto.form.AdviceListFormDTO;
import com.epmet.dto.form.ReplyAdviceFormDTO;
import com.epmet.dto.result.AdviceDetailResultDTO;
import com.epmet.excel.UserAdviceExcel;
import com.epmet.service.UserAdviceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -50,6 +55,9 @@ public class UserAdviceController {
@Autowired
private UserAdviceService userAdviceService;
@Autowired
private LoginUserUtil loginUserUtil;
@GetMapping("page")
public Result<PageData<UserAdviceDTO>> page(@RequestParam Map<String, Object> params){
PageData<UserAdviceDTO> page = userAdviceService.page(params);
@ -93,9 +101,24 @@ public class UserAdviceController {
}
@PostMapping("replyadvice")
public Result replyAdvice(ReplyAdviceFormDTO dto){
public Result replyAdvice(@RequestBody ReplyAdviceFormDTO dto){
ValidatorUtils.validateEntity(dto);
userAdviceService.replyAdvice(dto,loginUserUtil.getLoginUserId());
return new Result();
}
@PostMapping("advicedetail")
public Result adviceDetail(String adviceId){
if (StringUtils.isBlank(adviceId)){
throw new RenException("adviceId不能为空");
}
return new Result<AdviceDetailResultDTO>().ok(userAdviceService.adviceDetail(adviceId));
}
@PostMapping("advicelist")
public Result<PageData<UserAdviceDTO>> adviceList(AdviceListFormDTO dto){
ValidatorUtils.validateEntity(dto);
PageData<UserAdviceDTO> page = userAdviceService.adviceList(dto);
return new Result<PageData<UserAdviceDTO>>().ok(page);
}
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java

@ -59,8 +59,7 @@ public class UserBadgeController {
*/
@PostMapping("authbadgerecord")
public Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO){
userBadgeService.authBadgeRecord(certificationAddFormDTO);
return new Result();
return userBadgeService.authBadgeRecord(certificationAddFormDTO);
}
/**

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java

@ -36,6 +36,15 @@ public interface UserBadgeDao {
*/
List<UserBadgeListResultDTO> selectAllBadge(@Param("customerId") String customerId);
/**
* @Description 查询单个徽章信息
* @Param customerId
* @Param badgeId
* @author zxc
* @date 2020/11/9 11:17 上午
*/
UserBadgeListResultDTO selectBadgeByBadgeId(@Param("customerId") String customerId,@Param("badgeId") String badgeId);
/**
* @Description 查询徽章认证记录
* @Param userId

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java

@ -43,6 +43,11 @@ public class UserAdviceImgEntity extends BaseEpmetEntity {
*/
private String adviceId;
/**
* 类型resi为用户上传,oper为运营上传
*/
private String type;
/**
* 图片url
*/

3
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceImgExcel.java

@ -37,6 +37,9 @@ public class UserAdviceImgExcel {
@Excel(name = "建议id")
private String adviceId;
@Excel(name = "类型")
private String type;
@Excel(name = "图片url")
private String imgUrl;

14
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/MessageFeignClient.java

@ -2,12 +2,17 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.feign.fallback.MessageFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class)
public interface MessageFeignClient {
@ -18,4 +23,13 @@ public interface MessageFeignClient {
@GetMapping(value = "message/sms/captcha/{mobile}")
Result sendSmsCaptcha(@PathVariable("mobile") String mobile);
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 批量推送消息
**/
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessageList(List<UserMessageFormDTO> msgList);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java

@ -3,9 +3,12 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.feign.MessageFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 消息服务降级
*/
@ -17,4 +20,15 @@ public class MessageFeignClientFallback implements MessageFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendSmsCaptcha", mobile);
}
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 批量推送消息
**/
@Override
public Result saveUserMessageList(List<UserMessageFormDTO> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList);
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceImgService.java

@ -92,4 +92,13 @@ public interface UserAdviceImgService extends BaseService<UserAdviceImgEntity> {
* @date 2020-11-04
*/
void delete(String[] ids);
/**
* @Description 根据adviceId获取关联的图片
* @param adviceId
* @return void
* @Author liushaowen
* @Date 2020/11/9 9:59
*/
List<UserAdviceImgEntity> getImgsByAdviceId(String adviceId);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java

@ -20,7 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.UserAdviceDTO;
import com.epmet.dto.form.AdviceListFormDTO;
import com.epmet.dto.form.ReplyAdviceFormDTO;
import com.epmet.dto.result.AdviceDetailResultDTO;
import com.epmet.entity.UserAdviceEntity;
import java.util.List;
@ -103,4 +105,22 @@ public interface UserAdviceService extends BaseService<UserAdviceEntity> {
* @Date 2020/11/6 16:44
*/
void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId);
/**
* @Description 建议详情
* @param adviceId
* @return com.epmet.dto.result.AdviceDetailResultDTO
* @Author liushaowen
* @Date 2020/11/6 17:19
*/
AdviceDetailResultDTO adviceDetail(String adviceId);
/**
* @Description 查询建议列表
* @param dto
* @return com.epmet.commons.tools.page.PageData<com.epmet.dto.UserAdviceDTO>
* @Author liushaowen
* @Date 2020/11/9 10:41
*/
PageData<UserAdviceDTO> adviceList(AdviceListFormDTO dto);
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java

@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -28,6 +29,8 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.BadgeMessageConstant;
import com.epmet.constant.UserConstant;
import com.epmet.dao.BadgeDao;
import com.epmet.dto.BadgeDTO;
import com.epmet.dto.ResiUserBadgeDTO;
@ -39,6 +42,7 @@ import com.epmet.dto.result.BadgeDetailResultDTO;
import com.epmet.dto.result.BadgeListResultDTO;
import com.epmet.entity.BadgeCertificationConfigEntity;
import com.epmet.entity.BadgeEntity;
import com.epmet.feign.MessageFeignClient;
import com.epmet.redis.UserBadgeRedis;
import com.epmet.service.*;
import org.apache.commons.collections4.CollectionUtils;
@ -68,6 +72,8 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
private UserBadgeService userBadgeService;
@Autowired
private ResiUserBadgeService resiUserBadgeService;
@Autowired
private MessageFeignClient messageFeignClient;
@Override
@ -317,9 +323,11 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
@Override
public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) {
UserBadgeCertificateRecordDTO dto = userBadgeCertificateRecordService.get(formDTO.getRecordId());
BadgeDetailResultDTO detail = baseDao.selectDetail(dto.getCustomerId(), dto.getBadgeId());
dto.setAuditStatus(formDTO.getAuditStatus());
dto.setAuditRemark(formDTO.getAuditRemark());
dto.setStaffId(tokenDto.getUserId());
dto.setIsLast(BadgeConstant.YES);
dto.setAuditTime(new Date());
userBadgeCertificateRecordService.update(dto);
@ -333,6 +341,7 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus());
resiUserBadgeService.save(resiUserBadgeDTO);
List<UserMessageFormDTO> msgList = new ArrayList<>();
if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) {
//更新Redis
OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO();
@ -340,7 +349,28 @@ public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> imp
openedOrClosedFormDTO.setUserId(dto.getUserId());
openedOrClosedFormDTO.setBadgeId(dto.getBadgeId());
userBadgeService.openedOrClosed(openedOrClosedFormDTO);
//通知
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(dto.getCustomerId());
messageFormDTO.setApp(UserConstant.APP_RESI);
messageFormDTO.setGridId(dto.getGridId());
messageFormDTO.setUserId(dto.getUserId());
messageFormDTO.setTitle(BadgeMessageConstant.TITLE);
messageFormDTO.setMessageContent(String.format(BadgeMessageConstant.APPROVED_MSG, detail.getBadgeName()));
messageFormDTO.setReadFlag(Constant.UNREAD);
} else {
//通知
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(dto.getCustomerId());
messageFormDTO.setApp(UserConstant.APP_RESI);
messageFormDTO.setGridId(dto.getGridId());
messageFormDTO.setUserId(dto.getUserId());
messageFormDTO.setTitle(BadgeMessageConstant.TITLE);
messageFormDTO.setMessageContent(String.format(BadgeMessageConstant.REJECTED_MSG, detail.getBadgeName(), formDTO.getAuditRemark()));
messageFormDTO.setReadFlag(Constant.UNREAD);
msgList.add(messageFormDTO);
}
messageFeignClient.saveUserMessageList(msgList);
}
@Override

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java

@ -101,4 +101,16 @@ public class UserAdviceImgServiceImpl extends BaseServiceImpl<UserAdviceImgDao,
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param adviceId
* @return UserAdviceImgEntity
* @Description 根据adviceId获取关联的图片
* @Author liushaowen
* @Date 2020/11/9 9:59
*/
@Override
public List<UserAdviceImgEntity> getImgsByAdviceId(String adviceId) {
return baseDao.selectList(new QueryWrapper<UserAdviceImgEntity>().eq("ADVICE_ID",adviceId));
}
}

112
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java

@ -19,21 +19,35 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.UserAdviceConstant;
import com.epmet.dao.UserAdviceDao;
import com.epmet.dto.UserAdviceDTO;
import com.epmet.dto.form.AdviceListFormDTO;
import com.epmet.dto.form.ReplyAdviceFormDTO;
import com.epmet.dto.result.AdviceDetailResultDTO;
import com.epmet.entity.UserAdviceEntity;
import com.epmet.entity.UserAdviceImgEntity;
import com.epmet.redis.UserAdviceRedis;
import com.epmet.service.UserAdviceImgService;
import com.epmet.service.UserAdviceService;
import io.jsonwebtoken.lang.Collections;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -50,6 +64,9 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd
@Autowired
private UserAdviceRedis userAdviceRedis;
@Autowired
private UserAdviceImgService userAdviceImgService;
@Override
public PageData<UserAdviceDTO> page(Map<String, Object> params) {
IPage<UserAdviceEntity> page = baseDao.selectPage(
@ -66,8 +83,8 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd
return ConvertUtils.sourceToTarget(entityList, UserAdviceDTO.class);
}
private QueryWrapper<UserAdviceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<UserAdviceEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<UserAdviceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -112,6 +129,95 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd
*/
@Override
public void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId) {
baseDao.replyAdvice(dto.getAdviceId(),dto.getReplyContent(),dto.getGovContent(),loginUserId);
//检验是否已经回复过
UserAdviceEntity userAdviceEntity = baseDao.selectById(dto.getAdviceId());
if (StringUtils.isNotBlank(userAdviceEntity.getReplyContent()) || StringUtils.isNotBlank(userAdviceEntity.getReplyUserId())) {
throw new RenException("该建议已被回复,不能再次回复");
}
//更新advice表
baseDao.replyAdvice(dto.getAdviceId(), dto.getReplyContent(), dto.getGovContent(), loginUserId);
//如果govImg不为空,插入advice_img表
List<String> govImgList = dto.getGovImgList();
if (!Collections.isEmpty(govImgList)) {
List<UserAdviceImgEntity> userAdviceImgEntities = new ArrayList<>();
for (int i = 0; i < govImgList.size(); i++) {
//最多存三张图片
if (i == 3) {
break;
}
UserAdviceImgEntity entity = new UserAdviceImgEntity();
entity.setImgUrl(govImgList.get(i));
entity.setAdviceId(dto.getAdviceId());
entity.setType("oper");
userAdviceImgEntities.add(entity);
}
userAdviceImgService.insertBatch(userAdviceImgEntities);
}
}
/**
* @param adviceId
* @return com.epmet.dto.result.AdviceDetailResultDTO
* @Description 建议详情
* @Author liushaowen
* @Date 2020/11/6 17:19
*/
@Override
public AdviceDetailResultDTO adviceDetail(String adviceId) {
UserAdviceEntity userAdviceEntity = baseDao.selectById(adviceId);
AdviceDetailResultDTO adviceDetailResultDTO = new AdviceDetailResultDTO();
BeanUtils.copyProperties(userAdviceEntity, adviceDetailResultDTO);
adviceDetailResultDTO.setAdviceId(userAdviceEntity.getId());
adviceDetailResultDTO.setAdviceTime(userAdviceEntity.getCreatedTime());
//拼接建议类型
if (!"*".equals(userAdviceEntity.getAdviceType())) {
StringBuilder type = new StringBuilder();
if (userAdviceEntity.getAdviceType().contains("gov")) {
type.append(UserAdviceConstant.GOV_TYPE_TEXT);
}
if (userAdviceEntity.getAdviceType().contains("software")) {
if (type.length() != 0) {
type.append(",");
}
type.append(UserAdviceConstant.SOFTWARE_TYPE_TEXT);
}
adviceDetailResultDTO.setAdviceType(type.toString());
}
//获取建议图片
List<UserAdviceImgEntity> imgsByAdviceId = userAdviceImgService.getImgsByAdviceId(adviceId);
List<String> govImgList = new ArrayList<>();
List<String> resiImgList = new ArrayList<>();
for (UserAdviceImgEntity entity : imgsByAdviceId) {
if ("resi".equals(entity.getType())) {
resiImgList.add(entity.getImgUrl());
} else if ("oper".equals(entity.getType())) {
govImgList.add(entity.getImgUrl());
}
}
adviceDetailResultDTO.setImgList(resiImgList);
adviceDetailResultDTO.setGovImgList(govImgList);
return adviceDetailResultDTO;
}
/**
* @param dto
* @return com.epmet.commons.tools.page.PageData<com.epmet.dto.UserAdviceDTO>
* @Description 查询建议列表
* @Author liushaowen
* @Date 2020/11/9 10:41
*/
@Override
public PageData<UserAdviceDTO> adviceList(AdviceListFormDTO dto) {
//page分页
Page<UserAdviceEntity> page = new Page<>(dto.getPageNo(), dto.getPageSize());
//时间降序
page.addOrder(OrderItem.desc(FieldConstant.CREATED_TIME));
//wrapper
QueryWrapper<UserAdviceEntity> wrapper = new QueryWrapper<>();
IPage<UserAdviceEntity> result = baseDao.selectPage(page,wrapper);
return null;
}
}

51
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

@ -20,7 +20,6 @@ import com.epmet.service.UserBadgeService;
import com.epmet.service.UserBaseInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -28,8 +27,6 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author zxc
@ -47,6 +44,8 @@ public class UserBadgeServiceImpl implements UserBadgeService {
private UserBaseInfoService userBaseInfoService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient messageFeignClient;
/**
* @Description 查询已经点亮的徽章
@ -148,12 +147,35 @@ public class UserBadgeServiceImpl implements UserBadgeService {
userBadgeDao.updateCertificateRecordIsLast(form.getBadgeId(),form.getUserId());
form.setGridId(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRegisteredGridId());
form.setIdNum(certificationAddFormDTO.getIdCard());
form.setCertificationImg(certificationAddFormDTO.getCertificate());
form.setSurname(certificationAddFormDTO.getSubName());
form.setCertificationImg(certificationAddFormDTO.getCertificationImg());
form.setSurname(certificationAddFormDTO.getSurname());
userBadgeDao.insertUserBadgeCertificateRecord(form);
//TODO 站内信发送 您好,您的xxx徽章因认证失败未成功点亮,请查看
this.sendMessageByUser(form);
return new Result();
}
public void sendMessageByUser(UserBadgeCertificateRecordDTO form){
List<UserMessageFormDTO> msgList = new ArrayList<>();
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setApp(BadgeConstant.RESI);
formDTO.setCustomerId(form.getCustomerId());
formDTO.setGridId(form.getGridId());
UserBadgeListResultDTO userBadgeListResultDTO = userBadgeDao.selectBadgeByBadgeId(form.getCustomerId(), form.getBadgeId());
if (null == userBadgeListResultDTO){
log.error(BadgeConstant.GET_BADGE_NAME_FAILURE);
return;
}
formDTO.setMessageContent(String.format(BadgeConstant.MESSAGE_CONTENT,userBadgeListResultDTO.getBadgeName()));
formDTO.setTitle(BadgeConstant.AUTH_TITLE);
formDTO.setReadFlag(BadgeConstant.READ_FLAG);
formDTO.setUserId(form.getUserId());
msgList.add(formDTO);
Result result = messageFeignClient.saveUserMessageList(msgList);
}
/**
* @Description 发送验证码
* @Param badgeSendCodeFormDTO
@ -232,24 +254,9 @@ public class UserBadgeServiceImpl implements UserBadgeService {
@Override
public void reloadCustomerBadge(String customerId){
userBadgeRedis.delCustomerBadge(customerId);
List<UserBadgeListResultDTO> resultUserBadge = new ArrayList<>();
List<UserBadgeListResultDTO> userBadgeListResultDTOS = userBadgeDao.selectAllBadge(customerId);
if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){
Map<String, List<UserBadgeListResultDTO>> groupByCustomer = userBadgeListResultDTOS.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getCustomerId));
resultUserBadge.addAll(groupByCustomer.get(BadgeConstant.DEFAULT_CUSTOMER));
List<UserBadgeListResultDTO> badgeByCustomer = groupByCustomer.get(customerId);
if (!CollectionUtils.isEmpty(badgeByCustomer)) {
resultUserBadge.forEach(r -> {
for (int i = NumConstant.ZERO; i < badgeByCustomer.size(); i++) {
if (r.getBadgeId().equals(badgeByCustomer.get(i).getBadgeId())) {
BeanUtils.copyProperties(badgeByCustomer.get(i), r);
badgeByCustomer.remove(badgeByCustomer.get(i));
}
}
});
resultUserBadge.addAll(badgeByCustomer);
}
userBadgeRedis.setCustomerBadge(resultUserBadge, customerId);
if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){
throw new RenException("客户徽章缓存初始化未查到数据");
}
userBadgeRedis.setCustomerBadge(userBadgeListResultDTOS, customerId);
}

5
epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

@ -142,7 +142,7 @@
</select>
<select id="selectAuditingList" resultType="com.epmet.dto.result.BadgeAuditingResultDTO">
SELECT
ubcr.ID,
ubcr.ID AS "badgeId",
badge.BADGE_NAME,
badge.BADGE_ICON,
ubcr.USER_ID,
@ -174,10 +174,11 @@
</select>
<select id="selectAuditRecord" resultType="com.epmet.dto.result.BadgeAuditRecordResultDTO">
SELECT
ubcr.ID,
ubcr.ID AS "badgeId",
badge.BADGE_NAME,
badge.BADGE_ICON,
ubcr.USER_ID,
ubcr.AUDIT_STATUS,
ubi.REAL_NAME AS "userName",
unix_timestamp(ubcr.CREATED_TIME) AS "createTime"
FROM

2
epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml

@ -40,7 +40,7 @@
reply_user_name = (select real_name from oper_user where user_id = #{replyUserId} and del_flag = 0),
updated_by = #{replyUserId},
updated_time = now()
where id = #{adviceId}
where id = #{adviceId} and del_flag = 0
</update>
</mapper>

1
epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceImgDao.xml

@ -6,6 +6,7 @@
<resultMap type="com.epmet.entity.UserAdviceImgEntity" id="userAdviceImgMap">
<result property="id" column="ID"/>
<result property="adviceId" column="ADVICE_ID"/>
<result property="type" column="TYPE"/>
<result property="imgUrl" column="IMG_URL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>

24
epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml

@ -89,7 +89,7 @@
SELECT
SURNAME,
NAME,
ID_NUM,
ID_NUM AS idCard,
( CASE WHEN AUDIT_STATUS = 'approved' THEN 'yes' ELSE 'no' END ) AS isCertificated,
MOBILE,
CERTIFICATION_IMG,
@ -126,6 +126,28 @@
AND cc.BADGE_ID = #{badgeId}
ORDER BY cf.SORT
</select>
<select id="selectBadgeByBadgeId" resultType="com.epmet.dto.result.UserBadgeListResultDTO">
SELECT
ID AS badgeId,
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId}
AND DEL_FLAG = '0'
AND ID = #{badgeId}
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default'
AND a.DEL_FLAG = '0'
AND BADGE_STATUS = 'online'
AND ID = #{badgeId}
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)
) t
</select>
<!-- 徽章审核记录表插入 -->
<insert id="insertUserBadgeCertificateRecord">

Loading…
Cancel
Save