Commit 60787f3e by 翁国栋

运营后台--

保险列表
parent 8c5c01e1
......@@ -3,6 +3,7 @@ package cn.timer.api.bean.insure;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description TODO
......@@ -21,4 +22,6 @@ public class CallBack implements Serializable {
private String serial_no;
private String policy_file;
private String total_expenditure;
private String endorsement_file;
private OrderImportInfo order_import_info;
}
......@@ -142,7 +142,13 @@ public class InsureUser extends Model<InsureUser> {
@ApiModelProperty(value = "失效日期")
private Date policyDateEnd;
@Transient
private String[] userIds;
@ApiModelProperty(value = "投保状态:1成功 2失败 3待更新")
private Integer insureStatus;
@ApiModelProperty(value = "保单id")
private Integer policyId;
@ApiModelProperty(value = "替换流水号,使用trans_id,RP_开头")
private String replaceTransId;
}
......@@ -36,7 +36,8 @@ public class WebSecurityConfig implements WebMvcConfigurer {
registry.addInterceptor(getSessionInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/callback/**")
.excludePathPatterns("/callBack/policy/**")
.excludePathPatterns("/callBack/policy/CallBack")
.excludePathPatterns("/callBack/policy/insuredCallBack")
.excludePathPatterns("/superLogin/**")
.excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*")
......
package cn.timer.api.controller.insure;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.insure.CallBack;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.http.HttpRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Maps;
import com.google.gson.JsonObject;
import com.mysql.cj.util.StringUtils;
import com.sun.xml.internal.bind.v2.TODO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.security.auth.callback.Callback;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @Description TODO
......@@ -22,12 +43,72 @@ import javax.security.auth.callback.Callback;
@RequestMapping(value = "/callBack/policy", produces = {"application/json"})
public class CallBackContorll {
private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class);
/*保全测试用*/
private static String appidq = "1000115041006006938";
/*保全测试用*/
private static String secretq = "6ba1bf4aa0bd14368c95ff0b9934a17b";
@PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调")
@ApiOperationSupport(order = 2)
private Integer callBack(@RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp, @RequestBody CallBack callBack){
private String insuredCallBack(@RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp, @RequestBody CallBack callBack){
log.info(String.valueOf(callBack));
return 1;
return "1";
}
@PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "Post", notes = "投保申请回调")
@ApiOperationSupport(order = 2)
private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap();
map.put("status","error");
if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){
return map;
}
if(!pid.equals(appidq)){
return map;
}
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1;)
{
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
if(!value.equals(sign)){
return map;
}
CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getStatus().equals("1")) {
log.info("callBack" + JSONObject.toJSONString(callBack));
List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()));
list.forEach(i -> {
i.setInsureStatus(1);
i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid()));
if(oldlist!=null||oldlist.size()>0) {
oldlist.forEach(i -> {
i.setInsureStatus(4);
i.updateById();
YgglMainEmp.builder().isInsure(3).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
}
InsurePolicy insurePolicy= InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo,list.get(0).getPolicyNo()));
if(oldlist==null||oldlist.size()==0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
}
insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById();
}else{
//TODO 写入日志
}
Map trueMap = Maps.newHashMap();
trueMap.put("status","1");
return trueMap;
}
}
......@@ -34,7 +34,7 @@ public class SuperLoginController {
@Autowired
private HttpSession session;
@PostMapping(value = "/adminLogin")
@ApiOperation(value = "运营后台登录", httpMethod = "POST", notes = "接口发布说明")
@ApiOperation(value = "运营后台登录", httpMethod = "Post", notes = "接口发布说明")
public Result<Object> adminLogin(@RequestBody EntRegisterDto entRegisterDto, HttpServletRequest request){
String ip = UserIp.getIpAddr(request);
AdminAccount adminAccount = AdminAccount.builder().build().selectOne(new QueryWrapper<AdminAccount>().lambda()
......@@ -49,7 +49,7 @@ public class SuperLoginController {
return ResultUtil.data(adminAccount);
};
@PostMapping(value = "/adminOutLogin")
@ApiOperation(value = "运营后台退出", httpMethod = "POST", notes = "接口发布说明")
@ApiOperation(value = "运营后台退出", httpMethod = "Post", notes = "接口发布说明")
public Result<String> adminOutLogin(HttpServletRequest request){
session= request.getSession();
session.removeAttribute("ai");
......
......@@ -2,7 +2,9 @@ package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -17,7 +19,8 @@ import java.util.List;
*/
@Repository
public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
public List<PolicyDto> policyList();
public List<PolicyDto> policyList(@Param("page") Page page);
PolicyDto getPolicyDetail(@Param("id")Integer id);
Integer totalPolicy();
}
package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -16,6 +19,8 @@ import java.util.List;
*/
@Repository
public interface InsureUserMapper extends BaseMapper<InsureUser> {
public List<PolicyDto> selectPolicyList(String id);
List<PolicyDto> selectPolicyList(@Param("page") Page page,@Param("id") String id);
Integer totalUser(@Param("id")String id);
List<InsureUser> selectListByIds(@Param("array")String[] ids);
}
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;
......@@ -28,5 +29,7 @@ public class InsureDto {
private String benefitBasicPlan;/*方案名称*/
private String benefitOccupationCategory;
private String tricycleFrameNumber;
private Integer type;/*类型 1是新增 3是替换*/
private String[] oldIds;
// private String
}
package cn.timer.api.dto.insure;
import cn.timer.api.utils.Page;
import lombok.Data;
import java.util.Date;
......@@ -31,5 +32,9 @@ public class PolicyDto {
private String benefitBasicPlan;
private String price;
private String orgCode;
private Page page;
private String policyFile;
private String benefitOccupationCategory;
private Integer userId;
}
......@@ -259,44 +259,6 @@
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.insure.InsureApplicant">
update insure_applicant
<set>
<if test="applicantEName != null">`applicant_e_name` = #{applicantEName},</if>
<if test="applicantEAddress != null">`applicant_e_address` = #{applicantEAddress},</if>
<if test="applicantEmployeeList != null">`applicant_employee_list` = #{applicantEmployeeList},</if>
<if test="applicantEContacts != null">`applicant_e_contacts` = #{applicantEContacts},</if>
<if test="applicantEPhone != null">`applicant_e_phone` = #{applicantEPhone},</if>
<if test="applicantENoType != null">`applicant_e_no_type` = #{applicantENoType},</if>
<if test="applicantENo != null">`applicant_e_no` = #{applicantENo},</if>
<if test="applicantEMail != null">`applicant_e_mail` = #{applicantEMail},</if>
<if test="applicantProvinceCity != null">`applicant_province_city` = #{applicantProvinceCity},</if>
<if test="applicantInvoiceReceivingAddress != null">`applicant_invoice_receiving_address` =
#{applicantInvoiceReceivingAddress},
</if>
<if test="applicantInvoiceBillingPhone != null">`applicant_invoice_billing_phone` =
#{applicantInvoiceBillingPhone},
</if>
<if test="applicantBusinessBankName != null">`applicant_business_bank_name` =
#{applicantBusinessBankName},
</if>
<if test="policyNo != null">`policy_no` = #{policyNo},</if>
<if test="applicantType != null">`applicant_type` = #{applicantType},</if>
<if test="transId != null">`trans_id` = #{transId},</if>
<if test="currency != null">`currency` = #{currency},</if>
<if test="applicantInvoicedAmount != null">`applicant_invoiced_amount` = #{applicantInvoicedAmount}</if>
<if test="applicantCorporateBankAccount != null">`applicant_corporate_bank_account` = #{applicantCorporateBankAccount}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from insure_applicant
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from insure_applicant where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
......
......@@ -224,36 +224,6 @@
</insert>
<update id="update" parameterType="cn.timer.api.bean.insure.InsurePolicy">
update insure_policy
<set>
<if test="schemeName != null">`scheme_name` = #{schemeName},</if>
<if test="policyDateStart != null">`policy_date_start` = #{policyDateStart},</if>
<if test="policyDateEnd != null">`policy_date_end` = #{policyDateEnd},</if>
<if test="productCodeId != null">`product_code_id` = #{productCodeId},</if>
<if test="planCodeId != null">`plan_code_id` = #{planCodeId},</if>
<if test="partnerPid != null">`partner_pid` = #{partnerPid},</if>
<if test="policyNo != null">`policy_no` = #{policyNo},</if>
<if test="type != null">`type` = #{type},</if>
<if test="currency != null">`currency` = #{currency},</if>
<if test="totalPremium != null">`total_premium` = #{totalPremium},</if>
<if test="status != null">`status` = #{status},</if>
<if test="policyFile != null">`policy_file` = #{policyFile},</if>
<if test="kitUrl != null">`kit_url` = #{kitUrl},</if>
<if test="insureApplicantId != null">`insure_applicant_id` = #{insureApplicantId},</if>
<if test="orgCode != null">`org_code` = #{orgCode},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from insure_policy
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from insure_policy where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
......@@ -264,12 +234,20 @@
<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.update_time AS updateTime,ip.policy_file AS policyFile
from insure_policy ip
LEFT JOIN insure_user iu on iu.policy_no = ip.policy_no
GROUP BY ip.policy_no
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}
</if>
</select>
<select id="totalPolicy" resultType="java.lang.Integer">
select count(ip.id)
from insure_policy ip
</select>
<select id="getPolicyDetail" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT
......@@ -280,10 +258,11 @@
ip.policy_no as policyNo,
ip.org_code as orgCode,
iu.insured_name as insuredName,
iu.benefit_basic_plan as benefitBasicPlan
iu.benefit_basic_plan as benefitBasicPlan,
iu.benefit_occupation_category as benefitOccupationCategory
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_no = ip.policy_no
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
WHERE
ip.id = #{id}
LIMIT 1
......
......@@ -26,6 +26,9 @@
<result property="applicantEmployeeList" column="applicant_employee_list"/>
<result property="policyDateStart" column="policy_date_start"/>
<result property="policyDateEnd" column="policy_date_end"/>
<result property="insureStatus" column="insure_status"/>
<result property="policyId" column="policy_id"/>
<result property="replaceTransId" column="replace_trans_id"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureUser">
......@@ -66,6 +69,8 @@
<if test="applicantEmployeeList != null and applicantEmployeeList != ''">AND `applicant_employee_list` =
#{applicantEmployeeList}
</if>
<if test="insureStatus != null and insureStatus != ''">AND `insure_status` = #{insureStatus}</if>
<if test="policyId != null and policyId != ''">AND `policy_id` = #{policyId}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
......@@ -112,6 +117,8 @@
<if test="applicantEmployeeList != null and applicantEmployeeList != ''">AND `applicant_employee_list` =
#{applicantEmployeeList}
</if>
<if test="insureStatus != null and insureStatus != ''">AND `insure_status` = #{insureStatus}</if>
<if test="policyId != null and policyId != ''">AND `policy_id` = #{policyId}</if>
</where>
</select>
......@@ -134,7 +141,9 @@
`type`,
`org_code`,
`user_id`,
`applicant_employee_list`)
`applicant_employee_list`,
`insure_status`,
`policy_id`)
values (#{transId},
#{price},
#{insuredName},
......@@ -152,7 +161,8 @@
#{type},
#{orgCode},
#{userId},
#{applicantEmployeeList})
#{applicantEmployeeList},
#{policyId})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsureUser" useGeneratedKeys="true"
......@@ -177,6 +187,8 @@
<if test="orgCode != null">,`org_code`</if>
<if test="userId != null">,`user_id`</if>
<if test="applicantEmployeeList != null">,`applicant_employee_list`</if>
<if test="insureStatus != null">,`insure_status`</if>
<if test="policyId != null">,`policy_id`</if>
)
values
(
......@@ -198,6 +210,8 @@
<if test="orgCode != null">,#{orgCode}</if>
<if test="userId != null">,#{userId}</if>
<if test="applicantEmployeeList != null">,#{applicantEmployeeList}</if>
<if test="insureStatus != null">,#{insureStatus}</if>
<if test="policyId != null">,#{policyId}</if>
)
</insert>
......@@ -222,7 +236,9 @@
`type`,
`org_code`,
`user_id`,
`applicant_employee_list`
`applicant_employee_list`,
`insure_status`,
`policy_id`
)
values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -244,45 +260,14 @@
#{item.type},
#{item.orgCode},
#{item.userId},
#{item.applicantEmployeeList}
#{item.applicantEmployeeList},
#{item.insureStatus},
#{item.policyId}
)
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.insure.InsureUser">
update insure_user
<set>
<if test="transId != null">`trans_id` = #{transId},</if>
<if test="price != null">`price` = #{price},</if>
<if test="insuredName != null">`insured_name` = #{insuredName},</if>
<if test="batchNo != null">`batch_no` = #{batchNo},</if>
<if test="premium != null">`premium` = #{premium},</if>
<if test="insuredMobile != null">`insured_mobile` = #{insuredMobile},</if>
<if test="insuredNo != null">`insured_no` = #{insuredNo},</if>
<if test="insuredEContact != null">`insured_e_contact` = #{insuredEContact},</if>
<if test="benefitBasicPlan != null">`benefit_basic_plan` = #{benefitBasicPlan},</if>
<if test="benefitOccupationCategory != null">`benefit_occupation_category` = #{benefitOccupationCategory},
</if>
<if test="benefitElEmployeeNumberT != null">`benefit_EL_employee_number_t` = #{benefitElEmployeeNumberT},
</if>
<if test="tricycleFrameNumber != null">`Tricycle_frame_number` = #{tricycleFrameNumber},</if>
<if test="policyNo != null">`policy_no` = #{policyNo},</if>
<if test="status != null">`status` = #{status},</if>
<if test="type != null">`type` = #{type},</if>
<if test="orgCode != null">`org_code` = #{orgCode},</if>
<if test="userId != null">`user_id` = #{userId},</if>
<if test="applicantEmployeeList != null">`applicant_employee_list` = #{applicantEmployeeList}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from insure_user
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from insure_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
......@@ -292,13 +277,38 @@
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto">
select iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,ip.scheme_name,iu.policy_date_start,
iu.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price from insure_user iu
iu.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price,
iu.user_id as userId
from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.policy_no=iu.policy_no
where yme.org_code = 3
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
where yme.org_code = 3 AND iu.insure_status=1
<if test="id !=null and id !=''">
and ip.id=#{id}
</if>
<if test="page.offset != null and page.totalPage !=null">
limit #{page.offset},#{page.totalPage}
</if>
</select>
<select id="totalUser" resultType="java.lang.Integer">
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
<if test="id !=null and id !=''">
and ip.id=#{id}
</if>
</select>
<!--根据id数组查询员工-->
<select id="selectListByIds" resultType="cn.timer.api.bean.insure.InsureUser">
SELECT
*
FROM insure_user
WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>
......@@ -250,7 +250,7 @@
AND
a.job_status in (0,1,2)
<if test="isInsure!=null and isInsure != ''">
AND a.is_insure=#{isInsure}
AND a.is_insure in (1,2)
</if>
ORDER BY
emp_num DESC
......
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