Commit 665fe7f6 by xuwenhao

12.19修改送水功能

parent 57feeaee
...@@ -87,6 +87,27 @@ ...@@ -87,6 +87,27 @@
<version>3.5.3.1</version> <version>3.5.3.1</version>
</dependency> </dependency>
<!--用于计算两点之间的距离-->
<dependency>
<groupId>org.gavaghan</groupId>
<artifactId>geodesy</artifactId>
<version>1.1.3</version>
</dependency>
<!-- 压缩图片-->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>org.jpedal</groupId>
<artifactId>OpenViewerFX</artifactId>
<version>6.6.14</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -7,9 +7,15 @@ import com.qianhe.common.core.page.TableDataInfo; ...@@ -7,9 +7,15 @@ import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType; import com.qianhe.common.enums.BusinessType;
import com.qianhe.system.domain.WaterGoodsCart; import com.qianhe.system.domain.WaterGoodsCart;
import com.qianhe.system.domain.WaterGoodsImg; import com.qianhe.system.domain.WaterGoodsImg;
import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.service.IWaterGoodsCartService; import com.qianhe.system.service.IWaterGoodsCartService;
import com.qianhe.system.service.IWaterGoodsImgService; import com.qianhe.system.service.IWaterGoodsImgService;
import com.qianhe.system.service.IWaterGoodsSpeService;
import com.qianhe.system.vo.WaterGoodsCartVo;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import com.qianhe.system.vo.WaterGoodsVo; import com.qianhe.system.vo.WaterGoodsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -24,6 +30,8 @@ public class WaterGoodsCartController extends BaseController { ...@@ -24,6 +30,8 @@ public class WaterGoodsCartController extends BaseController {
private IWaterGoodsCartService waterGoodsCartService; private IWaterGoodsCartService waterGoodsCartService;
@Autowired @Autowired
private IWaterGoodsImgService waterGoodsImgService; private IWaterGoodsImgService waterGoodsImgService;
@Autowired
private IWaterGoodsSpeService waterGoodsSpeService;
/** /**
* 查询购物车列表 * 查询购物车列表
...@@ -103,4 +111,48 @@ public class WaterGoodsCartController extends BaseController { ...@@ -103,4 +111,48 @@ public class WaterGoodsCartController extends BaseController {
{ {
return toAjax(waterGoodsCartService.deleteWaterGoodsCartByIds(ids)); return toAjax(waterGoodsCartService.deleteWaterGoodsCartByIds(ids));
} }
/**
* 购物车去结算按钮
* @param ids
* @return
*/
@GetMapping("/getInfo/{ids}")
public AjaxResult getWaterGoodsCart(@PathVariable Long[] ids){
//查询全部商品图片
List<WaterGoodsImg> waterGoodsImgList = waterGoodsImgService.selectWaterGoodsImgList(new WaterGoodsImg());
List<WaterGoodsCart> list = waterGoodsCartService.selectWaterGoodsCartByIds(ids);
List<WaterGoodsCartVo> waterGoodsCartVoList = new ArrayList<>();
for (WaterGoodsCart goodsCart : list) {
//转vo
WaterGoodsCartVo waterGoodsCartVo = new WaterGoodsCartVo();
BeanUtils.copyProperties(goodsCart,waterGoodsCartVo);
waterGoodsCartVo.setTitle(goodsCart.getGoodsName());
waterGoodsCartVo.setPrice(goodsCart.getGoodsPrice());
//封面图集合
List<WaterGoodsImg> coverImgs = new ArrayList<>();
//详情图集合
List<WaterGoodsImg> detailsImgs = new ArrayList<>();
for (WaterGoodsImg waterGoodsImg : waterGoodsImgList) {
//封面图
if (goodsCart.getGoodsId().equals(waterGoodsImg.getGoodsId()) && waterGoodsImg.getImgType() == 1){
coverImgs.add(waterGoodsImg);
}else if (goodsCart.getGoodsId().equals(waterGoodsImg.getGoodsId()) && waterGoodsImg.getImgType() == 2){
detailsImgs.add(waterGoodsImg);
}
}
if (coverImgs.size() > 0){
waterGoodsCartVo.setCoverImgs(coverImgs);
}
if (detailsImgs.size() > 0){
waterGoodsCartVo.setDetailsImgs(detailsImgs);
}
waterGoodsCartVo.setOrderGoodsType(2);
waterGoodsCartVoList.add(waterGoodsCartVo);
}
return success(waterGoodsCartVoList);
}
} }
package com.qianhe.system.controller; package com.qianhe.system.controller;
import com.github.pagehelper.PageInfo;
import com.qianhe.common.annotation.Log; import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController; import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult; import com.qianhe.common.core.domain.AjaxResult;
...@@ -120,7 +121,9 @@ public class WaterGoodsController extends BaseController ...@@ -120,7 +121,9 @@ public class WaterGoodsController extends BaseController
waterGoodsVos.add(waterGoodsVo); waterGoodsVos.add(waterGoodsVo);
} }
} }
return getDataTable(waterGoodsVos); TableDataInfo tableDataInfo = getDataTable(waterGoodsVos);
tableDataInfo.setTotal(new PageInfo(list).getTotal());
return tableDataInfo;
} }
@GetMapping("/zyImgList") @GetMapping("/zyImgList")
...@@ -204,6 +207,7 @@ public class WaterGoodsController extends BaseController ...@@ -204,6 +207,7 @@ public class WaterGoodsController extends BaseController
//按分类查询商品 //按分类查询商品
List<Map<String,Object>> mapList = new ArrayList<>(); List<Map<String,Object>> mapList = new ArrayList<>();
for (WaterGoodsType waterGoodsType : waterGoodsTypes) { for (WaterGoodsType waterGoodsType : waterGoodsTypes) {
if (!waterGoodsType.getTypeName().equals("主页轮播图")){
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
List<WaterGoodsVo> waterGoodsVoList = new ArrayList<>(); List<WaterGoodsVo> waterGoodsVoList = new ArrayList<>();
for (WaterGoodsVo waterGoodsVo : waterGoodsVos) { for (WaterGoodsVo waterGoodsVo : waterGoodsVos) {
...@@ -215,6 +219,7 @@ public class WaterGoodsController extends BaseController ...@@ -215,6 +219,7 @@ public class WaterGoodsController extends BaseController
map.put("waterGoodsVoList",waterGoodsVoList); map.put("waterGoodsVoList",waterGoodsVoList);
mapList.add(map); mapList.add(map);
} }
}
return getDataTable(mapList); return getDataTable(mapList);
} }
...@@ -268,4 +273,22 @@ public class WaterGoodsController extends BaseController ...@@ -268,4 +273,22 @@ public class WaterGoodsController extends BaseController
{ {
return toAjax(waterGoodsService.deleteWaterGoodsByIds(ids)); return toAjax(waterGoodsService.deleteWaterGoodsByIds(ids));
} }
/**
* 点击退款之后的水票信息
*/
@GetMapping("/getGoodsSp")
public AjaxResult getGoodsSp(){
return success(waterGoodsService.getGoodsSp());
}
/**
* 获取选中的商品信息
* @param waterGoodsVo
* @return
*/
@PostMapping("/getGoodsXq")
public AjaxResult getGoodsXq(@RequestBody WaterGoodsVo waterGoodsVo){
return success(waterGoodsService.getGoodsXq(waterGoodsVo));
}
} }
...@@ -31,7 +31,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -31,7 +31,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 查询商品图片列表 * 查询商品图片列表
*/ */
@PreAuthorize("@ss.hasPermi('system:img:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WaterGoodsImg waterGoodsImg) public TableDataInfo list(WaterGoodsImg waterGoodsImg)
{ {
...@@ -43,7 +42,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -43,7 +42,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 导出商品图片列表 * 导出商品图片列表
*/ */
@PreAuthorize("@ss.hasPermi('system:img:export')")
@Log(title = "商品图片", businessType = BusinessType.EXPORT) @Log(title = "商品图片", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterGoodsImg waterGoodsImg) public void export(HttpServletResponse response, WaterGoodsImg waterGoodsImg)
...@@ -56,7 +54,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -56,7 +54,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 获取商品图片详细信息 * 获取商品图片详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:img:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -66,7 +63,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -66,7 +63,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 新增商品图片 * 新增商品图片
*/ */
@PreAuthorize("@ss.hasPermi('system:img:add')")
@Log(title = "商品图片", businessType = BusinessType.INSERT) @Log(title = "商品图片", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WaterGoodsImg waterGoodsImg) public AjaxResult add(@RequestBody WaterGoodsImg waterGoodsImg)
...@@ -77,7 +73,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -77,7 +73,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 修改商品图片 * 修改商品图片
*/ */
@PreAuthorize("@ss.hasPermi('system:img:edit')")
@Log(title = "商品图片", businessType = BusinessType.UPDATE) @Log(title = "商品图片", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WaterGoodsImg waterGoodsImg) public AjaxResult edit(@RequestBody WaterGoodsImg waterGoodsImg)
...@@ -88,7 +83,6 @@ public class WaterGoodsImgController extends BaseController ...@@ -88,7 +83,6 @@ public class WaterGoodsImgController extends BaseController
/** /**
* 删除商品图片 * 删除商品图片
*/ */
@PreAuthorize("@ss.hasPermi('system:img:remove')")
@Log(title = "商品图片", businessType = BusinessType.DELETE) @Log(title = "商品图片", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
......
package com.qianhe.system.controller; package com.qianhe.system.controller;
import com.github.pagehelper.PageInfo;
import com.qianhe.common.annotation.Log; import com.qianhe.common.annotation.Log;
import com.qianhe.common.annotation.RepeatSubmit;
import com.qianhe.common.constant.HttpStatus;
import com.qianhe.common.core.controller.BaseController; import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult; import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.core.page.TableDataInfo; import com.qianhe.common.core.page.TableDataInfo;
...@@ -21,7 +24,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -21,7 +24,10 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
/** /**
* 订单Controller * 订单Controller
...@@ -39,8 +45,6 @@ public class WaterOrderController extends BaseController ...@@ -39,8 +45,6 @@ public class WaterOrderController extends BaseController
private IWaterOrderGoodsService waterOrderGoodsService; private IWaterOrderGoodsService waterOrderGoodsService;
@Autowired @Autowired
private IWaterGoodsImgService waterGoodsImgService; private IWaterGoodsImgService waterGoodsImgService;
@Value("${ruoyi.serverAddress}")
private String serverAddress;
/** /**
* 查询订单列表(管理端) * 查询订单列表(管理端)
...@@ -56,19 +60,42 @@ public class WaterOrderController extends BaseController ...@@ -56,19 +60,42 @@ public class WaterOrderController extends BaseController
List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods()); List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods());
if (list.size() > 0){ if (list.size() > 0){
for (WaterOrder order : list) { for (WaterOrder order : list) {
for (WaterOrderGoods waterOrderGood : waterOrderGoods) {
//转vo //转vo
WaterOrderVo waterOrderVo1 = new WaterOrderVo(); WaterOrderVo waterOrderVo1 = new WaterOrderVo();
BeanUtils.copyProperties(order,waterOrderVo1); BeanUtils.copyProperties(order,waterOrderVo1);
for (WaterOrderGoods waterOrderGood : waterOrderGoods) { if (waterOrderGood.getOrderId().equals(order.getId())){
if (order.getId().equals(waterOrderGood.getOrderId())){
waterOrderVo1.setWaterOrderGoods(waterOrderGood); waterOrderVo1.setWaterOrderGoods(waterOrderGood);
waterOrderVoList.add(waterOrderVo1); waterOrderVoList.add(waterOrderVo1);
} }
} }
} }
} }
for (WaterOrder waterOrder : list) {
boolean b = waterOrderVoList.stream().anyMatch(w -> w.getId().equals(waterOrder.getId()));
if (!b) {
//转vo
WaterOrderVo waterOrderVo1 = new WaterOrderVo();
BeanUtils.copyProperties(waterOrder,waterOrderVo1);
waterOrderVoList.add(waterOrderVo1);
}
}
// List<WaterOrderVo> waterOrderVoList1 = waterOrderVoList.stream().collect(Collectors.collectingAndThen(
// Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WaterOrderVo::getId))),
// ArrayList::new));
// //根据创建时间倒序排序
// List<WaterOrderVo> waterOrderVos = waterOrderVoList1.stream().sorted(Comparator.comparing(WaterOrderVo::getCreateTime).reversed()).collect(Collectors.toList());
// int i = 0;
// for (WaterOrderVo orderVo : waterOrderVos) {
// i ++;
// for (WaterOrderVo vo : waterOrderVoList) {
// if (orderVo.getId().equals(vo.getId())){
// vo.setXh(i);
// }
// }
// }
TableDataInfo tableDataInfo = getDataTable(waterOrderVoList); TableDataInfo tableDataInfo = getDataTable(waterOrderVoList);
tableDataInfo.setTotal(list.size()); tableDataInfo.setTotal(new PageInfo(list).getTotal());
return tableDataInfo; return tableDataInfo;
} }
...@@ -111,13 +138,14 @@ public class WaterOrderController extends BaseController ...@@ -111,13 +138,14 @@ public class WaterOrderController extends BaseController
if (detailsImgs.size() > 0){ if (detailsImgs.size() > 0){
waterOrderGood.setDetailsImgs(detailsImgs); waterOrderGood.setDetailsImgs(detailsImgs);
} }
waterOrderVo1.setWaterOrderGoods(waterOrderGood); waterOrderGoodsList.add(waterOrderGood);
waterOrderVoList.add(waterOrderVo1); // waterOrderVo1.setWaterOrderGoods(waterOrderGood);
// waterOrderVoList.add(waterOrderVo1);
} }
} }
// if (waterOrderGoodsList.size() > 0){ if (waterOrderGoodsList.size() > 0){
// waterOrderVo1.setWaterOrderGoodsList(waterOrderGoodsList); waterOrderVo1.setWaterOrderGoodsList(waterOrderGoodsList);
// } }
waterOrderVoList.add(waterOrderVo1); waterOrderVoList.add(waterOrderVo1);
} }
} }
...@@ -125,6 +153,14 @@ public class WaterOrderController extends BaseController ...@@ -125,6 +153,14 @@ public class WaterOrderController extends BaseController
} }
/** /**
* 查询用户订单数量
*/
@GetMapping("/getOrderNumByUser/{userId}")
public AjaxResult getOrderNumByUser(@PathVariable("userId") Long userId){
return success(waterOrderService.getOrderNumByUser(userId));
}
/**
* 导出订单列表 * 导出订单列表
*/ */
@Log(title = "订单", businessType = BusinessType.EXPORT) @Log(title = "订单", businessType = BusinessType.EXPORT)
...@@ -171,6 +207,7 @@ public class WaterOrderController extends BaseController ...@@ -171,6 +207,7 @@ public class WaterOrderController extends BaseController
*/ */
@Log(title = "订单", businessType = BusinessType.INSERT) @Log(title = "订单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@RepeatSubmit(message = "订单已提交,请勿重复操作!")
public AjaxResult add(@RequestBody WaterOrderVo waterOrderVo) public AjaxResult add(@RequestBody WaterOrderVo waterOrderVo)
{ {
return toAjax(waterOrderService.insertWaterOrder(waterOrderVo)); return toAjax(waterOrderService.insertWaterOrder(waterOrderVo));
...@@ -200,6 +237,7 @@ public class WaterOrderController extends BaseController ...@@ -200,6 +237,7 @@ public class WaterOrderController extends BaseController
* 修改订单状态 * 修改订单状态
*/ */
@PostMapping("/updateOrderState") @PostMapping("/updateOrderState")
@RepeatSubmit(message = "请勿重复操作!")
public AjaxResult updateOrderState(@RequestBody WaterOrderVo waterOrderVo){ public AjaxResult updateOrderState(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.updateOrderState(waterOrderVo)); return toAjax(waterOrderService.updateOrderState(waterOrderVo));
} }
...@@ -217,18 +255,17 @@ public class WaterOrderController extends BaseController ...@@ -217,18 +255,17 @@ public class WaterOrderController extends BaseController
*/ */
@GetMapping("/getWaterOrderListByStationId") @GetMapping("/getWaterOrderListByStationId")
public TableDataInfo getWaterOrderListByStationId(WaterOrderVo waterOrderVo){ public TableDataInfo getWaterOrderListByStationId(WaterOrderVo waterOrderVo){
//返回的订单列表
List<WaterOrderVo> waterOrderVoList = new ArrayList<>(); List<WaterOrderVo> list = waterOrderService.getWaterOrderListByStationId(waterOrderVo);
List<WaterOrder> list = waterOrderService.getWaterOrderListByStationId(waterOrderVo); //查询该站点所有订单
waterOrderVo.setPageNum(null);
List<WaterOrderVo> list1 = waterOrderService.getWaterOrderListByStationId(waterOrderVo);
//查询所有订单商品 //查询所有订单商品
List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods()); List<WaterOrderGoods> waterOrderGoods = waterOrderGoodsService.selectWaterOrderGoodsList(new WaterOrderGoods());
//查询所有商品图片 //查询所有商品图片
List<WaterGoodsImg> waterGoodsImgs = waterGoodsImgService.selectWaterGoodsImgList(new WaterGoodsImg()); List<WaterGoodsImg> waterGoodsImgs = waterGoodsImgService.selectWaterGoodsImgList(new WaterGoodsImg());
if (list.size() > 0){ if (list.size() > 0){
for (WaterOrder order : list) { for (WaterOrderVo order : list) {
//转vo
WaterOrderVo waterOrderVo1 = new WaterOrderVo();
BeanUtils.copyProperties(order,waterOrderVo1);
List<WaterOrderGoods> waterOrderGoodsList = new ArrayList<>(); List<WaterOrderGoods> waterOrderGoodsList = new ArrayList<>();
for (WaterOrderGoods waterOrderGood : waterOrderGoods) { for (WaterOrderGoods waterOrderGood : waterOrderGoods) {
if (order.getId().equals(waterOrderGood.getOrderId())){ if (order.getId().equals(waterOrderGood.getOrderId())){
...@@ -256,18 +293,23 @@ public class WaterOrderController extends BaseController ...@@ -256,18 +293,23 @@ public class WaterOrderController extends BaseController
} }
} }
if (waterOrderGoodsList.size() > 0){ if (waterOrderGoodsList.size() > 0){
waterOrderVo1.setWaterOrderGoodsList(waterOrderGoodsList); order.setWaterOrderGoodsList(waterOrderGoodsList);
} }
waterOrderVoList.add(waterOrderVo1);
} }
} }
return getDataTable(waterOrderVoList); TableDataInfo dataInfo = new TableDataInfo();
dataInfo.setRows(list);
dataInfo.setCode(HttpStatus.SUCCESS);
dataInfo.setMsg("查询成果");
dataInfo.setTotal(list1.size());
return dataInfo;
} }
/** /**
* 修改订单完成状态(送水端) * 修改订单完成状态(送水端)
*/ */
@PostMapping("/updateCompleteState") @PostMapping("/updateCompleteState")
@RepeatSubmit(message = "请勿重复操作!")
public AjaxResult updateCompleteState(@RequestBody WaterOrderVo waterOrderVo){ public AjaxResult updateCompleteState(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.updateCompleteState(waterOrderVo)); return toAjax(waterOrderService.updateCompleteState(waterOrderVo));
} }
...@@ -276,7 +318,34 @@ public class WaterOrderController extends BaseController ...@@ -276,7 +318,34 @@ public class WaterOrderController extends BaseController
* 修改订单确认状态(订水端) * 修改订单确认状态(订水端)
*/ */
@PostMapping("/updateConfirmState") @PostMapping("/updateConfirmState")
@RepeatSubmit(message = "请勿重复操作!")
public AjaxResult updateConfirmState(@RequestBody WaterOrderVo waterOrderVo){ public AjaxResult updateConfirmState(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.updateConfirmState(waterOrderVo)); return toAjax(waterOrderService.updateConfirmState(waterOrderVo));
} }
/**
* PC端首页统计订单数量
*/
@GetMapping("/countMonthOrderNum")
public AjaxResult countMonthOrderNum(){
return success(waterOrderService.countOrderNum());
}
/**
* 新增退款订单
*/
@PostMapping("/addReturnOrder")
@RepeatSubmit(message = "订单已提交,请勿重复操作!")
public AjaxResult addReturnOrder(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.addReturnOrder(waterOrderVo));
}
/**
* 修改待付款订单状态(订水端)
*/
@PostMapping("/updateOrderPayType")
@RepeatSubmit(message = "请勿重复操作!")
public AjaxResult updateOrderPayType(@RequestBody WaterOrderVo waterOrderVo){
return toAjax(waterOrderService.updateOrderPayType(waterOrderVo));
}
} }
package com.qianhe.system.controller; package com.qianhe.system.controller;
import com.github.pagehelper.PageInfo;
import com.qianhe.common.annotation.Log; import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController; import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult; import com.qianhe.common.core.domain.AjaxResult;
...@@ -59,7 +60,9 @@ public class WaterSpeController extends BaseController ...@@ -59,7 +60,9 @@ public class WaterSpeController extends BaseController
} }
waterSpeVoList.add(waterSpeVo); waterSpeVoList.add(waterSpeVo);
} }
return getDataTable(waterSpeVoList); TableDataInfo tableDataInfo = getDataTable(waterSpeVoList);
tableDataInfo.setTotal(new PageInfo(list).getTotal());
return tableDataInfo;
} }
/** /**
......
package com.qianhe.system.controller; package com.qianhe.system.controller;
import com.github.pagehelper.PageInfo;
import com.qianhe.common.annotation.Log; import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController; import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult; import com.qianhe.common.core.domain.AjaxResult;
...@@ -10,6 +11,7 @@ import com.qianhe.system.domain.WaterStation; ...@@ -10,6 +11,7 @@ import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.service.IWaterStationService; import com.qianhe.system.service.IWaterStationService;
import com.qianhe.system.service.IWaterStationUserService; import com.qianhe.system.service.IWaterStationUserService;
import com.qianhe.system.vo.WaterStationUserVo;
import com.qianhe.system.vo.WaterStationVo; import com.qianhe.system.vo.WaterStationVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,15 +47,15 @@ public class WaterStationController extends BaseController ...@@ -45,15 +47,15 @@ public class WaterStationController extends BaseController
List<WaterStationVo> waterStationVoList = new ArrayList<>(); List<WaterStationVo> waterStationVoList = new ArrayList<>();
//送水工列表 //送水工列表
List<WaterStationUser> waterStationUsers = waterStationUserService.selectWaterStationUserList(new WaterStationUser()); List<WaterStationUserVo> waterStationUsers = waterStationUserService.selectWaterStationUserList(new WaterStationUser());
for (WaterStation station : waterStations) { for (WaterStation station : waterStations) {
//送水工集合 //送水工集合
List<WaterStationUser> waterStationUserList = new ArrayList<>(); List<WaterStationUserVo> waterStationUserList = new ArrayList<>();
//转vo //转vo
WaterStationVo waterStationVo = new WaterStationVo(); WaterStationVo waterStationVo = new WaterStationVo();
BeanUtils.copyProperties(station,waterStationVo); BeanUtils.copyProperties(station,waterStationVo);
for (WaterStationUser waterStationUser : waterStationUsers) { for (WaterStationUserVo waterStationUser : waterStationUsers) {
if (station.getId().equals(waterStationUser.getStationId())){ if (station.getId().equals(waterStationUser.getStationId())){
waterStationUserList.add(waterStationUser); waterStationUserList.add(waterStationUser);
} }
...@@ -63,7 +65,9 @@ public class WaterStationController extends BaseController ...@@ -63,7 +65,9 @@ public class WaterStationController extends BaseController
} }
waterStationVoList.add(waterStationVo); waterStationVoList.add(waterStationVo);
} }
return getDataTable(waterStationVoList); TableDataInfo tableDataInfo = getDataTable(waterStationVoList);
tableDataInfo.setTotal(new PageInfo(waterStations).getTotal());
return tableDataInfo;
} }
/** /**
...@@ -128,10 +132,28 @@ public class WaterStationController extends BaseController ...@@ -128,10 +132,28 @@ public class WaterStationController extends BaseController
} }
/** /**
* 查询站点下拉框(PC端)
*/
@GetMapping("/getWaterStationList")
public AjaxResult getWaterStationList(){
return AjaxResult.success(waterStationService.getWaterStationList());
}
/**
* 查询站点下拉框 * 查询站点下拉框
*/ */
@GetMapping("/getStationList") @GetMapping("/getStationList")
public AjaxResult getStationList(){ public AjaxResult getStationList(@RequestParam("lon") double lon, @RequestParam("lat") double lat, String stationName){
return AjaxResult.success(waterStationService.getStationList()); return AjaxResult.success(waterStationService.getStationList(lon,lat,stationName));
}
/**
* 获取最近站点信息
*/
@GetMapping("/getRecentlyStation")
public AjaxResult getRecentlyStation(@RequestParam("lon") double lon, @RequestParam("lat") double lat){
WaterStationVo recentlyStation = waterStationService.getRecentlyStation(lon, lat);
return success(recentlyStation);
} }
} }
...@@ -8,6 +8,7 @@ import com.qianhe.common.enums.BusinessType; ...@@ -8,6 +8,7 @@ import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.poi.ExcelUtil; import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.service.IWaterStationUserService; import com.qianhe.system.service.IWaterStationUserService;
import com.qianhe.system.vo.WaterStationUserVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -35,7 +36,7 @@ public class WaterStationUserController extends BaseController ...@@ -35,7 +36,7 @@ public class WaterStationUserController extends BaseController
public TableDataInfo list(WaterStationUser waterStationUser) public TableDataInfo list(WaterStationUser waterStationUser)
{ {
startPage(); startPage();
List<WaterStationUser> list = waterStationUserService.selectWaterStationUserList(waterStationUser); List<WaterStationUserVo> list = waterStationUserService.selectWaterStationUserList(waterStationUser);
return getDataTable(list); return getDataTable(list);
} }
...@@ -46,8 +47,8 @@ public class WaterStationUserController extends BaseController ...@@ -46,8 +47,8 @@ public class WaterStationUserController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterStationUser waterStationUser) public void export(HttpServletResponse response, WaterStationUser waterStationUser)
{ {
List<WaterStationUser> list = waterStationUserService.selectWaterStationUserList(waterStationUser); List<WaterStationUserVo> list = waterStationUserService.selectWaterStationUserList(waterStationUser);
ExcelUtil<WaterStationUser> util = new ExcelUtil<WaterStationUser>(WaterStationUser.class); ExcelUtil<WaterStationUserVo> util = new ExcelUtil<WaterStationUserVo>(WaterStationUserVo.class);
util.exportExcel(response, list, "站点用户数据"); util.exportExcel(response, list, "站点用户数据");
} }
......
...@@ -31,7 +31,6 @@ public class WaterTextController extends BaseController ...@@ -31,7 +31,6 @@ public class WaterTextController extends BaseController
/** /**
* 查询通知公告文本列表 * 查询通知公告文本列表
*/ */
@PreAuthorize("@ss.hasPermi('system:text:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WaterText waterText) public TableDataInfo list(WaterText waterText)
{ {
...@@ -41,9 +40,18 @@ public class WaterTextController extends BaseController ...@@ -41,9 +40,18 @@ public class WaterTextController extends BaseController
} }
/** /**
* 查询通知公告文本列表(订水端)
*/
@GetMapping("/listDs")
public TableDataInfo listDs(WaterText waterText)
{
List<WaterText> list = waterTextService.selectWaterTextList(waterText);
return getDataTable(list);
}
/**
* 导出通知公告文本列表 * 导出通知公告文本列表
*/ */
@PreAuthorize("@ss.hasPermi('system:text:export')")
@Log(title = "通知公告文本", businessType = BusinessType.EXPORT) @Log(title = "通知公告文本", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, WaterText waterText) public void export(HttpServletResponse response, WaterText waterText)
...@@ -56,7 +64,6 @@ public class WaterTextController extends BaseController ...@@ -56,7 +64,6 @@ public class WaterTextController extends BaseController
/** /**
* 获取通知公告文本详细信息 * 获取通知公告文本详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:text:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -66,7 +73,6 @@ public class WaterTextController extends BaseController ...@@ -66,7 +73,6 @@ public class WaterTextController extends BaseController
/** /**
* 新增通知公告文本 * 新增通知公告文本
*/ */
@PreAuthorize("@ss.hasPermi('system:text:add')")
@Log(title = "通知公告文本", businessType = BusinessType.INSERT) @Log(title = "通知公告文本", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WaterText waterText) public AjaxResult add(@RequestBody WaterText waterText)
...@@ -77,7 +83,6 @@ public class WaterTextController extends BaseController ...@@ -77,7 +83,6 @@ public class WaterTextController extends BaseController
/** /**
* 修改通知公告文本 * 修改通知公告文本
*/ */
@PreAuthorize("@ss.hasPermi('system:text:edit')")
@Log(title = "通知公告文本", businessType = BusinessType.UPDATE) @Log(title = "通知公告文本", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WaterText waterText) public AjaxResult edit(@RequestBody WaterText waterText)
...@@ -88,7 +93,6 @@ public class WaterTextController extends BaseController ...@@ -88,7 +93,6 @@ public class WaterTextController extends BaseController
/** /**
* 删除通知公告文本 * 删除通知公告文本
*/ */
@PreAuthorize("@ss.hasPermi('system:text:remove')")
@Log(title = "通知公告文本", businessType = BusinessType.DELETE) @Log(title = "通知公告文本", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
......
...@@ -19,9 +19,11 @@ import com.qianhe.system.service.impl.WaterUserServiceImpl; ...@@ -19,9 +19,11 @@ import com.qianhe.system.service.impl.WaterUserServiceImpl;
import com.qianhe.system.utils.SsAccessTokenUtils; import com.qianhe.system.utils.SsAccessTokenUtils;
import com.qianhe.system.utils.SsWxUserInfoUtils; import com.qianhe.system.utils.SsWxUserInfoUtils;
import com.qianhe.system.utils.WxUserInfoUtils; import com.qianhe.system.utils.WxUserInfoUtils;
import com.qianhe.system.vo.WaterStationUserVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -118,11 +120,30 @@ public class SsWxLogin { ...@@ -118,11 +120,30 @@ public class SsWxLogin {
map.put("userType",waterUser.getUserType()); map.put("userType",waterUser.getUserType());
map.put("userGender",waterUser.getUserGender()); map.put("userGender",waterUser.getUserGender());
//查询送水工站点信息 //查询送水工站点信息
WaterStationUser waterStationUser = waterStationUserService.selectWaterStationUserByPhone(waterUser.getPhoneNum()); WaterStationUserVo waterStationUser = waterStationUserService.selectWaterStationUserByPhone(waterUser.getPhoneNum());
if (StringUtils.isNull(waterStationUser)){ if (StringUtils.isNull(waterStationUser)){
throw new ServiceException("未查询到您管理的站点信息,请联系管理员!"); throw new ServiceException("未查询到您管理的站点信息,请联系管理员!");
} }
map.put("waterStationUser",waterStationUser); map.put("waterStationUser",waterStationUser);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
/**
* 自定义退出登录
*/
@GetMapping("/logout")
public AjaxResult logout(HttpServletRequest request) {
String mpToken = mpTokenService.getToken(request);
MpLoginUser loginUser = mpTokenService.getMpLoginUser(mpToken);
if (StringUtils.isNotNull(loginUser))
{
String userName = loginUser.getNickName();
// 删除用户缓存记录
mpTokenService.delMpLoginUser(loginUser.getMpToken());
// 记录用户退出日志
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功"));
}
return AjaxResult.success("退出成功");
}
} }
...@@ -17,6 +17,7 @@ import com.qianhe.system.utils.WxUserInfoUtils; ...@@ -17,6 +17,7 @@ import com.qianhe.system.utils.WxUserInfoUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -113,4 +114,23 @@ public class WxLogin { ...@@ -113,4 +114,23 @@ public class WxLogin {
map.put("userGender",waterUser.getUserGender()); map.put("userGender",waterUser.getUserGender());
return AjaxResult.success(map); return AjaxResult.success(map);
} }
/**
* 自定义退出登录
*/
@GetMapping("/logout")
public AjaxResult logout(HttpServletRequest request) {
String mpToken = mpTokenService.getToken(request);
MpLoginUser loginUser = mpTokenService.getMpLoginUser(mpToken);
if (StringUtils.isNotNull(loginUser))
{
String userName = loginUser.getNickName();
// 删除用户缓存记录
mpTokenService.delMpLoginUser(loginUser.getMpToken());
// 记录用户退出日志
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功"));
}
return AjaxResult.success("退出成功");
}
} }
...@@ -17,7 +17,7 @@ import java.util.Date; ...@@ -17,7 +17,7 @@ import java.util.Date;
* @date 2023-11-23 * @date 2023-11-23
*/ */
@Data @Data
public class WaterOrder public class WaterOrder extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -83,6 +83,9 @@ public class WaterOrder ...@@ -83,6 +83,9 @@ public class WaterOrder
@Excel(name = "站点详细地址") @Excel(name = "站点详细地址")
private String stationAddress; private String stationAddress;
/** 订单商品分类(1商品页,2购物车) */
private Integer orderGoodsType;
/** 订单状态(1待付款2待接单3进行中4已完成5已取消6已退款) */ /** 订单状态(1待付款2待接单3进行中4已完成5已取消6已退款) */
@Excel(name = "订单状态(1待付款2待接单3进行中4已完成5已取消6已退款)") @Excel(name = "订单状态(1待付款2待接单3进行中4已完成5已取消6已退款)")
private Integer orderState; private Integer orderState;
......
...@@ -15,7 +15,6 @@ public class WaterText extends BaseEntity ...@@ -15,7 +15,6 @@ public class WaterText extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id; private Long id;
/** 标题(首页公告,用户协议,隐私政策,关于我们) */ /** 标题(首页公告,用户协议,隐私政策,关于我们) */
......
...@@ -54,4 +54,11 @@ public interface WaterGoodsCartMapper { ...@@ -54,4 +54,11 @@ public interface WaterGoodsCartMapper {
* @return * @return
*/ */
int deleteWaterGoodsCartByIds(Long[] ids); int deleteWaterGoodsCartByIds(Long[] ids);
/**
* 根据购物车id查询购物车商品
* @param ids
* @return
*/
List<WaterGoodsCart> selectWaterGoodsCartByIds(Long[] ids);
} }
...@@ -107,4 +107,10 @@ public interface WaterGoodsMapper ...@@ -107,4 +107,10 @@ public interface WaterGoodsMapper
* @param list * @param list
*/ */
void batchInsertWaterGoodsImgs(List<WaterGoodsImg> list); void batchInsertWaterGoodsImgs(List<WaterGoodsImg> list);
/**
* 水票商品信息
* @return
*/
WaterGoods selectGoodsSp();
} }
...@@ -3,6 +3,7 @@ package com.qianhe.system.mapper; ...@@ -3,6 +3,7 @@ package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterOrder; import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.domain.WaterOrderGoods; import com.qianhe.system.domain.WaterOrderGoods;
import com.qianhe.system.vo.WaterOrderVo; import com.qianhe.system.vo.WaterOrderVo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -106,5 +107,25 @@ public interface WaterOrderMapper ...@@ -106,5 +107,25 @@ public interface WaterOrderMapper
* @param waterOrderVo 订单 * @param waterOrderVo 订单
* @return 订单集合 * @return 订单集合
*/ */
public List<WaterOrder> getWaterOrderListByStationId(WaterOrderVo waterOrderVo); public List<WaterOrderVo> getWaterOrderListByStationId(WaterOrderVo waterOrderVo);
Map<String,Integer> getOrderNumByUser(WaterOrderVo waterOrderVo);
/**
* 查询今天和昨天的所有订单
*/
List<WaterOrder> selectOrderListByTime();
/**
* 统计每月普通订单
* @return
*/
List<Map<String, Integer>> countOrderNumByPt(@Param("year") int year);
/**
* 统计每月退款呢订单
* @return
*/
List<Map<String, Integer>> countOrderNumByTk(@Param("year") int year);
} }
...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper; ...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper;
import com.qianhe.system.domain.WaterStation; import com.qianhe.system.domain.WaterStation;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.vo.WaterStationUserVo;
import com.qianhe.system.vo.WaterStationVo; import com.qianhe.system.vo.WaterStationVo;
import java.util.List; import java.util.List;
...@@ -36,7 +37,7 @@ public interface WaterStationMapper ...@@ -36,7 +37,7 @@ public interface WaterStationMapper
* *
* @return 站点集合 * @return 站点集合
*/ */
public List<Map<String,Object>> getStationList(); public List<WaterStation> getStationList(WaterStation waterStation);
/** /**
* 新增站点 * 新增站点
...@@ -75,7 +76,7 @@ public interface WaterStationMapper ...@@ -75,7 +76,7 @@ public interface WaterStationMapper
* @param waterStationUsers * @param waterStationUsers
* @return * @return
*/ */
void batchInsertStationUser(List<WaterStationUser> waterStationUsers); void batchInsertStationUser(List<WaterStationUserVo> waterStationUsers);
/** /**
* 删除站点用户 * 删除站点用户
...@@ -88,4 +89,5 @@ public interface WaterStationMapper ...@@ -88,4 +89,5 @@ public interface WaterStationMapper
* @param ids * @param ids
*/ */
void deleteWaterStationUserByStationIds(Long[] ids); void deleteWaterStationUserByStationIds(Long[] ids);
} }
...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper; ...@@ -2,6 +2,7 @@ package com.qianhe.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.vo.WaterStationUserVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -28,7 +29,7 @@ public interface WaterStationUserMapper extends BaseMapper<WaterStationUser> ...@@ -28,7 +29,7 @@ public interface WaterStationUserMapper extends BaseMapper<WaterStationUser>
* @param waterStationUser 站点用户 * @param waterStationUser 站点用户
* @return 站点用户集合 * @return 站点用户集合
*/ */
public List<WaterStationUser> selectWaterStationUserList(WaterStationUser waterStationUser); public List<WaterStationUserVo> selectWaterStationUserList(WaterStationUser waterStationUser);
/** /**
* 新增站点用户 * 新增站点用户
...@@ -67,5 +68,5 @@ public interface WaterStationUserMapper extends BaseMapper<WaterStationUser> ...@@ -67,5 +68,5 @@ public interface WaterStationUserMapper extends BaseMapper<WaterStationUser>
* @param phone * @param phone
* @return * @return
*/ */
WaterStationUser selectWaterStationUserByPhone(@Param("phone") Long phone); WaterStationUserVo selectWaterStationUserByPhone(@Param("phone") Long phone);
} }
...@@ -40,4 +40,11 @@ public interface IWaterGoodsCartService { ...@@ -40,4 +40,11 @@ public interface IWaterGoodsCartService {
* @return * @return
*/ */
int deleteWaterGoodsCartByIds(Long[] ids); int deleteWaterGoodsCartByIds(Long[] ids);
/**
* 根据购物车id查询购物车商品
* @param ids
* @return
*/
List<WaterGoodsCart> selectWaterGoodsCartByIds(Long[] ids);
} }
...@@ -63,4 +63,17 @@ public interface IWaterGoodsService ...@@ -63,4 +63,17 @@ public interface IWaterGoodsService
* @return 结果 * @return 结果
*/ */
public int deleteWaterGoodsById(Long id); public int deleteWaterGoodsById(Long id);
/**
* 水票商品信息
* @return
*/
WaterGoodsVo getGoodsSp();
/**
* 获取选中的商品信息
* @param waterGoodsVo
* @return
*/
WaterGoodsVo getGoodsXq(WaterGoodsVo waterGoodsVo);
} }
package com.qianhe.system.service; package com.qianhe.system.service;
import com.qianhe.system.domain.WaterGoodsSpe; import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.vo.WaterGoodsSpeVo; import com.qianhe.system.vo.WaterGoodsSpeVo;
import java.util.List; import java.util.List;
...@@ -60,4 +61,12 @@ public interface IWaterGoodsSpeService ...@@ -60,4 +61,12 @@ public interface IWaterGoodsSpeService
* @return 结果 * @return 结果
*/ */
public int deleteWaterGoodsSpeById(Long id); public int deleteWaterGoodsSpeById(Long id);
/**
* 查询商品关联规格值列表
*
* @param waterGoodsSpeVal 商品关联规格值
* @return 商品关联规格值集合
*/
public List<WaterGoodsSpeVal> selectWaterGoodsSpeValList(WaterGoodsSpeVal waterGoodsSpeVal);
} }
...@@ -48,6 +48,14 @@ public interface IWaterOrderService ...@@ -48,6 +48,14 @@ public interface IWaterOrderService
public int updateWaterOrder(WaterOrderVo waterOrderVo); public int updateWaterOrder(WaterOrderVo waterOrderVo);
/** /**
* 修改订单
*
* @param waterOrderVo 订单
* @return 结果
*/
public int updateWaterOrder1(WaterOrderVo waterOrderVo);
/**
* 批量删除订单 * 批量删除订单
* *
* @param ids 需要删除的订单主键集合 * @param ids 需要删除的订单主键集合
...@@ -83,7 +91,7 @@ public interface IWaterOrderService ...@@ -83,7 +91,7 @@ public interface IWaterOrderService
* @param waterOrderVo 订单 * @param waterOrderVo 订单
* @return 订单集合 * @return 订单集合
*/ */
public List<WaterOrder> getWaterOrderListByStationId(WaterOrderVo waterOrderVo); public List<WaterOrderVo> getWaterOrderListByStationId(WaterOrderVo waterOrderVo);
/** /**
* 修改订单完成状态(送水端) * 修改订单完成状态(送水端)
...@@ -98,4 +106,31 @@ public interface IWaterOrderService ...@@ -98,4 +106,31 @@ public interface IWaterOrderService
* @return * @return
*/ */
int updateConfirmState(WaterOrderVo waterOrderVo); int updateConfirmState(WaterOrderVo waterOrderVo);
Map<String,Integer> getOrderNumByUser(Long userId);
/**
* 查询今天和昨天的所有订单
*/
List<WaterOrder> selectOrderListByTime();
/**
* PC端首页统计
* @return
*/
List<Map<String,Integer>> countOrderNum();
/**
* 新增退款订单
* @param waterOrderVo
* @return
*/
int addReturnOrder(WaterOrderVo waterOrderVo);
/**
* 修改待付款订单状态(订水端)
* @param waterOrderVo
* @return
*/
int updateOrderPayType(WaterOrderVo waterOrderVo);
} }
...@@ -74,5 +74,20 @@ public interface IWaterStationService ...@@ -74,5 +74,20 @@ public interface IWaterStationService
* *
* @return 站点集合 * @return 站点集合
*/ */
public List<Map<String,Object>> getStationList(); public List<WaterStationVo> getStationList(double lon, double lat,String stationName);
/**
* 查询最新站点
* @param lon
* @param lat
* @return
*/
WaterStationVo getRecentlyStation(double lon, double lat);
/**
* 查询站点下拉框(PC端)
* @return
*/
List<WaterStation> getWaterStationList();
} }
...@@ -2,6 +2,7 @@ package com.qianhe.system.service; ...@@ -2,6 +2,7 @@ package com.qianhe.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.vo.WaterStationUserVo;
import java.util.List; import java.util.List;
...@@ -27,7 +28,7 @@ public interface IWaterStationUserService extends IService<WaterStationUser> ...@@ -27,7 +28,7 @@ public interface IWaterStationUserService extends IService<WaterStationUser>
* @param waterStationUser 站点用户 * @param waterStationUser 站点用户
* @return 站点用户集合 * @return 站点用户集合
*/ */
public List<WaterStationUser> selectWaterStationUserList(WaterStationUser waterStationUser); public List<WaterStationUserVo> selectWaterStationUserList(WaterStationUser waterStationUser);
/** /**
* 新增站点用户 * 新增站点用户
...@@ -67,5 +68,5 @@ public interface IWaterStationUserService extends IService<WaterStationUser> ...@@ -67,5 +68,5 @@ public interface IWaterStationUserService extends IService<WaterStationUser>
* @param phone 站点用户手机号 * @param phone 站点用户手机号
* @return 站点用户 * @return 站点用户
*/ */
public WaterStationUser selectWaterStationUserByPhone(Long phone); public WaterStationUserVo selectWaterStationUserByPhone(Long phone);
} }
...@@ -109,4 +109,14 @@ public class WaterGoodsCartServiceImpl implements IWaterGoodsCartService { ...@@ -109,4 +109,14 @@ public class WaterGoodsCartServiceImpl implements IWaterGoodsCartService {
public int deleteWaterGoodsCartByIds(Long[] ids) { public int deleteWaterGoodsCartByIds(Long[] ids) {
return waterGoodsCartMapper.deleteWaterGoodsCartByIds(ids); return waterGoodsCartMapper.deleteWaterGoodsCartByIds(ids);
} }
/**
* 根据购物车id查询购物车商品
* @param ids
* @return
*/
@Override
public List<WaterGoodsCart> selectWaterGoodsCartByIds(Long[] ids) {
return waterGoodsCartMapper.selectWaterGoodsCartByIds(ids);
}
} }
...@@ -2,6 +2,7 @@ package com.qianhe.system.service.impl; ...@@ -2,6 +2,7 @@ package com.qianhe.system.service.impl;
import com.qianhe.common.utils.DateUtils; import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.WaterGoodsSpe; import com.qianhe.system.domain.WaterGoodsSpe;
import com.qianhe.system.domain.WaterGoodsSpeVal;
import com.qianhe.system.mapper.WaterGoodsSpeMapper; import com.qianhe.system.mapper.WaterGoodsSpeMapper;
import com.qianhe.system.service.IWaterGoodsSpeService; import com.qianhe.system.service.IWaterGoodsSpeService;
import com.qianhe.system.vo.WaterGoodsSpeVo; import com.qianhe.system.vo.WaterGoodsSpeVo;
...@@ -94,4 +95,14 @@ public class WaterGoodsSpeServiceImpl implements IWaterGoodsSpeService ...@@ -94,4 +95,14 @@ public class WaterGoodsSpeServiceImpl implements IWaterGoodsSpeService
{ {
return waterGoodsSpeMapper.deleteWaterGoodsSpeById(id); return waterGoodsSpeMapper.deleteWaterGoodsSpeById(id);
} }
/**
* 查询商品关联规格值列表
* @param waterGoodsSpeVal 商品关联规格值
* @return
*/
@Override
public List<WaterGoodsSpeVal> selectWaterGoodsSpeValList(WaterGoodsSpeVal waterGoodsSpeVal) {
return waterGoodsSpeMapper.selectWaterGoodsSpeValList(waterGoodsSpeVal);
}
} }
...@@ -7,15 +7,20 @@ import com.qianhe.system.domain.WaterStationUser; ...@@ -7,15 +7,20 @@ import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.mapper.WaterStationMapper; import com.qianhe.system.mapper.WaterStationMapper;
import com.qianhe.system.mapper.WaterStationUserMapper; import com.qianhe.system.mapper.WaterStationUserMapper;
import com.qianhe.system.service.IWaterStationService; import com.qianhe.system.service.IWaterStationService;
import com.qianhe.system.utils.PositionUtil;
import com.qianhe.system.vo.WaterStationUserVo;
import com.qianhe.system.vo.WaterStationVo; import com.qianhe.system.vo.WaterStationVo;
import org.gavaghan.geodesy.Ellipsoid;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 站点Service业务层处理 * 站点Service业务层处理
...@@ -48,7 +53,7 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -48,7 +53,7 @@ public class WaterStationServiceImpl implements IWaterStationService
//查询站点用户 //查询站点用户
WaterStationUser waterStationUser = new WaterStationUser(); WaterStationUser waterStationUser = new WaterStationUser();
waterStationUser.setStationId(id); waterStationUser.setStationId(id);
List<WaterStationUser> waterStationUsers = waterStationUserMapper.selectWaterStationUserList(waterStationUser); List<WaterStationUserVo> waterStationUsers = waterStationUserMapper.selectWaterStationUserList(waterStationUser);
if (waterStationUsers.size() > 0){ if (waterStationUsers.size() > 0){
waterStationVo.setWaterStationUserList(waterStationUsers); waterStationVo.setWaterStationUserList(waterStationUsers);
} }
...@@ -128,13 +133,13 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -128,13 +133,13 @@ public class WaterStationServiceImpl implements IWaterStationService
private void insertWaterStationUser(WaterStationVo waterStationVo) { private void insertWaterStationUser(WaterStationVo waterStationVo) {
//送水工集合 //送水工集合
List<WaterStationUser> waterStationUserList = waterStationVo.getWaterStationUserList(); List<WaterStationUserVo> waterStationUserList = waterStationVo.getWaterStationUserList();
List<WaterStationUser> waterStationUsers = new ArrayList<>(); List<WaterStationUserVo> waterStationUsers = new ArrayList<>();
//站点主键id //站点主键id
Long id = waterStationVo.getId(); Long id = waterStationVo.getId();
if (StringUtils.isNotNull(waterStationUserList) && waterStationUserList.size() > 0){ if (StringUtils.isNotNull(waterStationUserList) && waterStationUserList.size() > 0){
for (WaterStationUser waterStationUser : waterStationUserList) { for (WaterStationUserVo waterStationUser : waterStationUserList) {
waterStationUser.setStationId(id); waterStationUser.setStationId(id);
waterStationUser.setCreateTime(DateUtils.getNowDate()); waterStationUser.setCreateTime(DateUtils.getNowDate());
waterStationUser.setCreateUser("管理员"); waterStationUser.setCreateUser("管理员");
...@@ -189,7 +194,66 @@ public class WaterStationServiceImpl implements IWaterStationService ...@@ -189,7 +194,66 @@ public class WaterStationServiceImpl implements IWaterStationService
* @return * @return
*/ */
@Override @Override
public List<Map<String, Object>> getStationList() { public List<WaterStationVo> getStationList(double lon, double lat, String stationName) {
return waterStationMapper.getStationList(); WaterStation waterStation1 = new WaterStation();
if (StringUtils.isNotEmpty(stationName)){
waterStation1.setStationName(stationName);
}
List<WaterStation> stationList = waterStationMapper.getStationList(waterStation1);
List<WaterStationVo> waterStationVoList = new ArrayList<>();
//计算距离
for (WaterStation waterStation : stationList) {
//计算距离
double distance = PositionUtil.getDistance(lon, lat, waterStation.getStationLonTen(), waterStation.getStationLatTen(), Ellipsoid.WGS84);
//换算成千米
double distance1 = distance / 1000;
WaterStationVo waterStationVo = new WaterStationVo();
BeanUtils.copyProperties(waterStation,waterStationVo);
waterStationVo.setDistance(distance1);
waterStationVoList.add(waterStationVo);
}
//根据距离升序排序
List<WaterStationVo> collect = waterStationVoList.stream().sorted(Comparator.comparing(WaterStationVo::getDistance)).collect(Collectors.toList());
//根据营业状态降序排序
List<WaterStationVo> waterStationVos = collect.stream().sorted(Comparator.comparing(WaterStationVo::getIsOpen).reversed()).collect(Collectors.toList());
return waterStationVos;
}
/**
* 查询最近站点
* @param lon
* @param lat
* @return
*/
@Override
public WaterStationVo getRecentlyStation(double lon, double lat) {
//查询所有站点信息
List<WaterStation> waterStations = waterStationMapper.selectWaterStationList(new WaterStation());
List<WaterStationVo> waterStationVoList = new ArrayList<>();
//循环站点,计算符合距离的站点
for (WaterStation waterStation : waterStations) {
//判断用户和站点之前的距离是否在站点管辖范围之内
boolean inCircle = PositionUtil.isInCircle(lon, lat, waterStation.getStationLonTen(), waterStation.getStationLatTen(), "5000");
//计算距离
double distance = PositionUtil.getDistance(lon, lat, waterStation.getStationLonTen(), waterStation.getStationLatTen(), Ellipsoid.WGS84);
if (inCircle){
WaterStationVo waterStationVo = new WaterStationVo();
BeanUtils.copyProperties(waterStation,waterStationVo);
waterStationVo.setDistance(distance);
waterStationVoList.add(waterStationVo);
}
}
//根据距离排序,选出最近的站点
List<WaterStationVo> collect = waterStationVoList.stream().sorted(Comparator.comparing(WaterStationVo::getDistance)).collect(Collectors.toList());
return collect.get(0);
}
/**
* 查询站点下拉框(PC端)
* @return
*/
@Override
public List<WaterStation> getWaterStationList() {
return waterStationMapper.getStationList(new WaterStation());
} }
} }
...@@ -5,6 +5,7 @@ import com.qianhe.common.utils.DateUtils; ...@@ -5,6 +5,7 @@ import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.WaterStationUser; import com.qianhe.system.domain.WaterStationUser;
import com.qianhe.system.mapper.WaterStationUserMapper; import com.qianhe.system.mapper.WaterStationUserMapper;
import com.qianhe.system.service.IWaterStationUserService; import com.qianhe.system.service.IWaterStationUserService;
import com.qianhe.system.vo.WaterStationUserVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -41,7 +42,7 @@ public class WaterStationUserServiceImpl extends ServiceImpl<WaterStationUserMap ...@@ -41,7 +42,7 @@ public class WaterStationUserServiceImpl extends ServiceImpl<WaterStationUserMap
* @return 站点用户 * @return 站点用户
*/ */
@Override @Override
public List<WaterStationUser> selectWaterStationUserList(WaterStationUser waterStationUser) public List<WaterStationUserVo> selectWaterStationUserList(WaterStationUser waterStationUser)
{ {
return waterStationUserMapper.selectWaterStationUserList(waterStationUser); return waterStationUserMapper.selectWaterStationUserList(waterStationUser);
} }
...@@ -102,7 +103,7 @@ public class WaterStationUserServiceImpl extends ServiceImpl<WaterStationUserMap ...@@ -102,7 +103,7 @@ public class WaterStationUserServiceImpl extends ServiceImpl<WaterStationUserMap
* @return * @return
*/ */
@Override @Override
public WaterStationUser selectWaterStationUserByPhone(Long phone) { public WaterStationUserVo selectWaterStationUserByPhone(Long phone) {
return waterStationUserMapper.selectWaterStationUserByPhone(phone); return waterStationUserMapper.selectWaterStationUserByPhone(phone);
} }
} }
package com.qianhe.system.task;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.WaterOrder;
import com.qianhe.system.service.IWaterOrderService;
import com.qianhe.system.vo.WaterOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Component("waterTask")
public class WaterTask {
@Autowired
private IWaterOrderService waterOrderService;
/**
* 修改订单状态
*/
public void updateOrderState(){
//查询今天和昨天所有的订单
List<WaterOrder> waterOrders = waterOrderService.selectOrderListByTime();
//循环计算所有超过12小时的订单
for (WaterOrder waterOrder : waterOrders) {
//判断该订单是退款订单还是普通订单
if (waterOrder.getOrderType() == 1){
// 计算差值并转换为小时数
long difference = waterOrder.getCreateTime().getTime() - DateUtils.getNowDate().getTime();
long hours = difference / (60 * 60 * 1000);
//判断该订单是否已超过十二小时
if (hours > 12){
//普通订单,修改订单状态为已完成
//判断送水工是否点击已送达
if (waterOrder.getCompleteState() == 1){
WaterOrderVo waterOrderVo = new WaterOrderVo();
waterOrderVo.setId(waterOrder.getId());
waterOrderVo.setOrderState(4);
waterOrderVo.setConfirmState(1);
waterOrderVo.setFinishTime(DateUtils.getNowDate());
waterOrderService.updateWaterOrder1(waterOrderVo);
}
}
}else {
//退款订单
// 计算差值并转换为小时数
long difference = waterOrder.getCreateTime().getTime() - DateUtils.getNowDate().getTime();
long hours = difference / (60 * 60 * 1000);
//判断退款订单是否超过二十四小时
if (hours > 24){
//退款订单,修改订单状态为已退款
//判断送水工是否点击已退款
if (waterOrder.getCompleteState() == 2){
WaterOrderVo waterOrderVo = new WaterOrderVo();
waterOrderVo.setId(waterOrder.getId());
waterOrderVo.setOrderState(6);
waterOrderVo.setConfirmState(2);
waterOrderVo.setFinishTime(DateUtils.getNowDate());
waterOrderService.updateWaterOrder1(waterOrderVo);
}
}
}
}
}
}
package com.qianhe.system.utils;
import com.idrsolutions.image.png.PngCompressor;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.imageio.*;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.FileImageOutputStream;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Random;
import java.util.zip.GZIPOutputStream;
import static com.qianhe.common.utils.file.MimeTypeUtils.IMAGE_PNG;
/**
* 图片压缩工具
*/
@Component
public class ImageThumbnailsUtil {
@Value("${ruoyi.profile}")
private String profile;
/***
* 压缩jpg、jpeg格式图片
* @param inputImagePath
* @param outputImagePath
* @throws IOException
*/
public void compressImage(String inputImagePath, String outputImagePath) throws IOException{
// 指定原始图片路径
inputImagePath = profile + inputImagePath.replace("/profile","");
// 设置目标图片保存路径及名称
outputImagePath = profile + outputImagePath.replace("/profile","");
// 创建输入流对象
FileInputStream fis = new FileInputStream(new File(inputImagePath));
// 获取图片信息
BufferedImage image = ImageIO.read(fis);
// 创建输出流对象
FileOutputStream fos = new FileOutputStream(new File(outputImagePath));
// 将图片写入到输出流中并进行压缩处理
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
encoder.encode(image);
// 关闭输入、输出流
fis.close();
fos.close();
}
/***
* 压缩PNG格式图片
* @param inputImagePath
* @param outputImagePath
* @throws IOException
*/
public void compressImagePNG(String inputImagePath, String outputImagePath) throws IOException{
// 指定原始图片路径
inputImagePath = profile + inputImagePath.replace("/profile","");
outputImagePath = profile + outputImagePath.replace("/profile","");
File file = new File(inputImagePath); // 源文件
File outfile = new File(outputImagePath); // 目标输出文件,可与源文件一致,一致会覆盖
PngCompressor.compress(file, outfile);
}
}
package com.qianhe.system.utils;
import com.qianhe.common.utils.StringUtils;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.stereotype.Component;
/**
* 坐标位置相关util
*/
@Component
public class PositionUtil {
/**
* 方法四:(利用第三方jar包计算)
* 计算两个经纬度之间的距离
*
* @param longitude1 第一点的经度
* @param latitude1 第一点的纬度
* @param longitude2 第二点的经度
* @param latitude2 第二点的纬度
* @param ellipsoid 计算方式
* @return 返回的距离,单位m
*/
public static double getDistance(double longitude1, double latitude1, double longitude2, double latitude2, Ellipsoid ellipsoid) {
// 创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离
GlobalCoordinates firstPoint = new GlobalCoordinates(latitude1, longitude1);
GlobalCoordinates secondPoint = new GlobalCoordinates(latitude2, longitude2);
GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, firstPoint, secondPoint);
return geoCurve.getEllipsoidalDistance();
}
/**
* 判断坐标点是否在圆形区域内
* 计算这个坐标点和圆心点之间的距离,然后跟圆的半径进行比较,如果比半径大,就不在圆形区域内,如果小于等于圆的半径,则该坐标点在圆形区域内
*
* @param longitude1 第一点的经度
* @param latitude1 第一点的纬度
* @param longitude2 第二点的经度
* @param latitude2 第二点的纬度
* @param radius 圆形范围半径(单位:米)
* @return true:不在区域内; false:在区域内
*/
public static boolean isInCircle(double longitude1, double latitude1, double longitude2, double latitude2, String radius) {
if (StringUtils.isBlank(radius)) {
throw new RuntimeException("请输入范围半径");
}
return getDistance(longitude1, latitude1, longitude2, latitude2,Ellipsoid.WGS84) > Double.parseDouble(radius);
}
}
package com.qianhe.system.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.system.domain.WaterGoodsImg;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class WaterGoodsCartVo {
/** 主键id */
private Long id;
/** 订单商品类型 */
private Integer orderGoodsType;
/** 用户id */
private Long userId;
/** 商品id */
private Long goodsId;
/** 商品名称 */
private String goodsName;
/** 商品名称 */
private String title;
/** 商品分类id */
private Long goodsTypeId;
/** 商品分类名称 */
private String goodsTypeName;
/** 商品规格id */
private String goodsSpeId;
/** 商品规格值id */
private String goodsSpeValId;
/** 商品规格详情 */
private String goodsSpeVal;
/** 商品价格 */
private BigDecimal goodsPrice;
/** 商品价格 */
private BigDecimal price;
/** 商品数量 */
private Integer goodsNum;
/** 商品总价 */
private BigDecimal goodsTotal;
/** 是否选中(1是,0否) */
private String isSelect;
/** 上架状态 */
private String status;
/** 创建人 */
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 封面图集合 */
private List<WaterGoodsImg> coverImgs;
/** 详情图集合 */
private List<WaterGoodsImg> detailsImgs;
/** 商品关联规格集合 */
private WaterGoodsSpeVo waterGoodsSpe;
}
...@@ -17,6 +17,12 @@ public class WaterGoodsVo { ...@@ -17,6 +17,12 @@ public class WaterGoodsVo {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** 订单商品类型 */
private Integer orderGoodsType;
/** 商品id */
private Long goodsId;
/** 标题 */ /** 标题 */
@Excel(name = "标题") @Excel(name = "标题")
private String title; private String title;
...@@ -49,6 +55,9 @@ public class WaterGoodsVo { ...@@ -49,6 +55,9 @@ public class WaterGoodsVo {
@Excel(name = "价格") @Excel(name = "价格")
private BigDecimal price; private BigDecimal price;
/** 商品数量 */
private Integer goodsNum;
/** 销量 */ /** 销量 */
@Excel(name = "销量") @Excel(name = "销量")
private String volume; private String volume;
...@@ -70,6 +79,15 @@ public class WaterGoodsVo { ...@@ -70,6 +79,15 @@ public class WaterGoodsVo {
/** 详情图集合 */ /** 详情图集合 */
private List<WaterGoodsImg> detailsImgs; private List<WaterGoodsImg> detailsImgs;
/** 商品规格id */
private String goodsSpeId;
/** 商品规格值id */
private String goodsSpeValId;
/** 商品规格详情 */
private String goodsSpeVal;
/** 商品关联规格集合 */ /** 商品关联规格集合 */
private WaterGoodsSpeVo waterGoodsSpe; private WaterGoodsSpeVo waterGoodsSpe;
} }
...@@ -14,6 +14,9 @@ public class WaterOrderVo { ...@@ -14,6 +14,9 @@ public class WaterOrderVo {
private Long id; private Long id;
/** 序号 */
private Integer xh;
/** 用户id */ /** 用户id */
private Long userId; private Long userId;
...@@ -25,7 +28,6 @@ public class WaterOrderVo { ...@@ -25,7 +28,6 @@ public class WaterOrderVo {
@Excel(name = "订单编号", needMerge = true) @Excel(name = "订单编号", needMerge = true)
private String orderNum; private String orderNum;
/** 用户手机号 */ /** 用户手机号 */
private Long userPhone; private Long userPhone;
...@@ -67,6 +69,9 @@ public class WaterOrderVo { ...@@ -67,6 +69,9 @@ public class WaterOrderVo {
@Excel(name = "支付方式", readConverterExp = "1=银行支付,2=水票支付", needMerge = true) @Excel(name = "支付方式", readConverterExp = "1=银行支付,2=水票支付", needMerge = true)
private Integer payType; private Integer payType;
/** 订单商品分类(1商品页,2购物车) */
private Integer orderGoodsType;
/** 订单状态(1待付款2待接单3进行中4已完成5已取消6已退款) */ /** 订单状态(1待付款2待接单3进行中4已完成5已取消6已退款) */
@Excel(name = "订单状态", readConverterExp = "1=待付款,2=待接单,3=进行中,4=已完成,5=已取消,6=已退款", needMerge = true) @Excel(name = "订单状态", readConverterExp = "1=待付款,2=待接单,3=进行中,4=已完成,5=已取消,6=已退款", needMerge = true)
private Integer orderState; private Integer orderState;
...@@ -118,7 +123,7 @@ public class WaterOrderVo { ...@@ -118,7 +123,7 @@ public class WaterOrderVo {
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",needMerge = true)
private Date createTime; private Date createTime;
/** 创建人 */ /** 创建人 */
......
package com.qianhe.system.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class WaterStationUserVo {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 年龄 */
@Excel(name = "年龄")
private Long age;
/** 性别 */
@Excel(name = "性别")
private Long gender;
/** 手机号 */
@Excel(name = "手机号")
private Long phone;
/** 身份证号 */
@Excel(name = "身份证号")
private String idNum;
/** 站点id */
@Excel(name = "站点id")
private Long stationId;
/** 站点名称 */
private String stationName;
/** 创建人 */
@Excel(name = "创建人")
private String createUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
...@@ -63,6 +63,9 @@ public class WaterStationVo { ...@@ -63,6 +63,9 @@ public class WaterStationVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 距离(单位:米)*/
private double distance;
/** 送水工集合 */ /** 送水工集合 */
private List<WaterStationUser> waterStationUserList; private List<WaterStationUserVo> waterStationUserList;
} }
...@@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null"> and user_id = #{userId}</if> <if test="userId != null"> and user_id = #{userId}</if>
<if test="goodsId != null "> and goods_id = #{goodsId}</if> <if test="goodsId != null "> and goods_id = #{goodsId}</if>
<if test="goodsName != null "> and goods_name like concat('%', #{goodsName}, '%')</if> <if test="goodsName != null "> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="goodsSpeId != null and goodsSpeId != ''">and goods_spe_id = #{goodsSpeId}</if>
<if test="goodsSpeValId != null and goodsSpeValId != ''">and goods_spe_val_id = #{goodsSpeValId}</if>
</where> </where>
order by create_time DESC order by create_time DESC
</select> </select>
...@@ -45,6 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -45,6 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectWaterGoodsCartByIds" parameterType="String" resultMap="WaterGoodsCartResult">
<include refid="selectWaterGoodsCartVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertWaterGoodsCart" parameterType="WaterGoodsCart" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWaterGoodsCart" parameterType="WaterGoodsCart" useGeneratedKeys="true" keyProperty="id">
insert into water_goods_cart insert into water_goods_cart
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWaterGoodsVo"/> <include refid="selectWaterGoodsVo"/>
<where> <where>
del_flag = '0' del_flag = '0'
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="goodsTypeId != null "> and goods_type_id = #{goodsTypeId}</if> <if test="goodsTypeId != null "> and goods_type_id = #{goodsTypeId}</if>
<if test="belongStationId != null "> and belong_station_id like concat('%', #{belongStationId}, '%')</if> <if test="belongStationId != null "> and belong_station_id like concat('%', #{belongStationId}, '%')</if>
<if test="coverImg != null and coverImg != ''"> and cover_img = #{coverImg}</if> <if test="coverImg != null and coverImg != ''"> and cover_img = #{coverImg}</if>
...@@ -40,7 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,7 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterGoodsList1" resultMap="WaterGoodsResult"> <select id="selectWaterGoodsList1" resultMap="WaterGoodsResult">
select url cover_img from water_goods_img where img_type = 1 and goods_id = (select id from water_goods where title = '主页轮播图') -- select url cover_img from water_goods_img where img_type = 1 and goods_id = (select id from water_goods where title = '主页轮播图')
select url cover_img from water_goods_img where del_flag = '0'
and goods_id in (SELECT id from water_goods WHERE del_flag = '0'
AND goods_type_id in (select id from water_goods_type where del_flag = '0' and type_name = '主页轮播图'))
</select> </select>
<select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult"> <select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult">
...@@ -157,4 +160,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -157,4 +160,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.imgName}, #{item.url}, #{item.imgType}, #{item.goodsId}) (#{item.imgName}, #{item.url}, #{item.imgType}, #{item.goodsId})
</foreach> </foreach>
</insert> </insert>
<select id="selectGoodsSp" resultMap="WaterGoodsResult">
<include refid="selectWaterGoodsVo"/>
WHERE del_flag = '0' AND goods_type_id
IN (SELECT id FROM water_goods_type WHERE del_flag = '0' AND type_name like concat('%', '水票', '%')) order by create_time DESC LIMIT 1
</select>
</mapper> </mapper>
...@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="stationCity" column="station_city" /> <result property="stationCity" column="station_city" />
<result property="stationArea" column="station_area" /> <result property="stationArea" column="station_area" />
<result property="stationAddress" column="station_address" /> <result property="stationAddress" column="station_address" />
<result property="orderGoodsType" column="order_goods_type" />
<result property="orderState" column="order_state" /> <result property="orderState" column="order_state" />
<result property="completeState" column="complete_state" /> <result property="completeState" column="complete_state" />
<result property="confirmState" column="confirm_state" /> <result property="confirmState" column="confirm_state" />
...@@ -50,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -50,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWaterOrderVo"> <sql id="selectWaterOrderVo">
select id, order_num, user_id, user_name, user_phone, user_province, user_city, user_area, user_address, station_id, station_name, station_phone, station_province, station_city, station_area, station_address, order_state, complete_state, confirm_state, pay_state, pay_type, pay_num, cancel_result, user_address_id, name, province, city, area, address, mobile, deliever_time, deliever_name, deliever_mobile, create_time, create_user, deliever_over, take_time, finish_time, remark, goods_val, order_type, return_order_result from water_order select id, order_num, user_id, user_name, user_phone, user_province, user_city, user_area, user_address, station_id, station_name, station_phone, station_province, station_city, station_area, station_address, order_goods_type, order_state, complete_state, confirm_state, pay_state, pay_type, pay_num, cancel_result, user_address_id, name, province, city, area, address, mobile, deliever_time, deliever_name, deliever_mobile, create_time, create_user, deliever_over, take_time, finish_time, remark, goods_val, order_type, return_order_result from water_order
</sql> </sql>
<select id="selectWaterOrderList" parameterType="com.qianhe.system.vo.WaterOrderVo" resultMap="WaterOrderResult"> <select id="selectWaterOrderList" parameterType="com.qianhe.system.vo.WaterOrderVo" resultMap="WaterOrderResult">
...@@ -72,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -72,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stationCity != null and stationCity != ''"> and station_city = #{stationCity}</if> <if test="stationCity != null and stationCity != ''"> and station_city = #{stationCity}</if>
<if test="stationArea != null and stationArea != ''"> and station_area = #{stationArea}</if> <if test="stationArea != null and stationArea != ''"> and station_area = #{stationArea}</if>
<if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if> <if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if>
<if test="orderGoodsType != null "> and order_goods_type = #{orderGoodsType}</if>
<if test="orderState != null "> and order_state = #{orderState}</if> <if test="orderState != null "> and order_state = #{orderState}</if>
<if test="completeState != null "> and complete_state = #{completeState}</if> <if test="completeState != null "> and complete_state = #{completeState}</if>
<if test="confirmState != null "> and confirm_state = #{confirmState}</if> <if test="confirmState != null "> and confirm_state = #{confirmState}</if>
...@@ -101,14 +103,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -101,14 +103,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time DESC order by create_time DESC
</select> </select>
<select id="getWaterOrderListByStationId" parameterType="com.qianhe.system.vo.WaterOrderVo" resultMap="WaterOrderResult"> <select id="getWaterOrderListByStationId" parameterType="com.qianhe.system.vo.WaterOrderVo" resultType="com.qianhe.system.vo.WaterOrderVo">
<include refid="selectWaterOrderVo"/> <include refid="selectWaterOrderVo"/>
<where> <where>
del_flag = '0' and order_state != 1 del_flag = '0' and order_state != 1
<if test="stationId != null "> and station_id = #{stationId}</if> <if test="stationId != null "> and station_id = #{stationId}</if>
<if test="orderState != null "> and order_state = #{orderState}</if> <if test="orderState != null and orderState != ''"> and order_state = #{orderState}</if>
</where> </where>
order by create_time DESC limit #{pageNum} order by create_time DESC
<if test="pageNum != null"> limit #{pageNum}</if>
</select> </select>
<select id="selectWaterOrderById" parameterType="Long" resultMap="WaterOrderResult"> <select id="selectWaterOrderById" parameterType="Long" resultMap="WaterOrderResult">
...@@ -131,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -131,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userArea != null">user_area,</if> <if test="userArea != null">user_area,</if>
<if test="userAddress != null">user_address,</if> <if test="userAddress != null">user_address,</if>
<if test="stationId != null">station_id,station_name,station_phone,station_province,station_city,station_area,station_address,</if> <if test="stationId != null">station_id,station_name,station_phone,station_province,station_city,station_area,station_address,</if>
<if test="orderGoodsType != null">order_goods_type,</if>
<if test="orderState != null">order_state,</if> <if test="orderState != null">order_state,</if>
<if test="completeState != null">complete_state,</if> <if test="completeState != null">complete_state,</if>
<if test="confirmState != null">confirm_state,</if> <if test="confirmState != null">confirm_state,</if>
...@@ -169,6 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -169,6 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(select area from water_station where id = #{stationId}), (select area from water_station where id = #{stationId}),
(select station_address from water_station where id = #{stationId}), (select station_address from water_station where id = #{stationId}),
</if> </if>
<if test="orderGoodsType != null">#{orderGoodsType},</if>
<if test="orderState != null">#{orderState},</if> <if test="orderState != null">#{orderState},</if>
<if test="completeState != null">#{completeState},</if> <if test="completeState != null">#{completeState},</if>
<if test="confirmState != null">#{confirmState},</if> <if test="confirmState != null">#{confirmState},</if>
...@@ -221,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -221,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
station_area = (select area from water_station where id = #{stationId}), station_area = (select area from water_station where id = #{stationId}),
station_address = (select station_address from water_station where id = #{stationId}), station_address = (select station_address from water_station where id = #{stationId}),
</if> </if>
<if test="orderGoodsType != null">order_goods_type = #{orderGoodsType},</if>
<if test="orderState != null">order_state = #{orderState},</if> <if test="orderState != null">order_state = #{orderState},</if>
<if test="completeState != null">complete_state = #{completeState},</if> <if test="completeState != null">complete_state = #{completeState},</if>
<if test="confirmState != null">confirm_state = #{confirmState},</if> <if test="confirmState != null">confirm_state = #{confirmState},</if>
...@@ -292,4 +298,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -292,4 +298,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM `water_order` FROM `water_order`
WHERE del_flag = '0' and station_id = #{stationId} and order_state != 1 and DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d'); WHERE del_flag = '0' and station_id = #{stationId} and order_state != 1 and DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d');
</select> </select>
<select id="getOrderNumByUser" parameterType="com.qianhe.system.vo.WaterOrderVo" resultType="Map">
SELECT COUNT(id) as orderNum FROM `water_order` WHERE del_flag = '0' AND user_id = #{userId} AND order_state = #{orderState};
</select>
<!--查询今天和昨天的所有订单-->
<select id="selectOrderListByTime" resultMap="WaterOrderResult">
<include refid="selectWaterOrderVo"/>
WHERE del_flag = '0' AND DATE(create_time) = CURDATE() OR DATE(create_time) = CURDATE() - INTERVAL 1 DAY;
</select>
<!--统计每月普通订单数量-->
<select id="countOrderNumByPt" parameterType="Integer" resultType="Map">
SELECT MONTH(create_time) AS month, COUNT(*) as count
FROM water_order WHERE order_type = '1' AND YEAR(create_time) = #{year}
GROUP BY MONTH(create_time);
</select>
<!--统计每月退款订单数量-->
<select id="countOrderNumByTk" parameterType="Integer" resultType="Map">
SELECT MONTH(create_time) AS month, COUNT(*) as count
FROM water_order WHERE order_type = '2' AND YEAR(create_time) = #{year}
GROUP BY MONTH(create_time);
</select>
</mapper> </mapper>
...@@ -43,8 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -43,8 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time DESC order by create_time DESC
</select> </select>
<select id="getStationList" resultType="Map"> <select id="getStationList" parameterType="WaterStation" resultMap="WaterStationResult">
select id as stationId, station_name as stationName from water_station where del_flag = '0' select id, station_name, phone_num, station_address, station_lon, station_lon_ten,station_lat,station_lat_ten,
create_time, province, city, area, is_open, create_user
from water_station where del_flag = '0'
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
</select> </select>
<select id="selectWaterStationById" parameterType="Long" resultMap="WaterStationResult"> <select id="selectWaterStationById" parameterType="Long" resultMap="WaterStationResult">
...@@ -92,10 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -92,10 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stationName != null">station_name = #{stationName},</if> <if test="stationName != null">station_name = #{stationName},</if>
<if test="phoneNum != null">phone_num = #{phoneNum},</if> <if test="phoneNum != null">phone_num = #{phoneNum},</if>
<if test="stationAddress != null">station_address = #{stationAddress},</if> <if test="stationAddress != null">station_address = #{stationAddress},</if>
<if test="stationLon != null">station_lon = #{stationLon},</if> <if test="stationLon != null and stationLon != 0.0">station_lon = #{stationLon},</if>
<if test="stationLonTen != null">station_lon_ten = #{stationLonTen},</if> <if test="stationLonTen != null and stationLonTen != 0.0">station_lon_ten = #{stationLonTen},</if>
<if test="stationLat != null">station_lat = #{stationLat},</if> <if test="stationLat != null and stationLat != 0.0">station_lat = #{stationLat},</if>
<if test="stationLatTen != null">station_lat_ten = #{stationLatTen},</if> <if test="stationLatTen != null and stationLatTen != 0.0">station_lat_ten = #{stationLatTen},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="province != null">province = #{province},</if> <if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if> <if test="city != null">city = #{city},</if>
......
...@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qianhe.system.mapper.WaterStationUserMapper"> <mapper namespace="com.qianhe.system.mapper.WaterStationUserMapper">
<resultMap type="WaterStationUser" id="WaterStationUserResult"> <resultMap type="com.qianhe.system.vo.WaterStationUserVo" id="WaterStationUserResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="age" column="age" /> <result property="age" column="age" />
...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="idNum" column="id_num" /> <result property="idNum" column="id_num" />
<result property="stationId" column="station_id" /> <result property="stationId" column="station_id" />
<result property="stationName" column="station_name" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="createUser" column="create_user" /> <result property="createUser" column="create_user" />
</resultMap> </resultMap>
...@@ -21,23 +22,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,23 +22,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectWaterStationUserList" parameterType="WaterStationUser" resultMap="WaterStationUserResult"> <select id="selectWaterStationUserList" parameterType="WaterStationUser" resultMap="WaterStationUserResult">
<include refid="selectWaterStationUserVo"/> select su.id, su.name, su.age, su.gender, su.phone, su.id_num, su.station_id, s.station_name, su.create_time, su.create_user
from water_station_user su LEFT JOIN water_station s ON s.id = su.station_id
<where> <where>
del_flag = '0' su.del_flag = '0'
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and su.name like concat('%', #{name}, '%')</if>
<if test="age != null "> and age = #{age}</if> <if test="age != null "> and su.age = #{age}</if>
<if test="gender != null "> and gender = #{gender}</if> <if test="gender != null "> and su.gender = #{gender}</if>
<if test="phone != null "> and phone = #{phone}</if> <if test="phone != null "> and su.phone = #{phone}</if>
<if test="idNum != null and idNum != ''"> and id_num = #{idNum}</if> <if test="idNum != null and idNum != ''"> and su.id_num = #{idNum}</if>
<if test="stationId != null "> and station_id = #{stationId}</if> <if test="stationId != null "> and su.station_id = #{stationId}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if> <if test="createUser != null and createUser != ''"> and su.create_user = #{createUser}</if>
</where> </where>
order by create_time DESC order by su.create_time DESC
</select> </select>
<select id="selectWaterStationUserById" parameterType="Long" resultMap="WaterStationUserResult"> <select id="selectWaterStationUserById" parameterType="Long" resultMap="WaterStationUserResult">
<include refid="selectWaterStationUserVo"/> select su.id, su.name, su.age, su.gender, su.phone, su.id_num, su.station_id, s.station_name, su.create_time, su.create_user
where id = #{id} from water_station_user su LEFT JOIN water_station s ON s.id = su.station_id
where su.id = #{id}
</select> </select>
<select id="selectWaterStationUserByPhone" parameterType="Long" resultMap="WaterStationUserResult"> <select id="selectWaterStationUserByPhone" parameterType="Long" resultMap="WaterStationUserResult">
......
...@@ -18,9 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -18,9 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterTextList" parameterType="WaterText" resultMap="WaterTextResult"> <select id="selectWaterTextList" parameterType="WaterText" resultMap="WaterTextResult">
<include refid="selectWaterTextVo"/> <include refid="selectWaterTextVo"/>
<where> <where>
del_flag = '0'
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if> <if test="content != null and content != ''"> and content = #{content}</if>
</where> </where>
order by create_time DESC
</select> </select>
<select id="selectWaterTextById" parameterType="Long" resultMap="WaterTextResult"> <select id="selectWaterTextById" parameterType="Long" resultMap="WaterTextResult">
...@@ -52,14 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -52,14 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteWaterTextById" parameterType="Long"> <update id="deleteWaterTextById" parameterType="Long">
delete from water_text where id = #{id} update water_text set del_flag = '1' where id = #{id}
</delete> </update>
<delete id="deleteWaterTextByIds" parameterType="String"> <update id="deleteWaterTextByIds" parameterType="String">
delete from water_text where id in update water_text set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
</mapper> </mapper>
...@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getUserDefaultAddress" parameterType="Long" resultMap="WaterUserAddressResult"> <select id="getUserDefaultAddress" parameterType="Long" resultMap="WaterUserAddressResult">
<include refid="selectWaterUserAddressVo"/> <include refid="selectWaterUserAddressVo"/>
where water_user_id = #{userId} and is_default = '1' where del_flag = '0' and water_user_id = #{userId} and is_default = '1'
</select> </select>
<insert id="insertWaterUserAddress" parameterType="WaterUserAddress" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWaterUserAddress" parameterType="WaterUserAddress" useGeneratedKeys="true" keyProperty="id">
......
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