|
|
@ -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<StaffGridVisite |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<CustomerGridByUserIdResultDTO> 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<CustomerGridDTO> gridInfoResult = |
|
|
|