yangdamao 1 year ago
parent
commit
338a11313d

+ 21 - 95
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -260,105 +260,23 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         //给模板绑定数据
         Calendar rightNow = Calendar.getInstance();
         Map<String, Object> bindingMap = new HashMap<>();
-//        if (ObjectUtils.isNull(maps.get("name"))){
-//            bindingMap.put("username", " ");
-//        }else {
-//            bindingMap.put("username", JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("s"))){
-//            bindingMap.put("s", "");
-//        }else {
-//            bindingMap.put("s", JSONObject.parseObject(String.valueOf(maps.get("sex")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("post"))){
-//            bindingMap.put("post", "");
-//        }else {
-//            bindingMap.put("post", JSONObject.parseObject(String.valueOf(maps.get("apply_post")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("idcard"))){
-//            bindingMap.put("idcard", "");
-//        }else {
-//            bindingMap.put("idcard", JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("phone"))){
-//            bindingMap.put("phone", "");
-//        }else {
-//            bindingMap.put("phone", JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("school"))){
-//            bindingMap.put("school", "");
-//        }else {
-//            bindingMap.put("school", JSONObject.parseObject(String.valueOf(maps.get("school")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("edu"))){
-//            bindingMap.put("edu", "");
-//        }else {
-//            bindingMap.put("edu", JSONObject.parseObject(String.valueOf(maps.get("education")), UserProfileFit.class).getValue());
-//        }
-//        String major = maps.get("major");
-//        if (ObjectUtils.isNull(major)){
-//            bindingMap.put("major", "");
-//        }else {
-//            bindingMap.put("major", JSONObject.parseObject(String.valueOf(maps.get("major")), UserProfileFit.class).getValue());
-//        }
-//        if (StringUtils.isBlank(maps.get("cname"))){
-//            bindingMap.put("cname", "");
-//        }else {
-//            bindingMap.put("cname", JSONObject.parseObject(String.valueOf(maps.get("unit_contact")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("cphone"))){
-//            bindingMap.put("cphone", "");
-//        }else {
-//            bindingMap.put("cphone", JSONObject.parseObject(String.valueOf(maps.get("unit_tel")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("image"))){
-//            bindingMap.put("image", "");
-//        }else {
-//            bindingMap.put("image", ALIYUN_OSS_ENDPOINT + "/" + JSONObject.parseObject(String.valueOf(maps.get("commitment_electr_signature")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("y"))){
-//            bindingMap.put("y", "");
-//        }else {
-//            bindingMap.put("y", Convert.toStr(rightNow.get(Calendar.YEAR)));
-//        }
-//        if (ObjectUtils.isNull(maps.get("m"))){
-//            bindingMap.put("m", "");
-//        }else {
-//            bindingMap.put("m", rightNow.get(Calendar.MONTH) + 1);
-//        }
-//        if (ObjectUtils.isNull(maps.get("d"))){
-//            bindingMap.put("d", "");
-//        }else {
-//            bindingMap.put("d", rightNow.get(Calendar.DAY_OF_MONTH));
-//        }
-//        if (ObjectUtils.isNull(maps.get("time"))){
-//            bindingMap.put("time", "");
-//        }else {
-//            bindingMap.put("time", JSONObject.parseObject(String.valueOf(maps.get("graduation_time")), UserProfileFit.class).getValue());
-//        }
-//        if (ObjectUtils.isNull(maps.get("year"))){
-//            bindingMap.put("year", "");
-//        }else {
-//            bindingMap.put("year", JSONObject.parseObject(String.valueOf(maps.get("working_years")), UserProfileFit.class).getValue());
-//        }
 
