From df5ea6970e24d5432ba045f56fe70182fed96254 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Mon, 26 Apr 2021 14:31:31 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=A7=92=E8=89=B2,=E5=A2=9E=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E9=87=8C=E7=A8=8B=E7=A2=91=E6=88=96=E5=85=A8=E9=83=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ccsens/tall/bean/po/ProShow.java | 11 ++++ .../ccsens/tall/bean/po/ProShowExample.java | 60 +++++++++++++++++++ .../com/ccsens/tall/bean/vo/ProjectVo.java | 10 ++++ .../ccsens/tall/persist/dao/ProRoleDao.java | 7 +++ .../ccsens/tall/service/ProRoleService.java | 21 ++++++- .../main/resources/mapper_dao/ProRoleDao.xml | 55 +++++++++++------ .../resources/mapper_raw/ProShowMapper.xml | 25 ++++++-- 7 files changed, 165 insertions(+), 24 deletions(-) diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java b/tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java index 8a8a13ba..8dacaa85 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java +++ b/tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java @@ -42,6 +42,8 @@ public class ProShow implements Serializable { private Byte roleBelong; + private Byte milestoneSubtask; + private static final long serialVersionUID = 1L; public Long getId() { @@ -196,6 +198,14 @@ public class ProShow implements Serializable { this.roleBelong = roleBelong; } + public Byte getMilestoneSubtask() { + return milestoneSubtask; + } + + public void setMilestoneSubtask(Byte milestoneSubtask) { + this.milestoneSubtask = milestoneSubtask; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -221,6 +231,7 @@ public class ProShow implements Serializable { sb.append(", updatedAt=").append(updatedAt); sb.append(", recStatus=").append(recStatus); sb.append(", roleBelong=").append(roleBelong); + sb.append(", milestoneSubtask=").append(milestoneSubtask); sb.append("]"); return sb.toString(); } diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java b/tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java index 59f56608..7383b642 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java +++ b/tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java @@ -1274,6 +1274,66 @@ public class ProShowExample { addCriterion("role_belong not between", value1, value2, "roleBelong"); return (Criteria) this; } + + public Criteria andMilestoneSubtaskIsNull() { + addCriterion("milestone_subtask is null"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskIsNotNull() { + addCriterion("milestone_subtask is not null"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskEqualTo(Byte value) { + addCriterion("milestone_subtask =", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskNotEqualTo(Byte value) { + addCriterion("milestone_subtask <>", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskGreaterThan(Byte value) { + addCriterion("milestone_subtask >", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskGreaterThanOrEqualTo(Byte value) { + addCriterion("milestone_subtask >=", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskLessThan(Byte value) { + addCriterion("milestone_subtask <", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskLessThanOrEqualTo(Byte value) { + addCriterion("milestone_subtask <=", value, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskIn(List values) { + addCriterion("milestone_subtask in", values, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskNotIn(List values) { + addCriterion("milestone_subtask not in", values, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskBetween(Byte value1, Byte value2) { + addCriterion("milestone_subtask between", value1, value2, "milestoneSubtask"); + return (Criteria) this; + } + + public Criteria andMilestoneSubtaskNotBetween(Byte value1, Byte value2) { + addCriterion("milestone_subtask not between", value1, value2, "milestoneSubtask"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java b/tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java index 93a0cc16..6b052c17 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java +++ b/tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java @@ -185,6 +185,8 @@ public class ProjectVo { private String relevanceProjectName; @ApiModelProperty("成员信息") private List members; + @ApiModelProperty("对谁不可见") + private List roleOfNoLook = new ArrayList<>(); @JsonIgnore private Long parentId; //一级角色Id @JsonIgnore @@ -194,6 +196,14 @@ public class ProjectVo { } @ApiModel @Data + public static class RolesOfNoLook{ + @ApiModelProperty("不可见角色id") + private Long id; + @ApiModelProperty("不可见角色名称") + private String name; + } + @ApiModel + @Data public static class ProMemberVo{ @JsonIgnore private Long mUserId;//成员的userId diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java index b3fd7016..24a14f76 100644 --- a/tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java @@ -121,6 +121,13 @@ public interface ProRoleDao extends ProRoleMapper{ */ List selectMemberOfRole(Long roleId); + /** + * 根据角色id查询不可见角色列表 + * @param roleId 二级角色id + * @return 不可见角色list + */ + List selectRoleOfNoLook(Long roleId); + diff --git a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java index 1201b29d..468ce041 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java @@ -251,6 +251,14 @@ public class ProRoleService implements IProRoleService { private List getRealMemberRolesShowByProjectIdAll(Long projectId, Long currentUserId) { List memberRoleList; memberRoleList = proRoleDao.selectSecondRolesByProjectId(projectId); + //查找对谁不可见 + for (ProjectVo.RoleInfo roleInfo : memberRoleList) { + List noLookList = proRoleDao.selectRoleOfNoLook(roleInfo.getId()); + if (CollectionUtil.isNotEmpty(noLookList)){ + roleInfo.getRoleOfNoLook().addAll(noLookList); + } + } + return memberRoleList; } @@ -773,6 +781,16 @@ public class ProRoleService implements IProRoleService { if (ObjectUtil.isNull(project)) { throw new BaseException(CodeEnum.NOT_PROJECT); } + //查找项目配置 + String milestone = ""; + ProShowExample proShowExample = new ProShowExample(); + proShowExample.createCriteria().andProjectIdEqualTo(projectId.getProjectId()); + List proShows = proShowDao.selectByExample(proShowExample); + if (CollectionUtil.isNotEmpty(proShows)){ + Byte milestoneSubtask = proShows.get(0).getMilestoneSubtask(); + milestone = milestoneSubtask == 0 ? "里程碑":null; + } + long beginTime = projectId.getStartTime() == null ? project.getBeginTime() : projectId.getStartTime(); long endTime = projectId.getEndTime() == null ? project.getEndTime() : projectId.getEndTime(); //1、查找一级任务 @@ -783,6 +801,7 @@ public class ProRoleService implements IProRoleService { List firstTaskDetailList = taskDetailDao.selectByExample(proTaskDetailExample); log.info("查找到一级任务:{}", firstTaskDetailList); if (CollectionUtil.isNotEmpty(firstTaskDetailList)) { + String finalMilestone = milestone; firstTaskDetailList.forEach(firstTaskDetail -> { int sequence = 1; TaskVo.NormalTask normalTask = new TaskVo.NormalTask(); @@ -790,7 +809,7 @@ public class ProRoleService implements IProRoleService { normalTask.setDetailId(firstTaskDetail.getId()); normalTask.setSequence(sequence); - List secondTaskList = taskDetailDao.getTaskByParentId(firstTaskDetail.getId(), "里程碑",beginTime,endTime); + List secondTaskList = taskDetailDao.getTaskByParentId(firstTaskDetail.getId(), finalMilestone,beginTime,endTime); List secondList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(secondTaskList)) { secondTaskList.forEach(secondTask -> { diff --git a/tall/src/main/resources/mapper_dao/ProRoleDao.xml b/tall/src/main/resources/mapper_dao/ProRoleDao.xml index 184f860a..1b2cd0ca 100644 --- a/tall/src/main/resources/mapper_dao/ProRoleDao.xml +++ b/tall/src/main/resources/mapper_dao/ProRoleDao.xml @@ -70,28 +70,28 @@ @@ -445,4 +445,23 @@ pmr.role_id = #{roleId} AND pmr.rec_status = 0 + + \ No newline at end of file diff --git a/tall/src/main/resources/mapper_raw/ProShowMapper.xml b/tall/src/main/resources/mapper_raw/ProShowMapper.xml index dd83eae0..06e24aca 100644 --- a/tall/src/main/resources/mapper_raw/ProShowMapper.xml +++ b/tall/src/main/resources/mapper_raw/ProShowMapper.xml @@ -21,6 +21,7 @@ + @@ -83,7 +84,7 @@ id, project_id, slide, filter, is_show_mvp, style, create_task, time_show, duration, show_shortcuts, select_task_type, detail_path, pims_nav_type, share_change, share_change_code, - created_at, updated_at, rec_status, role_belong + created_at, updated_at, rec_status, role_belong, milestone_subtask @@ -318,6 +325,9 @@ role_belong = #{record.roleBelong,jdbcType=TINYINT}, + + milestone_subtask = #{record.milestoneSubtask,jdbcType=TINYINT}, + @@ -343,7 +353,8 @@ created_at = #{record.createdAt,jdbcType=TIMESTAMP}, updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, rec_status = #{record.recStatus,jdbcType=TINYINT}, - role_belong = #{record.roleBelong,jdbcType=TINYINT} + role_belong = #{record.roleBelong,jdbcType=TINYINT}, + milestone_subtask = #{record.milestoneSubtask,jdbcType=TINYINT} @@ -405,6 +416,9 @@ role_belong = #{roleBelong,jdbcType=TINYINT}, + + milestone_subtask = #{milestoneSubtask,jdbcType=TINYINT}, + where id = #{id,jdbcType=BIGINT} @@ -427,7 +441,8 @@ created_at = #{createdAt,jdbcType=TIMESTAMP}, updated_at = #{updatedAt,jdbcType=TIMESTAMP}, rec_status = #{recStatus,jdbcType=TINYINT}, - role_belong = #{roleBelong,jdbcType=TINYINT} + role_belong = #{roleBelong,jdbcType=TINYINT}, + milestone_subtask = #{milestoneSubtask,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} \ No newline at end of file From aa3f854b0705af38a049f62c1f6b39f09c540f50 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Mon, 26 Apr 2021 15:27:50 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86:=E4=BF=AE=E6=94=B9=E5=AF=B9=E8=B0=81?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E8=A7=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccsens/tall/bean/dto/RoleDto.java | 9 ++++ .../ccsens/tall/service/IProRoleService.java | 7 ++++ .../ccsens/tall/service/ProRoleService.java | 41 +++++++++++++++++++ .../com/ccsens/tall/web/RoleController.java | 9 ++++ 4 files changed, 66 insertions(+) diff --git a/tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java b/tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java index 64b7caea..57ccc427 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java +++ b/tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java @@ -105,4 +105,13 @@ public class RoleDto { @ApiModelProperty("角色id") private Long roleId; } + + @Data + @ApiModel("对谁不可见") + public static class RoleOfNoLook { + @ApiModelProperty("角色id") + private Long roleId; + @ApiModelProperty("不可见角色id(数组)") + private List noRoleId; + } } diff --git a/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java b/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java index eb634833..a6fd520a 100644 --- a/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java +++ b/tall/src/main/java/com/ccsens/tall/service/IProRoleService.java @@ -79,4 +79,11 @@ public interface IProRoleService { void queryRoleIsShows(QueryDto param); void upRoleShowsOrder(QueryDto param); + + /** + * 角色管理:修改对谁不可见 + * @param param 参数 + * @param userId 当前用户id + */ + void upRoleWhoNoLook(RoleDto.RoleOfNoLook param, Long userId); } diff --git a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java index 468ce041..96d660d6 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ProRoleService.java @@ -1135,4 +1135,45 @@ public class ProRoleService implements IProRoleService { } return memberId; } + + /** + * 修改对谁不可见 + * @param param 参数 + * @param userId 当前用户id + */ + @Override + public void upRoleWhoNoLook(RoleDto.RoleOfNoLook param, Long userId) { + ProRole proRole = proRoleDao.selectByPrimaryKey(param.getRoleId()); + if (ObjectUtil.isNotNull(proRole)){ + //用户在项目中的最高权限 + int power = selectPowerByRoleName(userId, proRole.getProjectId()); + if (2 < power){ + //删除之前的记录 + ProRoleExcludeExample excludeExample = new ProRoleExcludeExample(); + excludeExample.createCriteria().andRoleIdEqualTo(param.getRoleId()).andRecStatusEqualTo((byte)0); + List proRoleExcludes = proRoleExcludeMapper.selectByExample(excludeExample); + if (CollectionUtil.isNotEmpty(proRoleExcludes)){ + for (ProRoleExclude proRoleExclude : proRoleExcludes) { + ProRoleExclude oldExclude = new ProRoleExclude(); + oldExclude.setId(proRoleExclude.getId()); + oldExclude.setRecStatus((byte)2); + proRoleExcludeMapper.updateByExampleSelective(oldExclude,excludeExample); + } + } + + //添加新数据 + for (Long noRoleId : param.getNoRoleId()) { + ProRoleExclude roleExclude = new ProRoleExclude(); + roleExclude.setId(snowflake.nextId()); + roleExclude.setRoleId(param.getRoleId()); + roleExclude.setOtherRoleId(noRoleId); + proRoleExcludeMapper.insertSelective(roleExclude); + } + }else{ + throw new BaseException(CodeEnum.NOT_POWER); + } + } + + } + } diff --git a/tall/src/main/java/com/ccsens/tall/web/RoleController.java b/tall/src/main/java/com/ccsens/tall/web/RoleController.java index dba40607..e2b7c9ee 100644 --- a/tall/src/main/java/com/ccsens/tall/web/RoleController.java +++ b/tall/src/main/java/com/ccsens/tall/web/RoleController.java @@ -163,4 +163,13 @@ public class RoleController { List roleInfoList = proRoleService.getRolesByProjectIdAndUserId(projectId, currentUserId,imitation,queryType); return JsonResponse.newInstance().ok(roleInfoList); } + + @MustLoginTall + @ApiOperation(value = "角色管理:修改对谁不可见",notes = "") + @RequestMapping(value = "/upRoleWhoNoLook", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse upRoleWhoNoLook(@ApiParam @Validated @RequestBody QueryDto params){ + log.info("传入参数:{}", params); + proRoleService.upRoleWhoNoLook(params.getParam(),params.getUserId()); + return JsonResponse.newInstance().ok(); + } } From 43ccb3075eaf52accfc27d26708afe16ac6e8e98 Mon Sep 17 00:00:00 2001 From: zy_Java <654600784@qq.com> Date: Mon, 26 Apr 2021 16:17:49 +0800 Subject: [PATCH 3/7] 20210426v1.3 --- .../ccsens/tall/service/ProTaskDetailService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java b/tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java index aba905a0..526c70e3 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java @@ -420,11 +420,15 @@ public class ProTaskDetailService implements IProTaskDetailService { // } //通过角色id查找 负责人名称 检查人名称 Long executorRole = normalTask.getExecutorRole(); - ProRole proRole = proRoleDao.selectByPrimaryKey(executorRole); - normalTask.setExecutorRoleName(proRole.getName()); + ProRole executor = proRoleDao.selectByPrimaryKey(executorRole); + if(ObjectUtil.isNotNull(executor)) { + normalTask.setExecutorRoleName(executor.getName()); + } Long checkerRole = normalTask.getCheckerRole(); - ProRole proRole1 = proRoleDao.selectByPrimaryKey(checkerRole); - normalTask.setCheckerRoleName(proRole1.getName()); + ProRole checker = proRoleDao.selectByPrimaryKey(checkerRole); + if(ObjectUtil.isNotNull(checker)) { + normalTask.setExecutorRoleName(checker.getName()); + } //处理插件 managePlugin(currentUserId, roleId, normalTask, imitation); From 1008fa8790bfd8f57eb26e94ae24333fdfbee3b1 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Mon, 26 Apr 2021 16:18:07 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=A0=BC=E5=BC=8F=E5=92=8C=E7=99=BB=E5=BD=95=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ccsens/tall/bean/vo/UserVo.java | 2 ++ .../com/ccsens/tall/persist/dao/SysUserDao.java | 7 +++++++ .../com/ccsens/tall/service/UserInfoService.java | 3 +++ tall/src/main/resources/mapper_dao/SysUserDao.xml | 15 +++++++++++++++ 4 files changed, 27 insertions(+) diff --git a/tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java b/tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java index d2ed5e45..ce1f6005 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java +++ b/tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java @@ -144,6 +144,8 @@ public class UserVo { private Date createdAt; @ApiModelProperty("空间使用情况") private Interspace interspace; + @ApiModelProperty("WxInfo") + private WxInfo wxInfo; @ApiModelProperty("标签信息") private List labelList; } diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java index 344526b9..c6b688e7 100644 --- a/tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java @@ -61,4 +61,11 @@ public interface SysUserDao extends SysUserMapper { * @return */ UserVo.TokenBean getTokenBeanByUserId(Long userId); + + /** + * 查找用户wxInfo中的信息 + * @param currentUserId 当前用户id + * @return UserVo.WxInfo + */ + UserVo.WxInfo selectWxInfo(@Param("userId") Long currentUserId); } diff --git a/tall/src/main/java/com/ccsens/tall/service/UserInfoService.java b/tall/src/main/java/com/ccsens/tall/service/UserInfoService.java index 61855606..1cd54e20 100644 --- a/tall/src/main/java/com/ccsens/tall/service/UserInfoService.java +++ b/tall/src/main/java/com/ccsens/tall/service/UserInfoService.java @@ -195,6 +195,9 @@ public class UserInfoService implements IUserInfoService{ //获取空间使用信息 UserVo.Interspace interspace = sysUserDao.selectInterspace(currentUserId); selectUserInfo.setInterspace(interspace); + //封装wxInfo + UserVo.WxInfo wxInfo = sysUserDao.selectWxInfo(currentUserId); + selectUserInfo.setWxInfo(wxInfo); } return selectUserInfo; diff --git a/tall/src/main/resources/mapper_dao/SysUserDao.xml b/tall/src/main/resources/mapper_dao/SysUserDao.xml index d917ade3..c884fb86 100644 --- a/tall/src/main/resources/mapper_dao/SysUserDao.xml +++ b/tall/src/main/resources/mapper_dao/SysUserDao.xml @@ -198,4 +198,19 @@ AND rec_status = 0 + + \ No newline at end of file From 2aecfdf2a326f1a529b246ca37adab6f8943ea65 Mon Sep 17 00:00:00 2001 From: zy_Java <654600784@qq.com> Date: Mon, 26 Apr 2021 17:46:27 +0800 Subject: [PATCH 5/7] 20210424v1.5 --- .../main/java/com/ccsens/tall/service/TaskDeliverService.java | 4 ++-- tall/src/main/resources/application.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java b/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java index 13c6de2b..fd1b7ff2 100644 --- a/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java +++ b/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java @@ -321,7 +321,7 @@ public class TaskDeliverService implements ITaskDeliverService { data.setDeliverId(taskDeliver.getId()); data.setDeliverName(taskDeliver.getName()); data.setRoleId(roleId); - data.setTaskId(taskDetail.getId()); + data.setTaskId(uploadDeliver.getTaskId()); data.setUploader(currentUserId); data.setUploadTime(now); data.setFile(uploadDeliver.getFileInfo()); @@ -811,7 +811,7 @@ public class TaskDeliverService implements ITaskDeliverService { } else { checkerDtoData.setRoleId(task.getExecutorRole()); } - checkerDtoData.setTaskId(task.getId()); + checkerDtoData.setTaskId(checkDeliver.getTaskId()); checkerDtoData.setDeliverId(deliver.getId()); checkerDtoData.setDeliverName(deliver.getName()); if(ObjectUtil.isNotNull(checkRole)) { diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index b5408a3a..ebc544af 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: dev - include: util-dev,common + active: test + include: util-test,common From 1a3a4e99a824e8da915732d94a6ec65b3cf28ee9 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Mon, 26 Apr 2021 17:53:52 +0800 Subject: [PATCH 6/7] ocr --- pom.xml | 4 +- .../com/ccsens/tcm/bean/po/ReportOcr.java | 84 +++ .../ccsens/tcm/bean/po/ReportOcrExample.java | 571 ++++++++++++++++++ .../tcm/bean/vo/BiologicalSamplesVo.java | 4 +- .../com/ccsens/tcm/bean/vo/PatientVo.java | 2 + .../tcm/persist/mapper/ReportOcrMapper.java | 30 + .../com/ccsens/tcm/service/OcrService.java | 110 +++- .../ccsens/tcm/service/PatientService.java | 5 +- .../java/com/ccsens/tcm/uitl/Constant.java | 4 +- tcm/src/main/resources/application.yml | 4 +- .../main/resources/mapper_dao/PatientDao.xml | 4 +- .../resources/mapper_raw/ReportOcrMapper.xml | 228 +++++++ util/pom.xml | 6 + .../com/ccsens/util/ali/AliInstanceUtil.java | 27 + .../util/ali/Demolyocr_general_advanced.java | 168 ++++++ .../HttpApiClientlyocr_general_advanced.java | 34 ++ .../HttpsApiClientlyocr_general_advanced.java | 50 ++ 17 files changed, 1297 insertions(+), 38 deletions(-) create mode 100644 tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcr.java create mode 100644 tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcrExample.java create mode 100644 tcm/src/main/java/com/ccsens/tcm/persist/mapper/ReportOcrMapper.java create mode 100644 tcm/src/main/resources/mapper_raw/ReportOcrMapper.xml create mode 100644 util/src/main/java/com/ccsens/util/ali/AliInstanceUtil.java create mode 100644 util/src/main/java/com/ccsens/util/ali/Demolyocr_general_advanced.java create mode 100644 util/src/main/java/com/ccsens/util/ali/HttpApiClientlyocr_general_advanced.java create mode 100644 util/src/main/java/com/ccsens/util/ali/HttpsApiClientlyocr_general_advanced.java diff --git a/pom.xml b/pom.xml index 8b68ec59..e6b63103 100644 --- a/pom.xml +++ b/pom.xml @@ -219,13 +219,13 @@ org.apache.httpcomponents httpclient - 4.3.1 + 4.5.1 org.apache.httpcomponents httpcore - 4.3.1 + 4.4.3 diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcr.java b/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcr.java new file mode 100644 index 00000000..e2dbaf2f --- /dev/null +++ b/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcr.java @@ -0,0 +1,84 @@ +package com.ccsens.tcm.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class ReportOcr implements Serializable { + private Long id; + + private String code; + + private Byte ocrChannel; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code == null ? null : code.trim(); + } + + public Byte getOcrChannel() { + return ocrChannel; + } + + public void setOcrChannel(Byte ocrChannel) { + this.ocrChannel = ocrChannel; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", code=").append(code); + sb.append(", ocrChannel=").append(ocrChannel); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcrExample.java b/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcrExample.java new file mode 100644 index 00000000..9a8d6af0 --- /dev/null +++ b/tcm/src/main/java/com/ccsens/tcm/bean/po/ReportOcrExample.java @@ -0,0 +1,571 @@ +package com.ccsens.tcm.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ReportOcrExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public ReportOcrExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCodeIsNull() { + addCriterion("code is null"); + return (Criteria) this; + } + + public Criteria andCodeIsNotNull() { + addCriterion("code is not null"); + return (Criteria) this; + } + + public Criteria andCodeEqualTo(String value) { + addCriterion("code =", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotEqualTo(String value) { + addCriterion("code <>", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThan(String value) { + addCriterion("code >", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeGreaterThanOrEqualTo(String value) { + addCriterion("code >=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThan(String value) { + addCriterion("code <", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLessThanOrEqualTo(String value) { + addCriterion("code <=", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeLike(String value) { + addCriterion("code like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotLike(String value) { + addCriterion("code not like", value, "code"); + return (Criteria) this; + } + + public Criteria andCodeIn(List values) { + addCriterion("code in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotIn(List values) { + addCriterion("code not in", values, "code"); + return (Criteria) this; + } + + public Criteria andCodeBetween(String value1, String value2) { + addCriterion("code between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andCodeNotBetween(String value1, String value2) { + addCriterion("code not between", value1, value2, "code"); + return (Criteria) this; + } + + public Criteria andOcrChannelIsNull() { + addCriterion("ocr_channel is null"); + return (Criteria) this; + } + + public Criteria andOcrChannelIsNotNull() { + addCriterion("ocr_channel is not null"); + return (Criteria) this; + } + + public Criteria andOcrChannelEqualTo(Byte value) { + addCriterion("ocr_channel =", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelNotEqualTo(Byte value) { + addCriterion("ocr_channel <>", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelGreaterThan(Byte value) { + addCriterion("ocr_channel >", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelGreaterThanOrEqualTo(Byte value) { + addCriterion("ocr_channel >=", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelLessThan(Byte value) { + addCriterion("ocr_channel <", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelLessThanOrEqualTo(Byte value) { + addCriterion("ocr_channel <=", value, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelIn(List values) { + addCriterion("ocr_channel in", values, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelNotIn(List values) { + addCriterion("ocr_channel not in", values, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelBetween(Byte value1, Byte value2) { + addCriterion("ocr_channel between", value1, value2, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andOcrChannelNotBetween(Byte value1, Byte value2) { + addCriterion("ocr_channel not between", value1, value2, "ocrChannel"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java b/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java index 41d383e9..9ccd2d46 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java @@ -14,8 +14,10 @@ public class BiologicalSamplesVo { public static class selBiolog { @ApiModelProperty("医院名称") private String name; - @ApiModelProperty("患者编号") + @ApiModelProperty("患者住院号") private String hospitalization; + @ApiModelProperty("患者研究编号") + private String patientCode; @ApiModelProperty("生物样本编号") private String code; @ApiModelProperty("样本类型 0:抗血凝10ml 1:促凝血5ml 2:晨尿10ml 3:24小时尿10ml") diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java b/tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java index bf753325..a95c11ac 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java @@ -21,6 +21,8 @@ public class PatientVo { private Long id; @ApiModelProperty("住院号") private String hospitalization; + @ApiModelProperty("研究编号") + private String code; @ApiModelProperty("对照组id") private Long inpatientId; @ApiModelProperty("录入状态:0:新建 1:数据搜集中 2数据搜集完成 3数据搜集超时 4:废弃") diff --git a/tcm/src/main/java/com/ccsens/tcm/persist/mapper/ReportOcrMapper.java b/tcm/src/main/java/com/ccsens/tcm/persist/mapper/ReportOcrMapper.java new file mode 100644 index 00000000..f8edf532 --- /dev/null +++ b/tcm/src/main/java/com/ccsens/tcm/persist/mapper/ReportOcrMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.tcm.persist.mapper; + +import com.ccsens.tcm.bean.po.ReportOcr; +import com.ccsens.tcm.bean.po.ReportOcrExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface ReportOcrMapper { + long countByExample(ReportOcrExample example); + + int deleteByExample(ReportOcrExample example); + + int deleteByPrimaryKey(Long id); + + int insert(ReportOcr record); + + int insertSelective(ReportOcr record); + + List selectByExample(ReportOcrExample example); + + ReportOcr selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") ReportOcr record, @Param("example") ReportOcrExample example); + + int updateByExample(@Param("record") ReportOcr record, @Param("example") ReportOcrExample example); + + int updateByPrimaryKeySelective(ReportOcr record); + + int updateByPrimaryKey(ReportOcr record); +} \ No newline at end of file diff --git a/tcm/src/main/java/com/ccsens/tcm/service/OcrService.java b/tcm/src/main/java/com/ccsens/tcm/service/OcrService.java index 4256cd74..6db98029 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/OcrService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/OcrService.java @@ -2,14 +2,22 @@ package com.ccsens.tcm.service; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.cloudapi.sdk.model.ApiResponse; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ccsens.tcm.bean.dto.QuestionOcrDto; +import com.ccsens.tcm.bean.po.ReportOcr; +import com.ccsens.tcm.bean.po.ReportOcrExample; import com.ccsens.tcm.bean.vo.QuestionOcrVo; import com.ccsens.tcm.persist.dao.QuestionOcrDao; +import com.ccsens.tcm.persist.mapper.ReportOcrMapper; import com.ccsens.tcm.uitl.Constant; +import com.ccsens.util.CodeEnum; +import com.ccsens.util.ali.AliInstanceUtil; import com.ccsens.util.baidu.BaiDuDto; import com.ccsens.util.baidu.BaiDuUtil; import com.ccsens.util.baidu.BaiDuVo; +import com.ccsens.util.exception.BaseException; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -33,35 +41,83 @@ public class OcrService implements IOcrService { @Resource private QuestionOcrDao questionOcrDao; + @Resource + private ReportOcrMapper reportOcrMapper; + @Override public List identifyWords(QuestionOcrDto.GeneralBasic generalBasic, Long userId) { + long time1 = System.currentTimeMillis(); List vos = new ArrayList<>(); - BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); - basic.setUrl(generalBasic.getUrl()); - BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); - log.info("文字识别:{}", words); - if (words == null || words.getWordsResultNum() <= 0) { - return vos; - } + // 类型测评规则 List rules = questionOcrDao.queryRules(generalBasic.getHospitalId(), generalBasic.getCode()); log.info("规则:{}", rules); if (CollectionUtil.isEmpty(rules)) { return vos; } - Map keyMap = new HashMap<>(); + long time2 = System.currentTimeMillis(); + log.info("查询规则时间:{}", time2 - time1); + ReportOcrExample ocrExample = new ReportOcrExample(); + ocrExample.createCriteria().andCodeEqualTo(generalBasic.getCode()); + List reportOcrList = reportOcrMapper.selectByExample(ocrExample); + long time3 = System.currentTimeMillis(); + log.info("查询reportOrc:{}", time3 - time2); + + boolean baidu = CollectionUtil.isEmpty(reportOcrList) || reportOcrList.get(0).getOcrChannel() != 1; + + // 识别字符串 + List contents = new ArrayList<>(); + long time4 = 0; + + if (baidu) { + BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic(); + basic.setUrl(generalBasic.getUrl()); + BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic); + log.info("文字识别:{}", words); + if (words == null || CollectionUtil.isEmpty(words.getWordsResult())) { + return vos; + } + words.getWordsResult().forEach(word -> contents.add(word.getWords())); + } else { + // 阿里 + String body = "{\"img\":\"\",\"url\":\""+generalBasic.getUrl()+"\",\"prob\":false,\"charInfo\":false,\"rotate\":false,\"table\":false}"; + ApiResponse response = AliInstanceUtil.getGeneralAdvancedHttps().ocrAdvancedSyncMode(body.getBytes()); + time4 = System.currentTimeMillis(); + log.info("阿里接口调用:{}", time4 -time3); + log.info("调用阿里的通用识别接口,请求:{}, 返回:{}", body, response); + int code = response.getCode(); + int curCode = 200; + if (code != curCode) { + CodeEnum thirdError = CodeEnum.THIRD_ERROR; + thirdError.setMsg(response.getEx().getMessage()); + throw new BaseException(thirdError); + } + String result = new String(response.getBody()); + log.info("result:{}", result); + JSONObject json = JSONObject.parseObject(result); + JSONArray infos = json.getJSONArray("prism_wordsInfo"); + for (Object obj: infos) { + JSONObject info = (JSONObject)obj; + contents.add(info.getString("word").replaceAll("\\s+","")); + } + } + + + + Map keyMap = new HashMap<>(16); rules.forEach(rule -> { JSONObject start = StrUtil.isEmpty(rule.getStart()) ? null : JSONObject.parseObject(rule.getStart()); JSONObject end = StrUtil.isEmpty(rule.getEnd()) ? null : JSONObject.parseObject(rule.getEnd()); - StringBuilder builder = new StringBuilder(); + StringBuilder builder; if (start == null) { // 不知道这种场景 + return; } else if (start.containsKey(Constant.BaiDu.NUM)) { // 包含读取第几个 - builder = getContent(words, keyMap, start); + builder = getContent(contents, keyMap, start); } else { - builder = getContent(words, start, end); + builder = getContent(contents, start, end); } QuestionOcrVo.GeneralBasic vo = new QuestionOcrVo.GeneralBasic(); @@ -71,24 +127,24 @@ public class OcrService implements IOcrService { vo.setContent(builder.toString()); vos.add(vo); }); - + long time5 = System.currentTimeMillis(); + log.info("数据处理时间:{}", time5 - time4); return vos; } - private StringBuilder getContent(BaiDuVo.GeneralBasic words, Map keyMap, JSONObject start) { + private StringBuilder getContent(List contents, Map keyMap, JSONObject start) { StringBuilder builder = new StringBuilder(); String key = start.getString(Constant.BaiDu.KEY); int index = start.getIntValue(Constant.BaiDu.NUM); if (keyMap.containsKey(key) ) { if (keyMap.get(key) >= 0) { - builder.append( words.getWordsResult().get(keyMap.get(key) + index).getWords()); + builder.append( contents.get(keyMap.get(key) + index)); } } else { - for (int i = 0; i < words.getWordsResultNum(); i++) { - BaiDuVo.GeneralWord word = words.getWordsResult().get(i); - if (word.getWords().contains(key)) { - keyMap.put(key, i); - builder.append(words.getWordsResult().get(i + index).getWords()); + for (int i = 0; i < contents.size(); i++) { + if (contents.get(i).contains(key)) { + keyMap.put(key.trim(), i); + builder.append(contents.get(i + index)); return builder; } } @@ -96,20 +152,18 @@ public class OcrService implements IOcrService { return builder; } - private StringBuilder getContent(BaiDuVo.GeneralBasic words, JSONObject start, JSONObject end) { + private StringBuilder getContent(List contents, JSONObject start, JSONObject end) { StringBuilder builder = new StringBuilder(); - for (int i = 0; i < words.getWordsResult().size(); i++) { - BaiDuVo.GeneralWord word = words.getWordsResult().get(i); - String wordStr = word.getWords(); - if (start != null && wordStr.startsWith(start.getString(Constant.BaiDu.KEY))) { + for (String content : contents) { + String word = content.trim(); + if (start != null && word.startsWith(start.getString(Constant.BaiDu.KEY))) { builder.delete(0, builder.length()); - builder.append(wordStr); - } else if (end != null && wordStr.startsWith(end.getString(Constant.BaiDu.KEY))) { + builder.append(word); + } else if (end != null && word.startsWith(end.getString(Constant.BaiDu.KEY))) { break; } else { - builder.append(wordStr); + builder.append(word); } - } return builder; } diff --git a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java index 154ebad2..27288ca9 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java @@ -3,6 +3,7 @@ package com.ccsens.tcm.service; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.ccsens.tcm.bean.dto.BiologicalSamplesDto; import com.ccsens.tcm.bean.dto.ConRecDto; import com.ccsens.tcm.bean.dto.PatientDto; @@ -94,7 +95,7 @@ public class PatientService implements IPatientService { patientInformation.setId(snowflake.nextId()); patientInformation.setHospitalId(hospital.getId()); // 生成编号 - long incr = redisUtil.incr(Constant.Redis.HOSPITAL_NUM + hospital.getCode(), 1) + 1; + long incr = redisUtil.incr(StrUtil.format(Constant.Redis.HOSPITAL_NUM, hospital.getCode(), inpatient.getCode()) , 1); DecimalFormat df=new DecimalFormat("000"); String num = hospital.getCode() + inpatient.getCode() + df.format(incr); log.info("编号:{}", num); @@ -357,7 +358,7 @@ public class PatientService implements IPatientService { biologicalSamples.setId(snowflake.nextId()); biologicalSamples.setPatientInformationId(patientInformations.get(0).getId()); BeanUtils.copyProperties(param,biologicalSamples); - biologicalSamples.setCode(param.getHospitalization() + Constant.SPLIT_STRIKE + Constant.Biological.getByType(param.getSampleType()).getCode() + Constant.SPLIT_STRIKE + param.getCollectTime()); + biologicalSamples.setCode(patientInformations.get(0).getCode() + Constant.SPLIT_STRIKE + Constant.Biological.getByType(param.getSampleType()).getCode() + Constant.SPLIT_STRIKE + param.getCollectTime()); biologicalSamplesMapper.insertSelective(biologicalSamples); } diff --git a/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java b/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java index 93effda2..2a773a85 100644 --- a/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java +++ b/tcm/src/main/java/com/ccsens/tcm/uitl/Constant.java @@ -102,8 +102,8 @@ public class Constant { public final static String DISEASE_TIME = "disease_time"; /**所有题目按code分类*/ public final static String CODE_QUESTION = "code_question"; - /**医院排序*/ - public final static String HOSPITAL_NUM = "hospital_num_"; + /**医院_组别排序*/ + public final static String HOSPITAL_NUM = "hospital_num_{}_{}"; } public static class File{ diff --git a/tcm/src/main/resources/application.yml b/tcm/src/main/resources/application.yml index 33b76558..4ecd13fd 100644 --- a/tcm/src/main/resources/application.yml +++ b/tcm/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: green - include: common, util-green + active: dev + include: common, util-dev diff --git a/tcm/src/main/resources/mapper_dao/PatientDao.xml b/tcm/src/main/resources/mapper_dao/PatientDao.xml index 149a59d8..b07f35b4 100644 --- a/tcm/src/main/resources/mapper_dao/PatientDao.xml +++ b/tcm/src/main/resources/mapper_dao/PatientDao.xml @@ -41,6 +41,7 @@ SELECT tpi.id, tpi.hospitalization, + tpi.code, tpi.inpatient_id AS inpatientId, tpi.input_status AS inputStatus, tpi.hospital_id AS hospitalId, @@ -148,6 +149,7 @@ SELECT tpi.id, tpi.hospitalization, + tpi.code, tpi.inpatient_id AS inpatientId, tpi.input_status AS inputStatus, tpi.hospital_id AS hospitalId, @@ -391,7 +393,7 @@ t.user_id + select + + distinct + + + from t_report_ocr + + + + + order by ${orderByClause} + + + + + delete from t_report_ocr + where id = #{id,jdbcType=BIGINT} + + + delete from t_report_ocr + + + + + + insert into t_report_ocr (id, code, ocr_channel, + created_at, updated_at, rec_status + ) + values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{ocrChannel,jdbcType=TINYINT}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} + ) + + + insert into t_report_ocr + + + id, + + + code, + + + ocr_channel, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{code,jdbcType=VARCHAR}, + + + #{ocrChannel,jdbcType=TINYINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_report_ocr + + + id = #{record.id,jdbcType=BIGINT}, + + + code = #{record.code,jdbcType=VARCHAR}, + + + ocr_channel = #{record.ocrChannel,jdbcType=TINYINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_report_ocr + set id = #{record.id,jdbcType=BIGINT}, + code = #{record.code,jdbcType=VARCHAR}, + ocr_channel = #{record.ocrChannel,jdbcType=TINYINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_report_ocr + + + code = #{code,jdbcType=VARCHAR}, + + + ocr_channel = #{ocrChannel,jdbcType=TINYINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_report_ocr + set code = #{code,jdbcType=VARCHAR}, + ocr_channel = #{ocrChannel,jdbcType=TINYINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/util/pom.xml b/util/pom.xml index e44755c6..7bc75312 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -38,6 +38,12 @@ javase 2.0 + + + com.aliyun.api.gateway + sdk-core-java + 1.1.6 + diff --git a/util/src/main/java/com/ccsens/util/ali/AliInstanceUtil.java b/util/src/main/java/com/ccsens/util/ali/AliInstanceUtil.java new file mode 100644 index 00000000..c1839d43 --- /dev/null +++ b/util/src/main/java/com/ccsens/util/ali/AliInstanceUtil.java @@ -0,0 +1,27 @@ +package com.ccsens.util.ali; + +import com.alibaba.cloudapi.sdk.model.HttpClientBuilderParams; + +/** + * @description: + * @author: whj + * @time: 2021/4/25 16:53 + */ +public class AliInstanceUtil { + + private static String appKey = "203933478"; + private static String appSecret = "KrDev8GlVu6DyMOhjGSudngDZ8RsslYE"; + + /** + * + * @return + */ + public static HttpsApiClientlyocr_general_advanced getGeneralAdvancedHttps(){ + HttpClientBuilderParams httpsParam = new HttpClientBuilderParams(); + httpsParam.setAppKey(appKey); + httpsParam.setAppSecret(appSecret); + HttpsApiClientlyocr_general_advanced instance = HttpsApiClientlyocr_general_advanced.getInstance(); + instance.init(httpsParam); + return instance; + } +} diff --git a/util/src/main/java/com/ccsens/util/ali/Demolyocr_general_advanced.java b/util/src/main/java/com/ccsens/util/ali/Demolyocr_general_advanced.java new file mode 100644 index 00000000..98d141e0 --- /dev/null +++ b/util/src/main/java/com/ccsens/util/ali/Demolyocr_general_advanced.java @@ -0,0 +1,168 @@ +// +// Created by fred on 2016/10/26. +// Copyright © 2016年 Alibaba. All rights reserved. +// + +package com.ccsens.util.ali; + +import com.alibaba.cloudapi.sdk.constant.SdkConstant; +import com.alibaba.cloudapi.sdk.model.ApiCallback; +import com.alibaba.cloudapi.sdk.model.ApiRequest; +import com.alibaba.cloudapi.sdk.model.ApiResponse; +import com.alibaba.cloudapi.sdk.model.HttpClientBuilderParams; +import java.io.IOException; + + + +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.ssl.SSLContextBuilder; +import org.apache.http.ssl.TrustStrategy; +import javax.net.ssl.*; +import java.security.KeyStore; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +public class Demolyocr_general_advanced { + + + static{ + //HTTP Client init + HttpClientBuilderParams httpParam = new HttpClientBuilderParams(); + httpParam.setAppKey("203933478"); + httpParam.setAppSecret("KrDev8GlVu6DyMOhjGSudngDZ8RsslYE"); + HttpApiClientlyocr_general_advanced.getInstance().init(httpParam); + + + //HTTPS Client init + HttpClientBuilderParams httpsParam = new HttpClientBuilderParams(); + httpsParam.setAppKey("203933478"); + httpsParam.setAppSecret("KrDev8GlVu6DyMOhjGSudngDZ8RsslYE"); + + /** + * HTTPS request use DO_NOT_VERIFY mode only for demo + * Suggest verify for security + */ + //httpsParam.setRegistry(getNoVerifyRegistry()); + + HttpsApiClientlyocr_general_advanced.getInstance().init(httpsParam); + + + } + + + public static void ocrAdvancedHttpsTest(){ + HttpsApiClientlyocr_general_advanced.getInstance().ocrAdvanced("default".getBytes(SdkConstant.CLOUDAPI_ENCODING) , new ApiCallback() { + @Override + public void onFailure(ApiRequest request, Exception e) { + e.printStackTrace(); + } + + @Override + public void onResponse(ApiRequest request, ApiResponse response) { + try { + System.out.println(getResultString(response)); + }catch (Exception ex){ + ex.printStackTrace(); + } + } + }); + } + + public static void ocrAdvancedHttpsSyncTest(){ + ApiResponse response = HttpsApiClientlyocr_general_advanced.getInstance().ocrAdvancedSyncMode("default".getBytes(SdkConstant.CLOUDAPI_ENCODING)); + try { + System.out.println(getResultString(response)); + }catch (Exception ex){ + ex.printStackTrace(); + } + } + + + + private static String getResultString(ApiResponse response) throws IOException { + StringBuilder result = new StringBuilder(); + result.append("Response from backend server").append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF); + result.append("ResultCode:").append(SdkConstant.CLOUDAPI_LF).append(response.getCode()).append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF); + if(response.getCode() != 200){ + result.append("Error description:").append(response.getHeaders().get("X-Ca-Error-Message")).append(SdkConstant.CLOUDAPI_LF).append(SdkConstant.CLOUDAPI_LF); + } + + result.append("ResultBody:").append(SdkConstant.CLOUDAPI_LF).append(new String(response.getBody() , SdkConstant.CLOUDAPI_ENCODING)); + + return result.toString(); + } + + private static Registry getNoVerifyRegistry() { + RegistryBuilder registryBuilder = RegistryBuilder.create(); + try { + registryBuilder.register("http", PlainConnectionSocketFactory.INSTANCE).build(); + registryBuilder.register( + "https", + new SSLConnectionSocketFactory(new SSLContextBuilder().loadTrustMaterial( + KeyStore.getInstance(KeyStore.getDefaultType()), new TrustStrategy() { + @Override + public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + return true; + } + }).build(), + new HostnameVerifier() { + @Override + public boolean verify(String paramString, SSLSession paramSSLSession) { + return true; + } + })); + + } catch (Exception e) { + throw new RuntimeException("HttpClientUtil init failure !", e); + } + return registryBuilder.build(); + } + + + private static void trustAllHttpsCertificates() throws Exception { + javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[1]; + javax.net.ssl.TrustManager tm = new miTM(); + trustAllCerts[0] = tm; + javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext + .getInstance("SSL"); + sc.init(null, trustAllCerts, null); + javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc + .getSocketFactory()); + } + + static class miTM implements javax.net.ssl.TrustManager, + javax.net.ssl.X509TrustManager { + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } + + public boolean isServerTrusted( + java.security.cert.X509Certificate[] certs) { + return true; + } + + public boolean isClientTrusted( + java.security.cert.X509Certificate[] certs) { + return true; + } + + @Override + public void checkServerTrusted( + java.security.cert.X509Certificate[] certs, String authType) + throws java.security.cert.CertificateException { + return; + } + + @Override + public void checkClientTrusted( + java.security.cert.X509Certificate[] certs, String authType) + throws java.security.cert.CertificateException { + return; + } + } +} diff --git a/util/src/main/java/com/ccsens/util/ali/HttpApiClientlyocr_general_advanced.java b/util/src/main/java/com/ccsens/util/ali/HttpApiClientlyocr_general_advanced.java new file mode 100644 index 00000000..99c5d958 --- /dev/null +++ b/util/src/main/java/com/ccsens/util/ali/HttpApiClientlyocr_general_advanced.java @@ -0,0 +1,34 @@ +// +// Created by fred on 2017/1/12. +// Copyright © 2016年 Alibaba. All rights reserved. +// + +package com.ccsens.util.ali; +import com.alibaba.cloudapi.sdk.client.ApacheHttpClient; +import com.alibaba.cloudapi.sdk.enums.Scheme; +import com.alibaba.cloudapi.sdk.enums.HttpMethod; +import com.alibaba.cloudapi.sdk.model.ApiRequest; +import com.alibaba.cloudapi.sdk.model.ApiResponse; +import com.alibaba.cloudapi.sdk.model.ApiCallback; +import com.alibaba.cloudapi.sdk.model.HttpClientBuilderParams; +import com.alibaba.cloudapi.sdk.enums.ParamPosition; +import com.alibaba.cloudapi.sdk.enums.WebSocketApiType; +import com.alibaba.fastjson.JSONObject; + + +public class HttpApiClientlyocr_general_advanced extends ApacheHttpClient{ + public final static String HOST = "ocrapi-advanced.taobao.com"; + static HttpApiClientlyocr_general_advanced instance = new HttpApiClientlyocr_general_advanced(); + public static HttpApiClientlyocr_general_advanced getInstance(){return instance;} + + public void init(HttpClientBuilderParams httpClientBuilderParams){ + httpClientBuilderParams.setScheme(Scheme.HTTP); + httpClientBuilderParams.setHost(HOST); + super.init(httpClientBuilderParams); + } + + + + + +} \ No newline at end of file diff --git a/util/src/main/java/com/ccsens/util/ali/HttpsApiClientlyocr_general_advanced.java b/util/src/main/java/com/ccsens/util/ali/HttpsApiClientlyocr_general_advanced.java new file mode 100644 index 00000000..fa99dcbc --- /dev/null +++ b/util/src/main/java/com/ccsens/util/ali/HttpsApiClientlyocr_general_advanced.java @@ -0,0 +1,50 @@ +// +// Created by fred on 2017/1/12. +// Copyright © 2016年 Alibaba. All rights reserved. +// + +package com.ccsens.util.ali; + +import com.alibaba.cloudapi.sdk.client.ApacheHttpClient; +import com.alibaba.cloudapi.sdk.enums.HttpMethod; +import com.alibaba.cloudapi.sdk.enums.ParamPosition; +import com.alibaba.cloudapi.sdk.enums.Scheme; +import com.alibaba.cloudapi.sdk.model.ApiCallback; +import com.alibaba.cloudapi.sdk.model.ApiRequest; +import com.alibaba.cloudapi.sdk.model.ApiResponse; +import com.alibaba.cloudapi.sdk.model.HttpClientBuilderParams; +import com.alibaba.cloudapi.sdk.enums.WebSocketApiType; +import com.alibaba.fastjson.JSONObject; + +public class HttpsApiClientlyocr_general_advanced extends ApacheHttpClient{ + public final static String HOST = "ocrapi-advanced.taobao.com"; + static HttpsApiClientlyocr_general_advanced instance = new HttpsApiClientlyocr_general_advanced(); + public static HttpsApiClientlyocr_general_advanced getInstance(){return instance;} + + public void init(HttpClientBuilderParams httpClientBuilderParams){ + httpClientBuilderParams.setScheme(Scheme.HTTPS); + httpClientBuilderParams.setHost(HOST); + super.init(httpClientBuilderParams); + } + + + + public void ocrAdvanced(byte[] body , ApiCallback callback) { + String path = "/ocrservice/advanced"; + ApiRequest request = new ApiRequest(HttpMethod.POST_BODY , path, body); + + + + sendAsyncRequest(request , callback); + } + + public ApiResponse ocrAdvancedSyncMode(byte[] body) { + String path = "/ocrservice/advanced"; + ApiRequest request = new ApiRequest(HttpMethod.POST_BODY , path, body); + + + + return sendSyncRequest(request); + } + +} \ No newline at end of file From f3d1059d1b6446dfbfcb7328b99fbc45c2c4d371 Mon Sep 17 00:00:00 2001 From: ma <1062634917@qq.com> Date: Mon, 26 Apr 2021 18:11:23 +0800 Subject: [PATCH 7/7] =?UTF-8?q?lwbs=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2"?= =?UTF-8?q?=E6=88=91=E7=9A=84"=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ccsens/tall/persist/dao/TaskDetailDao.java | 2 +- .../main/java/com/ccsens/tall/service/LwbsService.java | 8 +++++++- tall/src/main/resources/mapper_dao/TaskDetailDao.xml | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java index b451322d..a177df26 100644 --- a/tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java @@ -70,7 +70,7 @@ public interface TaskDetailDao extends ProTaskDetailMapper { * @param userId 当前用户的userId * @return */ - List queryLwbsByProjectId(@Param("projectId")Long projectId, @Param("startTime")Long startTime, @Param("endTime")Long endTime, @Param("userId")Long userId); + List queryLwbsByProjectId(@Param("projectId")Long projectId, @Param("startTime")Long startTime, @Param("endTime")Long endTime, @Param("userId")Long userId,@Param("roleIds") List roleIds); /** * 通过任务详情id查询项目下的经理角色id diff --git a/tall/src/main/java/com/ccsens/tall/service/LwbsService.java b/tall/src/main/java/com/ccsens/tall/service/LwbsService.java index bc9e5d46..8ad885c0 100644 --- a/tall/src/main/java/com/ccsens/tall/service/LwbsService.java +++ b/tall/src/main/java/com/ccsens/tall/service/LwbsService.java @@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * @author 逗 @@ -33,6 +34,8 @@ public class LwbsService implements ILwbsService{ private TaskDetailDao taskDetailDao; @Resource public SysProjectDao sysProjectDao; + @Resource + public ProMemberService proMemberService; /** * 查询该用户的所有项目 @@ -125,8 +128,11 @@ public class LwbsService implements ILwbsService{ private TaskVo.ProTaskInfo queryLwbsByProjectId(Long projectId, Long startTime,Long endTime, Long userId){ TaskVo.ProTaskInfo proTaskInfo = new TaskVo.ProTaskInfo(); + //查找当前用户在项目中的角色 + List proRoles = proMemberService.selectRolesByUserIdAndProjectId(userId, projectId, null); + List roleIds = proRoles.stream().map(ProRole::getId).collect(Collectors.toList()); //查询当前项目下所有任务 - List normalTaskList = taskDetailDao.queryLwbsByProjectId(projectId,startTime,endTime,userId); + List normalTaskList = taskDetailDao.queryLwbsByProjectId(projectId,startTime,endTime,userId,roleIds); //分解为全局和普通 if(CollectionUtil.isNotEmpty(normalTaskList)) { TaskUtil.Task task = TaskUtil.splitTask(normalTaskList, startTime, endTime, 0); diff --git a/tall/src/main/resources/mapper_dao/TaskDetailDao.xml b/tall/src/main/resources/mapper_dao/TaskDetailDao.xml index f991ca6b..bb00af62 100644 --- a/tall/src/main/resources/mapper_dao/TaskDetailDao.xml +++ b/tall/src/main/resources/mapper_dao/TaskDetailDao.xml @@ -721,6 +721,13 @@ AND s.end_time >= #{startTime} AND d.Level = 2 + AND + + d.executor_role IN + + #{item} + + order by s.begin_time )t LEFT JOIN