Ver Fonte

user增加企业微信实际userid字段

seyason há 2 anos atrás
pai
commit
df5de555cc

Diff do ficheiro suprimidas por serem muito extensas
+ 78 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java


+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java

@@ -21,7 +21,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2022-09-28
+ * @since 2022-10-08
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -245,6 +245,12 @@ public class User extends Model<User> {
     @TableField(exist = false)
     private String type;
 
+    /**
+     * 企业微信用户userid
+     */
+    @TableField("corpwx_real_userid")
+    private String corpwxRealUserid;
+
 
     @Override
     protected Serializable pkVal() {

+ 27 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -84,6 +84,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Resource
     private SysFunctionMapper sysFunctionMapper;
     @Resource
+    private CorpwxJobResultMapper corpwxJobResultMapper;
+    @Resource
     private SysRoleModuleService sysRoleModuleService;
     @Resource
     private SysRoleFunctionService sysRoleFunctionService;
@@ -1514,10 +1516,31 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                     file.delete();
                 }
             }*/
-                Thread.sleep(3000);
-                String syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
-                //返回生成的文件地址/upload文件夹下
-                httpRespMsg.data = syncTranslationResult;
+                int i = 0;
+                String syncTranslationResult = null;
+                /**
+                 * 异步上传转译文件的任务完成时会触发回调,在WeiXinCorpController中的commonDevCallbackPost实现了对回调的处理,存储到corpwxJobResult表中
+                 * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
+                 */
+                while (i < 10) {
+                    Thread.sleep(300);
+                    CorpwxJobResult corpwxJobResult = corpwxJobResultMapper.selectById(jobId);
+                    if (corpwxJobResult != null) {
+                        if (corpwxJobResult.getErrCode() == 0) {
+                            syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
+                        } else {
+                            httpRespMsg.setError(corpwxJobResult.getErrMsg());
+                            return httpRespMsg;
+                        }
+                        break;
+                    }
+                    i++;
+                }
+                if (syncTranslationResult != null) {
+                    httpRespMsg.data = syncTranslationResult;
+                } else {
+                    httpRespMsg.setError("处理超时...");
+                }
             }else {
                 httpRespMsg.data = "/upload/" + fileUrlSuffix;
             }

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -40,6 +40,7 @@
         <result column="is_ops" property="isOps" />
         <result column="job_number" property="jobNumber" />
         <result column="corpwx_deptid" property="corpwxDeptid" />
+        <result column="corpwx_real_userid" property="corpwxRealUserid" />
     </resultMap>
     <resultMap id="BaseResultMap2" type="com.management.platform.entity.User">
         <id column="id" property="id" />
@@ -49,7 +50,7 @@
     </resultMap>
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost, month_cost, salary_type, manage_dept_id, color, is_active, wx_openid, role_id, role_name, cost_apply_date, dingding_userid, dingding_unionid, corpwx_userid, induction_date, inactive_date, position, report_status, superior_id, plate1, plate2, plate3, plate4, plate5, is_ops, job_number, corpwx_deptid
+        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost, month_cost, salary_type, manage_dept_id, color, is_active, wx_openid, role_id, role_name, cost_apply_date, dingding_userid, dingding_unionid, corpwx_userid, induction_date, inactive_date, position, report_status, superior_id, plate1, plate2, plate3, plate4, plate5, is_ops, job_number, corpwx_deptid, corpwx_real_userid
     </sql>
     <!--单独分页获取人员-->
     <select id="getUserByDepartment" resultType="java.util.Map">