-
-        bindingMap.put("username", JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue());
-        bindingMap.put("s", JSONObject.parseObject(String.valueOf(maps.get("sex")), UserProfileFit.class).getValue());
-        bindingMap.put("post", JSONObject.parseObject(String.valueOf(maps.get("apply_post")), UserProfileFit.class).getValue());
-        bindingMap.put("idcard", JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue());
-        bindingMap.put("phone", JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue());
-        bindingMap.put("school", JSONObject.parseObject(String.valueOf(maps.get("school")), UserProfileFit.class).getValue());
-        bindingMap.put("edu", JSONObject.parseObject(String.valueOf(maps.get("education")), UserProfileFit.class).getValue());
-        bindingMap.put("major", JSONObject.parseObject(String.valueOf(maps.get("major")), UserProfileFit.class).getValue());
-        bindingMap.put("cname", JSONObject.parseObject(String.valueOf(maps.get("unit_contact")), UserProfileFit.class).getValue());
-        bindingMap.put("cphone", JSONObject.parseObject(String.valueOf(maps.get("unit_tel")), UserProfileFit.class).getValue());
-        bindingMap.put("image", ALIYUN_OSS_ENDPOINT + "/" + JSONObject.parseObject(String.valueOf(maps.get("commitment_electr_signature")), UserProfileFit.class).getValue());
+        bindingMap.put("username", jsonHandle(maps,"username"));
+        bindingMap.put("s", jsonHandle(maps,"s"));
+        bindingMap.put("post", jsonHandle(maps,"post"));
+        bindingMap.put("idcard", jsonHandle(maps,"idcard"));
+        bindingMap.put("phone", jsonHandle(maps,"phone"));
+        bindingMap.put("school", jsonHandle(maps,"school"));
+        bindingMap.put("edu", jsonHandle(maps,"edu"));
+        bindingMap.put("major", jsonHandle(maps,"major"));
+        bindingMap.put("cname", jsonHandle(maps,"cname"));
+        bindingMap.put("cphone", jsonHandle(maps,"cphone"));
+        bindingMap.put("image", ALIYUN_OSS_ENDPOINT + "/" + jsonHandle(maps,"commitment_electr_signature"));
         bindingMap.put("y", Convert.toStr(rightNow.get(Calendar.YEAR)));
         bindingMap.put("m", rightNow.get(Calendar.MONTH) + 1);
         bindingMap.put("d", rightNow.get(Calendar.DAY_OF_MONTH));
-        bindingMap.put("time", JSONObject.parseObject(String.valueOf(maps.get("graduation_time")), UserProfileFit.class).getValue());
-        bindingMap.put("year", JSONObject.parseObject(String.valueOf(maps.get("working_years")), UserProfileFit.class).getValue());
+        bindingMap.put("time", jsonHandle(maps,"graduation_time"));
+        bindingMap.put("year", jsonHandle(maps,"working_years"));
         File touch = FileUtil.touch(ZHONGZHENG_PROFILE + imgIndex+"word.html");
         //默认freemake配置
         Configuration configuration = new Configuration();
@@ -393,6 +311,14 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         return upload;
     }
 
+    private String jsonHandle(Map<String,String> maps,String key){
+        UserProfileFit userProfileFit = JSONObject.parseObject(String.valueOf(maps.get(key)), UserProfileFit.class);
+        if (ObjectUtils.isNull(userProfileFit) || ObjectUtils.isNull(userProfileFit.getValue())){
+            return "";
+        }
+        return userProfileFit.getValue();
+    }
+
     @Override
     public String addWord(UserProfileAddBo bo) throws IOException {
         UserProfileQueryBo userProfileQueryBo = new UserProfileQueryBo();

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionWatchPerServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CheckSectionWatchVo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerAddBo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerBo;
@@ -80,7 +81,8 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
             format = format + "&watchPer="+watchPer.getWatchPer();
         }
         String s = Base64.encode(format);
-        String url = String.format("%s?param=%s&tenantId=%s",liveHost,s,watchPer.getTenantId());
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        String url = String.format("%s?param=%s&tenantId=%s",liveHost,s,tenantId);
         vo.setEnCodePC(url);
         vo.setEnCode(url);
         if (ObjectUtils.isNull(watchPer)){