Browse Source

Merge branch 'dev' into test

tags/B.1.2.4.0_20230908_base
yinruoxi 2 years ago
parent
commit
d290237d2c
4 changed files with 28 additions and 12 deletions
  1. +1
    -1
      xueyi-api/xueyi-api-modules-auth/src/main/java/com/xueyi/modules/auth/api/domain/vo/IntentionReqDto.java
  2. +10
    -9
      xueyi-common/xueyi-common-web/src/main/java/com/xueyi/common/web/entity/service/impl/BaseServiceImpl.java
  3. +16
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmSkillController.java
  4. +1
    -1
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java

+ 1
- 1
xueyi-api/xueyi-api-modules-auth/src/main/java/com/xueyi/modules/auth/api/domain/vo/IntentionReqDto.java View File

@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
public class IntentionReqDto {
@NotNull(message = "staffId不能为空")
private String staffId;
@NotNull(message = "staffType不能为空")
private String staffType;
@NotNull(message = "skillCode不能为空")
private String skillCode;


+ 10
- 9
xueyi-common/xueyi-common-web/src/main/java/com/xueyi/common/web/entity/service/impl/BaseServiceImpl.java View File

@@ -256,15 +256,16 @@ public class BaseServiceImpl<Q extends BaseEntity, D extends BaseEntity, IDG ext
@Override
public void saveToEs(BaseEntity dto) {
try {
// CharsetUtil
String indexName = activeProfile+"_"+StrUtil.camelCaseToUnderscore(dto.getClass().getSimpleName());
log.info("indexName:{}", indexName);
createEsIndex((D)dto);
String finalIndexName = indexName;
client.index(i -> i
.index(finalIndexName)
.id(dto.getId().toString())
.document(dto));
if (null != dto.getId()) {
String indexName = activeProfile+"_"+StrUtil.camelCaseToUnderscore(dto.getClass().getSimpleName());
log.info("indexName:{}", indexName);
createEsIndex((D)dto);
String finalIndexName = indexName;
client.index(i -> i
.index(finalIndexName)
.id(dto.getId().toString())
.document(dto));
}
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);


+ 16
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmSkillController.java View File

@@ -1,6 +1,7 @@
package com.xueyi.system.digitalmans.controller;

import com.xueyi.common.core.context.SecurityContextHolder;
import com.xueyi.common.core.utils.core.StrUtil;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.result.R;
import com.xueyi.common.core.web.validate.V_A;
@@ -13,6 +14,7 @@ import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.modules.auth.api.domain.vo.IntentionReqDto;
import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto;
import com.xueyi.system.api.digitalmans.domain.po.DmSkillPo;
import com.xueyi.system.api.staff.domain.po.DmStaffPo;
import com.xueyi.system.digitalmans.domain.dto.DmCustomMadeDto;
import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto;
import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanExtDto;
@@ -22,6 +24,7 @@ import com.xueyi.system.digitalmans.domain.query.DmSkillQuery;
import com.xueyi.system.digitalmans.service.IDmDigitalmanExtService;
import com.xueyi.system.digitalmans.service.IDmDigitalmanService;
import com.xueyi.system.digitalmans.service.IDmSkillService;
import com.xueyi.system.staff.mapper.DmStaffMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -96,6 +99,9 @@ public class DmSkillController extends BaseController<DmSkillQuery, DmSkillDto,
//return success(dmStaffService.selectStaffListByTimestamp(deviceVo));
}

@Autowired
private DmStaffMapper staffMapper;

@InnerAuth
@PostMapping("/inner/auth")
public AjaxResult skillAuth(@Valid @RequestBody IntentionReqDto intentionReqDto) {
@@ -106,8 +112,17 @@ public class DmSkillController extends BaseController<DmSkillQuery, DmSkillDto,
}

String auth = dto.getAuth();
DmStaffPo staffPo = staffMapper.selectById(intentionReqDto.getStaffId());

if (StringUtils.isNotEmpty(auth) && (auth.equals(intentionReqDto.getStaffType()) || auth.startsWith(intentionReqDto.getStaffType()+",") || auth.indexOf(","+intentionReqDto.getStaffType()+",")!=-1 || auth.endsWith(","+intentionReqDto.getStaffType()))){
if (staffPo == null) {
return AjaxResult.error("指定ID的员工不存在");
}

String type = intentionReqDto.getStaffType();
if (StrUtil.isNotEmpty(type)) {
type = staffPo.getUserType();
}
if (StringUtils.isNotEmpty(auth) && (auth.equals(type) || auth.startsWith(type+",") || auth.indexOf(","+type+",")!=-1 || auth.endsWith(","+type))){
return AjaxResult.success(dto);
} else {
return AjaxResult.error("权限不足");


+ 1
- 1
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java View File

@@ -184,7 +184,7 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
cr.setFaceUrl(url);
cr.setResourceId(dmResourcesDto.getId());
}
recognizedRecordsService.saveToEs(recordsConverter.mapperDto(cr));
// recognizedRecordsService.saveToEs(recordsConverter.mapperDto(cr));
crs.add(cr);
}



Loading…
Cancel
Save