he2802 1 năm trước cách đây
mục cha
commit
cb040f4bf7

+ 99 - 16
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fasterxml.jackson.databind.exc.InvalidFormatException;
 import com.openhtmltopdf.swing.Java2DRenderer;
 import com.openhtmltopdf.util.FSImageWriter;
@@ -259,22 +260,104 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         //给模板绑定数据
         Calendar rightNow = Calendar.getInstance();
         Map<String, Object> bindingMap = new HashMap<>();
-        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("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());
+        if (ObjectUtils.isNull(String.valueOf(maps.get("name")))){
+            bindingMap.put("username", "");
+        }else {
+            bindingMap.put("username", JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("s")))){
+            bindingMap.put("s", "");
+        }else {
+            bindingMap.put("s", JSONObject.parseObject(String.valueOf(maps.get("sex")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("post")))){
+            bindingMap.put("post", "");
+        }else {
+            bindingMap.put("post", JSONObject.parseObject(String.valueOf(maps.get("apply_post")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("idcard")))){
+            bindingMap.put("idcard", "");
+        }else {
+            bindingMap.put("idcard", JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("phone")))){
+            bindingMap.put("phone", "");
+        }else {
+            bindingMap.put("phone", JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("school")))){
+            bindingMap.put("school", "");
+        }else {
+            bindingMap.put("school", JSONObject.parseObject(String.valueOf(maps.get("school")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("edu")))){
+            bindingMap.put("edu", "");
+        }else {
+            bindingMap.put("edu", JSONObject.parseObject(String.valueOf(maps.get("education")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("major")))){
+            bindingMap.put("major", "");
+        }else {
+            bindingMap.put("major", JSONObject.parseObject(String.valueOf(maps.get("major")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("cname")))){
+            bindingMap.put("cname", "");
+        }else {
+            bindingMap.put("cname", JSONObject.parseObject(String.valueOf(maps.get("unit_contact")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("cphone")))){
+            bindingMap.put("cphone", "");
+        }else {
+            bindingMap.put("cphone", JSONObject.parseObject(String.valueOf(maps.get("unit_tel")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(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(String.valueOf(maps.get("y")))){
+            bindingMap.put("y", "");
+        }else {
+            bindingMap.put("y", Convert.toStr(rightNow.get(Calendar.YEAR)));
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("m")))){
+            bindingMap.put("m", "");
+        }else {
+            bindingMap.put("m", rightNow.get(Calendar.MONTH) + 1);
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("d")))){
+            bindingMap.put("d", "");
+        }else {
+            bindingMap.put("d", rightNow.get(Calendar.DAY_OF_MONTH));
+        }
+        if (ObjectUtils.isNull(String.valueOf(maps.get("time")))){
+            bindingMap.put("time", "");
+        }else {
+            bindingMap.put("time", JSONObject.parseObject(String.valueOf(maps.get("graduation_time")), UserProfileFit.class).getValue());
+        }
+        if (ObjectUtils.isNull(String.valueOf(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("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());
         File touch = FileUtil.touch(ZHONGZHENG_PROFILE + imgIndex+"word.html");
         //默认freemake配置
         Configuration configuration = new Configuration();

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -936,7 +936,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="getClassUserNumByTenant" parameterType="java.lang.Long" resultType="java.lang.Long">
         SELECT
-            sum( a.num )
+            IFNULL(sum( a.num ),0)
         FROM
             ( SELECT COUNT( user_id ) AS num FROM class_grade_user WHERE grade_id = #{gradeId} AND `status` = 1 AND change_grade = 0 GROUP BY user_id ) a
     </select>