From 439a383d577222f2b0436d771ea328358dc559dd Mon Sep 17 00:00:00 2001 From: ieaii <1069385070@qq.com> Date: Tue, 19 Nov 2024 11:29:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=AF=B9=E6=8E=A5=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E4=BA=91=E5=AE=9E=E5=90=8D=E5=88=B6=E5=92=8C=E4=BA=BA=E8=84=B8?= =?UTF-8?q?=E6=89=93=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-hanhai-vue/src/views/xcx/ClockInConfList.vue | 195 +++++++++++++++++++++ .../src/views/xcx/ClockInProjectItemList.vue | 8 +- .../src/views/xcx/ClockInProjectList.vue | 8 +- .../src/views/xcx/modules/ClockInConfForm.vue | 123 +++++++++++++ .../xcx/modules/ClockInConfModal.Style#Drawer.vue | 84 +++++++++ .../src/views/xcx/modules/ClockInConfModal.vue | 60 +++++++ .../java/org/jeecg/common/util/TencentUtils.java | 26 ++- .../controller/ClockInConfController.java | 171 ++++++++++++++++++ .../modules/clockinconf/entity/ClockInConf.java | 65 +++++++ .../clockinconf/mapper/ClockInConfMapper.java | 17 ++ .../clockinconf/mapper/xml/ClockInConfMapper.xml | 5 + .../clockinconf/service/IClockInConfService.java | 16 ++ .../service/impl/ClockInConfServiceImpl.java | 27 +++ .../modules/clockinconf/vue/ClockInConfList.vue | 195 +++++++++++++++++++++ .../clockinconf/vue/modules/ClockInConfForm.vue | 123 +++++++++++++ .../vue/modules/ClockInConfModal.Style#Drawer.vue | 84 +++++++++ .../clockinconf/vue/modules/ClockInConfModal.vue | 60 +++++++ .../modules/clockinconf/vue3/ClockInConf.api.ts | 61 +++++++ .../modules/clockinconf/vue3/ClockInConf.data.ts | 61 +++++++ .../modules/clockinconf/vue3/ClockInConfList.vue | 162 +++++++++++++++++ .../vue3/components/ClockInConfModal.vue | 58 ++++++ .../controller/ClockinLogController.java | 51 +++++- .../xcx/auth/service/impl/AuthServiceImpl.java | 53 +++++- .../jeecg/modules/xcx/clockin/req/ClockInReq.java | 2 + .../clockin/service/impl/ClockinServiceImpl.java | 11 +- .../xcx/user/service/impl/UserServiceImpl.java | 1 + .../src/main/resources/application-dev.yml | 2 + .../src/main/resources/application-test.yml | 1 + 28 files changed, 1710 insertions(+), 20 deletions(-) create mode 100644 admin-hanhai-vue/src/views/xcx/ClockInConfList.vue create mode 100644 admin-hanhai-vue/src/views/xcx/modules/ClockInConfForm.vue create mode 100644 admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.Style#Drawer.vue create mode 100644 admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/controller/ClockInConfController.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/entity/ClockInConf.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/ClockInConfMapper.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/xml/ClockInConfMapper.xml create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/IClockInConfService.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/impl/ClockInConfServiceImpl.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/ClockInConfList.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfForm.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.Style#Drawer.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.api.ts create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.data.ts create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConfList.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/components/ClockInConfModal.vue diff --git a/admin-hanhai-vue/src/views/xcx/ClockInConfList.vue b/admin-hanhai-vue/src/views/xcx/ClockInConfList.vue new file mode 100644 index 0000000..cb75939 --- /dev/null +++ b/admin-hanhai-vue/src/views/xcx/ClockInConfList.vue @@ -0,0 +1,195 @@ + + + + \ No newline at end of file diff --git a/admin-hanhai-vue/src/views/xcx/ClockInProjectItemList.vue b/admin-hanhai-vue/src/views/xcx/ClockInProjectItemList.vue index 438f0c6..805e4da 100644 --- a/admin-hanhai-vue/src/views/xcx/ClockInProjectItemList.vue +++ b/admin-hanhai-vue/src/views/xcx/ClockInProjectItemList.vue @@ -12,10 +12,10 @@
新增 - 导出 - - 导入 - + + + + diff --git a/admin-hanhai-vue/src/views/xcx/ClockInProjectList.vue b/admin-hanhai-vue/src/views/xcx/ClockInProjectList.vue index 8967c1b..a95923c 100644 --- a/admin-hanhai-vue/src/views/xcx/ClockInProjectList.vue +++ b/admin-hanhai-vue/src/views/xcx/ClockInProjectList.vue @@ -14,10 +14,10 @@
新增 - 导出 - - 导入 - + + + + diff --git a/admin-hanhai-vue/src/views/xcx/modules/ClockInConfForm.vue b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfForm.vue new file mode 100644 index 0000000..0963059 --- /dev/null +++ b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfForm.vue @@ -0,0 +1,123 @@ + + + \ No newline at end of file diff --git a/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.Style#Drawer.vue b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.Style#Drawer.vue new file mode 100644 index 0000000..b12f016 --- /dev/null +++ b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.vue b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.vue new file mode 100644 index 0000000..b2ca7fd --- /dev/null +++ b/admin-hanhai-vue/src/views/xcx/modules/ClockInConfModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TencentUtils.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TencentUtils.java index 84c6c5f..c4f04e6 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TencentUtils.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/TencentUtils.java @@ -4,10 +4,12 @@ import cn.hutool.core.util.BooleanUtil; import com.alibaba.fastjson.JSON; import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.faceid.v20180301.FaceidClient; import com.tencentcloudapi.iai.v20180301.IaiClient; import com.tencentcloudapi.iai.v20180301.models.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.config.TencentConfig; import org.jeecg.modules.clockinauth.entity.ClockinAuth; import org.springframework.beans.factory.annotation.Value; @@ -188,7 +190,7 @@ public class TencentUtils { try { DetectFaceRequest req = new DetectFaceRequest(); req.setMaxFaceNum(1L); - req.setImage(clockinAuth.getPic()); + req.setUrl(clockinAuth.getPic()); req.setNeedFaceAttributes(1L); req.setNeedQualityDetection(1L); // 返回的resp是一个DetectFaceResponse的实例,与请求对象对应 @@ -199,7 +201,7 @@ public class TencentUtils { request.setGender((long) (gender > 2 ? 0 : gender)); // 1 男 2 女 request.setQualityControl(4L); request.setPersonName(clockinAuth.getName()); - request.setImage(photo); + request.setUrl(photo); CreatePersonResponse response = client.CreatePerson(request); log.info("创建人脸模型返回参数:{}", JSON.toJSONString(response)); @@ -242,20 +244,23 @@ public class TencentUtils { /** * 人脸验证 */ - public static void VerifyFace(String UserId) { + public static VerifyFaceResponse VerifyFace(String UserId,String pic,Long qualityControl) { try { IaiClient client = getIaiClient(); // 实例化一个请求对象,每个接口都会对应一个request对象 VerifyFaceRequest req = new VerifyFaceRequest(); req.setPersonId(UserId); - req.setUrl("https://sns-img-hw.xhscdn.com/627e45c8-b78a-d2a5-a262-b9fb1bbe15fc?imageView2/2/w/900/format/webp"); - req.setQualityControl(4L); + req.setUrl(pic); + req.setQualityControl(qualityControl); // 返回的resp是一个VerifyFaceResponse的实例,与请求对象对应 VerifyFaceResponse resp = client.VerifyFace(req); // 输出json格式的字符串回包 - System.out.println(VerifyFaceResponse.toJsonString(resp)); + log.info(VerifyFaceResponse.toJsonString(resp)); + return resp; + } catch (TencentCloudSDKException e) { - System.out.println(e.toString()); + log.error(e.toString()); + throw new JeecgBootException("人脸识别错误"); } } @@ -284,4 +289,11 @@ public class TencentUtils { } + public static void IdCardVerify(){ + + + IaiClient client = getIaiClient(); + + } + } diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/controller/ClockInConfController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/controller/ClockInConfController.java new file mode 100644 index 0000000..9b94a93 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/controller/ClockInConfController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.clockinconf.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.clockinconf.entity.ClockInConf; +import org.jeecg.modules.clockinconf.service.IClockInConfService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: clock_in_conf + * @Author: jeecg-boot + * @Date: 2024-11-18 + * @Version: V1.0 + */ +@Api(tags="clock_in_conf") +@RestController +@RequestMapping("/clockinconf/clockInConf") +@Slf4j +public class ClockInConfController extends JeecgController { + @Autowired + private IClockInConfService clockInConfService; + + /** + * 分页列表查询 + * + * @param clockInConf + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "clock_in_conf-分页列表查询") + @ApiOperation(value="clock_in_conf-分页列表查询", notes="clock_in_conf-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ClockInConf clockInConf, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(clockInConf, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = clockInConfService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param clockInConf + * @return + */ + @AutoLog(value = "clock_in_conf-添加") + @ApiOperation(value="clock_in_conf-添加", notes="clock_in_conf-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ClockInConf clockInConf) { + clockInConfService.save(clockInConf); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param clockInConf + * @return + */ + @AutoLog(value = "clock_in_conf-编辑") + @ApiOperation(value="clock_in_conf-编辑", notes="clock_in_conf-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ClockInConf clockInConf) { + clockInConfService.updateById(clockInConf); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "clock_in_conf-通过id删除") + @ApiOperation(value="clock_in_conf-通过id删除", notes="clock_in_conf-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + clockInConfService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "clock_in_conf-批量删除") + @ApiOperation(value="clock_in_conf-批量删除", notes="clock_in_conf-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.clockInConfService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "clock_in_conf-通过id查询") + @ApiOperation(value="clock_in_conf-通过id查询", notes="clock_in_conf-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ClockInConf clockInConf = clockInConfService.getById(id); + if(clockInConf==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(clockInConf); + } + + /** + * 导出excel + * + * @param request + * @param clockInConf + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ClockInConf clockInConf) { + return super.exportXls(request, clockInConf, ClockInConf.class, "clock_in_conf"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ClockInConf.class); + } + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/entity/ClockInConf.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/entity/ClockInConf.java new file mode 100644 index 0000000..d27d8b0 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/entity/ClockInConf.java @@ -0,0 +1,65 @@ +package org.jeecg.modules.clockinconf.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: clock_in_conf + * @Author: jeecg-boot + * @Date: 2024-11-18 + * @Version: V1.0 + */ +@Data +@TableName("clock_in_conf") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="clock_in_conf对象", description="clock_in_conf") +public class ClockInConf implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.Integer id; + /**健名*/ + @Excel(name = "健名", width = 15) + @ApiModelProperty(value = "健名") + private java.lang.String name; + /**值*/ + @Excel(name = "值", width = 15) + @ApiModelProperty(value = "值") + private java.lang.String value; + /**说明*/ + @Excel(name = "说明", width = 15) + @ApiModelProperty(value = "说明") + private java.lang.String info; + /**是否删除*/ + @Excel(name = "是否删除", width = 15, dicCode = "is_delete") + @Dict(dicCode = "is_delete") + @ApiModelProperty(value = "是否删除") + private java.lang.Integer delFlag; + /**创建时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private java.util.Date createTime; + /**修改时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "修改时间") + private java.util.Date updateTime; +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/ClockInConfMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/ClockInConfMapper.java new file mode 100644 index 0000000..eb3904a --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/ClockInConfMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.clockinconf.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.clockinconf.entity.ClockInConf; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: clock_in_conf + * @Author: jeecg-boot + * @Date: 2024-11-18 + * @Version: V1.0 + */ +public interface ClockInConfMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/xml/ClockInConfMapper.xml b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/xml/ClockInConfMapper.xml new file mode 100644 index 0000000..53a204e --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/mapper/xml/ClockInConfMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/IClockInConfService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/IClockInConfService.java new file mode 100644 index 0000000..1aa11a1 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/IClockInConfService.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.clockinconf.service; + +import org.jeecg.modules.clockinconf.entity.ClockInConf; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: clock_in_conf + * @Author: jeecg-boot + * @Date: 2024-11-18 + * @Version: V1.0 + */ +public interface IClockInConfService extends IService { + + String getConf(String name); + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/impl/ClockInConfServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/impl/ClockInConfServiceImpl.java new file mode 100644 index 0000000..54658dd --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/service/impl/ClockInConfServiceImpl.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.clockinconf.service.impl; + +import org.jeecg.modules.clockinconf.entity.ClockInConf; +import org.jeecg.modules.clockinconf.mapper.ClockInConfMapper; +import org.jeecg.modules.clockinconf.service.IClockInConfService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: clock_in_conf + * @Author: jeecg-boot + * @Date: 2024-11-18 + * @Version: V1.0 + */ +@Service +public class ClockInConfServiceImpl extends ServiceImpl implements IClockInConfService { + + @Override + public String getConf(String name) { + ClockInConf clockInConf = this.lambdaQuery() + .eq(ClockInConf::getDelFlag, 0) + .eq(ClockInConf::getName, name) + .one(); + return clockInConf.getValue(); + } +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/ClockInConfList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/ClockInConfList.vue new file mode 100644 index 0000000..cb75939 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/ClockInConfList.vue @@ -0,0 +1,195 @@ + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfForm.vue new file mode 100644 index 0000000..0963059 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfForm.vue @@ -0,0 +1,123 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.Style#Drawer.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.Style#Drawer.vue new file mode 100644 index 0000000..b12f016 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.vue new file mode 100644 index 0000000..b2ca7fd --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue/modules/ClockInConfModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.api.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.api.ts new file mode 100644 index 0000000..2d7b532 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/clockinconf/clockInConf/list', + save='/clockinconf/clockInConf/add', + edit='/clockinconf/clockInConf/edit', + deleteOne = '/clockinconf/clockInConf/delete', + deleteBatch = '/clockinconf/clockInConf/deleteBatch', + importExcel = '/clockinconf/clockInConf/importExcel', + exportXls = '/clockinconf/clockInConf/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.data.ts new file mode 100644 index 0000000..72a971b --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConf.data.ts @@ -0,0 +1,61 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '健名', + align:"center", + dataIndex: 'name' + }, + { + title: '值', + align:"center", + dataIndex: 'value' + }, + { + title: '说明', + align:"center", + dataIndex: 'info' + }, + { + title: '是否删除', + align:"center", + dataIndex: 'delFlag_dictText' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '健名', + field: 'name', + component: 'Input', + }, + { + label: '值', + field: 'value', + component: 'InputTextArea',//TODO 注意string转换问题 + }, + { + label: '说明', + field: 'info', + component: 'InputTextArea',//TODO 注意string转换问题 + }, + { + label: '是否删除', + field: 'delFlag', + component: 'JDictSelectTag', + componentProps:{ + dictCode:"is_delete" + }, + dynamicRules: ({model,schema}) => { + return [ + { required: true, message: '请输入是否删除!'}, + ]; + }, + }, +]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConfList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConfList.vue new file mode 100644 index 0000000..c6ec016 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/ClockInConfList.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/components/ClockInConfModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/components/ClockInConfModal.vue new file mode 100644 index 0000000..bdea2e1 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinconf/vue3/components/ClockInConfModal.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java index 3079345..97a84ef 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java @@ -9,8 +9,12 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.clockinlog.entity.ClockinLog; import org.jeecg.modules.clockinlog.service.IClockinLogService; @@ -27,6 +31,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -49,7 +54,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ClockinLogController extends JeecgController { @Autowired private IClockinLogService clockinLogService; - + @Value("${jeecg.path.upload}") + private String upLoadPath; /** * 分页列表查询 * @@ -153,9 +159,50 @@ public class ClockinLogController extends JeecgController clazz, String title) { + // Step.1 组装查询条件 + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + // Step.2 获取导出数据 + List pageList = service.list(queryWrapper); + List exportList = null; + + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList()); + } else { + exportList = pageList; + } + + // Step.3 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + //此处设置的filename无效 ,前端会重更新设置一下 + mv.addObject(NormalExcelConstants.FILE_NAME, title); + mv.addObject(NormalExcelConstants.CLASS, clazz); + //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置-------------------- + ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title); + exportParams.setImageBasePath(upLoadPath); + //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置---------------------- + mv.addObject(NormalExcelConstants.PARAMS,exportParams); + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); + return mv; + } + + private String getId(ClockinLog item) { + try { + return PropertyUtils.getProperty(item, "id").toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + /** * 通过excel导入数据 * diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/auth/service/impl/AuthServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/auth/service/impl/AuthServiceImpl.java index 1bd9989..00816e5 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/auth/service/impl/AuthServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/auth/service/impl/AuthServiceImpl.java @@ -1,5 +1,13 @@ package org.jeecg.modules.xcx.auth.service.impl; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import com.tencentcloudapi.faceid.v20180301.FaceidClient; +import com.tencentcloudapi.faceid.v20180301.models.IdCardVerificationRequest; +import com.tencentcloudapi.faceid.v20180301.models.IdCardVerificationResponse; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; @@ -10,10 +18,12 @@ import org.jeecg.modules.clockinauth.service.IClockinAuthService; import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; import org.jeecg.modules.xcx.auth.req.ApplyAuthReq; import org.jeecg.modules.xcx.auth.service.IAuthService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; - +@Slf4j @Service public class AuthServiceImpl implements IAuthService { @@ -21,7 +31,14 @@ public class AuthServiceImpl implements IAuthService { private IClockinAuthService clockinAuthService; @Resource private ShiroRealm shiroRealm; + @Value("${tencent.cloud.secretId}") + private String secretId; + @Value("${tencent.cloud.secretKey}") + private String secretKey; + @Value("${tencent.cloud.endpoint}") + private String endpoint; + @Transactional(rollbackFor = Exception.class) @Override public Result applyAuth(ApplyAuthReq applyAuthReq) { HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(applyAuthReq.getToken()); @@ -31,13 +48,45 @@ public class AuthServiceImpl implements IAuthService { if(StringUtils.isBlank(applyAuthReq.getCardNo())){ throw new JeecgBootException("请填写身份证"); } + ClockinAuth clockinAuth1 = clockinAuthService.lambdaQuery() + .eq(ClockinAuth::getDelFlag, 0) + .eq(ClockinAuth::getUserId, hanHaiMember.getId()) + .in(ClockinAuth::getStatus, 0, 1) + .one(); + + if(clockinAuth1 != null){ + throw new JeecgBootException("已提交过实名认证,请勿重复提交"); + } + ClockinAuth clockinAuth = new ClockinAuth(); clockinAuth.setUserId(hanHaiMember.getId()); clockinAuth.setName(applyAuthReq.getName()); clockinAuth.setCardNo(applyAuthReq.getCardNo()); clockinAuth.setPic(applyAuthReq.getPic()); + clockinAuth.setStatus(1); + IdCardVerificationRequest req = new IdCardVerificationRequest(); + req.setName(clockinAuth.getName()); + req.setIdCard(clockinAuth.getCardNo()); + try { + Credential cred = new Credential(secretId, secretKey); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint(endpoint); + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + FaceidClient faceidClient = new FaceidClient(cred,"",clientProfile); + IdCardVerificationResponse resp = faceidClient.IdCardVerification(req); + if(!StringUtils.equals(resp.getResult(),"0")){ + throw new JeecgBootException(resp.getDescription()); + } + }catch (TencentCloudSDKException e){ + log.error(e.toString()); + throw new JeecgBootException("实名制失败"); + } + clockinAuthService.save(clockinAuth); -// TencentUtils.createPerson(clockinAuth); + + + TencentUtils.createPerson(clockinAuth); return Result.OK(); } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/req/ClockInReq.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/req/ClockInReq.java index 160b13e..43f8ebf 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/req/ClockInReq.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/req/ClockInReq.java @@ -19,5 +19,7 @@ public class ClockInReq { /**纬度*/ @ApiModelProperty(value = "纬度") private String lat; + /**人脸*/ + private String image; } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/service/impl/ClockinServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/service/impl/ClockinServiceImpl.java index 12090a2..b6b858f 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/service/impl/ClockinServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/clockin/service/impl/ClockinServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.xcx.clockin.service.impl; +import com.tencentcloudapi.iai.v20180301.models.VerifyFaceResponse; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; @@ -10,6 +11,7 @@ import org.jeecg.modules.clockInproject.entity.ClockInProject; import org.jeecg.modules.clockInproject.service.IClockInProjectService; import org.jeecg.modules.clockInprojectitem.entity.ClockInProjectItem; import org.jeecg.modules.clockInprojectitem.service.IClockInProjectItemService; +import org.jeecg.modules.clockinconf.service.IClockInConfService; import org.jeecg.modules.clockinlog.entity.ClockinLog; import org.jeecg.modules.clockinlog.ressp.ClockInLogResp; import org.jeecg.modules.clockinlog.service.IClockinLogService; @@ -24,6 +26,7 @@ import org.jeecg.modules.xcx.clockin.req.ClockInTotalReq; import org.jeecg.modules.xcx.clockin.resp.ClockInTotalResp; import org.jeecg.modules.xcx.clockin.service.IClockinService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; @@ -42,7 +45,10 @@ public class ClockinServiceImpl implements IClockinService { private IClockInProjectItemService clockInProjectItemService; @Resource private IClockinTeamLogService clockinTeamLogService; + @Resource + private IClockInConfService clockInConfService; + @Transactional(rollbackFor = Exception.class) @Override public Result clockIn(ClockInReq clockInReq) { HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(clockInReq.getToken()); @@ -69,7 +75,10 @@ public class ClockinServiceImpl implements IClockinService { throw new JeecgBootException("当前未到打卡时间"); } -// TencentUtils.VerifyFace(hanHaiMember.getId()); + VerifyFaceResponse verifyFaceResponse = TencentUtils.VerifyFace(hanHaiMember.getId(), clockInReq.getImage(),Long.parseLong(clockInConfService.getConf("qualityControl"))); + if(!verifyFaceResponse.getIsMatch()){ + throw new JeecgBootException("人脸识别错误"); + } ClockinLog clockinLog1 = clockinLogService.lambdaQuery() .eq(ClockinLog::getDelFlag, 0) diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/user/service/impl/UserServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/user/service/impl/UserServiceImpl.java index 6cd5a61..6c938e3 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/user/service/impl/UserServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/xcx/user/service/impl/UserServiceImpl.java @@ -48,6 +48,7 @@ public class UserServiceImpl implements IUserService { } ClockinAuth clockinAuth = clockinAuthService.lambdaQuery() .eq(ClockinAuth::getDelFlag, 0) + .in(ClockinAuth::getStatus,0,1) .eq(ClockinAuth::getUserId, hanHaiMember.getId()) .one(); hanHaiMember.setAuth(clockinAuth); diff --git a/jeecg-boot-module-system/src/main/resources/application-dev.yml b/jeecg-boot-module-system/src/main/resources/application-dev.yml index 10844c0..d515174 100644 --- a/jeecg-boot-module-system/src/main/resources/application-dev.yml +++ b/jeecg-boot-module-system/src/main/resources/application-dev.yml @@ -343,3 +343,5 @@ tencent: face: groupName: test region: ap-beijing + endpoint: faceid.tencentcloudapi.com + diff --git a/jeecg-boot-module-system/src/main/resources/application-test.yml b/jeecg-boot-module-system/src/main/resources/application-test.yml index cec1113..71e1a88 100644 --- a/jeecg-boot-module-system/src/main/resources/application-test.yml +++ b/jeecg-boot-module-system/src/main/resources/application-test.yml @@ -343,3 +343,4 @@ tencent: face: groupName: test region: ap-beijing + endpoint: faceid.tencentcloudapi.com