|
@@ -4,10 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.base.bo.ProfileTpAddBo;
|
|
@@ -15,14 +18,18 @@ import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
|
|
|
import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
|
|
|
import com.zhongzheng.modules.base.domain.ProfileTp;
|
|
|
import com.zhongzheng.modules.base.domain.ProfileTpBusiness;
|
|
|
+import com.zhongzheng.modules.base.domain.UserProfile;
|
|
|
import com.zhongzheng.modules.base.mapper.ProfileTpMapper;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpBusinessService;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
+import com.zhongzheng.modules.base.service.IUserProfileService;
|
|
|
import com.zhongzheng.modules.base.vo.ProfileTpVo;
|
|
|
+import com.zhongzheng.modules.user.bo.CommitmentSealBo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -39,6 +46,9 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
|
|
|
@Autowired
|
|
|
private IProfileTpBusinessService iProfileTpBusinessService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserProfileService iUserProfileService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public ProfileTpVo queryById(Long profileTpId){
|
|
@@ -166,5 +176,43 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean commitmentSealUpload(CommitmentSealBo bo) {
|
|
|
+ //todo 承诺书校验
|
|
|
+
|
|
|
+ UserProfile userProfile = iUserProfileService.getById(bo.getId());
|
|
|
+ if (ObjectUtils.isNull(userProfile)){
|
|
|
+ throw new CustomException("学员资料不存在");
|
|
|
+ }
|
|
|
+ if (!userProfile.getUserId().equals(bo.getUserId())){
|
|
|
+ throw new CustomException("当前学员和资料不匹配");
|
|
|
+ }
|
|
|
+ //替换学员承诺书
|
|
|
+ String keyValue = userProfile.getKeyValue();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(keyValue);
|
|
|
+ Map<String, Object> userMap = new HashMap<>();
|
|
|
+ for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
|
|
|
+ userMap.put(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ String key = "commitment_seal";
|
|
|
+ JSONObject recentJson = JSONObject.parseObject(userMap.get(key).toString());
|
|
|
+ Map<String, Object> recentMap = new HashMap<>();
|
|
|
+ for (Map.Entry<String, Object> entry : recentJson.entrySet()) {
|
|
|
+ recentMap.put(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(recentMap)){
|
|
|
+ recentMap.put("value",bo.getImageUrl());
|
|
|
+ }else {
|
|
|
+ recentMap.put("fieldKey",key);
|
|
|
+ recentMap.put("value",bo.getImageUrl());
|
|
|
+ recentMap.put("fieldName","承诺书盖章");
|
|
|
+ recentMap.put("status",0);
|
|
|
+ }
|
|
|
+ userMap.put(key,recentMap);
|
|
|
+ String content = JSONObject.toJSONString(userMap);
|
|
|
+ userProfile.setKeyValue(content);
|
|
|
+ return iUserProfileService.updateById(userProfile);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|