Commit b1a5b3fe by 翁国栋

8小时后台--

投保需求变更,需要在被保险人信息组增加省市区
parent 2b1e90a5
package cn.timer.api.bean.insure;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 省市区
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-06-27 15:09:26
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "insure_province")
@ApiModel("省市区")
public class InsureProvince extends Model<InsureProvince> {
private static final long serialVersionUID = 4347130709431957277L;
@Id
private Integer id;
/**
* 名字
*/
private String name;
/**
* 值
*/
private Integer pid;
/**
* 值
*/
private Integer value;
}
package cn.timer.api.controller.insure; package cn.timer.api.controller.insure;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Random; import java.util.Random;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.timer.api.bean.insure.InsureApplicant; import cn.timer.api.bean.insure.InsureApplicant;
import cn.timer.api.bean.insure.InsureProvince;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
...@@ -93,7 +98,6 @@ public class InsureApplicantController { ...@@ -93,7 +98,6 @@ public class InsureApplicantController {
insureApplicant.setApplicantType("2"); insureApplicant.setApplicantType("2");
insureApplicant.setApplicantENoType("3646"); insureApplicant.setApplicantENoType("3646");
insureApplicant.setApplicantENo(qyzxEntInfoM.getCreditCode()); insureApplicant.setApplicantENo(qyzxEntInfoM.getCreditCode());
insureApplicant.setApplicantProvinceCity("21721");
return insureApplicant; return insureApplicant;
} }
...@@ -115,5 +119,27 @@ public class InsureApplicantController { ...@@ -115,5 +119,27 @@ public class InsureApplicantController {
throw new CustomException("获取投保人异常"); throw new CustomException("获取投保人异常");
} }
} }
@GetMapping("/getProvince")
@ApiOperation(value = "获取投保省市区", httpMethod = "GET", notes = "获取投保人")
@Transactional(rollbackFor = Exception.class)
public Result<Object> getRegion(){
List<InsureProvince> nodeList= InsureProvince.builder().build().selectList(new QueryWrapper<InsureProvince>().lambda().isNotNull(InsureProvince::getId));
// 配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("id");
treeNodeConfig.setParentIdKey("parentId");
// 最大递归深度
treeNodeConfig.setDeep(4);
List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig, (treeNode, tree) -> {
tree.setId(treeNode.getId().toString());
tree.setParentId(treeNode.getPid().toString());
tree.setName(treeNode.getName());
tree.putExtra("value", treeNode.getValue());
});
return ResultUtil.data(treeNodes);
}
} }
...@@ -219,7 +219,7 @@ public class InsureContorll { ...@@ -219,7 +219,7 @@ public class InsureContorll {
companyApplicantMap.put("applicant_e_no_type", insureApplicant.getApplicantENoType());/*企业证件类型*/ companyApplicantMap.put("applicant_e_no_type", insureApplicant.getApplicantENoType());/*企业证件类型*/
companyApplicantMap.put("applicant_e_no", insureApplicant.getApplicantENo());/*企业证件号码*/ companyApplicantMap.put("applicant_e_no", insureApplicant.getApplicantENo());/*企业证件号码*/
companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/ companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/
companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/ companyApplicantMap.put("applicant_province_city", insureApplicant.getApplicantProvinceCity());/*省市区*/
/*非必要字段*/ /*非必要字段*/
companyApplicantMap.put("applicant_invoice_receiving_address", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceReceivingAddress()) ? "" : insureApplicant.getApplicantInvoiceReceivingAddress()); companyApplicantMap.put("applicant_invoice_receiving_address", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceReceivingAddress()) ? "" : insureApplicant.getApplicantInvoiceReceivingAddress());
...@@ -275,6 +275,7 @@ public class InsureContorll { ...@@ -275,6 +275,7 @@ public class InsureContorll {
insured.put("benefit_basic_plan", p.getBenefitBasicPlan()); insured.put("benefit_basic_plan", p.getBenefitBasicPlan());
insured.put("benefit_occupation_category", p.getBenefitOccupationCategory()); insured.put("benefit_occupation_category", p.getBenefitOccupationCategory());
insured.put("benefit_EL_employee_number_t", p.getUserIds().length); insured.put("benefit_EL_employee_number_t", p.getUserIds().length);
insured.put("insured_province_city_thr",insureApplicant.getApplicantProvinceCity());/*省市区*/
insuredArray.add(insured); insuredArray.add(insured);
}); });
quotations.put("insured", insuredArray); quotations.put("insured", insuredArray);
...@@ -1684,4 +1685,105 @@ public class InsureContorll { ...@@ -1684,4 +1685,105 @@ public class InsureContorll {
} }
return 0; return 0;
} }
// @PostMapping(value = "/replaceUserPolicy")
// @ApiOperation(value = "18.导入替换人员", httpMethod = "POST", notes = "导入用户")
// @Transactional(rollbackFor = Exception.class)
// public Result<Object> replaceUserPolicy(@RequestParam("file") MultipartFile file, @RequestParam("policyId") Integer policyId){
// InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
// try {
// XSSFWorkbook xw = new XSSFWorkbook(file.getInputStream());
// XSSFSheet sheetAt = xw.getSheetAt(0);
// //默认第一行为标题行,i = 0
// XSSFRow titleRow = sheetAt.getRow(0);
// YgglMainEmp y;
// InsureUser ru;
// /*原被保人*/
// List<InsureUser> originalList;
// List<InsureUser> replaceList;
// // 循环获取每一行数据
// for (int i = 1; i < sheetAt.getPhysicalNumberOfRows(); i++) {
// XSSFRow row = sheetAt.getRow(i);
// y = YgglMainEmp.builder().build();
// ru=InsureUser.builder().build();
// // 读取每一格内容
// for (int index = 0; index < row.getPhysicalNumberOfCells(); index++) {
// XSSFCell titleCell = titleRow.getCell(index);
// XSSFCell cell = row.getCell(index);
// if (cell == null) {
// continue;
// } else {
// cell.setCellType(CellType.STRING);
// }
// if (cell.getStringCellValue().equals("")) {
// continue;
// }
// switch (ExcelUtils.getString(titleCell)) {
// case "ID":/*不重要*/
// break;
// case "name":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列被保人姓名不能为空");
// }
// ru.setInsuredName(ExcelUtils.getString(cell).trim());
// break;
// case "ID_type":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列证件类型不能为空");
// }
// break;
// case "ID_number":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列证件号码不能为空");
// }
// ru.setInsuredNo(ExcelUtils.getString(cell));
// break;
// case "Update_date":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列批改生效日不能为空");
// }
// break;
// case "replace_name":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列新保人员姓名不能为空");
// }
// break;
// case "replace_ID_type":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列新保人员证件类型不能为空");
// }
// break;
// case "replace_ID_number":
// if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
// return ResultUtil.error("第" + i + "行第" + index + "列新保人员证件号不能为空");
// }
// break;
// case "Date_of_birth":
// break;
// case "insured_type":
// break;
// case "insured_relationship":
// break;
// case "cert_type_related_insured":
// break;
// case "insured_relationship_id":
// break;
// case "Branch":
// break;
// case "Tricycle_frame_number":
// break;
// case "insured_number":
// break;
// case "benefit_occupation_category":
// break;
//
// }
// }
// }
// }catch (Exception e){
// throw new CustomException("导入异常");
// }
// return ResultUtil.success();
// }
} }
package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureProvince;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* 省市区
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-06-27 15:09:26
*/
@Repository
public interface InsureProvinceMapper extends BaseMapper<InsureProvince> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.insure.InsureProvinceMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.insure.InsureProvince" id="insureProvinceMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="pid" column="pid"/>
<result property="value" column="value"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureProvince">
select *
from insure_province
where id = #{value}
</select>
<select id="queryList" resultType="cn.timer.api.bean.insure.InsureProvince">
select * from insure_province
<where>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="pid != null and pid != ''">AND `pid` = #{pid}</if>
<if test="value != null and value != ''">AND `value` = #{value}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from insure_province
<where>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="pid != null and pid != ''">AND `pid` = #{pid}</if>
<if test="value != null and value != ''">AND `value` = #{value}</if>
</where>
</select>
<insert id="save" parameterType="cn.timer.api.bean.insure.InsureProvince" useGeneratedKeys="true" keyProperty="id">
insert into insure_province
(`name`,
`pid`,
`value`)
values (#{name},
#{pid},
#{value})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsureProvince" useGeneratedKeys="true"
keyProperty="id">
insert into insure_province
(
<if test="name != null">,`name`</if>
<if test="pid != null">,`pid`</if>
<if test="value != null">,`value`</if>
)
values
(
<if test="name != null">,#{name}</if>
<if test="pid != null">,#{pid}</if>
<if test="value != null">,#{value}</if>
)
</insert>
<insert id="saveList" parameterType="cn.timer.api.bean.insure.InsureProvince" useGeneratedKeys="true"
keyProperty="id">
insert into insure_province
(
`name`,
`pid`,
`value`
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.name},
#{item.pid},
#{item.value}
)
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.insure.InsureProvince">
update insure_province
<set>
<if test="name != null">`name` = #{name},</if>
<if test="pid != null">`pid` = #{pid},</if>
<if test="value != null">`value` = #{value}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from insure_province
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from insure_province where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</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