From 790862321312e5ff0b57b99679552780704464bb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 13 Dec 2021 09:33:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=8C=96=E5=85=9A=E5=BB=BA?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=BE=A4=E4=BC=97=E6=BB=A1=E6=84=8F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/demand/ServiceStatDTO.java | 23 +++++++++++++++++++ .../java/com/epmet/dao/IcPartyUnitDao.java | 3 +++ .../com/epmet/dao/IcUserDemandRecDao.java | 3 +++ .../epmet/service/IcUserDemandRecService.java | 10 ++++++++ .../service/impl/IcPartyUnitServiceImpl.java | 19 +++++++++++---- .../impl/IcUserDemandRecServiceImpl.java | 19 +++++++++++---- .../main/resources/mapper/IcPartyUnitDao.xml | 6 +++++ .../resources/mapper/IcUserDemandRecDao.xml | 22 ++++++++++++++++++ 8 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java new file mode 100644 index 0000000000..2393e942d6 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result.demand; + + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ServiceStatDTO implements Serializable { + /** + * 服务方id + */ + private String serverId; + /** + * 总分 + */ + private BigDecimal totalScore; + /** + * 服务的需求个数 + */ + private Integer demandCount; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java index caf1f6336c..4efaff7d84 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java @@ -23,6 +23,7 @@ import com.epmet.entity.IcPartyUnitEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -43,4 +44,6 @@ public interface IcPartyUnitDao extends BaseDao { List selectListByAgencyId(@Param("agencyIds") List agencyIds, @Param("unitName") String unitName, @Param("customerId")String customerId); + + int updateSatisfaction(@Param("partyUnitId") String serverId, @Param("satisfaction") BigDecimal satisfaction); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java index a06f831778..3089b64be9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.form.demand.IcResiUserDemandFromDTO; import com.epmet.dto.form.demand.UserDemandPageFormDTO; import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.IcResiUserReportDemandRes; +import com.epmet.dto.result.demand.ServiceStatDTO; import com.epmet.entity.IcUserDemandRecEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -56,4 +57,6 @@ public interface IcUserDemandRecDao extends BaseDao { * @return */ DemandRecResultDTO selectDemandRecDetail(@Param("customerId") String customerId, @Param("demandRecId") String demandRecId); + + List selectGroupByPartyUnit(@Param("customerId") String customerId, @Param("partyUnitId") String partyUnitId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java index e3b719615e..0ed62b84be 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java @@ -23,6 +23,7 @@ import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.IcResiUserReportDemandRes; +import com.epmet.dto.result.demand.ServiceStatDTO; import com.epmet.entity.IcUserDemandRecEntity; import java.util.List; @@ -144,4 +145,13 @@ public interface IcUserDemandRecService extends BaseService groupByPartyUnit(String customerId, String partyUnitId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index 78625590df..7e2f697833 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -43,6 +43,7 @@ import com.epmet.dto.form.PartyUnitFormDTO; import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.form.demand.SubCodeFormDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.demand.ServiceStatDTO; import com.epmet.entity.IcPartyUnitEntity; import com.epmet.excel.IcPartyUnitImportExcel; import com.epmet.feign.EpmetAdminOpenFeignClient; @@ -61,6 +62,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -108,6 +110,9 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl()); } + if(StringUtils.isBlank(item.getSatisfaction())){ + item.setSatisfaction(StrConstant.HYPHEN); + } }); PageInfo pageInfo = new PageInfo<>(dtoList); return new PageData<>(dtoList, pageInfo.getTotal()); @@ -374,15 +379,19 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl list = icUserDemandRecService.groupByPartyUnit(formDTO.getCustomerId(), formDTO.getPartyUnitId()); + for (ServiceStatDTO serviceStatDTO : list) { + if (0 != serviceStatDTO.getDemandCount()) { + BigDecimal result = serviceStatDTO.getTotalScore().divide(new BigDecimal(serviceStatDTO.getDemandCount()), 4, BigDecimal.ROUND_HALF_UP); + baseDao.updateSatisfaction(serviceStatDTO.getServerId(),result); + } + } } private String getServiceMatter(Map map, String matter) { diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index eec0f484eb..7f55c2ecfd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -48,6 +48,7 @@ import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.IcResiUserReportDemandRes; +import com.epmet.dto.result.demand.ServiceStatDTO; import com.epmet.entity.*; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -569,10 +570,20 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl groupByPartyUnit(String customerId, String partyUnitId) { + if(StringUtils.isBlank(customerId)&&StringUtils.isBlank(partyUnitId)){ + return new ArrayList<>(); + } + return baseDao.selectGroupByPartyUnit(customerId,partyUnitId); + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml index a346765fd8..024b33adf6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml @@ -46,4 +46,10 @@ + + update ic_party_unit + set SATISFACTION=#{satisfaction},UPDATED_TIME=NOW() + where del_flag='0' + and id=#{partyUnitId} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index 33d491e2b4..f352685356 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -195,4 +195,26 @@ AND r.CUSTOMER_ID = #{customerId} and r.id=#{demandRecId} + + + \ No newline at end of file