Commit 4594c10e by 翁国栋 Committed by 284718418@qq.com

8小时后台,投保人改为当前企业

parent a67b2894
...@@ -6,6 +6,7 @@ import java.util.Optional; ...@@ -6,6 +6,7 @@ import java.util.Optional;
import java.util.Random; import java.util.Random;
import cn.timer.api.bean.insure.InsureApplicant; import cn.timer.api.bean.insure.InsureApplicant;
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;
import cn.timer.api.dao.insure.InsureApplicantMapper; import cn.timer.api.dao.insure.InsureApplicantMapper;
...@@ -48,22 +49,49 @@ public class InsureApplicantController { ...@@ -48,22 +49,49 @@ public class InsureApplicantController {
@PostMapping("/insureApplicationSetting") @PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) { private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById();if(insureApplicant==null){ InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,params.getOrgCode()));
params.insert();
return ResultUtil.data(params);
}
params.setId(insureApplicant.getId()); params.setId(insureApplicant.getId());
params.updateById(); params.updateById();
return ResultUtil.data(params); return ResultUtil.data(params);
} }
@GetMapping("/getApplicantAdmin")
@ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,orgCode));
if(insureApplicant==null){
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(orgCode).build().selectById();
insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(orgCode);
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
}
private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) {
InsureApplicant insureApplicant;
insureApplicant=new InsureApplicant();
insureApplicant.setApplicantEName(qyzxEntInfoM.getName());
insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress());
insureApplicant.setApplicantEContacts(qyzxEntInfoM.getOperName());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantType("2");
insureApplicant.setApplicantENoType("3646");
insureApplicant.setApplicantENo(qyzxEntInfoM.getCreditCode());
insureApplicant.setApplicantProvinceCity("21721");
return insureApplicant;
}
@GetMapping("/getApplicant") @GetMapping("/getApplicant")
@ApiOperation(value = "获取投保人", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant() { private Result<Object> getApplicant(@CurrentUser UserBean userBean) {
InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById(); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,userBean.getOrgCode()));
if(insureApplicant==null){ if(insureApplicant==null){
return ResultUtil.data(null); QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById();
insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(userBean.getOrgCode());
insureApplicant.insert();
} }
return ResultUtil.data(insureApplicant); return ResultUtil.data(insureApplicant);
} }
......
...@@ -64,7 +64,7 @@ public class InsureUserController{ ...@@ -64,7 +64,7 @@ public class InsureUserController{
@ApiOperation(value = "3.保单列表--8小时端", httpMethod = "POST", notes = "保单列表") @ApiOperation(value = "3.保单列表--8小时端", httpMethod = "POST", notes = "保单列表")
public Result<Object> userPolicyList(@CurrentUser UserBean userBean, @RequestBody PolicyDto policyDto) { public Result<Object> userPolicyList(@CurrentUser UserBean userBean, @RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode,userBean.getOrgCode()).eq(InsurePolicy::getStatus,1)); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getId,policyDto.getId()));
if(insurePolicy==null){ if(insurePolicy==null){
return ResultUtil.error("保单号不存在"); return ResultUtil.error("保单号不存在");
} }
......
...@@ -28,5 +28,6 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> { ...@@ -28,5 +28,6 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
List<InsureUserDto> selectPlansListByorgCode(@Param("orgCode")Integer id); List<InsureUserDto> selectPlansListByorgCode(@Param("orgCode")Integer id);
List<InsurePolicy> selectPolicyListByStatus(@Param("date") Date date); List<InsurePolicy> selectPolicyListByStatus(@Param("date") Date date);
Integer selectPlansTotalByorgCode(@Param("orgCode")Integer id);
} }
...@@ -243,7 +243,8 @@ ...@@ -243,7 +243,8 @@
ip.policy_date_end as policyDateEnd, ip.policy_date_end as policyDateEnd,
sum(iu.price) AS totalPremium, sum(iu.price) AS totalPremium,
ip.update_time AS updateTime, ip.update_time AS updateTime,
ip.`status` as `status` ip.`status` as `status`,
ip.org_code as orgCode
FROM FROM
insure_policy ip insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id LEFT JOIN insure_user iu ON iu.policy_id = ip.id
...@@ -347,6 +348,14 @@ ...@@ -347,6 +348,14 @@
iu.benefit_basic_plan, iu.benefit_basic_plan,
iu.benefit_occupation_category iu.benefit_occupation_category
</select> </select>
<select id="selectPlansTotalByorgCode" resultType="java.lang.Integer">
SELECT
count(ip.id)
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
WHERE ip.org_code=#{orgCode}
</select>
<select id="selectPolicyListByStatus" resultType="cn.timer.api.bean.insure.InsurePolicy"> <select id="selectPolicyListByStatus" resultType="cn.timer.api.bean.insure.InsurePolicy">
select * from insure_policy select * from insure_policy
......
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