|
|
@@ -11,10 +11,15 @@ import cn.hutool.poi.word.Word07Writer;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.modules.alioss.bo.OssRequest;
|
|
|
+import com.zhongzheng.modules.alioss.service.impl.OssServiceImpl;
|
|
|
import com.zhongzheng.modules.base.bo.UserProfileFit;
|
|
|
+import org.apache.http.entity.ContentType;
|
|
|
import org.apache.poi.xwpf.usermodel.BreakType;
|
|
|
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -27,6 +32,7 @@ import com.zhongzheng.modules.base.domain.UserProfile;
|
|
|
import com.zhongzheng.modules.base.mapper.UserProfileMapper;
|
|
|
import com.zhongzheng.modules.base.vo.UserProfileVo;
|
|
|
import com.zhongzheng.modules.base.service.IUserProfileService;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
import sun.misc.BASE64Encoder;
|
|
|
|
|
|
import java.awt.*;
|
|
|
@@ -49,6 +55,12 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
|
@Value("${aliyun.oss.endpoint}")
|
|
|
private String ALIYUN_OSS_ENDPOINT;
|
|
|
|
|
|
+ @Value("${zhongzheng.profile}")
|
|
|
+ private String ZHONGZHENG_PROFILE;
|
|
|
+
|
|
|
+ @Autowired()
|
|
|
+ private OssServiceImpl ossService;
|
|
|
+
|
|
|
@Override
|
|
|
public UserProfileVo queryById(Long id){
|
|
|
UserProfileQueryBo userProfileQueryBo = new UserProfileQueryBo();
|
|
|
@@ -135,7 +147,7 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String addWord(UserProfileAddBo bo) {
|
|
|
+ public String addWord(UserProfileAddBo bo) throws IOException {
|
|
|
UserProfileQueryBo userProfileQueryBo = new UserProfileQueryBo();
|
|
|
userProfileQueryBo.setUserId(bo.getUserId());
|
|
|
userProfileQueryBo.setGoodsId(bo.getGoodsId());
|
|
|
@@ -164,10 +176,17 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
|
|
|
bindingMap.put("d", 1);
|
|
|
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+"word.docx");
|
|
|
//最终渲染出来的样子
|
|
|
- template.render(bindingMap);
|
|
|
-
|
|
|
- return "11";
|
|
|
+ template.render(bindingMap,touch);
|
|
|
+ OssRequest ossRequest = new OssRequest();
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(touch);
|
|
|
+ MultipartFile multipartFile = new MockMultipartFile(touch.getName(), touch.getName(),
|
|
|
+ ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
|
|
+ ossRequest.setFile((MultipartFile) touch);
|
|
|
+ ossRequest.setImageStatus(6);
|
|
|
+ String upload = ossService.upload(ossRequest);
|
|
|
+ return upload;
|
|
|
}
|
|
|
|
|
|
@Override
|