源码定制: java C# 安卓 小程序 安卓 python PHP 包调试运行 修改代码 开发文档 文档定制
传统信息的管理大部分依赖于管理人员的手工登记与管理,然而,随着近些年信息技术的迅猛发展,让许多比较老套的信息管理模式进行了更新迭代,老师信息因为其管理内容繁杂,管理数量繁多导致手工进行处理不能满足广大用户的需求,因此就应运而生出相应的教师薪酬管理系统。
本教师薪酬管理系统分为管理员还有用户两个权限,管理员可以管理用户的基本信息内容,可以管理公告信息以及老师信息,能够与用户进行相互交流等操作,用户可以查看老师信息,可以查看公告以及查看管理员回复信息等操作。
该教师薪酬管理系统采用的是WEB应用程序开发中最受欢迎的小程序结构模式,使用占用空间小但功能齐全的MySQL数据库进行数据的存储操作,系统开发技术使用到了JSP技术。该教师薪酬管理系统能够解决许多传统手工操作的难题,比如数据查询耽误时间长,数据管理步骤繁琐等问题。总的来说,教师薪酬管理系统性能稳定,功能较全,投入运行使用性价比很高。
关键词:教师薪酬管理系统;MySQL数据库;SSM技术
基于springboot教师薪酬管理系统源码和论文649
演示视频:
基于springboot教师薪酬管理系统源码和论文【包调试运行】
Most of the management of traditional car rental information relies on the manual registration and management of managers. However, with the rapid development of information technology in recent years, many old-fashioned information management models have been iterated and updated, and car rental information is because of its The management content is complicated, and the large number of managements leads to manual processing that cannot meet the needs of the majority of car rental users. Therefore, the corresponding car rental management system should be born.
The car rental management system is divided into two functions: the administrator and the user. The administrator can manage the basic information content of the user, can manage the car information and the rental information of the car, and can communicate with the user, etc., and the user can view the car information. You can rent a car online, you can leave a message online, and view the administrator's reply information.
The car rental management system adopts the most popular xiaochengxu three-layer structure mode in WEB application development, and uses a small but full-featured MySQL database for data storage operations. The system development technology uses JSP technology. The car rental management system can solve many traditional manual operation problems, such as long delays in data query and cumbersome data management steps. In general, the car rental management system has stable performance and full-featured functions.
Key Words:Car rental management system; MySQL database; SSM technology



























