Commit 0464b571 by 翁国栋 Committed by 284718418@qq.com

运营后台--

增加可投多个方案
parent f308d477
package cn.timer.api.controller.insure; package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.CallBack; import cn.timer.api.bean.insure.CallBack;
import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
...@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -36,9 +38,13 @@ import java.util.Map; ...@@ -36,9 +38,13 @@ import java.util.Map;
public class CallBackContorll { public class CallBackContorll {
private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class); private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class);
/*保全测试用*/ /*保全测试用*/
private static String appidq = "1000115041006006938"; @Value("${insure.appidq}")
/*保全测试用*/ private String appidq;
private static String secretq = "6ba1bf4aa0bd14368c95ff0b9934a17b"; @Value("${insure.secretq}")
private String secretq;
@Value("${BASE_API_URL}")
private String base_api_url;
@PostMapping(value = "/insuredCallBack") @PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调") @ApiOperation(value = "6.投保申请回调", httpMethod = "Post", notes = "投保申请回调")
...@@ -76,6 +82,8 @@ public class CallBackContorll { ...@@ -76,6 +82,8 @@ public class CallBackContorll {
private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status","error"); map.put("status","error");
int type = 7;
Integer policyId = null;
if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){ if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){
return map; return map;
} }
...@@ -94,25 +102,31 @@ public class CallBackContorll { ...@@ -94,25 +102,31 @@ public class CallBackContorll {
if(!value.equals(sign)){ if(!value.equals(sign)){
return map; return map;
} }
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid",pid);
paramsMap.put("timestamp",timestamp);
paramsMap.put("sign",sign);
CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class); CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getStatus().equals("1")) { if(callBack.getStatus().equals("1")) {
log.info("callBack" + JSONObject.toJSONString(callBack)); 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<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus,3));
list.forEach(i -> { list.forEach(i -> {
i.setInsureStatus(1); i.setInsureStatus(1);
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); 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())); 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) { if(oldlist!=null&&oldlist.size()>0) {
oldlist.forEach(i -> { oldlist.forEach(i -> {
i.setInsureStatus(4); i.setInsureStatus(4);
i.setStatus("2"); i.setStatus("2");
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(3).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
type=8;
} }
InsurePolicy insurePolicy= InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo,list.get(0).getPolicyNo())); InsurePolicy insurePolicy= InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo,list.get(0).getPolicyNo()));
policyId=insurePolicy.getId();
if(oldlist==null||oldlist.size()==0) { if(oldlist==null||oldlist.size()==0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money()))); insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
} }
...@@ -121,9 +135,13 @@ public class CallBackContorll { ...@@ -121,9 +135,13 @@ public class CallBackContorll {
insurePolicy.updateById(); insurePolicy.updateById();
}else{ }else{
//TODO 写入日志 //TODO 写入日志
} }
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
trueMap.put("status","1"); trueMap.put("status","1");
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(type)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url+"/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(callBack.getOrder_import_info().getErr_msg()).policyId(policyId).build().insert();
return trueMap; return trueMap;
} }
} }
...@@ -3,12 +3,15 @@ package cn.timer.api.controller.insure; ...@@ -3,12 +3,15 @@ package cn.timer.api.controller.insure;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
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;
import cn.timer.api.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page; import cn.timer.api.utils.Page;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -69,5 +72,23 @@ public class InsureUserController{ ...@@ -69,5 +72,23 @@ public class InsureUserController{
map.put("total", insureUserMapper.totalUser(policyDto)); map.put("total", insureUserMapper.totalUser(policyDto));
return ResultUtil.data(map); return ResultUtil.data(map);
} }
@PostMapping(value = "/getPolicyUserList")
@ApiOperation(value = "获取选中用户方案信息", httpMethod = "Post", notes = "获取选中用户方案信息")
public Result<Object> getPolicyUserList(@RequestBody InsureDto dto){
List<InsureUserDto> userList= insureUserMapper.selectPlansListByIds(dto.getOldIds());
if(userList.size()<=0){
return ResultUtil.error("用户方案错误");
}
return ResultUtil.data(userList);
}
@GetMapping(value = "/getPolicyPlansList")
@ApiOperation(value = "获取方案列表", httpMethod = "Get", notes = "获取选中用户方案信息")
public Result<Object> getPolicyUserList(@RequestParam("policyId") String policyId){
List<InsureUserDto> userList= insureUserMapper.selectPlansListById(policyId);
if(userList.size()<=0){
return ResultUtil.error("用户方案错误");
}
return ResultUtil.data(userList);
}
} }
...@@ -9,26 +9,30 @@ import lombok.Data; ...@@ -9,26 +9,30 @@ import lombok.Data;
* @Date 2022/3/24 17:20 * @Date 2022/3/24 17:20
*/ */
public enum InsuranceEnum { public enum InsuranceEnum {
A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类"), A_30(12,"30万意外/3万医疗/扩展24小时(A类)","A类","36968","63119"),
A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类"), A_50(15,"50万意外/5万医疗/扩展24小时(A类)","A类","36969","63119"),
A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类"), A_80(18,"80万意外/10万医疗/扩展24小时(A类)","A类","36970","63119"),
A_80_20(25,"80万意外/20万医疗/扩展24小时(A类)","A类"), A_80_20(25,"80万意外/20万医疗/扩展24小时(A类)","A类","36971","63119"),
A_100(28,"100万意外/10万医疗/扩展24小时(A类)","A类"), A_100(28,"100万意外/10万医疗/扩展24小时(A类)","A类","36972","63119"),
B_30(18,"30万意外/3万医疗/扩展24小时(B类)","B类"), B_30(18,"30万意外/3万医疗/扩展24小时(B类)","B类","36968","63120"),
B_50(20,"50万意外/5万医疗/扩展24小时(B类)","B类"), B_50(20,"50万意外/5万医疗/扩展24小时(B类)","B类","36969","63120"),
B_80(35,"80万意外/10万医疗/扩展24小时(B类)","B类"), B_80(35,"80万意外/10万医疗/扩展24小时(B类)","B类","36970","63120"),
B_80_20(38,"80万意外/20万医疗/扩展24小时(B类)","B类"), B_80_20(38,"80万意外/20万医疗/扩展24小时(B类)","B类","36971","63120"),
B_100(40,"100万意外/10万医疗/扩展24小时(B类)","B类"), B_100(40,"100万意外/10万医疗/扩展24小时(B类)","B类","36972","63120"),
C_50(60,"50万意外/5万医疗/扩展24小时(C类)","C类"), C_50(60,"50万意外/5万医疗/扩展24小时(C类)","C类","36969","63121"),
C_80(75,"80万意外/10万医疗/扩展24小时(C类)","C类"); C_80(75,"80万意外/10万医疗/扩展24小时(C类)","C类","36970","63121");
private Integer price; private Integer price;
private String name; private String name;
private String type; private String type;
private String plan;
private String category;
InsuranceEnum(Integer price, String name,String type) { InsuranceEnum(Integer price, String name,String type,String plan,String category) {
this.price = price; this.price = price;
this.name = name; this.name = name;
this.type=type; this.type=type;
this.plan=plan;
this.category=category;
} }
public Integer getPrice() { public Integer getPrice() {
...@@ -55,10 +59,27 @@ public enum InsuranceEnum { ...@@ -55,10 +59,27 @@ public enum InsuranceEnum {
this.type = type; this.type = type;
} }
public static InsuranceEnum getEnum(Integer value) { public String getPlan() {
return plan;
}
public void setPlan(String plan) {
this.plan = plan;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public static InsuranceEnum getEnum(String plan,String category) {
for(InsuranceEnum v : values()) for(InsuranceEnum v : values())
if(v.price==value) return v; if(v.getPlan().equals(plan)&&v.getCategory().equals(category)) return v;
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
} }
...@@ -2,6 +2,7 @@ package cn.timer.api.dao.insure; ...@@ -2,6 +2,7 @@ package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PolicyDto; import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.utils.Page; import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -22,5 +23,8 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> { ...@@ -22,5 +23,8 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> {
List<PolicyDto> selectPolicyList(@Param("policyDto") PolicyDto policyDto ); List<PolicyDto> selectPolicyList(@Param("policyDto") PolicyDto policyDto );
Integer totalUser(@Param("policyDto") PolicyDto policyDto); Integer totalUser(@Param("policyDto") PolicyDto policyDto);
List<InsureUser> selectListByIds(@Param("array")String[] ids); List<InsureUser> selectListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListById(@Param("policyId")String id);
} }
...@@ -5,6 +5,8 @@ import lombok.Builder; ...@@ -5,6 +5,8 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
/** /**
* @Description TODO * @Description TODO
...@@ -19,14 +21,17 @@ public class InsureDto { ...@@ -19,14 +21,17 @@ public class InsureDto {
private String id; private String id;
private String orgCode;/*劳动合同*/ private String orgCode;/*劳动合同*/
private String companyName;/*用工单位实际工作单位*/ private String companyName;/*用工单位实际工作单位*/
private String[] userIds;
private String policyDateStart; private String policyDateStart;
private String policyDateEnd; private String policyDateEnd;
private Integer type;/*类型 1是新增 3是替换*/
private String productId;
private List<PlansDto> plans;
private String benefitBasicPlan;/*方案名称*/ private String benefitBasicPlan;/*方案名称*/
private String benefitOccupationCategory; private String benefitOccupationCategory;
private String tricycleFrameNumber; private String tricycleFrameNumber;
private Integer type;/*类型 1是新增 3是替换*/
private String[] oldIds; private String[] oldIds;
private String productId; private String[] userIds;
private Double totalPrice;
// private String // private String
} }
package cn.timer.api.dto.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/7 17:13
*/
@Data
public class InsureUserDto {
private Integer policyId;
private String benefitBasicPlan;
private String benefitOccupationCategory;
private Integer totalUser;
private String[] oldIds;
}
package cn.timer.api.dto.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/6 9:14
*/
@Data
public class PlansDto{
private int index;
private String[] userIds;
private String benefitBasicPlan;/*方案名称*/
private String benefitOccupationCategory;
private String tricycleFrameNumber;
private Integer price;
}
...@@ -37,4 +37,7 @@ public class PolicyDto { ...@@ -37,4 +37,7 @@ public class PolicyDto {
private String benefitOccupationCategory; private String benefitOccupationCategory;
private Integer userId; private Integer userId;
private Integer insureStatus; private Integer insureStatus;
private String planId;
private String categoryId;
} }
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
</delete> </delete>
<select id="selectListById" resultType="cn.timer.api.bean.insure.InsureLog"> <select id="selectListById" resultType="cn.timer.api.bean.insure.InsureLog">
select id,return_msg,`type`,create_time from insure_log select id,return_msg,`type`,create_time,file_url from insure_log
where policy_id = #{policyId} where policy_id = #{policyId}
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
......
...@@ -323,4 +323,5 @@ ...@@ -323,4 +323,5 @@
GROUP BY GROUP BY
ip.id ip.id
</select> </select>
</mapper> </mapper>
...@@ -279,12 +279,14 @@ ...@@ -279,12 +279,14 @@
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto"> <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.insure_status, select iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,ip.scheme_name,iu.policy_date_start,iu.insure_status,
iu.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price, 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 iu.user_id as userId,iu.batch_no as batchNo,iu.benefit_occupation_category as benefitOccupationCategory
from insure_user iu from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id LEFT JOIN insure_policy ip on ip.id=iu.policy_id
<where> <where>
ip.id=#{policyDto.id} ip.id=#{policyDto.id}
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
<if test="policyDto.name !=null and policyDto.name !=''"> <if test="policyDto.name !=null and policyDto.name !=''">
and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%') and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%')
</if> </if>
...@@ -314,6 +316,8 @@ ...@@ -314,6 +316,8 @@
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''"> <if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !=''">
and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart} and iu.policy_date_start <![CDATA[>=]]> #{policyDto.policyDateStart}
</if> </if>
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
</where> </where>
</select> </select>
...@@ -328,4 +332,29 @@ ...@@ -328,4 +332,29 @@
</foreach> </foreach>
</select> </select>
<!--根据id数组查询员工-->
<select id="selectPlansListByIds" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
group by benefit_basic_plan,benefit_occupation_category
</select>
<select id="selectPlansListById" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE policy_id = #{policyId}
group by benefit_basic_plan,benefit_occupation_category
</select>
</mapper> </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