Browse Source

Merge branch 'dev_log' into develop

# Conflicts:
#	epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
dev_shibei_match
wxz 4 years ago
parent
commit
4ec0ae120b
  1. 1
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java
  2. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java
  3. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java
  4. 1
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/OperatorInfo.java
  5. 1
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java
  6. 1
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java
  7. 35
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java
  8. 1
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.4__addlog_ope_col.sql
  9. 2
      epmet-admin/epmet-admin-server/src/main/resources/logback-spring.xml
  10. 1
      epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml
  11. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  12. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  13. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

1
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java

@ -40,6 +40,7 @@ public class LogOperationResultDTO {
/**
* 操作人ID
*/
private String customerId;
private String operatorId;
private String operatorName;
private String operatorMobile;

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java

@ -65,6 +65,8 @@ public class LogOperationEntity extends BaseEpmetEntity {
*/
private String targetId;
private String customerId;
/**
* 操作人ID
*/

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java

@ -58,6 +58,6 @@ public class LogOperationHelper implements ResultDataResolver {
Result<CustomerStaffDTO> result = userOpenFeignClient.getCustomerStaffInfoByUserId(form);
CustomerStaffDTO staffInfo = getResultDataOrThrowsException(result, ServiceConstant.EPMET_ADMIN_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(),
"调用epmet-user服务获取staff信息发生异常");
return new OperatorInfo(staffInfo.getMobile(), staffInfo.getRealName());
return new OperatorInfo(staffInfo.getCustomerId(), staffInfo.getMobile(), staffInfo.getRealName());
}
}

1
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/OperatorInfo.java

@ -6,6 +6,7 @@ import lombok.Data;
@Data
@AllArgsConstructor
public class OperatorInfo {
private String customerId;
private String mobile;
private String name;
}

1
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java

@ -67,6 +67,7 @@ public class AuthOperationLogListener implements MessageListenerConcurrently {
logEntity.setFromApp(msgObj.getFromApp());
logEntity.setFromClient(msgObj.getFromClient());
logEntity.setTargetId("");
logEntity.setCustomerId(operatorInfo.getCustomerId());
logEntity.setOperatorId(msgObj.getUserId());
logEntity.setOperatorName(operatorInfo.getName());
logEntity.setOperatorMobile(operatorInfo.getMobile());

1
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java

@ -63,6 +63,7 @@ public class ProjectOperationLogListener implements MessageListenerConcurrently
logEntity.setIp(msgObj.getIp());
logEntity.setFromApp(msgObj.getFromApp());
logEntity.setFromClient(msgObj.getFromClient());
logEntity.setCustomerId(operatorInfo.getCustomerId());
logEntity.setOperatorId(msgObj.getOperatorId());
logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatorName(operatorInfo.getName());

35
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java

@ -16,14 +16,12 @@ import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.LogOperationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -54,29 +52,35 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
@Override
public List<LogOperationResultDTO> listOperationLogs(String condition, String customerId, Integer pageNo, Integer pageSize) {
// 1.条件查询
List<LogOperationResultDTO> logDtos = listByOperatorMobile(condition, customerId, pageNo, pageSize);
if (CollectionUtils.isEmpty(logDtos)) {
logDtos = listByOperatorName(condition, pageNo, pageSize);
}
if (CollectionUtils.isEmpty(logDtos)) {
return new ArrayList<>();
}
//List<LogOperationResultDTO> logDtos = listByOperatorMobile(condition, customerId, pageNo, pageSize);
//if (CollectionUtils.isEmpty(logDtos)) {
// logDtos = listByOperatorName(condition, pageNo, pageSize);
//}
//
//if (CollectionUtils.isEmpty(logDtos)) {
// return new ArrayList<>();
//}
// 2.直接分页查询
// 条件查询,排序
LambdaQueryWrapper<LogOperationEntity> w = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(condition)) {
w.like(LogOperationEntity::getOperatorName, condition)
.or()
.like(LogOperationEntity::getOperatorMobile, condition);
}
w.eq(LogOperationEntity::getCustomerId, customerId);
w.orderByDesc(LogOperationEntity::getOperatingTime);
IPage<LogOperationEntity> iPage = logOperationDao.selectPage(new Page<>(pageNo, pageSize), w);
List<LogOperationEntity> logEntities = iPage.getRecords();
List<String> userIds = logEntities.stream().map(l -> l.getOperatorId()).collect(Collectors.toList());
Set<String> userIds = logEntities.stream().map(l -> l.getOperatorId()).collect(Collectors.toSet());
return convertLogOperationEntity2DTO(logEntities, getStaffMapByUserIds(userIds));
}
private Map<String, CustomerStaffDTO> getStaffMapByUserIds(List<String> userIds) {
private Map<String, CustomerStaffDTO> getStaffMapByUserIds(Set<String> userIds) {
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setUserIds(userIds);
form.setUserIds(new ArrayList<>(userIds));
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常");
@ -168,6 +172,7 @@ public class LogOperationServiceImpl implements LogOperationService, ResultDataR
ldto.setTargetId(l.getTargetId());
ldto.setType(l.getType());
ldto.setTypeDisplay(l.getTypeDisplay());
ldto.setCustomerId(l.getCustomerId());
ldto.setOperatorMobile(staffMap.get(l.getOperatorId()).getMobile());
ldto.setOperatorName(staffMap.get(l.getOperatorId()).getRealName());
return ldto;

1
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.4__addlog_ope_col.sql

@ -0,0 +1 @@
alter table log_operation add CUSTOMER_ID varchar(64) comment '客户id' not null after OPERATOR_ID;

2
epmet-admin/epmet-admin-server/src/main/resources/logback-spring.xml

@ -134,7 +134,7 @@
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="dev,test,local">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>

1
epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml

@ -13,6 +13,7 @@
<result property="fromApp" column="FROM_APP"/>
<result property="fromClient" column="FROM_CLIENT"/>
<result property="category" column="CATEGORY"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="operatorId" column="OPERATOR_ID"/>
<result property="operatorName" column="OPERATOR_NAME"/>
<result property="operatorMobile" column="OPERATOR_MOBILE"/>

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java

@ -124,7 +124,7 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
result.forEach(r -> {
if (!r.getLlStatus()){
finalGrids.forEach(g -> {
if (StringUtils.isNotBlank(g.getCenterMark())&& !"[]".equals(g.getCenterMark())){
if (r.getGridId().equals(g.getGridId()) && (StringUtils.isNotBlank(g.getCenterMark())&& !"[]".equals(g.getCenterMark()))){
r.setLongitude(getLL(g.getCenterMark(),PatrolConstant.LONGITUDE));
r.setLatitude(getLL(g.getCenterMark(),PatrolConstant.LATITUDE));
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -21,7 +21,7 @@ import java.util.Map;
* @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:09
*/
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class, url = "http://127.0.0.1:8087")
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class, url = "localhost:8087")
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class)
public interface EpmetUserOpenFeignClient {
@ -224,7 +224,7 @@ public interface EpmetUserOpenFeignClient {
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息校验用户是否存在
**/
@GetMapping(value = "/epmetuser/customerstaff/getCustsomerStaffByIdAndPhone")
@GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndPhone")
Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO);
/**

4
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -424,9 +424,7 @@ public class CustomerStaffController {
*/
@PostMapping("list")
public Result<List<CustomerStaffDTO>> list(@RequestBody CustomerStaffFormDTO input) {
String customerId = StringUtils.isBlank(input.getCustomerId()) ? loginUserUtil.getLoginUserCustomerId() : input.getCustomerId();
List<CustomerStaffDTO> staffs = customerStaffService.list(customerId, input.getRealName(), input.getMobile(), input.getUserIds());
List<CustomerStaffDTO> staffs = customerStaffService.list(input.getCustomerId(), input.getRealName(), input.getMobile(), input.getUserIds());
return new Result<List<CustomerStaffDTO>>().ok(staffs);
}

Loading…
Cancel
Save