package com.controller;import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;/*** 商品订单* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/shangpinOrder")
public class ShangpinOrderController {private static final Logger logger = LoggerFactory.getLogger(ShangpinOrderController.class);private static final String TABLE_NAME = "shangpinOrder";@Autowiredprivate ShangpinOrderService shangpinOrderService;@Autowiredprivate TokenService tokenService;@Autowiredprivate AddressService addressService;//收货地址@Autowiredprivate CartService cartService;//购物车@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate NewsService newsService;//新闻信息@Autowiredprivate NonghuService nonghuService;//农户@Autowiredprivate ShangpinService shangpinService;//商品@Autowiredprivate ShangpinChatService shangpinChatService;//用户咨询@Autowiredprivate ShangpinCollectionService shangpinCollectionService;//商品收藏@Autowiredprivate ShangpinCommentbackService shangpinCommentbackService;//商品评价@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));else if("农户".equals(role))params.put("nonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = shangpinOrderService.queryPage(params);//字典表数据转换List<ShangpinOrderView> list =(List<ShangpinOrderView>)page.getList();for(ShangpinOrderView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ShangpinOrderEntity shangpinOrder = shangpinOrderService.selectById(id);if(shangpinOrder !=null){//entity转viewShangpinOrderView view = new ShangpinOrderView();BeanUtils.copyProperties( shangpinOrder , view );//把实体数据重构到view中//级联表 收货地址//级联表AddressEntity address = addressService.selectById(shangpinOrder.getAddressId());if(address != null){BeanUtils.copyProperties( address , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setAddressId(address.getId());}//级联表 商品//级联表ShangpinEntity shangpin = shangpinService.selectById(shangpinOrder.getShangpinId());if(shangpin != null){BeanUtils.copyProperties( shangpin , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setShangpinId(shangpin.getId());}//级联表 用户//级联表YonghuEntity yonghu = yonghuService.selectById(shangpinOrder.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ShangpinOrderEntity shangpinOrder, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,shangpinOrder:{}",this.getClass().getName(),shangpinOrder.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");else if("用户".equals(role))shangpinOrder.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));shangpinOrder.setCreateTime(new Date());shangpinOrder.setInsertTime(new Date());shangpinOrderService.insert(shangpinOrder);return R.ok();}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ShangpinOrderEntity shangpinOrder, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,shangpinOrder:{}",this.getClass().getName(),shangpinOrder.toString());ShangpinOrderEntity oldShangpinOrderEntity = shangpinOrderService.selectById(shangpinOrder.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// shangpinOrder.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));shangpinOrderService.updateById(shangpinOrder);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<ShangpinOrderEntity> oldShangpinOrderList =shangpinOrderService.selectBatchIds(Arrays.asList(ids));//要删除的数据shangpinOrderService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<ShangpinOrderEntity> shangpinOrderList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环ShangpinOrderEntity shangpinOrderEntity = new ShangpinOrderEntity();
// shangpinOrderEntity.setShangpinOrderUuidNumber(data.get(0)); //订单编号 要改的
// shangpinOrderEntity.setAddressId(Integer.valueOf(data.get(0))); //收货地址 要改的
// shangpinOrderEntity.setShangpinId(Integer.valueOf(data.get(0))); //商品 要改的
// shangpinOrderEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// shangpinOrderEntity.setBuyNumber(Integer.valueOf(data.get(0))); //购买数量 要改的
// shangpinOrderEntity.setShangpinOrderTruePrice(data.get(0)); //实付价格 要改的
// shangpinOrderEntity.setShangpinOrderCourierName(data.get(0)); //快递公司 要改的
// shangpinOrderEntity.setShangpinOrderCourierNumber(data.get(0)); //快递单号 要改的
// shangpinOrderEntity.setShangpinOrderTypes(Integer.valueOf(data.get(0))); //订单类型 要改的
// shangpinOrderEntity.setShangpinOrderPaymentTypes(Integer.valueOf(data.get(0))); //支付类型 要改的
// shangpinOrderEntity.setInsertTime(date);//时间
// shangpinOrderEntity.setCreateTime(date);//时间shangpinOrderList.add(shangpinOrderEntity);//把要查询是否重复的字段放入map中//订单编号if(seachFields.containsKey("shangpinOrderUuidNumber")){List<String> shangpinOrderUuidNumber = seachFields.get("shangpinOrderUuidNumber");shangpinOrderUuidNumber.add(data.get(0));//要改的}else{List<String> shangpinOrderUuidNumber = new ArrayList<>();shangpinOrderUuidNumber.add(data.get(0));//要改的seachFields.put("shangpinOrderUuidNumber",shangpinOrderUuidNumber);}}//查询是否重复//订单编号List<ShangpinOrderEntity> shangpinOrderEntities_shangpinOrderUuidNumber = shangpinOrderService.selectList(new EntityWrapper<ShangpinOrderEntity>().in("shangpin_order_uuid_number", seachFields.get("shangpinOrderUuidNumber")));if(shangpinOrderEntities_shangpinOrderUuidNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ShangpinOrderEntity s:shangpinOrderEntities_shangpinOrderUuidNumber){repeatFields.add(s.getShangpinOrderUuidNumber());}return R.error(511,"数据库的该表中的 [订单编号] 字段已经存在 存在数据为:"+repeatFields.toString());}shangpinOrderService.insertBatch(shangpinOrderList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = shangpinOrderService.queryPage(params);//字典表数据转换List<ShangpinOrderView> list =(List<ShangpinOrderView>)page.getList();for(ShangpinOrderView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Integer id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ShangpinOrderEntity shangpinOrder = shangpinOrderService.selectById(id);if(shangpinOrder !=null){//entity转viewShangpinOrderView view = new ShangpinOrderView();BeanUtils.copyProperties( shangpinOrder , view );//把实体数据重构到view中//级联表AddressEntity address = addressService.selectById(shangpinOrder.getAddressId());if(address != null){BeanUtils.copyProperties( address , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段view.setAddressId(address.getId());}//级联表ShangpinEntity shangpin = shangpinService.selectById(shangpinOrder.getShangpinId());if(shangpin != null){BeanUtils.copyProperties( shangpin , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段view.setShangpinId(shangpin.getId());}//级联表YonghuEntity yonghu = yonghuService.selectById(shangpinOrder.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ShangpinOrderEntity shangpinOrder, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,shangpinOrder:{}",this.getClass().getName(),shangpinOrder.toString());ShangpinEntity shangpinEntity = shangpinService.selectById(shangpinOrder.getShangpinId());if(shangpinEntity == null){return R.error(511,"查不到该商品");}// Double shangpinNewMoney = shangpinEntity.getShangpinNewMoney();if(false){}else if(shangpinEntity.getShangpinNewMoney() == null){return R.error(511,"现价/积分不能为空");}else if((shangpinEntity.getShangpinKucunNumber() -shangpinOrder.getBuyNumber())<0){return R.error(511,"购买数量不能大于库存数量");}//计算所获得积分Double buyJifen =0.0;Integer userId = (Integer) request.getSession().getAttribute("userId");YonghuEntity yonghuEntity = yonghuService.selectById(userId);if(yonghuEntity == null)return R.error(511,"用户不能为空");if(yonghuEntity.getNewMoney() == null)return R.error(511,"用户金额不能为空");double balance = yonghuEntity.getNewMoney() - shangpinEntity.getShangpinNewMoney()*shangpinOrder.getBuyNumber();//余额buyJifen = new BigDecimal(shangpinEntity.getShangpinPrice()).multiply(new BigDecimal(shangpinOrder.getBuyNumber())).doubleValue();//所获积分if(balance<0)return R.error(511,"余额不够支付");shangpinOrder.setShangpinOrderTypes(101); //设置订单状态为已支付shangpinOrder.setShangpinOrderTruePrice(shangpinEntity.getShangpinNewMoney()*shangpinOrder.getBuyNumber()); //设置实付价格shangpinOrder.setYonghuId(userId); //设置订单支付人idshangpinOrder.setShangpinOrderUuidNumber(String.valueOf(new Date().getTime()));shangpinOrder.setShangpinOrderPaymentTypes(1);shangpinOrder.setInsertTime(new Date());shangpinOrder.setCreateTime(new Date());shangpinEntity.setShangpinKucunNumber( shangpinEntity.getShangpinKucunNumber() -shangpinOrder.getBuyNumber());shangpinService.updateById(shangpinEntity);shangpinOrderService.insert(shangpinOrder);//新增订单//更新第一注册表yonghuEntity.setNewMoney(balance);//设置金额yonghuEntity.setYonghuNewJifen(yonghuEntity.getYonghuNewJifen() + buyJifen); //设置总积分yonghuEntity.setYonghuSumJifen(yonghuEntity.getYonghuSumJifen() + buyJifen); //设置总积分if(yonghuEntity.getYonghuSumJifen() < 10000)yonghuEntity.setHuiyuandengjiTypes(1);else if(yonghuEntity.getYonghuSumJifen() < 100000)yonghuEntity.setHuiyuandengjiTypes(2);else if(yonghuEntity.getYonghuSumJifen() < 1000000)yonghuEntity.setHuiyuandengjiTypes(3);yonghuService.updateById(yonghuEntity);NonghuEntity nonghuEntity = nonghuService.selectById(shangpinEntity.getNonghuId());nonghuEntity.setNewMoney(nonghuEntity.getNewMoney()+shangpinOrder.getShangpinOrderTruePrice());//动态计算金额nonghuService.updateById(nonghuEntity);return R.ok();}/*** 添加订单*/@RequestMapping("/order")public R add(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("order方法:,,Controller:{},,params:{}",this.getClass().getName(),params.toString());String shangpinOrderUuidNumber = String.valueOf(new Date().getTime());//获取当前登录用户的idInteger userId = (Integer) request.getSession().getAttribute("userId");Integer addressId = Integer.valueOf(String.valueOf(params.get("addressId")));Integer shangpinOrderPaymentTypes = Integer.valueOf(String.valueOf(params.get("shangpinOrderPaymentTypes")));//支付类型String data = String.valueOf(params.get("shangpins"));JSONArray jsonArray = JSON.parseArray(data);List<Map> shangpins = JSON.parseObject(jsonArray.toString(), List.class);//获取当前登录用户的个人信息YonghuEntity yonghuEntity = yonghuService.selectById(userId);//当前订单表List<ShangpinOrderEntity> shangpinOrderList = new ArrayList<>();//商品表List<ShangpinEntity> shangpinList = new ArrayList<>();//购物车idsList<Integer> cartIds = new ArrayList<>();BigDecimal zhekou = new BigDecimal(1.0);// 获取折扣Wrapper<DictionaryEntity> dictionary = new EntityWrapper<DictionaryEntity>().eq("dic_code", "huiyuandengji_types").eq("dic_name", "会员等级类型").eq("code_index", yonghuEntity.getHuiyuandengjiTypes());DictionaryEntity dictionaryEntity = dictionaryService.selectOne(dictionary);if(dictionaryEntity != null ){zhekou = BigDecimal.valueOf(Double.valueOf(dictionaryEntity.getBeizhu()));}//循环取出需要的数据for (Map<String, Object> map : shangpins) {//取值Integer shangpinId = Integer.valueOf(String.valueOf(map.get("shangpinId")));//商品idInteger buyNumber = Integer.valueOf(String.valueOf(map.get("buyNumber")));//购买数量ShangpinEntity shangpinEntity = shangpinService.selectById(shangpinId);//购买的商品String id = String.valueOf(map.get("id"));if(StringUtil.isNotEmpty(id))cartIds.add(Integer.valueOf(id));//判断商品的库存是否足够if(shangpinEntity.getShangpinKucunNumber() < buyNumber){//商品库存不足直接返回return R.error(shangpinEntity.getShangpinName()+"的库存不足");}else{//商品库存充足就减库存shangpinEntity.setShangpinKucunNumber(shangpinEntity.getShangpinKucunNumber() - buyNumber);}//订单信息表增加数据ShangpinOrderEntity shangpinOrderEntity = new ShangpinOrderEntity<>();//赋值订单信息shangpinOrderEntity.setShangpinOrderUuidNumber(shangpinOrderUuidNumber);//订单编号shangpinOrderEntity.setAddressId(addressId);//收货地址shangpinOrderEntity.setShangpinId(shangpinId);//商品shangpinOrderEntity.setYonghuId(userId);//用户shangpinOrderEntity.setBuyNumber(buyNumber);//购买数量 ??????shangpinOrderEntity.setShangpinOrderTypes(101);//订单类型shangpinOrderEntity.setShangpinOrderPaymentTypes(shangpinOrderPaymentTypes);//支付类型shangpinOrderEntity.setInsertTime(new Date());//订单创建时间shangpinOrderEntity.setCreateTime(new Date());//创建时间//判断是什么支付方式 1代表余额 2代表积分if(shangpinOrderPaymentTypes == 1){//余额支付//计算金额Double money = new BigDecimal(shangpinEntity.getShangpinNewMoney()).multiply(new BigDecimal(buyNumber)).multiply(zhekou).doubleValue();if(yonghuEntity.getNewMoney() - money <0 ){return R.error("余额不足,请充值!!!");}else{//计算所获得积分Double buyJifen =0.0;buyJifen = new BigDecimal(shangpinEntity.getShangpinPrice()).multiply(new BigDecimal(buyNumber)).doubleValue();yonghuEntity.setNewMoney(yonghuEntity.getNewMoney() - money); //设置金额yonghuEntity.setYonghuNewJifen(yonghuEntity.getYonghuNewJifen() + buyJifen); //设置现积分yonghuEntity.setYonghuSumJifen(yonghuEntity.getYonghuSumJifen() + buyJifen); //设置总积分//积分够了自动增加会员等级if(yonghuEntity.getYonghuSumJifen() < 10000)yonghuEntity.setHuiyuandengjiTypes(1);else if(yonghuEntity.getYonghuSumJifen() < 100000)yonghuEntity.setHuiyuandengjiTypes(2);else if(yonghuEntity.getYonghuSumJifen() < 1000000)yonghuEntity.setHuiyuandengjiTypes(3);shangpinOrderEntity.setShangpinOrderTruePrice(money);}}else{//积分支付Double money = shangpinEntity.getShangpinNewMoney() * buyNumber;if(yonghuEntity.getYonghuNewJifen() - money <0 ){return R.error("积分不足,无法支付");}else{yonghuEntity.setYonghuNewJifen(yonghuEntity.getYonghuNewJifen() - money);//设置现在积分shangpinOrderEntity.setShangpinOrderTruePrice(money);//实付积分}}shangpinOrderList.add(shangpinOrderEntity);shangpinList.add(shangpinEntity);}shangpinOrderService.insertBatch(shangpinOrderList);shangpinService.updateBatchById(shangpinList);yonghuService.updateById(yonghuEntity);if(cartIds != null && cartIds.size()>0)cartService.deleteBatchIds(cartIds);return R.ok();}/*** 退款*/@RequestMapping("/refund")public R refund(Integer id, HttpServletRequest request){logger.debug("refund方法:,,Controller:{},,id:{}",this.getClass().getName(),id);String role = String.valueOf(request.getSession().getAttribute("role"));ShangpinOrderEntity shangpinOrder = shangpinOrderService.selectById(id);//当前表serviceInteger buyNumber = shangpinOrder.getBuyNumber();Integer shangpinOrderPaymentTypes = shangpinOrder.getShangpinOrderPaymentTypes();Integer shangpinId = shangpinOrder.getShangpinId();if(shangpinId == null)return R.error(511,"查不到该商品");ShangpinEntity shangpinEntity = shangpinService.selectById(shangpinId);if(shangpinEntity == null)return R.error(511,"查不到该商品");Double shangpinNewMoney = shangpinEntity.getShangpinNewMoney();if(shangpinNewMoney == null)return R.error(511,"商品价格不能为空");Integer userId = (Integer) request.getSession().getAttribute("userId");YonghuEntity yonghuEntity = yonghuService.selectById(userId);if(yonghuEntity == null)return R.error(511,"用户不能为空");if(yonghuEntity.getNewMoney() == null)return R.error(511,"用户金额不能为空");Double zhekou = 1.0;// 获取折扣Wrapper<DictionaryEntity> dictionary = new EntityWrapper<DictionaryEntity>().eq("dic_code", "huiyuandengji_types").eq("dic_name", "会员等级类型").eq("code_index", yonghuEntity.getHuiyuandengjiTypes());DictionaryEntity dictionaryEntity = dictionaryService.selectOne(dictionary);if(dictionaryEntity != null ){zhekou = Double.valueOf(dictionaryEntity.getBeizhu());}//判断是什么支付方式 1代表余额 2代表积分if(shangpinOrderPaymentTypes == 1){//余额支付//计算金额Double money = shangpinEntity.getShangpinNewMoney() * buyNumber * zhekou;//计算所获得积分Double buyJifen = 0.0;buyJifen = new BigDecimal(shangpinEntity.getShangpinPrice()).multiply(new BigDecimal(buyNumber)).doubleValue();yonghuEntity.setNewMoney(yonghuEntity.getNewMoney() + money); //设置金额yonghuEntity.setYonghuSumJifen(yonghuEntity.getYonghuSumJifen() - buyJifen); //设置总积分if(yonghuEntity.getYonghuNewJifen() - buyJifen <0 )return R.error("积分已经消费,无法退款!!!");yonghuEntity.setYonghuNewJifen(yonghuEntity.getYonghuNewJifen() - buyJifen); //设置现积分if(yonghuEntity.getYonghuSumJifen() < 10000)yonghuEntity.setHuiyuandengjiTypes(1);else if(yonghuEntity.getYonghuSumJifen() < 100000)yonghuEntity.setHuiyuandengjiTypes(2);else if(yonghuEntity.getYonghuSumJifen() < 1000000)yonghuEntity.setHuiyuandengjiTypes(3);}else{//积分支付Double money = shangpinEntity.getShangpinNewMoney() * buyNumber;yonghuEntity.setYonghuNewJifen(yonghuEntity.getYonghuNewJifen() + money); //设置现积分}shangpinEntity.setShangpinKucunNumber(shangpinEntity.getShangpinKucunNumber() + buyNumber);shangpinOrder.setShangpinOrderTypes(102);//设置订单状态为已退款shangpinOrderService.updateAllColumnById(shangpinOrder);//根据id更新yonghuService.updateById(yonghuEntity);//更新用户信息shangpinService.updateById(shangpinEntity);//更新订单中商品的信息return R.ok();}/*** 评价*/@RequestMapping("/commentback")public R commentback(Integer id, String commentbackText, Integer shangpinCommentbackPingfenNumber, HttpServletRequest request){logger.debug("commentback方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ShangpinOrderEntity shangpinOrder = shangpinOrderService.selectById(id);if(shangpinOrder == null)return R.error(511,"查不到该订单");Integer shangpinId = shangpinOrder.getShangpinId();if(shangpinId == null)return R.error(511,"查不到该商品");ShangpinCommentbackEntity shangpinCommentbackEntity = new ShangpinCommentbackEntity();shangpinCommentbackEntity.setId(id);shangpinCommentbackEntity.setShangpinId(shangpinId);shangpinCommentbackEntity.setYonghuId((Integer) request.getSession().getAttribute("userId"));shangpinCommentbackEntity.setShangpinCommentbackText(commentbackText);shangpinCommentbackEntity.setInsertTime(new Date());shangpinCommentbackEntity.setReplyText(null);shangpinCommentbackEntity.setUpdateTime(null);shangpinCommentbackEntity.setCreateTime(new Date());shangpinCommentbackService.insert(shangpinCommentbackEntity);shangpinOrder.setShangpinOrderTypes(105);//设置订单状态为已评价shangpinOrderService.updateById(shangpinOrder);//根据id更新return R.ok();}/*** 发货*/@RequestMapping("/deliver")public R deliver(Integer id ,String shangpinOrderCourierNumber, String shangpinOrderCourierName , HttpServletRequest request){logger.debug("refund:,,Controller:{},,ids:{}",this.getClass().getName(),id.toString());ShangpinOrderEntity shangpinOrderEntity = shangpinOrderService.selectById(id);shangpinOrderEntity.setShangpinOrderTypes(103);//设置订单状态为已发货shangpinOrderEntity.setShangpinOrderCourierNumber(shangpinOrderCourierNumber);shangpinOrderEntity.setShangpinOrderCourierName(shangpinOrderCourierName);shangpinOrderService.updateById( shangpinOrderEntity);return R.ok();}/*** 收货*/@RequestMapping("/receiving")public R receiving(Integer id , HttpServletRequest request){logger.debug("refund:,,Controller:{},,ids:{}",this.getClass().getName(),id.toString());ShangpinOrderEntity shangpinOrderEntity = shangpinOrderService.selectById(id);shangpinOrderEntity.setShangpinOrderTypes(104);//设置订单状态为收货shangpinOrderService.updateById( shangpinOrderEntity);return R.ok();}}
