InsureApplicantController.java 2.43 KB
Newer Older
翁国栋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
package cn.timer.api.controller.insure;

import java.io.IOException;
import java.util.Map;
import java.util.Optional;
import java.util.Random;

import cn.timer.api.bean.insure.InsureApplicant;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.insure.InsureApplicantMapper;
import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.utils.HttpUtils;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.alibaba.druid.util.Base64;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;


/**
 * 投保人
 *
 * @author wgd
 * @email 862422848@qq.com
 * @date 2022-03-07 17:02:46
 */
翁国栋 committed
42
@Api(tags = "8.0保险列表")
翁国栋 committed
43 44 45 46 47 48 49
@RestController
@Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"})
public class InsureApplicantController {

    @PostMapping("/insureApplicationSetting")
    @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
翁国栋 committed
50 51
    private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
        InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById();if(insureApplicant==null){
翁国栋 committed
52 53 54
            params.insert();
            return ResultUtil.data(params);
        }
翁国栋 committed
55 56 57
        params.setId(insureApplicant.getId());
        params.updateById();
        return ResultUtil.data(params);
翁国栋 committed
58 59 60
    }


翁国栋 committed
61 62 63 64
    @GetMapping("/getApplicant")
    @ApiOperation(value = "获取投保人", httpMethod = "Get", notes = "获取投保人")
    private Result<Object> getApplicant() {
        InsureApplicant insureApplicant = InsureApplicant.builder().id(1).build().selectById();
翁国栋 committed
65 66 67 68 69 70 71
        if(insureApplicant==null){
            return ResultUtil.data(null);
        }
        return ResultUtil.data(insureApplicant);
    }

}