基于feign传参MultipartFile问题解决
293
2022-07-25
目录一,项目简介二,环境介绍三,系统展示四,核心代码展示五,项目总结
一,项目简介
客户的主要功能:个人资料管理,购买的保险信息管理,理赔的申请
事故调查员功能:个人资料管理,事故调查管理,现场勘察管理
管理员功能:个人资料管理,用户管理,理赔审请审核,赔偿金发放管理
二,环境介绍
语言环境:java: jdk1.8
数据库:mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
开发技术:后台springboot+springmvvc+mybatis
前台:layui+jquery+jsp
三,系统展示
用户登陆:
用户注册
个人资料管理
车险管理
理赔记录管理
管理员管理功能:
用户管理
理赔审核
赔偿金发放
事故调查员功能
事故调查
现场勘察管理
四,核心代码展示
package com.controller;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.InitializingBean;
import com.entity.Insurance;
import com.service.InsuranceService;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import com.entity.Result;
import com.utils.ResultUtil;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import com.entity.User;
import java.util.Date;
import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageInfo;
/**
* ZNZ
*/
@Controller
@RequestMapping(value = "/admin/insurance")
public class AdminInsuranceController extends BaseController {
@Autowired
private InsuranceService insuranceService;
@RequestMapping("add")
public String add(HttpServletRequest request, Insurance model) {
request.setAttribute("model", model);
return "/admin/insurance-add";
}
@RequestMapping("edit")
public String edit(HttpServletRequest request, String id) {
Insurance model = insuranceService.getModel(id);
request.setAttribute("model", model);
return "/admin/insurance-add";
}
@RequestMapping("save")
@ResponseBody
public Result save(HttpServletRequest request, Insurance model) {
User user = (User) request.getSession().getAttribute("user");
int i = 0;
if (StringUtils.isBlank(model.getId())) {
model.preInsert();
model.setCreateDate(new Date());
model.setUserId(user.getId());
i = insuranceService.insertModel(model);
} else {
i = insuranceService.updateModel(model);
}
if (i == 0) {
return ResultUtil.error("失败");
} else {
return ResultUtil.success(null);
}
}
//删除批量删除
@RequestMapping("delete")
@ResponseBody
public Result delete(HttpServletRequest request, String id) {
if (StringUtils.isNotBlank(id)) {
String[] split = id.split(",");
for (int i = 0; i < split.length; i++) {
insuranceService.deleteModel(split[i]);
}
return ResultUtil.success();
} else {
return ResultUtil.error("未选中删除项!");
}
}
@RequestMapping("list")
public String list(HttpServletRequest request, Insurance model) {
request.setAttribute("model", model);
return "/admin/insurance-list";
}
//获取列表数据
@RequestMapping("list/data")
@ResponseBody
public Result list(HttpServletRequest request, InsurKCnhRUOance model, @RequestParam(defaultValue = "1") Integer page, Integer limit) {
User user = (User) request.getSession().getAttribute("user");
if (user.getType() == 0){
model.setUserId(user.getId());
}
PageHelper.startPage(page, limit);
List
PageInfo
return ResultUtil.success(list, pageInfo.getTotal());
}
}
package com.controller;
import com.entity.*;
import com.service.InsuranceService;
import com.service.OrdersService;
import com.utils.MapUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.InitializingBean;
import com.service.InvestigationService;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import com.utils.ResultUtil;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Date;
import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageInfo;
@Controller
@RequestMapping(value="/admin/investigation")
public class AdminInvestigationController extends BaseController {
@Autowired
private InvestigationService investigationService;
@Autowired
private OrdersService ordersService;
@Autowired
private InsuranceService insuranceService;
@RequestMapping("add")
public String add(HttpServletRequest request,Investigation model){
request.setAttribute("model",model);
return "/admin/investigation-add";
}
@RequestMapping("diaocha")
public String diaocha(HttpServletRequest request,String id){
Orders model = ordersService.getModel(id);
Insurance insurance = insuranceService.getModel(model.getInsuranceId());
request.setAttribute("model",model);
request.setAttribute("insurance",insurance);
Investigation investigation = investigationService.selectOneModel(MapUtil.buildMap("orderId", model.getId()));
if (investigation != null){
request.setAttribute("investigation",investigation);
return "/admin/investigation-view";
}
return "/admin/investigation-add";
}
@RequestMapping("edit")
public String edit(HttpServletRequest request,String id){
Investigation model = investigationService.getModel(id);
request.setAttribute("model",model);
return "/admin/investigation-add";
}
@RequestMapping("save")
@ResponseBody
public Result save(HttpServletRequest request,Investigation model){
User user = (User) request.getSession().getAttribute("user");
int i = 0;
if (StringUtils.isBlank(model.getId())) {
model.preInsert();
model.setCreateDate(new Date());
i = investigationService.insertModel(model);
//更新保单状态
Orders orders = ordersService.getModel(model.getOrderId());
orders.setState(2);
ordersService.updateModel(orders);
} else {
i = investigationService.updateModel(model);
}
if (i == 0) {
return ResultUtil.error("失败");
} else {
return ResultUtil.success(null);
}
}
//删除批量删除
@RequestMapping("delete")
@ResponseBody
public Result delete(HttpServletRequest request,String id){
if (StringUtils.isNotBlank(id)){
String[] split = id.split(",");
for (int i = 0; i < split.length; i++) {
investigationService.deleteModel(split[i]);
}
return ResultUtil.success();
}else {
return ResultUtil.error("未选中删除项!");
}
}
@RequestMapping("list")
public String list(HttpServletRequest request,Investigation model){
request.setAttribute("model",model);
return "/admin/investigation-list";
}
//获取列表数据
@RequestMapping("list/data")
@ResponseBody
public Result list(HttpServletRequest request,User model, @RequestParam(defaultValue = "1")Integer page,Integer limit){
PageHelper.startPage(page,limit);
List
PageInfo
return ResultUtil.success(list,pageInfo.getTotal());
}
}
package com.controller;
import com.entity.Insurance;
import com.service.InsuranceService;
import com.service.UserService;
import com.utils.MapUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.InitializingBean;
import com.entity.Orders;
import com.service.OrdersService;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
import com.entity.Result;
import com.utils.ResultUtil;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import com.entity.User;
import java.util.Date;
import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageInfo;
@Controller
@RequestMapping(value = "/admin/orders")
public class AdminOrdersController extends BaseController {
@Autowired
private OrdersService ordersService;
@Autowired
private InsuranceService insuranceService;
@Autowired
private UserService userService;
@RequestMapping("add")
public String add(HttpServletRequest request, Orders model) {
User user = (User) request.getSession().getAttribute("user");
List
request.setAttribute("model", model);
request.setAttribute("insuranceList", insuranceList);
return "/admin/orders-add";
}
@RequestMapping("edit")
public String edit(HttpServletRequest request, String id) {
Orders model = ordersService.getModel(id);
request.setAttribute("model", model);
return "/admin/orders-add";
}
@RequestMapping("save")
@ResponseBody
public Result save(HttpServletRequest request, Orders model) {
User user = (User) request.getSession().getAttribute("user");
int i = 0;
if (StringUtils.isBlank(model.getId())) {
model.preInsert();
model.setCreateDate(new Date());
i = ordersService.insertModel(model);
} else {
i = ordersService.updateModel(model);
}
if (i == 0) {
return ResultUtil.error("失败");
} else {
return ResultUtil.success(null);
}
}
@RequestMapping("approved")
@ResponseBody
public Result approved(String id,Integer state){
Orders model = ordersService.getModel(id);
model.setState(state);
if (state == 5){
getMoney(id);
}
int i = ordersService.updateModel(model);
if (i == 0) {
return ResultUtil.error("失败");
} else {
return ResultUtil.success(null);
}
}
/**
* 发放赔偿金
*/
public void getMoney(String orderId){
Orders orders = ordersService.getModel(orderId);//获取保单
User user = userService.getModel(orders.getUserId());//获取用户
BigDecimal price = orders.getPrice();//保单申请金额
user.setMoney(user.getMoney().add(price));//用户账户余额增加保费
userService.updateModel(user);
}
//删除批量删除
@RequestMapping("delete")
@ResponseBody
public Result delete(HttpServletRequest request, String id) {
if (StringUtils.isNotBlank(id)) {
String[] split = id.split(",");
for (int i = 0; i < split.length; i++) {
ordersService.deleteModel(split[i]);
}
return ResultUtil.success();
} else {
return ResultUtil.error("未选中删除项!");
}
}
@RequestMapping("list")
public String list(HttpServletRequest request, Orders model) {
request.setAttribute("model", model);
return "/admin/orders-list";
}
/**
* 用户提交的申请理赔
* @param request
* @param model
* @return
*/
@RequestMapping("approve")
public String approve(HttpServletRequest request, Orders model) {
request.setAttribute("model", model);
return "/admin/orders-approve";
}
/**
* 已经有调查勘察记录的申请单,确认是否发放赔偿金
* @param request
* @param model
* @return
*/
@RequestMapping("money/give")
public String moneyGive(HttpServletRequest request, Orders model) {
request.setAttribute("model", model);
return "/admin/orders-money";
}
/**
* 用户提交的需要调查的
* @param request
* @param model
* @return
*/
@RequestMapping("investigation")
public String investigation(HttpServletRequest request, Orders model) {
request.setAttribute("model", model);
return "/admin/orders-investigation";
}
/**
* 用户提交的需要调查的
* @param request
* @param model
* @return
*/
@RequestMapping("responsibility")
public String responsibility(HttpServletRequest request, Orders model) {
request.setAttribute("model", model);
return "/admin/orders-responsibility";
}
//获取列表数据
@RequestMapping("list/data")
@ResponseBody
public Result list(HttpServletRequest request, Orders model, @RequestParam(defaultValue = "1") Integer page, Integer limit) {
PageHelper.startPage(page, limit);
List
PageInfo
return ResultUtil.success(list, pageInfo.getTotal());
}
}
五,项目总结
本项目基本上实现了车险理陪的主要核心业务,角色功能相对完整,适合做毕业设计或课程设计使用。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~