Commit a970dbb3 by 翁国栋

8小时后台--

存储导入保单的execl
parent 1bcf28a0
...@@ -20,6 +20,7 @@ import cn.timer.api.dto.insure.InsureUserDto; ...@@ -20,6 +20,7 @@ import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PlansDto; import cn.timer.api.dto.insure.PlansDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.dto.spmk.User; import cn.timer.api.dto.spmk.User;
import cn.timer.api.service.OSSService;
import cn.timer.api.utils.*; import cn.timer.api.utils.*;
import com.alibaba.druid.util.Base64; import com.alibaba.druid.util.Base64;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -119,6 +120,9 @@ public class InsureContorll { ...@@ -119,6 +120,9 @@ public class InsureContorll {
@Value(value = "${config-8timer.init-password}") @Value(value = "${config-8timer.init-password}")
private String pwd; private String pwd;
@Autowired
private OSSService ossService;
private static SimpleDateFormat dtf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static SimpleDateFormat dtf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -1159,6 +1163,7 @@ public class InsureContorll { ...@@ -1159,6 +1163,7 @@ public class InsureContorll {
} else { } else {
return ResultUtil.error("保单不存在,请检查保单号是否正确"); return ResultUtil.error("保单不存在,请检查保单号是否正确");
} }
InsurePolicy oldPolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, policy.getPolicyNo())); InsurePolicy oldPolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, policy.getPolicyNo()));
if (oldPolicy == null) { if (oldPolicy == null) {
...@@ -1171,6 +1176,7 @@ public class InsureContorll { ...@@ -1171,6 +1176,7 @@ public class InsureContorll {
policy = oldPolicy; policy = oldPolicy;
policy.updateById(); policy.updateById();
} }
Result<String> ossUrl = ossService.upload(policy.getId(), "policy", file);
if (userList.size() <= 0) { if (userList.size() <= 0) {
throw new CustomException("导入错误,人员为空"); throw new CustomException("导入错误,人员为空");
} }
...@@ -1232,7 +1238,8 @@ public class InsureContorll { ...@@ -1232,7 +1238,8 @@ public class InsureContorll {
} }
InsureLog.builder().requestParam(JSONObject.toJSONString(map)).type(9).createTime(new Date()).requestType(2).returnBody(data).requestPath(policyDetailUrl) InsureLog.builder().requestParam(JSONObject.toJSONString(map)).type(9).createTime(new Date()).requestType(2).returnBody(data).requestPath(policyDetailUrl)
.returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).policyId(policy.getId()).build().insert(); .returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString())
.fileUrl(ossUrl.getData().substring(5)).policyId(policy.getId()).build().insert();
} catch (IOException e) { } catch (IOException e) {
log.error("导入保单:", e); log.error("导入保单:", e);
throw new CustomException("导入保单"); throw new CustomException("导入保单");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment