parent
ecb1115217
commit
a92d95349c
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
|
@ -16,6 +17,7 @@ import java.util.List;
|
|||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Setter
|
||||
@Alias("SysMenu")
|
||||
public class SysMenu extends BaseEntity
|
||||
{
|
||||
|
|
@ -66,6 +68,8 @@ public class SysMenu extends BaseEntity
|
|||
/** 菜单图标 */
|
||||
private String icon;
|
||||
|
||||
private Integer checked;
|
||||
|
||||
/** 子菜单 */
|
||||
private List<SysMenu> children = new ArrayList<SysMenu>();
|
||||
|
||||
|
|
@ -74,16 +78,16 @@ public class SysMenu extends BaseEntity
|
|||
|
||||
private Long templateId;
|
||||
|
||||
public Integer getChecked()
|
||||
{
|
||||
return checked;
|
||||
}
|
||||
|
||||
public Long getMenuId()
|
||||
{
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId)
|
||||
{
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
public String getMenuName()
|
||||
|
|
@ -91,172 +95,89 @@ public class SysMenu extends BaseEntity
|
|||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||
public String getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component)
|
||||
{
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getIsFrame()
|
||||
{
|
||||
return isFrame;
|
||||
}
|
||||
|
||||
public void setIsFrame(String isFrame)
|
||||
{
|
||||
this.isFrame = isFrame;
|
||||
}
|
||||
|
||||
public String getIsCache()
|
||||
{
|
||||
return isCache;
|
||||
}
|
||||
|
||||
public void setIsCache(String isCache)
|
||||
{
|
||||
this.isCache = isCache;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
public String getMenuType()
|
||||
{
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType)
|
||||
{
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(String visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||
public String getPerms()
|
||||
{
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms(String perms)
|
||||
{
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<SysMenu> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysMenu> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getSystemType() {
|
||||
return systemType;
|
||||
}
|
||||
|
||||
public void setSystemType(String systemType) {
|
||||
this.systemType = systemType;
|
||||
}
|
||||
|
||||
public Long getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.common.core.utils.http;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* @author bonus
|
||||
* @data 2023/1/5 15:14
|
||||
* @description 工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpUtils {
|
||||
static RestTemplate client = new RestTemplate();
|
||||
/**
|
||||
* GET/POST 请求
|
||||
*
|
||||
* @param url 地址
|
||||
* @param params 参数
|
||||
* @param type 请求类型 false:GET,true:POST
|
||||
* @return 数据
|
||||
*/
|
||||
public static String sendRequest(String url, Object params, boolean type) {
|
||||
try{
|
||||
//新建Http头,add方法可以添加参数
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
//设置请求发送方式
|
||||
HttpMethod method = type ? HttpMethod.POST : HttpMethod.GET;
|
||||
//以表单的方式提交
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
//将请求头部和参数合成一个请求
|
||||
HttpEntity<Object> requestEntity = new HttpEntity<>(params, headers);
|
||||
//执行HTTP请求,将返回的结构使用String类格式化(可以设置为对应返回值格式的类)
|
||||
ResponseEntity<String> response = client.exchange(url, method, requestEntity, String.class);
|
||||
return response.getBody();
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.gateway.config;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
|
||||
@Configuration
|
||||
public class ContextPathConfig {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty("server.servlet.context-path")
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public WebFilter contextPathWebFilter(ServerProperties serverProperties){
|
||||
String contextPath = serverProperties.getServlet().getContextPath();
|
||||
return (serverWebExchange, webFilterChain) ->{
|
||||
ServerHttpRequest request = serverWebExchange.getRequest();
|
||||
String requestPath = request.getURI().getPath();
|
||||
|
||||
if(requestPath.contains(contextPath)){
|
||||
String newPath = requestPath.replaceFirst(contextPath+"/", "");
|
||||
ServerHttpRequest newRequest = request.mutate()
|
||||
.path(newPath).build();
|
||||
return webFilterChain.filter(serverWebExchange.mutate()
|
||||
.request(newRequest)
|
||||
.build()
|
||||
);
|
||||
}else {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.bmw.domain.dto.AppFileDto;
|
||||
import com.bonus.bmw.domain.dto.BankCardBean;
|
||||
import com.bonus.bmw.domain.dto.BmWorkerEinUserVo;
|
||||
import com.bonus.bmw.domain.po.FaceRecognitionBean;
|
||||
import com.bonus.bmw.domain.vo.TreeVo;
|
||||
import com.bonus.bmw.service.AppRecognitionService;
|
||||
import com.bonus.bmw.service.AppService;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.BusinessType;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
|
|
@ -16,17 +21,14 @@ import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
|||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* app部分接口
|
||||
* app识别服务接口
|
||||
* @author fly
|
||||
* @date 2025/8/23
|
||||
*/
|
||||
|
|
@ -41,18 +43,46 @@ public class AppRecognitionController extends BaseController {
|
|||
/**
|
||||
* 人脸识别-人脸照片采集入库
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@PostMapping("/collectFacialData")
|
||||
public R<AppFileDto> collectFacialData(MultipartFile facePhoto, FaceRecognitionBean bean) {
|
||||
@SysLog(title = "人脸照片采集入库", businessType = OperaType.QUERY, logType = 0, module = "识别服务接口->人脸照片采集入库", details = "人脸照片采集入库")
|
||||
public String collectFacialData(MultipartFile facePhoto, FaceRecognitionBean bean) {
|
||||
return service.uploadFaceRecognition(facePhoto, bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸识别-识别人脸
|
||||
*/
|
||||
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@PostMapping("/getFaceRecognition")
|
||||
public R<AppFileDto> getFaceRecognition(MultipartFile facePhoto) {
|
||||
@SysLog(title = "识别人脸", businessType = OperaType.QUERY, logType = 0, module = "识别服务接口->识别人脸", details = "识别人脸")
|
||||
public AjaxResult getFaceRecognition(@RequestPart(value = "file")MultipartFile facePhoto) {
|
||||
return service.getFaceRecognition(facePhoto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 银行卡识别
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@PostMapping("/bankCardRecognition")
|
||||
@SysLog(title = "银行卡识别", businessType = OperaType.QUERY, logType = 0, module = "识别服务接口->银行卡识别", details = "银行卡识别")
|
||||
public AjaxResult bankCardRecognition(@RequestBody BankCardBean bean){
|
||||
return service.bankCardRecognition(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸识别打卡
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@PostMapping("/appPlayCard")
|
||||
@SysLog(title = "人脸识别打卡", businessType = OperaType.QUERY, logType = 0, module = "识别服务接口->人脸识别打卡", details = "人脸识别打卡")
|
||||
public AjaxResult appPlayCard(@RequestPart(value = "file")MultipartFile facePhoto, @RequestParam(value = "params")String params){
|
||||
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(params);
|
||||
System.err.println(jsonObject);
|
||||
String idNumber = jsonObject.getString("idNumber");
|
||||
return service.appPlayCard(facePhoto,idNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
package com.bonus.bmw.controller;
|
||||
import com.bonus.bmw.domain.po.HomePagePo;
|
||||
import com.bonus.bmw.domain.vo.CommonSetBean;
|
||||
import com.bonus.bmw.service.HomePageService;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.BusinessType;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.SysMenu;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
* @author fly
|
||||
|
|
@ -95,5 +104,39 @@ public class HomePageController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false), requiresPermissions = @RequiresPermissions("home:page:query"))
|
||||
@PostMapping("getMenuSelected")
|
||||
@SysLog(title = "快捷功能", businessType = OperaType.QUERY, logType = 0, module = "首页->快捷功能", details = "快捷功能")
|
||||
public AjaxResult getMenuSelected(CommonSetBean o){
|
||||
try {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
o.setUserId(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
||||
//首页-常用功能-已选
|
||||
// List<CommonSetBean> menuSelectedList= service.getMenuSelected(o);
|
||||
//首页-常用功能-所有(去除已选)
|
||||
List<CommonSetBean> menuAllList= service.getMenuAll(o);
|
||||
// map.put("menuSelectedList",menuSelectedList);
|
||||
map.put("menuAllList",menuAllList);
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false), requiresPermissions = @RequiresPermissions("home:page:query"))
|
||||
@PostMapping("addMenu")
|
||||
@SysLog(title = "快捷功能新增", businessType = OperaType.QUERY, logType = 0, module = "首页->快捷功能新增", details = "快捷功能新增")
|
||||
public AjaxResult addMenu(@RequestBody CommonSetBean bean) {
|
||||
try {
|
||||
bean.setUserId(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
||||
Integer result = service.addMenu(bean);
|
||||
return result != null && result > 0 ? AjaxResult.success() : error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class PmWorkerExitController extends BaseController {
|
|||
listFile.get(i).setFile(files[i]);
|
||||
}
|
||||
if(o.getProId()==null){
|
||||
return AjaxResult.error("请填写出厂工程");
|
||||
return AjaxResult.error("请填写出场工程");
|
||||
}
|
||||
return service.updateWorkerExit(o,listFile);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.bmw.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 银行卡
|
||||
* @author hay
|
||||
*/
|
||||
@Data
|
||||
public class BankCardBean {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* base64图片
|
||||
*/
|
||||
private String imageBase64;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
private String bankCard;
|
||||
|
||||
/**
|
||||
* 银行名称
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
|
@ -103,5 +103,11 @@ public class BmWorkerEinUserVo {
|
|||
* 考勤设备名称
|
||||
*/
|
||||
private String devName;
|
||||
/**
|
||||
* 人脸识别结果
|
||||
*/
|
||||
private Boolean faceResult;
|
||||
|
||||
private String faceRemark;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class MapBeanPo {
|
||||
|
||||
|
|
@ -15,4 +17,9 @@ public class MapBeanPo {
|
|||
|
||||
private Integer subId;
|
||||
|
||||
public MapBeanPo(Integer id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页 常用功能设置bean
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class CommonSetBean {
|
||||
//菜单id
|
||||
private Long id;
|
||||
//菜单名称
|
||||
private String name;
|
||||
//菜单路径
|
||||
private String url;
|
||||
//菜单图标
|
||||
private String icon;
|
||||
//用户id
|
||||
private Integer userId;
|
||||
//已选菜单
|
||||
private String checked; //1已选 0未选
|
||||
private String idArr;
|
||||
private List<String> idList;
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import com.bonus.bmw.domain.dto.BmWorkerEinUserVo;
|
|||
|
||||
public interface AppRecognitionMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 获取今日是否已签到
|
||||
* @param vo
|
||||
|
|
@ -28,7 +27,7 @@ public interface AppRecognitionMapper {
|
|||
|
||||
/**
|
||||
* 获取今日是否已签退
|
||||
* @param vo
|
||||
* @param idNumber
|
||||
* @return
|
||||
*/
|
||||
BmWorkerEinUserVo getOnUserInfoByIdNumber(String idNumber);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.po.HomePagePo;
|
||||
import com.bonus.bmw.domain.po.MapBeanPo;
|
||||
import com.bonus.bmw.domain.vo.*;
|
||||
import com.bonus.system.api.domain.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -89,4 +91,32 @@ public interface HomePageMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MapBeanVo> getProByProStatus(HomePagePo o);
|
||||
|
||||
/**
|
||||
* 获取快捷功能
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<CommonSetBean> getMenuSelected(CommonSetBean o);
|
||||
|
||||
/**
|
||||
* 获取所有快捷功能
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<CommonSetBean> getMenuAll(CommonSetBean o);
|
||||
|
||||
/**
|
||||
* 删除快捷功能
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
void delMenuByUserId(CommonSetBean bean);
|
||||
|
||||
/**
|
||||
* 新增快捷功能
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
Integer addMenu(List<MapBeanPo> list);
|
||||
}
|
||||
|
|
@ -38,4 +38,6 @@ public interface PmWorkerExitMapper {
|
|||
List<PmWorker> selectWorkListByWorkerId(PmWorkerDto o);
|
||||
|
||||
List<MapBeanVo> getContractIdAndWageCard(Integer workerId);
|
||||
|
||||
String getIdNumberByWorkerId(Integer workerId);
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.AppFileDto;
|
||||
import com.bonus.bmw.domain.dto.BankCardBean;
|
||||
import com.bonus.bmw.domain.dto.BmWorkerEinUserVo;
|
||||
import com.bonus.bmw.domain.po.FaceRecognitionBean;
|
||||
import com.bonus.bmw.domain.vo.TreeVo;
|
||||
import com.bonus.common.core.domain.R;
|
||||
|
|
@ -11,11 +13,14 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
public interface AppRecognitionService {
|
||||
|
||||
R<AppFileDto> uploadFaceRecognition(MultipartFile facePhoto, FaceRecognitionBean bean);
|
||||
String uploadFaceRecognition(MultipartFile facePhoto, FaceRecognitionBean bean);
|
||||
|
||||
R<AppFileDto> getFaceRecognition(MultipartFile facePhoto);
|
||||
AjaxResult getFaceRecognition(MultipartFile facePhoto);
|
||||
|
||||
AjaxResult bankCardRecognition(BankCardBean bean);
|
||||
|
||||
AjaxResult appPlayCard(MultipartFile facePhoto, String idNumber);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
import com.bonus.bmw.domain.vo.TreeVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface AppService {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.po.HomePagePo;
|
||||
import com.bonus.bmw.domain.vo.CommonSetBean;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.SysMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HomePageService{
|
||||
|
||||
|
|
@ -32,4 +36,25 @@ public interface HomePageService{
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getEinWorkerDistribution(HomePagePo o);
|
||||
|
||||
/**
|
||||
* 获取已选菜单
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<CommonSetBean> getMenuSelected(CommonSetBean o);
|
||||
|
||||
/**
|
||||
* 获取所有菜单
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<CommonSetBean> getMenuAll(CommonSetBean o);
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
Integer addMenu(CommonSetBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,29 +5,37 @@ import cn.hutool.http.HttpUtil;
|
|||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.bmw.domain.dto.AppFileDto;
|
||||
import com.bonus.bmw.domain.dto.BankCardBean;
|
||||
import com.bonus.bmw.domain.dto.BmWorkerEinUserVo;
|
||||
import com.bonus.bmw.domain.po.FaceRecognitionBean;
|
||||
import com.bonus.bmw.mapper.AppRecognitionMapper;
|
||||
import com.bonus.bmw.service.AppRecognitionService;
|
||||
import com.bonus.bmw.utils.BaiduRecognitionUtils;
|
||||
import com.bonus.bmw.utils.FaceStatusCodeReturn;
|
||||
import com.bonus.bmw.utils.IpAndPathConfig;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.file.FileUtils;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.bmw.utils.BaiduRecognitionUtils.HTTP_CLIENT;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -38,7 +46,7 @@ import java.util.List;
|
|||
public class AppRecognitionServiceImpl implements AppRecognitionService {
|
||||
|
||||
@Resource
|
||||
private AppRecognitionMapper appMapper;
|
||||
private AppRecognitionMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
|
@ -50,63 +58,141 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<AppFileDto> uploadFaceRecognition(MultipartFile facePhoto, FaceRecognitionBean bean) {
|
||||
public String uploadFaceRecognition(MultipartFile facePhoto, FaceRecognitionBean bean) {
|
||||
try {
|
||||
// 1. 获取文件字节数组
|
||||
byte[] bytes = facePhoto.getBytes();
|
||||
// 2. 使用 Base64 编码
|
||||
String fileBase64 = Base64.getEncoder().encodeToString(bytes);
|
||||
bean.setImg(fileBase64);
|
||||
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/updatedb",
|
||||
FastJsonHelper.beanToJsonStr(bean));
|
||||
log.error(body);
|
||||
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);
|
||||
String code = jsonObject.getString("code");
|
||||
return body.contains("30002") ? R.ok()
|
||||
: R.fail(FaceStatusCodeReturn.faceStatusCodeReturn(Integer.parseInt(code)));
|
||||
// 最多尝试两次,避免无限循环 ,删除无需重复
|
||||
int maxRetries = 1;
|
||||
if(!"delete".equals(bean.getOptMode())){
|
||||
// 1. 获取文件字节数组
|
||||
byte[] bytes = facePhoto.getBytes();
|
||||
// 2. 使用 Base64 编码
|
||||
String fileBase64 = Base64.getEncoder().encodeToString(bytes);
|
||||
// 根据文件类型添加相应的前缀
|
||||
String originalFilename = facePhoto.getOriginalFilename();
|
||||
if (originalFilename != null && originalFilename.toLowerCase().endsWith(".png")) {
|
||||
bean.setImg("data:image/png;base64," + fileBase64);
|
||||
} else {
|
||||
bean.setImg("data:image/jpeg;base64," + fileBase64);
|
||||
}
|
||||
maxRetries = 2;
|
||||
}else{
|
||||
bean.setImg("data:image/jpeg;base64,fddsdafretrthwuwtrewyewtrweet");
|
||||
}
|
||||
for (int i = 0; i < maxRetries; i++) {
|
||||
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/updatedb",
|
||||
FastJsonHelper.beanToJsonStr(bean));
|
||||
log.error(body);
|
||||
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);
|
||||
String code = jsonObject.getString("code");
|
||||
if ("30019".equals(code) && i == 0) {
|
||||
// 第一次遇到30019错误时,设置replace模式再试一次
|
||||
bean.setOptMode("replace");
|
||||
} else {
|
||||
// 其他情况直接返回结果
|
||||
return "30002".equals(code) ? FaceStatusCodeReturn.faceStatusCodeReturn(30002)
|
||||
: FaceStatusCodeReturn.faceStatusCodeReturn(Integer.parseInt(code));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
return "公司内部人脸识别服务处理异常";
|
||||
}
|
||||
return "公司内部人脸识别服务处理异常";
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<AppFileDto> getFaceRecognition(MultipartFile facePhoto) {
|
||||
public AjaxResult getFaceRecognition(MultipartFile facePhoto) {
|
||||
try {
|
||||
// 1. 获取文件字节数组
|
||||
byte[] bytes = facePhoto.getBytes();
|
||||
// 2. 使用 Base64 编码
|
||||
String fileBase64 = Base64.getEncoder().encodeToString(bytes);
|
||||
// 根据文件类型添加相应的前缀
|
||||
String originalFilename = facePhoto.getOriginalFilename();
|
||||
if (originalFilename != null && originalFilename.toLowerCase().endsWith(".png")) {
|
||||
fileBase64 = "data:image/png;base64," + fileBase64;
|
||||
} else {
|
||||
fileBase64 = "data:image/jpeg;base64," + fileBase64;
|
||||
}
|
||||
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/facerecognition",
|
||||
FastJsonHelper.beanToJsonStr(new FaceRecognitionBean(fileBase64)));
|
||||
log.error(body);
|
||||
log.info("人脸识别响应内容: {}", body);
|
||||
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);
|
||||
String code = jsonObject.getString("code");
|
||||
AppFileDto sysFile = new AppFileDto();
|
||||
BmWorkerEinUserVo sysFile = new BmWorkerEinUserVo();
|
||||
if(!"30000".equals(code)){
|
||||
sysFile.setFace(false);
|
||||
sysFile.setFaceResult(false);
|
||||
sysFile.setFaceRemark(body);
|
||||
}else{
|
||||
String data = jsonObject.getString("data");
|
||||
JSONArray jsonArray = FastJsonHelper.jsonArrStrToJsonArr(data);
|
||||
String idNumber = (String) jsonArray.get(0);
|
||||
sysFile.setFace(true);
|
||||
// 1. 获取用户信息
|
||||
BmWorkerEinUserVo vo = appMapper.getOnUserInfoByIdNumber(idNumber);
|
||||
if(vo != null && vo.getId() != null){
|
||||
saveAttData(vo,facePhoto);
|
||||
}else {
|
||||
return R.fail("人脸识别成功,但未找到入场人员信息");
|
||||
}
|
||||
sysFile = mapper.getOnUserInfoByIdNumber(idNumber);
|
||||
sysFile.setFaceResult(true);
|
||||
}
|
||||
return !"30000".equals(code) ? R.fail(FaceStatusCodeReturn.faceStatusCodeReturn(Integer.parseInt(code)))
|
||||
:R.ok();
|
||||
return !"30000".equals(code) ? AjaxResult.error(FaceStatusCodeReturn.faceStatusCodeReturn(Integer.parseInt(code)))
|
||||
: AjaxResult.success(sysFile);
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String saveAttData(BmWorkerEinUserVo vo,MultipartFile facePhoto) {
|
||||
@Override
|
||||
public AjaxResult bankCardRecognition(BankCardBean bean) {
|
||||
try {
|
||||
if (!StringHelper.isNullOrEmptyString(bean.getImageBase64())) {
|
||||
String image = URLEncoder.encode(bean.getImageBase64(), "utf-8");
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, "image=" + image + "&location=false&detect_quality=false");
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard?access_token=" + BaiduRecognitionUtils.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = BaiduRecognitionUtils.HTTP_CLIENT.newCall(request).execute();
|
||||
assert response.body() != null;
|
||||
String jsonString = response.body().string();
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonString);
|
||||
com.alibaba.fastjson.JSONObject resultObject = jsonObject.getJSONObject("result");
|
||||
String card_number = resultObject.getString("bank_card_number");
|
||||
String bank_name = resultObject.getString("bank_name");
|
||||
String date = resultObject.getString("valid_date");
|
||||
String type = resultObject.getString("bank_card_type");
|
||||
if (StringHelper.isNullOrEmptyString(card_number) || StringHelper.isNullOrEmptyString(bank_name)){
|
||||
return AjaxResult.error("银行卡信息识别失败");
|
||||
}
|
||||
BankCardBean bankCardBean = new BankCardBean();
|
||||
bankCardBean.setBankCard(card_number.replaceAll("\\s", ""));
|
||||
bankCardBean.setBankName(BaiduRecognitionUtils.updateBankName(bank_name));
|
||||
bankCardBean.setDate(date);
|
||||
bankCardBean.setType(type);
|
||||
System.out.println(bankCardBean.getBankCard());
|
||||
return AjaxResult.success("识别成功",bankCardBean);
|
||||
} else {
|
||||
return AjaxResult.error("请上传银行卡照片");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("银行卡识别失败", e);
|
||||
return AjaxResult.error("银行卡识别失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult appPlayCard(MultipartFile facePhoto, String idNumber) {
|
||||
// 1. 获取用户信息
|
||||
BmWorkerEinUserVo vo = mapper.getOnUserInfoByIdNumber(idNumber);
|
||||
if(vo != null && vo.getUserId() != null){
|
||||
saveAttData(vo,facePhoto);
|
||||
}else {
|
||||
return AjaxResult.error("未找到入场人员信息");
|
||||
}
|
||||
return AjaxResult.success("打卡成功");
|
||||
}
|
||||
|
||||
public void saveAttData(BmWorkerEinUserVo vo, MultipartFile facePhoto) {
|
||||
vo.setAttTime(DateUtil.now());
|
||||
vo.setDevCode("app打卡");
|
||||
vo.setDevName("app打卡设备");
|
||||
|
|
@ -115,21 +201,20 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
|
|||
vo.setAttMonth(DateUtils.getCurrentMonth());
|
||||
vo.setAttDay(DateUtils.getDate());
|
||||
vo.setCreateTime(DateUtils.getTime());
|
||||
Integer num= appMapper.getTodayIsExit(vo);
|
||||
Integer num= mapper.getTodayIsExit(vo);
|
||||
//每日新增一条考勤信息
|
||||
if(num==null || num ==0){
|
||||
UploadFileVo uploadFileVo=fileUploadUtils.uploadFile(facePhoto, Constants.FILE_UPLOAD_ATT_PHOTO, vo.getId(),"APP考勤打卡照片","app_att",null);
|
||||
if(uploadFileVo!=null){
|
||||
vo.setImage(uploadFileVo.getPath());
|
||||
appMapper.insertAttPerson(vo);
|
||||
mapper.insertAttPerson(vo);
|
||||
}
|
||||
}
|
||||
UploadFileVo uploadFileVo=fileUploadUtils.uploadFile(facePhoto, Constants.FILE_UPLOAD_ATT_RECORD_PHOTO, vo.getId(),"APP考勤打卡照片","app_att",null);
|
||||
if(uploadFileVo!=null){
|
||||
vo.setImage(uploadFileVo.getPath());
|
||||
appMapper.insertAttRecord(vo);
|
||||
mapper.insertAttRecord(vo);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,17 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
import com.bonus.bmw.domain.vo.TreeVo;
|
||||
import com.bonus.bmw.mapper.AppMapper;
|
||||
import com.bonus.bmw.mapper.BmSubContractMapper;
|
||||
import com.bonus.bmw.service.AppService;
|
||||
import com.bonus.bmw.service.BmSubContractService;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -37,12 +22,12 @@ import java.util.Map;
|
|||
public class AppServiceImpl implements AppService {
|
||||
|
||||
@Resource
|
||||
private AppMapper appMapper;
|
||||
private AppMapper mapper;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult validatePassword(SysUser sysUser) {
|
||||
String mm = appMapper.getMm(sysUser);
|
||||
String mm = mapper.getMm(sysUser);
|
||||
if (StringUtils.isNotEmpty(mm)) {
|
||||
if (mm.equals(SecurityUtils.encryptPassword(sysUser.getOldPassword()))) {
|
||||
return AjaxResult.success();
|
||||
|
|
@ -53,11 +38,11 @@ public class AppServiceImpl implements AppService {
|
|||
|
||||
@Override
|
||||
public AjaxResult updatePassword(SysUser sysUser) {
|
||||
String mm = appMapper.getMm(sysUser);
|
||||
String mm = mapper.getMm(sysUser);
|
||||
if (StringUtils.isNotEmpty(mm)) {
|
||||
if (mm.equals(SecurityUtils.encryptPassword(sysUser.getOldPassword()))) {
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(sysUser.getPassword()));
|
||||
int i = appMapper.updatePassword(sysUser);
|
||||
int i = mapper.updatePassword(sysUser);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
|
|
@ -71,9 +56,9 @@ public class AppServiceImpl implements AppService {
|
|||
@Override
|
||||
public AjaxResult getComWorkerTree(TreeVo vo) {
|
||||
//先查公司
|
||||
List<TreeVo> companyList = appMapper.getComList(vo);
|
||||
List<TreeVo> companyList = mapper.getComList(vo);
|
||||
companyList.forEach(company -> {
|
||||
List<TreeVo> subComList = appMapper.getSubComList(company);
|
||||
List<TreeVo> subComList = mapper.getSubComList(company);
|
||||
company.setChildList(subComList);
|
||||
});
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -2,18 +2,21 @@ package com.bonus.bmw.service.impl;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.bmw.domain.po.HomePagePo;
|
||||
import com.bonus.bmw.domain.po.MapBeanPo;
|
||||
import com.bonus.bmw.domain.vo.*;
|
||||
import com.bonus.bmw.mapper.HomePageMapper;
|
||||
import com.bonus.bmw.service.HomePageService;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.RemoteMenuService;
|
||||
import com.bonus.system.api.domain.SysMenu;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class HomePageServiceImpl implements HomePageService {
|
||||
|
|
@ -118,6 +121,48 @@ public class HomePageServiceImpl implements HomePageService {
|
|||
return AjaxResult.success(workerMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonSetBean> getMenuSelected(CommonSetBean o) {
|
||||
return mapper.getMenuSelected(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonSetBean> getMenuAll(CommonSetBean o) {
|
||||
return mapper.getMenuAll(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断菜单是否有子菜单
|
||||
* @param menus 所有菜单列表
|
||||
* @param menu 当前菜单
|
||||
* @return 是否有子菜单
|
||||
*/
|
||||
private boolean hasChild(List<SysMenu> menus, SysMenu menu) {
|
||||
for (SysMenu m : menus) {
|
||||
if (menu.getMenuId().equals(m.getParentId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer addMenu(CommonSetBean bean) {
|
||||
//将用户选择的菜单全部删除
|
||||
mapper.delMenuByUserId(bean);
|
||||
//新增用户选择的菜单
|
||||
if(!bean.getIdArr().isEmpty()){
|
||||
String[] idArr = bean.getIdArr().split(",");
|
||||
List<String> list = new ArrayList<>(Arrays.asList(idArr));
|
||||
List<MapBeanPo> listPo = new ArrayList<>();
|
||||
list.forEach(id -> {
|
||||
listPo.add(new MapBeanPo(bean.getUserId(),id));
|
||||
});
|
||||
return mapper.addMenu(listPo);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算 a / b 的百分比,保留两位有效数字
|
||||
* @param a 被除数
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.bonus.bmw.service.impl;
|
|||
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.FaceRecognitionBean;
|
||||
import com.bonus.bmw.domain.vo.MapBeanVo;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.bmw.mapper.PmWorkerExitMapper;
|
||||
import com.bonus.bmw.service.AppRecognitionService;
|
||||
import com.bonus.bmw.service.BmWorkerContractService;
|
||||
import com.bonus.bmw.service.PmWorkerExitService;
|
||||
import com.bonus.bmw.service.UrkSendService;
|
||||
|
|
@ -28,6 +30,9 @@ public class PmWorkerExitServiceImpl implements PmWorkerExitService {
|
|||
@Autowired
|
||||
private BmWorkerContractService contractService;
|
||||
|
||||
@Resource
|
||||
private AppRecognitionService appRecognitionService;
|
||||
|
||||
/**
|
||||
* 文件上传工具服务
|
||||
*/
|
||||
|
|
@ -78,6 +83,8 @@ public class PmWorkerExitServiceImpl implements PmWorkerExitService {
|
|||
int k = mapper.updateEinProRecordStatus(record.getId(),einStatus,isUploadFile,record.getExitWay());
|
||||
if(k==1){
|
||||
urkSendService.delUserByDevice(record.getWorkerId(),record.getProId());
|
||||
//删除app人脸
|
||||
delAppFace(record.getWorkerId());
|
||||
}
|
||||
return k == 1 ? AjaxResult.success() :AjaxResult.error("离场失败");
|
||||
}else {
|
||||
|
|
@ -85,6 +92,15 @@ public class PmWorkerExitServiceImpl implements PmWorkerExitService {
|
|||
}
|
||||
}
|
||||
|
||||
private void delAppFace(Integer workerId) {
|
||||
String idNumber = mapper.getIdNumberByWorkerId(workerId);
|
||||
//下发人脸到人脸库
|
||||
FaceRecognitionBean faceRecognitionBean = new FaceRecognitionBean();
|
||||
faceRecognitionBean.setUniqueKey(idNumber);
|
||||
faceRecognitionBean.setOptMode("delete");
|
||||
appRecognitionService.uploadFaceRecognition(null, faceRecognitionBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateWorkerBatchExit(List<PmWorkerDto> list) throws Exception {
|
||||
int count = 0;
|
||||
|
|
@ -115,6 +131,7 @@ public class PmWorkerExitServiceImpl implements PmWorkerExitService {
|
|||
if(count>0){
|
||||
//批量操作考勤机
|
||||
urkSendService.delUserByDeviceList(userId,proId);
|
||||
userId.forEach(this::delAppFace);
|
||||
}
|
||||
return AjaxResult.success("成功" + count + "条数据,失败" + failCount + "条数据,失败原因:没有补全合同工资卡");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ package com.bonus.bmw.service.impl;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.FaceRecognitionBean;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.service.BmWorkerContractService;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.bmw.service.UrkSendService;
|
||||
import com.bonus.bmw.service.*;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
||||
import com.bonus.bmw.mapper.PmWorkerMapper;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.bmw.service.PmWorkerService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
|
@ -50,6 +48,9 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
@Autowired
|
||||
private BmWorkerContractService contractService;
|
||||
|
||||
@Resource
|
||||
private AppRecognitionService appRecognitionService;
|
||||
|
||||
@Autowired
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
|
|
@ -72,6 +73,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
@Override
|
||||
@Transactional
|
||||
public AjaxResult insert(PmWorker record,List<WebFileDto> fileMsg) throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//是否失信人员名单
|
||||
PmWorker worker2 = mapper.getBlackWorkerByNumber(record.getIdNumber());
|
||||
if(worker2 != null && worker2.getName() != null){
|
||||
|
|
@ -118,10 +120,16 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
addWorkerEinData(record,fileMsg);
|
||||
//下发人脸到考勤机
|
||||
urkSendService.sendUserToDevice(record.getId(),record.getProId(),"0");
|
||||
//下发人脸到人脸库
|
||||
if(!collect.isEmpty()){
|
||||
FaceRecognitionBean faceRecognitionBean = new FaceRecognitionBean();
|
||||
faceRecognitionBean.setUniqueKey(record.getIdNumber());
|
||||
faceRecognitionBean.setOptMode("add");
|
||||
sb.append(appRecognitionService.uploadFaceRecognition(collect.get(0).getFile(), faceRecognitionBean));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AjaxResult(200, "添加成功",record.getId());
|
||||
return new AjaxResult(200, sb.append(",基础数据添加成功").toString(),record.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -190,6 +198,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
@Transactional
|
||||
@Override
|
||||
public AjaxResult updateByPrimaryKey(PmWorker record,List<WebFileDto> fileMsg) throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//是否失信人员名单
|
||||
PmWorker worker2 = mapper.getBlackWorkerByNumber(record.getIdNumber());
|
||||
if(worker2 != null && worker2.getName() != null){
|
||||
|
|
@ -224,6 +233,11 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
//换工程换人脸
|
||||
urkSendService.sendUserToDevice(record.getId(),record.getProId(),"0");
|
||||
}
|
||||
//下发人脸到人脸库
|
||||
FaceRecognitionBean faceRecognitionBean = new FaceRecognitionBean();
|
||||
faceRecognitionBean.setUniqueKey(record.getIdNumber());
|
||||
faceRecognitionBean.setOptMode("add");
|
||||
sb.append(appRecognitionService.uploadFaceRecognition(collect.get(0).getFile(), faceRecognitionBean));
|
||||
}
|
||||
if(record.getEinStatus() == 1){
|
||||
//已经入过场了
|
||||
|
|
@ -235,7 +249,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
urkSendService.sendUserToDevice(record.getId(),record.getProId(),"0");
|
||||
addWorkerEinData(record,fileMsg);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
return AjaxResult.success(sb.append(",基础数据更新成功"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
package com.bonus.bmw.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import okhttp3.*;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author fly
|
||||
* 外部接口地址
|
||||
*/
|
||||
public class BaiduRecognitionUtils {
|
||||
|
||||
/** 应用1 */
|
||||
public static final String BANK_CARD_API_KEY = "HAdKRY9O9tTzXNfDKcHD4Qmh";
|
||||
/** 应用1 */
|
||||
public static final String BANK_CARD_SECRET_KEY = "S07GzrLyIQIbDqDQZPmDHAWzsgJxs0P3";
|
||||
|
||||
/** 应用2 */
|
||||
public static final String BANK_CARD_API_KEY_2 = "7WOVv79Yr0MMMPNTUfrSxGZb";
|
||||
/** 应用2 */
|
||||
public static final String BANK_CARD_SECRET_KEY_2 = "VA0QjDVr4Br9e2GefxMizGDwsuifIQZP";
|
||||
|
||||
/** 应用3 */
|
||||
public static final String BANK_CARD_API_KEY_3 = "rdFbKoeAjzs9YgwM1kiERhGA";
|
||||
/** 应用3 */
|
||||
public static final String BANK_CARD_SECRET_KEY_3 = "NgkR11xe6qSBY5jW71WFdGLloQKPxsbo";
|
||||
|
||||
public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();
|
||||
|
||||
|
||||
/**
|
||||
* 从用户的AK,SK生成鉴权签名(Access Token)
|
||||
* 免费用户
|
||||
* @return 鉴权签名(Access Token)
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static String getAccessToken() throws IOException {
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = null;
|
||||
//生成随机数获取应用key
|
||||
Random random = new Random();
|
||||
int i = random.nextInt(3);
|
||||
if (i == 0){
|
||||
body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=" + BANK_CARD_API_KEY
|
||||
+ "&client_secret=" + BANK_CARD_SECRET_KEY);
|
||||
} else if (i == 1){
|
||||
body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=" + BANK_CARD_API_KEY_2
|
||||
+ "&client_secret=" + BANK_CARD_SECRET_KEY_2);
|
||||
} else {
|
||||
body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=" + BANK_CARD_API_KEY_3
|
||||
+ "&client_secret=" + BANK_CARD_SECRET_KEY_3);
|
||||
}
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/oauth/2.0/token")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
String jsonString = response.body().string();
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonString);
|
||||
String accessToken = jsonObject.getString("access_token");
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public static String updateBankName(String bankName) {
|
||||
if (!StringHelper.isNullOrEmptyString(bankName)){
|
||||
if (bankName.contains("工商银行")){
|
||||
return "中国工商银行";
|
||||
} else if (bankName.contains("建设银行")){
|
||||
return "中国建设银行";
|
||||
} else if (bankName.contains("人民银行")){
|
||||
return "中国人民银行";
|
||||
} else if (bankName.contains("农业银行")){
|
||||
return "中国农业银行";
|
||||
} else if (bankName.contains("交通银行")){
|
||||
return "中国交通银行";
|
||||
} else if (bankName.contains("农业发展银行")){
|
||||
return "中国农业发展银行";
|
||||
} else if (bankName.contains("邮政")){
|
||||
return "中国邮政储蓄银行";
|
||||
}else {
|
||||
return bankName;
|
||||
}
|
||||
} else {
|
||||
return bankName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
package com.bonus.bmw.utils;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
/**
|
||||
* 人脸识别 状态码
|
||||
*/
|
||||
@Data
|
||||
public class FaceCodeUtil {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public final static String ADD="add";
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
public final static String UPDATE="replace";
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public final static String DEL="delete";
|
||||
|
||||
/**
|
||||
* 已知个体的人脸识别
|
||||
*/
|
||||
public final static int code_00=30000;
|
||||
/**
|
||||
* 未知个体的人脸识别
|
||||
*/
|
||||
public final static int code_01=30001;
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public final static int code_02=30002;
|
||||
/**
|
||||
* 没有找到人脸数据库
|
||||
*/
|
||||
public final static int code_03=30003;
|
||||
/**
|
||||
* 30004
|
||||
*/
|
||||
public final static int code_04=30004;
|
||||
/**
|
||||
* 文件后缀无效
|
||||
*/
|
||||
public final static int code_05=30005;
|
||||
|
||||
/**
|
||||
* 不支持的输入文件类型
|
||||
*/
|
||||
public final static int code_06=30006;
|
||||
/**
|
||||
* 不支持的数据库更新类型
|
||||
*/
|
||||
public final static int code_07=30007;
|
||||
/**
|
||||
*图像中发现多张人脸
|
||||
*/
|
||||
public final static int code_08=30008;
|
||||
/**
|
||||
* 30009
|
||||
*/
|
||||
public final static int code_09=30009;
|
||||
/**
|
||||
* 人脸部分在画面外,向左或向右移动
|
||||
*/
|
||||
public final static int code_10=30010;
|
||||
/**
|
||||
* 人脸部分在画面外,向上或向下移动
|
||||
*/
|
||||
public final static int code_11=30011;
|
||||
/**
|
||||
* 图像中人脸向右旋
|
||||
*/
|
||||
public final static int code_12=30012;
|
||||
/**
|
||||
* 图像中人脸向左旋转
|
||||
*/
|
||||
public final static int code_13=30013;
|
||||
/**
|
||||
* 图像中人脸向上旋转
|
||||
*/
|
||||
public final static int code_14=30014;
|
||||
/**
|
||||
* 图像中人脸向下旋转
|
||||
*/
|
||||
public final static int code_15=30015;
|
||||
|
||||
/**
|
||||
* 图像中人脸分辨率低
|
||||
*/
|
||||
public final static int code_16=30016;
|
||||
|
||||
/**
|
||||
*图像中人脸清晰度差
|
||||
*/
|
||||
public final static int code_17=30017;
|
||||
/**
|
||||
*图像中未检测到人脸
|
||||
*/
|
||||
public final static int code_18=30018;
|
||||
/**
|
||||
* 身份已存在;
|
||||
*/
|
||||
public final static int code_19=30019;
|
||||
|
||||
|
||||
public static String getCodeString(Object obj){
|
||||
if(ObjectUtils.isEmpty(obj)){
|
||||
return "编码不存在";
|
||||
}
|
||||
int code=Integer.parseInt(obj.toString());
|
||||
switch (code){
|
||||
case code_00:
|
||||
return "已知个体的人脸识别";
|
||||
case code_01:
|
||||
return "未知个体的人脸识别";
|
||||
case code_02:
|
||||
return "图像处理成功";
|
||||
case code_03:
|
||||
return "没有找到人脸数据库";
|
||||
case code_04:
|
||||
return "文件路径无效";
|
||||
case code_05:
|
||||
return "文件后缀无效!";
|
||||
case code_06:
|
||||
return "不支持的输入文件类型!";
|
||||
case code_07:
|
||||
return "不支持的数据库更新类型!";
|
||||
case code_08:
|
||||
return "图像中发现多张人脸!";
|
||||
case code_09:
|
||||
return "光照条件差影响图像质量!";
|
||||
case code_10:
|
||||
return "人脸部分在画面外,向左或向右移动!";
|
||||
case code_11:
|
||||
return "人脸部分在画面外,向上或向下移动!";
|
||||
case code_12:
|
||||
return "图像中人脸向右旋转!";
|
||||
case code_13:
|
||||
return "图像中人脸向左旋转!";
|
||||
case code_14:
|
||||
return "图像中人脸向上旋转!";
|
||||
case code_15:
|
||||
return "图像中人脸向下旋转!";
|
||||
case code_16:
|
||||
return "图像中人脸分辨率低!";
|
||||
case code_17:
|
||||
return "图像中人脸清晰度差!";
|
||||
case code_18:
|
||||
return "图像中未检测到人脸!";
|
||||
case code_19:
|
||||
return "身份已存在!";
|
||||
default:
|
||||
return "人脸识别编码不存在,请联系郭乾坤!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
package com.bonus.bmw.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.http.HttpUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FaceInterUtilService {
|
||||
|
||||
/**
|
||||
* 新增人脸库
|
||||
*/
|
||||
public final static String addFace="/updatedb";
|
||||
|
||||
@Value("${face.path}")
|
||||
public String faceUrl;
|
||||
|
||||
/**
|
||||
* 刷新人脸库
|
||||
*/
|
||||
public final static String refresh="/refreshdb";
|
||||
/**
|
||||
* 识别人脸库
|
||||
*/
|
||||
public final static String sbFace="/facerecognition";
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
public AjaxResult addFace2(String image, String type, String id) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
map.put("optMode",type);
|
||||
map.put("uniqueKey",id);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+addFace,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
}else {
|
||||
result.put("code",201);
|
||||
}
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
|
||||
}
|
||||
/**
|
||||
* 人脸信进行修改
|
||||
* @param image
|
||||
* @param type
|
||||
* @param id ls-
|
||||
* bz-
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> addFace(String image, String type, String id) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
map.put("optMode",type);
|
||||
map.put("uniqueKey",id);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+addFace,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
}else {
|
||||
result.put("code",201);
|
||||
}
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
result.put("code",201);
|
||||
result.put("msg","未检测到人脸!");
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新图像库
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult refreshFace() {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
String msg= HttpUtils.sendRequest(faceUrl+refresh,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
result.put("msg","操作成功");
|
||||
}else {
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("code",201);
|
||||
}
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
|
||||
public AjaxResult verifyFace(String image) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+sbFace,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
//识别成功返回的数据
|
||||
if("30000".equals(code)){
|
||||
JSONArray jsonArray=json.getJSONArray("data");
|
||||
Object key= jsonArray.get(0);
|
||||
result.put("code",201);
|
||||
result.put("userId",key);
|
||||
result.put("msg","人脸识别成功");
|
||||
}else{
|
||||
result.put("code",201);
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
result.put("userId","-9999");
|
||||
}
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -12,13 +12,13 @@ public class IpAndPathConfig {
|
|||
* test 测试
|
||||
* prod 固定
|
||||
*/
|
||||
public static String environment = "test";
|
||||
public static String environment = "prod";
|
||||
|
||||
/**
|
||||
* 人脸检测后端相关
|
||||
*/
|
||||
public static String faceTestUrl = "http://192.168.0.14:1909/file";
|
||||
public static String faceProdUrl = "http://112.29.103.165:1617/file";
|
||||
public static String faceTestUrl = "http://192.168.0.14:18017";
|
||||
public static String faceProdUrl = "http://112.29.103.165:1616/faceIdentification/";
|
||||
|
||||
/**
|
||||
* 相关配置
|
||||
|
|
|
|||
|
|
@ -250,4 +250,62 @@
|
|||
GROUP BY
|
||||
sdd.dict_value
|
||||
</select>
|
||||
|
||||
<select id="getMenuSelected" resultType="com.bonus.bmw.domain.vo.CommonSetBean">
|
||||
SELECT
|
||||
sm.menu_id AS id,
|
||||
sm.menu_name AS `name`,
|
||||
sm.component AS url,
|
||||
sm.icon AS icon
|
||||
FROM
|
||||
sys_user_home_page suhp
|
||||
INNER JOIN sys_menu sm ON sm.menu_id = suhp.permission_id
|
||||
WHERE
|
||||
sm.menu_type = 'C'
|
||||
AND sm.STATUS = 0
|
||||
AND sm.perms = 0
|
||||
AND suhp.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- sp.menu_id AS id,-->
|
||||
<!-- sp.`menu_name` AS `name`,-->
|
||||
<!-- sp.component AS url,-->
|
||||
<!-- sp.icon AS icon,-->
|
||||
<select id="getMenuAll" resultType="com.bonus.bmw.domain.vo.CommonSetBean">
|
||||
SELECT DISTINCT
|
||||
sp.menu_id AS id,
|
||||
sp.`menu_name` AS `name`,
|
||||
sp.component AS url,
|
||||
sp.icon AS icon,
|
||||
IF(suhp.permission_id IS NOT NULL, 1, 0) AS checked
|
||||
FROM
|
||||
sys_menu sp
|
||||
LEFT JOIN sys_role_menu srp ON srp.menu_id = sp.menu_id
|
||||
LEFT JOIN sys_role sr ON sr.role_id = srp.role_id
|
||||
AND sr.`status` = 0
|
||||
AND sr.del_flag = 0
|
||||
LEFT JOIN sys_user su ON su.role_id = srp.role_id
|
||||
AND su.del_flag = 0
|
||||
LEFT JOIN sys_user_home_page suhp ON suhp.permission_id = sp.menu_id
|
||||
AND suhp.user_id = #{userId}
|
||||
WHERE
|
||||
sp.menu_type = 'C'
|
||||
AND sp.`status` = 0
|
||||
AND sp.perms = 0
|
||||
AND su.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="delMenuByUserId">
|
||||
delete from sys_user_home_page where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="addMenu" resultType="java.lang.Integer">
|
||||
INSERT INTO sys_user_home_page( user_id, permission_id)
|
||||
VALUES
|
||||
<foreach item="item" collection="list" separator="," index="index" >
|
||||
(
|
||||
#{item.id},#{item.name}
|
||||
)
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -142,4 +142,11 @@
|
|||
FROM
|
||||
`bm_worker_contract` where is_active = 1 and worker_id = #{workerId}
|
||||
</select>
|
||||
|
||||
<select id="getIdNumberByWorkerId" resultType="java.lang.String">
|
||||
SELECT
|
||||
`id_number`
|
||||
FROM
|
||||
`pm_worker` where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue