Browse Source

同步身份证资料

he2802 3 years ago
parent
commit
d39ccc6941

+ 35 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -9,6 +9,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.extra.template.TemplateException;
 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.fasterxml.jackson.databind.exc.InvalidFormatException;
 import com.openhtmltopdf.swing.Java2DRenderer;
@@ -25,6 +26,7 @@ import com.zhongzheng.modules.base.bo.UserProfileFit;
 import com.zhongzheng.modules.base.vo.JsonBean;
 import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
 import com.zhongzheng.modules.base.vo.UserProfileExportVo;
+import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
@@ -32,6 +34,7 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.InformRemindVo;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
+import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserVo;
 import freemarker.template.Configuration;
@@ -375,6 +378,11 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         if (userProfileVo.getTypeStatus().equals(1)){
             //审核资料发送消息
             sendAuidit(update);
+            if (update.getStatus().equals(1)) {
+                //审核通过同步身份证到用户信息
+                getUserPicInfo(update);
+            }
+
         }else if (userProfileVo.getTypeStatus().equals(2)){
             //审核承诺书发送消息
             sendAuiditSMS(update);
@@ -382,6 +390,33 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         return this.updateById(update);
     }
 
+    /**
+     * 同步身份证到用户信息
+     */
+    private void getUserPicInfo(UserProfile bo){
+        String keyValue = bo.getKeyValue();
+        if(Validator.isNotEmpty(keyValue)){
+            Map<String, String> maps = JSONObject.parseObject(keyValue,Map.class);
+            String recent_photos,idcard_face_photo,idcard_national_photo = null;
+            LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+            objectLambdaUpdateWrapper.eq(User::getUserId, bo.getUserId());
+            if(maps.containsKey("recent_photos")){
+                recent_photos = JSONObject.parseObject(String.valueOf(maps.get("recent_photos")), UserProfileFit.class).getValue();
+                objectLambdaUpdateWrapper.set(User::getOneInchPhotos, recent_photos);
+            }
+            if(maps.containsKey("idcard_face_photo")){
+                idcard_face_photo = JSONObject.parseObject(String.valueOf(maps.get("recent_photos")), UserProfileFit.class).getValue();
+                objectLambdaUpdateWrapper.set(User::getIdCardImg1, idcard_face_photo);
+            }
+            if(maps.containsKey("idcard_national_photo")){
+                idcard_national_photo = JSONObject.parseObject(String.valueOf(maps.get("recent_photos")), UserProfileFit.class).getValue();
+                objectLambdaUpdateWrapper.set(User::getIdCardImg2, idcard_national_photo);
+            }
+            objectLambdaUpdateWrapper.set(User::getUpdateTime,DateUtils.getNowTime());
+            iUserService.update(null, objectLambdaUpdateWrapper);
+        }
+    }
+
     private void sendAuiditSMS(UserProfile bo) {
         UserProfileVo userProfileVo = this.queryById(bo.getId());
         Long gradeId = baseMapper.selectGrade(userProfileVo.getUserId(),userProfileVo.getGoodsId());