Commit 826cdbd1 by 翁国栋 Committed by 284718418@qq.com

运营后台--

增加日志列表
parent 5ad25bff
......@@ -33,7 +33,7 @@ import java.util.Date;
@NoArgsConstructor
@Table(name = "insure_log")
@ApiModel("投保日志")
public class InsureLog extends Model<InsurePolicy> {
public class InsureLog extends Model<InsureLog> {
private static final long serialVersionUID = 1L;
@Id
......@@ -88,6 +88,8 @@ public class InsureLog extends Model<InsurePolicy> {
private Integer policyId;
public String fileUrl;
/**
* 设置:
*/
......@@ -221,4 +223,5 @@ public class InsureLog extends Model<InsurePolicy> {
return type;
}
}
......@@ -39,7 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
* @email 862422848@qq.com
* @date 2022-03-07 17:02:46
*/
@Api(tags = "投保人")
@Api(tags = "8.0保险列表")
@RestController
@Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"})
......
package cn.timer.api.controller.insure;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsureProduct;
import cn.timer.api.dao.insure.InsureLogMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
......@@ -25,11 +39,65 @@ import org.springframework.web.bind.annotation.RestController;
* @email 862422848@qq.com
* @date 2022-03-22 09:55:46
*/
@Api(tags = "8.0保险列表")
@RestController
@RequestMapping("insurelog")
@Transactional
@RequestMapping(value = "/insureLog", produces = {"application/json"})
public class InsureLogController{
@Autowired
private InsureLogMapper insureLogService;
private InsureLogMapper insureLogMapper;
@GetMapping(value = "/logList")
@ApiOperation(value = "12.日志列表", httpMethod = "Get", notes = "日志列表")
public Result<Object> logList(@RequestParam("policyId") String policyId) {
List<InsureLog> list = insureLogMapper.selectListById(policyId);
if (list.size()>0) {
return ResultUtil.data(list);
}
return ResultUtil.error("暂无日志");
}
@GetMapping(value = "/downUserExcel")
@ApiOperation(value = "12.人员清单", httpMethod = "Get", notes = "人员清单")
public void downUserExcel(@RequestParam("logId") String logId, HttpServletRequest request, HttpServletResponse response) {
InsureLog insureLog = InsureLog.builder().id(Integer.parseInt(logId)).build().selectById();
if(insureLog==null|| StringUtils.isNullOrEmpty(insureLog.getFileUrl())){
return;
}
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
OutputStream sos = null;
BufferedInputStream bis = null;
try {
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment; filename=" + new String((dtf2.format(LocalDateTime.now())+".xlsx").getBytes("UTF8"), "ISO-8859-1"));
response.setCharacterEncoding("UTF-8");
sos = response.getOutputStream();
String destUrl ="http:"+insureLog.getFileUrl();
URL url = new URL(destUrl);
HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
//连接指定的网络资源
httpUrl.connect();
//获取网络输入流
bis = new BufferedInputStream(httpUrl.getInputStream());
int b;
while ((b = bis.read()) != -1) {
sos.write(b);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
sos.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
......@@ -35,7 +35,6 @@ public class InsureProductController{
@GetMapping(value = "/productList")
@ApiOperation(value = "12.产品列表", httpMethod = "Get", notes = "产品列表")
@ApiOperationSupport(order = 2)
public Result<Object> productList() {
List<InsureProduct> productList = InsureProduct.builder().build().selectList(new QueryWrapper<InsureProduct>().lambda().eq(InsureProduct::getIsDel,0));
if (productList.size()>0) {
......
......@@ -36,7 +36,6 @@ public class InsureUserController{
@PostMapping(value = "/policyList")
@ApiOperation(value = "3.保单列表", httpMethod = "Post", notes = "保单列表")
@ApiOperationSupport(order = 2)
public Result<Object> policyList(@RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto.getPage(), String.valueOf(policyDto.getId()));
......@@ -45,8 +44,7 @@ public class InsureUserController{
return ResultUtil.data(map);
}
@GetMapping(value = "/userDetial")
@ApiOperation(value = "3.被保人详情", httpMethod = "Post", notes = "保单列表")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "被保人详情", httpMethod = "Post", notes = "保单列表")
public Result<Object> userDetial(@RequestParam("userId") String userId) {
InsureUser user = InsureUser.builder().id(Integer.parseInt(userId)).build().selectById();
return ResultUtil.data(user);
......
......@@ -2,8 +2,11 @@ package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
*
......@@ -14,5 +17,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface InsureLogMapper extends BaseMapper<InsureLog> {
List<InsureLog> selectListById(@Param("policyId")String policyId);
}
package cn.timer.api.dto.insure;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import sun.dc.pr.PRError;
import java.util.Date;
/**
* @Description TODO
......
......@@ -18,6 +18,7 @@
<result property="type" column="type"/>
<result property="requestType" column="request_type"/>
<result property="policyId" column="policy_id"/>
<result property="fileUrl" column="file_url"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureLog">
......@@ -170,4 +171,9 @@
</foreach>
</delete>
<select id="selectListById" resultType="cn.timer.api.bean.insure.InsureLog">
select id,return_msg,`type`,create_time from insure_log
where policy_id = #{policyId}
ORDER BY create_time DESC
</select>
</mapper>
......@@ -247,9 +247,8 @@
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
LEFT JOIN qyzx_ent_info_m qy on qy.id=iu.org_code
LEFT JOIN qyzx_ent_info_m qy on qy.id=ip.org_code
<where>
iu.insure_status = 1
<if test="policy.status!=null and policy.status!=''">
and ip.status = #{policy.status}
</if>
......@@ -307,20 +306,20 @@
<select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT
ip.id AS id,
ip.scheme_name AS schemeName,
ip.name AS schemeName,
ip.type AS type,
(select count(id) from insure_policy) AS totaPolicy,
(select count(org_code) from insure_policy) AS totalCompany,
count( iu.id ) AS totalUser,
(select sum(total_premium) from insure_policy) as totalPremium,
ip.update_time AS updateTime
ifnull(0,(select sum(total_premium) from insure_policy)) as totalPremium,
ipp.update_time AS updateTime
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
insure_product ip
LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id
LEFT JOIN insure_user iu ON iu.policy_id = ipp.id
WHERE
iu.insure_status = 1
ip.is_del = 0
GROUP BY
ip.type
ip.id
</select>
</mapper>
......@@ -283,7 +283,7 @@
from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
where yme.org_code = 3 AND iu.insure_status=1
where yme.org_code = 3
<if test="id !=null and id !=''">
and ip.id=#{id}
</if>
......@@ -296,7 +296,7 @@
select count(iu.id) from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
where yme.org_code = 3 AND iu.insure_status=1
where yme.org_code = 3
<if test="id !=null and id !=''">
and ip.id=#{id}
</if>
......
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