diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index dea6287ed4..c1fe6fbd85 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -203,8 +203,8 @@ 123456 true - 192.168.1.130:8848 - 6ceab336-d004-4acf-89c6-e121d06f4988 + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b false diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index de87b9eea4..6c42e6e7dc 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -220,6 +220,14 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { Result staffGridResult = govOrgFeignClient.getStaffGrid(latestGridFormDTO); if (staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())) { + StaffGridVisitedFormDTO gridRecordParam = new StaffGridVisitedFormDTO(); + gridRecordParam.setGridId(staffGridResult.getData().getGridId()); + gridRecordParam.setCustomerId(latestGridFormDTO.getCustomerId()); + gridRecordParam.setStaffId(latestGridFormDTO.getStaffId()); + Result writeRecordResult = epmetUserFeignClient.saveStaffGridVisitedRecord(gridRecordParam); + if(writeRecordResult.success()){ + logger.warn("com.epmet.service.impl.StaffAgencyServiceImpl.getLatestGrid,工作人员网格访问网格写入失败,staffId:{},gridId:{}",latestGridFormDTO.getStaffId(),staffGridResult.getData().getGridId()); + } return staffGridResult; } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java index 6869f1a5bf..554da4a12d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java @@ -23,6 +23,8 @@ import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.StaffGridVisitedEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.Date; + /** * 工作人员进入网格日志表 * @@ -41,4 +43,23 @@ public interface StaffGridVisitedDao extends BaseDao { **/ String selectStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + /** + * @Description 根据staffId和customerId查询当前用户上一次登陆的网格Id,Id,创建时间 + * @param latestGridFormDTO + * @return StaffGridVisitedEntity + * @author wangc + * @date 2020.08.27 15:05 + **/ + StaffGridVisitedEntity selectVisitedRecordByStaffId(LatestGridFormDTO latestGridFormDTO); + + /** + * @Description 更新工作人员网格登陆记录的时间 + * @param id + * @param date + * @return + * @author wangc + * @date 2020.08.27 16:28 + **/ + void updateRecordTime(String id, Date date); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java index 5b0ab6bf60..d76e08c884 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java @@ -43,9 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 工作人员进入网格日志表 @@ -124,10 +122,28 @@ public class StaffGridVisitedServiceImpl extends BaseServiceImpl getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + Calendar currentCal = Calendar.getInstance(); + currentCal.setTime(new Date()); CustomerGridByUserIdResultDTO gridResult = new CustomerGridByUserIdResultDTO(); - String gridId = baseDao.selectStaffLatestGrid(latestGridFormDTO); + StaffGridVisitedEntity recordEntity = baseDao.selectVisitedRecordByStaffId(latestGridFormDTO); + String gridId = null == recordEntity ? null : recordEntity.getGridId(); if(StringUtils.isNotBlank(gridId)){ + Calendar recordCal = Calendar.getInstance(); + recordCal.setTime(recordEntity.getCreatedTime()); + if(currentCal.get(Calendar.YEAR) == recordCal.get(Calendar.YEAR) && + currentCal.get(Calendar.DAY_OF_YEAR) == recordCal.get(Calendar.DAY_OF_YEAR) + && StringUtils.isNotBlank(recordEntity.getId())){ + //同一天 更新 + baseDao.updateRecordTime(recordEntity.getId(),currentCal.getTime()); + }else{ + //非同一天 新增 + recordEntity.setCustomerId(latestGridFormDTO.getCustomerId()); + recordEntity.setStaffId(latestGridFormDTO.getStaffId()); + recordEntity.setId(null); + recordEntity.setCreatedTime(null); + baseDao.insert(recordEntity); + } CustomerGridFormDTO param = new CustomerGridFormDTO(); param.setGridId(gridId); Result gridInfoResult = diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml index 73978e23f3..8805ed9dab 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml @@ -33,4 +33,35 @@ LIMIT 1 + + + + + + UPDATE + STAFF_GRID_VISITED + SET + CREATED_TIME = #{date}, + UPDATED_TIME = #{date} + WHERE + DEL_FLAG = '0' + AND + ID = #{id} + \ No newline at end of file