Commit 56fad829 by 翁国栋

运营后台--

保单列表
parent 678897d8
......@@ -86,6 +86,8 @@ public class InsureLog extends Model<InsurePolicy> {
*/
private Integer requestType;
private Integer policyId;
/**
* 设置:
*/
......@@ -218,4 +220,5 @@ public class InsureLog extends Model<InsurePolicy> {
public Integer getType() {
return type;
}
}
......@@ -151,4 +151,9 @@ public class InsureUser extends Model<InsureUser> {
@ApiModelProperty(value = "替换流水号,使用trans_id,RP_开头")
private String replaceTransId;
@ApiModelProperty(value = "申请类型:1新增 3批增")
private Integer applyType;
}
......@@ -39,7 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
* @email 862422848@qq.com
* @date 2022-03-07 17:02:46
*/
@Api(tags = "23.0保险列表")
@Api(tags = "投保人")
@RestController
@Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"})
......
......@@ -18,6 +18,7 @@ import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.*;
import com.alibaba.druid.util.Base64;
import com.aliyun.oss.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beust.jcommander.internal.Lists;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Maps;
......@@ -145,13 +146,6 @@ public class InsureContorll {
quotations.put("applicant_type", "2");/*投保人类型:2-企业*/
quotations.put("quotation_type", 3);/*报价类型:3-投保申请*/
quotations.put("currency", "5");/*币种:5人民币*/
quotations.put("source_type", "");/*币种:5人民币*/
quotations.put("cps_email", "");/*币种:5人民币*/
quotations.put("cps_tel", "");/*币种:5人民币*/
quotations.put("last_serial_number", "");/*币种:5人民币*/
quotations.put("from_source", "");/*币种:5人民币*/
quotations.put("operator_name", "");/*币种:5人民币*/
/*企业信息*/
InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById();
......@@ -182,14 +176,7 @@ public class InsureContorll {
basicMap.put("product_code_id", "61b85207a9f87da19fb5986");/*产品代码,选项值:61b85207a9f87da19fb5986 (生产环境) 61b85207a9f87da19fb5986 (沙箱环境)*/
basicMap.put("policy_date_start",insureDto.getPolicyDateStart());
basicMap.put("policy_date_end", insureDto.getPolicyDateEnd());
basicMap.put("channel", "");
basicMap.put("fee", "");
basicMap.put("partner_user_rate", "");
basicMap.put("promotion_fee", "");
basicMap.put("agent_id", "");
basicMap.put("policy_insure_notify", "");
basicMap.put("promotion_id", 0);
basicMap.put("policy_number_last_year", "");
quotations.put("basic", basicMap);
quotations.put("individual_applicant", Maps.newHashMap());
......@@ -228,6 +215,7 @@ public class InsureContorll {
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
Map policyMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("policy")), Map.class);
Map batchMap = JSONObject.parseObject(JSONObject.toJSONString(policyMap.get("batch")), Map.class);
InsureUser insureUser;
InsurePolicy insurePolicy = InsurePolicy.builder().build();
insurePolicy.setPolicyDateStart(dtf3.parse(insureDto.getPolicyDateStart()));
......@@ -249,9 +237,9 @@ public class InsureContorll {
insureUser.setUserId(y.getId());
insureUser.setInsuredName(qyzxEntInfoM.getName());
insureUser.setPrice(price.toString());/*前端获取的保费*/
insureUser.setTransId("MB_" + dtf2.format(now));
insureUser.setTransId("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now));
insureUser.setPremium(String.valueOf(ygglMainEmpList.size() * price));
insureUser.setBatchNo("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now));
insureUser.setBatchNo(batchMap.get("batch_no").toString());
insureUser.setBenefitBasicPlan(insureDto.getBenefitBasicPlan());
insureUser.setPolicyNo(policyMap.get("policy_no").toString());
insureUser.setUserId(y.getId());
......@@ -361,25 +349,16 @@ public class InsureContorll {
}
@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()));
map.put("list", Optional.ofNullable(list).orElse(Lists.newArrayList()));
map.put("total", insureUserMapper.totalUser(String.valueOf(policyDto.getId())));
return ResultUtil.data(map);
}
@PostMapping(value = "/policyListAdmin")
@ApiOperation(value = "4.保单列表--运营后台端", httpMethod = "Post", notes = "保单列表--运营后台端")
@ApiOperationSupport(order = 2)
public Result<Object> policyListAdmin(@RequestBody cn.timer.api.utils.Page page) {
public Result<Object> policyListAdmin(@RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<PolicyDto> list = insurePolicyMapper.policyList(page);
List<PolicyDto> list = insurePolicyMapper.policyList(policyDto);
map.put("list", list);
map.put("total", insurePolicyMapper.totalPolicy());
map.put("total", insurePolicyMapper.totalPolicy(policyDto));
return ResultUtil.data(map);
}
......@@ -521,7 +500,7 @@ public class InsureContorll {
}
@GetMapping(value = "/downPolicyFile")
@ApiOperation(value = "7.下载电子表单", httpMethod = "Get", notes = "下载电子表单")
@ApiOperation(value = "7.下载电子保单", httpMethod = "Get", notes = "下载电子保单")
@ApiOperationSupport(order = 2)
public void downPolicyFile(@RequestParam("policyId") String policyId, HttpServletRequest request, HttpServletResponse response) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(policyId)).build().selectById();
......@@ -767,6 +746,22 @@ public class InsureContorll {
}
return 0;
}
@PostMapping(value = "/policyTotal")
@ApiOperation(value = "10.保单统计列表", httpMethod = "Post", notes = "保单统计列表")
@ApiOperationSupport(order = 2)
public Result<Object> policyTotal() {
List<PolicyDto> list = insurePolicyMapper.policyTotalList();
return ResultUtil.data(list);
}
@GetMapping(value = "/isInsured")
@ApiOperation(value = "10.保单统计列表", httpMethod = "Post", notes = "保单统计列表")
@ApiOperationSupport(order = 2)
public Result<Object> isInsured(@RequestParam("orgCode")String orgCode) {
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode,orgCode));
if(insurePolicy!=null){
return ResultUtil.error("该企业已经投过保,保单号为"+insurePolicy.getPolicyNo());
}
return ResultUtil.success();
}
}
......@@ -2,18 +2,21 @@ package cn.timer.api.controller.insure;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.beust.jcommander.internal.Lists;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Maps;
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.web.bind.annotation.RestController;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
/**
......@@ -23,9 +26,30 @@ import org.springframework.web.bind.annotation.RestController;
* @email 862422848@qq.com
* @date 2022-03-11 09:06:53
*/
@Api(tags = "8.0保险列表")
@RestController
@RequestMapping("insureuser")
@Transactional
@RequestMapping(value ="/insureUser", produces = {"application/json"})
public class InsureUserController{
@Autowired
private InsureUserMapper insureUserMapper;
@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()));
map.put("list", Optional.ofNullable(list).orElse(Lists.newArrayList()));
map.put("total", insureUserMapper.totalUser(String.valueOf(policyDto.getId())));
return ResultUtil.data(map);
}
@GetMapping(value = "/userDetial")
@ApiOperation(value = "3.被保人详情", httpMethod = "Post", notes = "保单列表")
@ApiOperationSupport(order = 2)
public Result<Object> userDetial(@RequestParam("userId") String userId) {
InsureUser user = InsureUser.builder().id(Integer.parseInt(userId)).build().selectById();
return ResultUtil.data(user);
}
}
......@@ -19,8 +19,9 @@ import java.util.List;
*/
@Repository
public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
public List<PolicyDto> policyList(@Param("page") Page page);
List<PolicyDto> policyList(@Param("policy") PolicyDto policyDto);
PolicyDto getPolicyDetail(@Param("id")Integer id);
Integer totalPolicy();
Integer totalPolicy(@Param("policy")PolicyDto policyDto);
List<PolicyDto> policyTotalList();
}
......@@ -16,6 +16,8 @@
<result property="returnMsg" column="return_msg"/>
<result property="transId" column="trans_id"/>
<result property="type" column="type"/>
<result property="requestType" column="request_type"/>
<result property="policyId" column="policy_id"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureLog">
......
......@@ -232,21 +232,58 @@
</delete>
<select id="policyList" resultType="cn.timer.api.dto.insure.PolicyDto">
select ip.id AS id, ip.scheme_name AS schemeName, ip.type AS type, count(iu.id) AS totaPolicy,
count(iu.org_code) AS totalCompany, count(iu.id) AS totalUser, ip.total_premium AS totalPremium,
ip.update_time AS updateTime,ip.policy_file AS policyFile
from insure_policy ip
LEFT JOIN insure_user iu on iu.policy_id = ip.id
where iu.insure_status=1
GROUP BY ip.id
<if test="page.offset != null and page.totalPage !=null">
limit #{page.offset},#{page.totalPage}
SELECT
ip.id AS id,
ip.policy_no AS policyNo,
ip.create_time as createTime,
ip.scheme_name AS schemeName,
qy.`name` as `name`,
count( iu.id ) AS totalUser,
ip.policy_date_start as policyDateStart,
ip.policy_date_end as policyDateEnd,
ip.total_premium AS totalPremium,
ip.update_time AS updateTime,
ip.`status` as `status`
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
<where>
iu.insure_status = 1
<if test="policy.status!=null and policy.status!=''">
and ip.status = #{policy.status}
</if>
<if test="policy.orgCode!=null and policy.orgCode!=''">
and ip.org_code = #{policy.orgCode}
</if>
<if test="policy.benefitBasicPlan!=null and policy.benefitBasicPlan!=''">
and iu.benefit_basic_plan = #{policy.benefitBasicPlan}
</if>
<if test="policy.policyDateStart!=null and policy.policyDateStart!=''">
and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart}
</if>
</where>
GROUP BY
ip.id
<if test="policy.page.offset != null and policy.page.totalPage !=null">
limit #{policy.page.offset},#{policy.page.totalPage}
</if>
</select>
<select id="totalPolicy" resultType="java.lang.Integer">
select count(ip.id)
from insure_policy ip
<where>
<if test="policy.status!=null and policy.status!=''">
and ip.status = #{policy.status}
</if>
<if test="policy.orgCode!=null and policy.orgCode!=''">
and ip.org_code = #{policy.orgCode}
</if>
<if test="policy.policyDateStart!=null and policy.policyDateStart!=''">
and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart}
</if>
</where>
</select>
<select id="getPolicyDetail" resultType="cn.timer.api.dto.insure.PolicyDto">
......@@ -268,4 +305,22 @@
LIMIT 1
</select>
<select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT
ip.id AS id,
ip.scheme_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
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
WHERE
iu.insure_status = 1
GROUP BY
ip.type
</select>
</mapper>
......@@ -29,6 +29,7 @@
<result property="insureStatus" column="insure_status"/>
<result property="policyId" column="policy_id"/>
<result property="replaceTransId" column="replace_trans_id"/>
<result property="applyType" column="apply_type"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureUser">
......@@ -311,4 +312,5 @@
#{id}
</foreach>
</select>
</mapper>
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