From 5cc9058fb151d4285eb9d5e521060b57abf2d6c0 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 28 Jan 2021 15:07:18 +0800 Subject: [PATCH] Merge branch 'api' of https://gitee.com/jyyforjava/zq-erp into api --- zq-erp/src/main/resources/templates/views/admin/hive/statistics/jyls.html | 306 +++++++++ zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java | 68 -- zq-erp/src/main/java/com/matrix/system/hive/dto/OrderFlowListDto.java | 126 +++ zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java | 13 zq-erp/src/main/java/com/matrix/system/hive/statistics/ServiceStatisticsAction.java | 1 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html | 34 zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/jyls.html | 332 ++++++++++ zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java | 61 - zq-erp/src/main/java/com/matrix/system/hive/statistics/OrderFlowAction.java | 137 ++++ zq-erp/src/main/resources/templates/views/admin/hive/statistics/statistics-projSercice-item.html | 17 zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/statistics-projSercice-item.html | 12 zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml | 11 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html | 9 zq-erp/src/main/java/com/matrix/system/hive/service/MoneyCardUseService.java | 6 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml | 2 zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java | 11 zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml | 4 zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml | 104 +++ zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java | 39 - zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java | 5 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 5 zq-erp/src/main/resources/static/js/systools/AjaxProxyVue.js | 11 zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java | 11 zq-erp/src/main/resources/static/css/styleOne/style.min.css | 9 zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java | 21 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml | 61 + zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 192 ++--- zq-erp/src/main/java/com/matrix/system/hive/action/TaocanController.java | 24 zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java | 3 zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java | 5 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java | 83 -- zq-erp/src/main/java/com/matrix/system/hive/vo/OrderFlowVo.java | 152 ++++ zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml | 5 zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java | 14 zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderFlowDao.java | 6 zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java | 15 36 files changed, 1,435 insertions(+), 480 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java index 4238207..d9285cb 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java +++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java @@ -42,7 +42,6 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; @@ -131,7 +130,7 @@ if (CollectionUtils.isNotEmpty(serviceTcVos)) { serviceTcVos.forEach(item -> { - List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId()); + List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus()); List<ServiceProjVo> taocanProj = SysProjUseMapper.INSTANCE.entityListToProjVoList(sysProjUses); item.setProj(taocanProj); }); diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java index 97cf6ed..acb73b6 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java @@ -55,9 +55,10 @@ @Resource private SysVipInfoService vipInfoService; - @Autowired + @Resource private MoneyCardUseFlowDao moneyCardUseFlowDao; - @Autowired + + @Resource private MoneyCardUseDao moneyCardUseDao; @@ -76,20 +77,9 @@ @RequestMapping(value = "/editFormCz") public String editFormCz(Long id) { MoneyCardUse cardUseInfo = cardUseService.findByVipId(id); - if (cardUseInfo == null) { - cardUseInfo = new MoneyCardUse(); - cardUseInfo.setVipId(id); - cardUseInfo.setCardName("储值卡"); - cardUseInfo.setIsVipCar(Dictionary.FLAG_YES_Y); - cardUseInfo.setRealMoney(0D); - cardUseInfo.setGiftMoney(0D); - cardUseInfo.setSource("-"); - cardUseInfo.setFailTime(DateUtil.stringToDate("2050-01-01 00:00",DateUtil.DATE_FORMAT_MM)); - cardUseInfo.setStatus(Dictionary.MONEYCARD_STATUS_YX); - moneyCardUseDao.insert(cardUseInfo); + cardUseInfo=vipInfoService.addVipDefaultCard(id); } - WebUtil.getRequest().setAttribute("obj", cardUseInfo); return "admin/hive/beautySalon/cz-form"; } @@ -381,57 +371,7 @@ return new AjaxResult(AjaxResult.STATUS_FAIL, "冻结失败"); } - /** - * 退款 - * - * @return - */ - @RequestMapping(value = "getEffectCard") - public @ResponseBody - AjaxResult getEffectCard(MoneyCardUse moneyCardUse) { - AjaxResult result = AjaxResult.buildSuccessInstance(""); - //要退款的充值卡 - MoneyCardUse srcCardUse = cardUseService.findById(moneyCardUse.getId()); - if (!srcCardUse.getStatus().equals(Dictionary.TAOCAN_STATUS_YX)) { - throw new GlobleException("不是有效充值卡"); - } - //该会员是否有有效会籍卡 - MoneyCardUse targetCardUse = cardUseService.findByVipId(moneyCardUse.getVipId()); - double money = srcCardUse.getRealMoney(); - if (targetCardUse != null) { - targetCardUse.setRealMoney(money); - List<MoneyCardUse> list = Arrays.asList(targetCardUse); - if (targetCardUse.getId().equals(srcCardUse.getId())) { - result.setInfo("会籍卡退款只能退现金"); - result.setRows(list); - - } else { - result.setInfo("有有效会籍卡"); - result.setRows(list); - } - } else { - //无会员卡则new一个,为了把钱传递到前台 - targetCardUse = new MoneyCardUse(); - targetCardUse.setRealMoney(money); - List<MoneyCardUse> list1 = Arrays.asList(targetCardUse); - result.setInfo("无有效会籍卡,退现金"); - result.setRows(list1); - } - return result; - } - - @RequestMapping(value = "/returnMoney") - public @ResponseBody - AjaxResult returnMoney(MoneyCardUse moneyCardUse, Long hjkId, String tcRemark, Long - shopId, Double money - , String tcName) { - int i = cardUseService.returnMoney(moneyCardUse, hjkId); - if (i > 0) { - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功"); - } - return new AjaxResult(AjaxResult.STATUS_FAIL, "冻结失败"); - } } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java index 7289374..ffe1a96 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java @@ -293,16 +293,7 @@ MoneyCardUse cardUseInfo = cardUseService.findByVipId(order.getVipId()); if (cardUseInfo == null) { - cardUseInfo = new MoneyCardUse(); - cardUseInfo.setVipId(order.getVipId()); - cardUseInfo.setCardName("储值卡"); - cardUseInfo.setIsVipCar(Dictionary.FLAG_YES_Y); - cardUseInfo.setRealMoney(0D); - cardUseInfo.setGiftMoney(0D); - cardUseInfo.setSource("-"); - cardUseInfo.setStatus(Dictionary.MONEYCARD_STATUS_YX); - cardUseInfo.setFailTime(DateUtil.stringToDate("2050-01-01 00:00",DateUtil.DATE_FORMAT_MM)); - moneyCardUseDao.insert(cardUseInfo); + cardUseInfo=sysVipInfoService.addVipDefaultCard(order.getVipId()); } //打印需求加入门店信息 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java index 47a0a16..6da4382 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java @@ -18,11 +18,8 @@ import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; -import com.matrix.core.tools.DateUtil; -import com.matrix.system.hive.pojo.TaoCanVo; import com.matrix.system.hive.service.*; import org.apache.commons.collections.CollectionUtils; -import org.jsoup.helper.DataUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -197,7 +194,7 @@ queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); List<SysProjUse> taoCanList = projUseService.findInPage(queryUse, null); taoCanList.forEach(item->{ - item.setTaocanProjUse(projUseService.selectTaocanProjUse(item.getId())); + item.setTaocanProjUse(projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus())); item.setProjInfo(shoppingGoodsDao.selectById(item.getProjId())); }); result.putInMap("projList", projList); diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java index 1f50192..29c757c 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java @@ -168,21 +168,7 @@ return new AjaxResult(AjaxResult.STATUS_FAIL, "项目转让失败"); } - @RequestMapping(value = "/returnProj") - public @ResponseBody - AjaxResult returnTc(SysProjUse sysProjUse, Long moneyCardUseId, String tcRemark, Long shopId, Double money, String tcName) { - MoneyCardUse card = null; - if (moneyCardUseId != null) { - card = moneyCardUseService.findById(moneyCardUseId); - } - int i = projUseService.returnMoneyProj(sysProjUse, card, moneyCardUseId); - if (i > 0) { - - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功"); - } - return new AjaxResult(AjaxResult.STATUS_FAIL, "退款失败"); - } /** @@ -203,31 +189,6 @@ } - /** - * 退款 - * - * @return - */ - @RequestMapping(value = "/getEffectCard") - public @ResponseBody - AjaxResult getEffectCard(SysProjUse sysProjUse) { - MoneyCardUse cardUse = moneyCardUseService.findByVipId(sysProjUse.getVipId()); - double money = projUseService.getTotalMoneyProj(sysProjUse); - if (cardUse != null) { - cardUse.setRealMoney(money); - List<MoneyCardUse> list = new ArrayList<MoneyCardUse>(); - list.add(cardUse); - return new AjaxResult(AjaxResult.STATUS_SUCCESS, null, "有有效会籍卡", list, null); - } else { - //无会员卡则new一个,为了把钱传递到前台 - cardUse = new MoneyCardUse(); - cardUse.setRealMoney(money); - List<MoneyCardUse> list = new ArrayList<MoneyCardUse>(); - list.add(cardUse); - return new AjaxResult(AjaxResult.STATUS_SUCCESS, null, "无有效会籍卡", list, null); - } - - } /** * 冻结会员项目 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/TaocanController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/TaocanController.java index e221d43..ded5549 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/TaocanController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/TaocanController.java @@ -65,7 +65,7 @@ List<SysProjUse> projUseList =sysProjUseService.findInPage(sysProjUse,null); //设置套餐中的项目 projUseList.forEach(taocanProjUse -> { - taocanProjUse.setTaocanProjUse(sysProjUseService.selectTaocanProjUse(taocanProjUse.getId())); + taocanProjUse.setTaocanProjUse(sysProjUseService.selectTaocanProjUse(taocanProjUse.getId(),sysProjUse.getStatus())); }); return new AjaxResult(AjaxResult.STATUS_SUCCESS, projUseList, sysProjUseService.findTotal(sysProjUse)); } @@ -123,21 +123,7 @@ return new AjaxResult(AjaxResult.STATUS_FAIL, "套餐转让失败"); } - @RequestMapping(value = "/returnTc") - public @ResponseBody - AjaxResult returnTc(SysProjUse sysProjUse, Long moneyCardUseId, String tcRemark, Long shopId, Double money, String tcName) { - System.out.println("moneyCardUseId = " + moneyCardUseId); - MoneyCardUse card = moneyCardUseService.findById(moneyCardUseId); - System.out.println("card = " + card); - int i = sysProjUseService.returnMoneyTc(sysProjUse, card, moneyCardUseId); - if (i > 0) { - - - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功"); - } - return new AjaxResult(AjaxResult.STATUS_FAIL, "退款失败"); - } /** @@ -158,11 +144,7 @@ } - /** - * 退款 - * - * @return - */ + @RequestMapping(value = "/getEffectCard") public @ResponseBody AjaxResult getEffectCard(SysProjUse sysProjUse) { @@ -194,7 +176,7 @@ public String editForm(Long id) { if (id != null) { SysProjUse sysProjUse = sysProjUseService.findById(id); - sysProjUse.setTaocanProjUse(sysProjUseService.selectTaocanProjUse(sysProjUse.getId())); + sysProjUse.setTaocanProjUse(sysProjUseService.selectTaocanProjUse(sysProjUse.getId(), sysProjUse.getStatus())); WebUtil.getRequest().setAttribute("obj", sysProjUse); } return "admin/hive/vip/tc-form"; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java index 99d661c..5c37494 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java @@ -77,6 +77,11 @@ * 充值卡的id */ private Long goodsId; + + /** + * 订单ID + */ + private Long orderId; private Long vipId; @@ -88,7 +93,7 @@ private String isOver; /** - * 是会籍卡? Y 是,N否 + * 是默认储值卡? Y 是,N否 */ private String isVipCar; /** @@ -105,6 +110,14 @@ */ private String cardName; + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + public String getCardName() { return cardName; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java index 7450dda..94b8b15 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java @@ -63,6 +63,12 @@ private Long orderItemId; /** + * 订单id + */ + @Extend + private Long orderId; + + /** * 单次扣减金额(理解为单次手工业绩) * =订单金额/订单数量 * 如果是赠送则等于产品原价,业绩记录为赠销 @@ -138,6 +144,14 @@ private String updateRemark; + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + public String getUpdateRemark() { return updateRemark; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderFlowDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderFlowDao.java index 4486858..12411f9 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderFlowDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderFlowDao.java @@ -1,6 +1,8 @@ package com.matrix.system.hive.dao; import com.matrix.system.hive.bean.SysOrderFlow; +import com.matrix.system.hive.dto.OrderFlowListDto; +import com.matrix.system.hive.vo.OrderFlowVo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,4 +14,8 @@ public List<SysOrderFlow> selectByOrderId(@Param("orderId") Long orderId); public List<SysOrderFlow> selectPayMethodsAmountByOrderId(@Param("orderId") Long orderId); + + List<OrderFlowVo> selectInPage(@Param("record") OrderFlowListDto orderFlowListDto); + + Integer selectTotal(@Param("record")OrderFlowListDto orderFlowListDto); } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dto/OrderFlowListDto.java b/zq-erp/src/main/java/com/matrix/system/hive/dto/OrderFlowListDto.java new file mode 100644 index 0000000..b5d05a3 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/dto/OrderFlowListDto.java @@ -0,0 +1,126 @@ +package com.matrix.system.hive.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.matrix.core.pojo.PaginationDto; +import com.matrix.core.pojo.PaginationVO; +import com.matrix.core.tools.DateUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * @author jyy + * @date 2021-01-27 + **/ +@ApiModel(value = "OrderFlowListDto", description = "交易流水查询参数") +public class OrderFlowListDto extends PaginationDto { + + + @ApiModelProperty(value = "客户姓名/拼音/手机") + private String queryKey; + + @ApiModelProperty(value ="操作人") + private String oprationMan; + + @ApiModelProperty(value ="订单号") + private String orderNo; + + @ApiModelProperty(value ="交易类型") + private String flowType; + + + @ApiModelProperty(value ="支付方式") + private String payMethod; + + + @JsonFormat(pattern = DateUtil.DATE_FORMAT_DD, timezone = "GMT+8") + @ApiModelProperty(value = "查询参数开始时间", example = "2021-01-10") + private Date startTime; + + + @JsonFormat(pattern = DateUtil.DATE_FORMAT_DD, timezone = "GMT+8") + @ApiModelProperty(value = "查询参数结束时间", example = "2021-01-10") + private Date endTime; + + @ApiModelProperty(hidden = true) + private Long shopId; + + + @ApiModelProperty(hidden = true) + private Long companyId; + + + public String getQueryKey() { + return queryKey; + } + + public void setQueryKey(String queryKey) { + this.queryKey = queryKey; + } + + public String getOprationMan() { + return oprationMan; + } + + public void setOprationMan(String oprationMan) { + this.oprationMan = oprationMan; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getFlowType() { + return flowType; + } + + public void setFlowType(String flowType) { + this.flowType = flowType; + } + + public String getPayMethod() { + return payMethod; + } + + public void setPayMethod(String payMethod) { + this.payMethod = payMethod; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Long getShopId() { + return shopId; + } + + public void setShopId(Long shopId) { + this.shopId = shopId; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/MoneyCardUseService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/MoneyCardUseService.java index cc80452..c677c7b 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/MoneyCardUseService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/MoneyCardUseService.java @@ -93,11 +93,7 @@ */ public void transfer(MoneyCardUse moneyCardUse, Long vipId2, Double money); - /** - * 退款 - * jyy - */ - public int returnMoney(MoneyCardUse moneyCardUse, Long hjkId); + /** * 设置为有效 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java index 82f5810..df034a0 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java @@ -94,12 +94,7 @@ public int invalidTc(SysProjUse sysProjUse); - /** - * 退款 - * @param sysProjUse - * @return - */ - public int returnMoneyTc(SysProjUse sysProjUse, MoneyCardUse cardUse, Long moneyCardUseId); + /** * 设置为有效套餐 * @param proj @@ -134,28 +129,16 @@ /** - * 退款 - * @param sysProjUse - * @return - */ - public int returnMoneyProj(SysProjUse sysProjUse, MoneyCardUse cardUse, Long moneyCardUseId); - /** * 设置为有效套餐 * @param proj * @return */ public AjaxResult activeProj(SysProjUse proj); - /** - * 退款项目 - * @param sysProjUse - * @return - */ - public double getTotalMoneyProj(SysProjUse sysProjUse); public int updateProjUseTck(SysProjUse projUse); - public List<SysProjUse> selectTaocanProjUse(Long id); + public List<SysProjUse> selectTaocanProjUse(Long id, String status); } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java index 5d024d7..0d5f436 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java @@ -6,14 +6,13 @@ import com.matrix.system.app.dto.VipInfoListDto; import com.matrix.system.app.vo.VipInfoDetailVo; import com.matrix.system.app.vo.VipInfoListVo; +import com.matrix.system.hive.bean.MoneyCardUse; import com.matrix.system.hive.bean.SysVipInfo; import com.matrix.system.hive.plugin.util.BaseServices; import com.matrix.system.hive.pojo.VipInfoVo; import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.NoSuchAlgorithmException; import java.util.List; /** @@ -22,7 +21,7 @@ */ public interface SysVipInfoService extends BaseServices<SysVipInfo>{ - public int addVipDefaultCard(Long vipId); + public MoneyCardUse addVipDefaultCard(Long vipId); /** * 新增SysVipInfo * diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java index 4b91861..414e544 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java @@ -42,6 +42,10 @@ @Autowired private SysVipLevelDao viplevelDao; + + + + @Override public int add(MoneyCardUse moneyCardUse) { @@ -213,64 +217,7 @@ } } - //退款 - @Override - public int returnMoney(MoneyCardUse moneyCardUse, Long hjkId) { - - MoneyCardUse realObj = moneyCardUseDao.selectById(moneyCardUse.getId()); - - //检测商品是否已付款完成 - if (realObj.getOrderItemId() != 1) {//不是数据迁移过来的判断付款状态 - checkOrderStatu(realObj.getOrderItemId()); - } - - if (!realObj.getStatus().equals(Dictionary.TAOCAN_STATUS_YX)) { - throw new GlobleException("不是有效充值卡"); - } - - if (realObj.getSource().contains(Dictionary.TAOCAN_SOURCE_ZR)) { - throw new GlobleException("转让的充值卡不能退款"); - } - if (realObj.getSource().contains(Dictionary.TAOCAN_SOURCE_ZS)) { - throw new GlobleException("赠送的充值卡不能退款"); - } - - if (Dictionary.FLAG_YES_Y.equals(realObj.getIsVipCar())) { - //更新会员等级 - realObj.getVipInfo().setLevelId(0L); - infoDao.update(realObj.getVipInfo()); - } - StringBuilder content = new StringBuilder(); - - //有会籍卡退到会籍卡中,无则退了现金 - if (hjkId != null && !hjkId.equals("")) { - MoneyCardUse vipCard = moneyCardUseDao.selectById(hjkId); - vipCard.setRealMoney(vipCard.getRealMoney() + realObj.getRealMoney()); - moneyCardUseDao.update(vipCard); - content.append(realObj.getCardName() + "退款¥" + realObj.getRealMoney() + "到会籍卡") - .append(vipCard.getCardName()) - .append(",余次:" + vipCard.getLastCountName()) - .append(",本金余额:" + vipCard.getRealMoney()) - .append(",有效期:" + DateUtil.dateToString(vipCard.getFailTime(), DateUtil.DATE_FORMAT_MM)) - .append(",是否赠送:" + vipCard.getSourceName()); - } else { - content.append(realObj.getCardName() + "退款现金¥" + moneyCardUse.getReturnMonery() + ""); - } - DecimalFormat df = new DecimalFormat("#.00"); - double d = Double.valueOf(df.format(realObj.getRealMoney() - Double.valueOf(moneyCardUse.getReturnMonery()))); - //退款的本金为零,状态为已退款 - realObj.setRealMoney(d); - //赠送金额也清零 - realObj.setGiftMoney(0.0); - if (d <= 0) { - realObj.setStatus(Dictionary.TAOCAN_STATUS_TK); - } - int i = moneyCardUseDao.update(realObj); - SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); - //新增退款流水 - return i; - } //设置为有效 @Override diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java index 2bc34e5..fc36595 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java @@ -4,7 +4,6 @@ import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.PaginationVO; -import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.StringUtils; import com.matrix.core.tools.WebUtil; import com.matrix.system.app.dto.OrderListDto; @@ -17,10 +16,8 @@ import com.matrix.system.common.dao.BusParameterSettingsDao; import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.constance.Dictionary; -import com.matrix.system.constance.SystemConstance; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; -import com.matrix.system.hive.hievEnum.PayMethodEnum; import com.matrix.system.hive.plugin.util.CollectionUtils; import com.matrix.core.tools.DateUtil; import com.matrix.system.hive.plugin.util.MoneyUtil; @@ -36,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import javax.servlet.http.HttpSession; import javax.validation.constraints.NotEmpty; import java.util.*; @@ -113,7 +111,7 @@ @Value("${evn}") - private String evn; + private String evn; @Autowired private RabiitMqTemplate rabiitMqTemplate; @@ -147,7 +145,7 @@ @Override public List<SysOrder> findInPage(SysOrder sysOrder, PaginationVO pageVo) { - if(pageVo!=null){ + if (pageVo != null) { pageVo.setSort("desc"); pageVo.setSort("orderTime"); } @@ -211,7 +209,7 @@ // 订单欠款减去支付金额 设置实际欠款 Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); - zkTotal=MoneyUtil.add(zkTotal, itemZkTotal); + zkTotal = MoneyUtil.add(zkTotal, itemZkTotal); item.setStatus(orderStatus); } @@ -222,12 +220,12 @@ sysOrder.setCompanyId(source != null ? source.getCompanyId() : user.getCompanyId()); sysOrder.setPayTime(new Date()); - if(sysOrder.getId()==null){ + if (sysOrder.getId() == null) { //新增订单 sysOrder.setOrderNo(codeService.getOrderCode()); sysOrderDao.insert(sysOrder); - }else{ + } else { //更新订单 sysOrderDao.update(sysOrder); //删除原有订单明细 @@ -269,9 +267,9 @@ order.setArrears(0D); //发送微信公众号提醒 - UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_DDQX); - uniformMsgParam.put("orderId",order.getId()); - rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); + UniformMsgParam uniformMsgParam = new UniformMsgParam(order.getCompanyId(), UniformMsgParam.GZH_DDQX); + uniformMsgParam.put("orderId", order.getId()); + rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG + evn, uniformMsgParam.toJSONString()); return sysOrderDao.update(order); @@ -296,12 +294,12 @@ // 根据订单明细判断是赠送金额购买还是本金购买 - moneyCardUseFlow.setTotal(orderItem.getCardPay()); - moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), orderItem.getCardPay())); + moneyCardUseFlow.setTotal(orderItem.getCardPay()); + moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), orderItem.getCardPay())); //TODO 目前无法退回到具体的赠送金额还是本金 if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) { - if(moneyCardUse.getLastCount()!=null) { + if (moneyCardUse.getLastCount() != null) { moneyCardUse.setLastCount(moneyCardUse.getLastCount() + 1); moneyCardUseFlow.setTimes(1); } @@ -316,7 +314,7 @@ moneyCardUseFlow.setCreateTime(new Date()); moneyCardUseFlow.setOperationId(user.getSuId()); moneyCardUseFlow.setContent(moneyCardUse.getChangeRemark()); - moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney()); + moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); moneyCardUseFlowDao.insert(moneyCardUseFlow); } } @@ -484,7 +482,6 @@ @Transactional(rollbackFor = Exception.class) public void updateReceiptMoney(SysOrder pageOrder) throws GlobleException { - if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) { throw new GlobleException("该订单已经收过款,请刷新页面再试!"); } @@ -497,78 +494,92 @@ sysVipInfoDao.update(vipInfo); } + //设置订单的成交状态 changeOrderStatu(pageOrder); + // 设置会员充值卡使用情况 addMoneyCardUse(pageOrder); - // 新增出库单 - addOutStore(pageOrder); - // 改变客户项目套餐使用情况 addTaocanProj(pageOrder); + + // 新增出库单 + addOutStore(pageOrder); // 设置业绩 achieveNewService.addAchaeveByOrder(pageOrder); setShopSelCount(pageOrder); - } /** * 收款改变订单状态,划扣金额 + * * @author:姜友瑶 */ private void changeOrderStatu(SysOrder sourceOrder) { - int i = 1; + String orderStatus = Dictionary.ORDER_STATU_YFK; String flowType = SysOrderFlow.FLOW_TYPE_BUY; double cashPayTotal = 0D; double cardPayTotal = 0D; + + //处理支付流水 + int flowCount = 1; for (SysOrderFlow flow : sourceOrder.getFlows()) { - flow.setFlowNo(codeService.getFlowCode() + "-" + i); + + //支付内容摘要设置 Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); + // 若是退款,则取负数 if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) { flowType = SysOrderFlow.FLOW_TYPE_REFUND; - // 若是退款,则取负数 flow.setAmount(flow.getAmount().negate()); flow.setOrderId(sourceOrder.getOldOrderId()); } else { flow.setOrderId(sourceOrder.getId()); } - flow.setVipId(sourceOrder.getVipId()); - flow.setFlowType(flowType); - // 若使用储值卡付款 - if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { - if (flow.getCardId() != null) { - MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); - cardPaySk(moneyCardUse, sourceOrder, flow); - cardPayTotal += flow.getAmount().doubleValue(); - } - } - + //欠款处理 if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) { orderStatus = Dictionary.ORDER_STATU_QK; sourceOrder.setArrears(flow.getAmount().doubleValue()); } - if (!SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod()) && !SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { + //统计储值卡支付 + if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { + if (flow.getCardId() != null) { + MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); + cardPayTotal += flow.getAmount().doubleValue(); + + //修改储值卡余额 + cardPaySk(moneyCardUse, sourceOrder, flow); + }else{ + throw new GlobleException("无效的储值卡支付方式"); + } + } + //统计现金支付 + if (!SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod()) + && !SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { cashPayTotal += flow.getAmount().doubleValue(); } + + flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); + flow.setVipId(sourceOrder.getVipId()); + flow.setFlowType(flowType); flow.setShopId(sourceOrder.getShopId()); flow.setCompanyId(sourceOrder.getCompanyId()); sysOrderFlowDao.insert(flow); - i++; + flowCount++; } + //修改订单信息 if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) { orderStatus = Dictionary.ORDER_STATU_TK; } - // 更新收款状态 sourceOrder.setStatu(orderStatus); sourceOrder.setCardPay(cardPayTotal); @@ -606,7 +617,6 @@ } - /** * 使用充值卡付款操作 * @@ -624,48 +634,31 @@ SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); - MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); + MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { - if(moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { + if (moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); moneyCardUse.setGiftMoney(surplus); - moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); } else { throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); } } else { - if(moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { + if (moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); moneyCardUse.setRealMoney(surplus); - moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); } else { throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); } } - //设置卡项使用流水 - moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); - moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); - moneyCardUseFlow.setVipId(sourceOrder.getVipId()); - moneyCardUseFlow.setTimes(-1); - moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); - moneyCardUseFlow.setCreateTime(new Date()); - moneyCardUseFlow.setOperationId(user.getSuId()); - moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney()); - moneyCardUseFlowDao.insert(moneyCardUseFlow); - - // 达到使用次数后自动清空余额 - if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y) - && moneyCardUse.getLastCount() <= 0) { - moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); - moneyCardUse.setLastCount(0); - moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); - } - if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { - moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); - moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); + if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { + //余额为0时充值卡变为无效 + if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { + moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); + moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); + } } ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); @@ -675,6 +668,16 @@ } // 更新充值卡信息 moneyCardUseDao.update(moneyCardUse); + //设置卡项使用流水 + moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); + moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); + moneyCardUseFlow.setVipId(sourceOrder.getVipId()); + moneyCardUseFlow.setTimes(-1); + moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); + moneyCardUseFlow.setCreateTime(new Date()); + moneyCardUseFlow.setOperationId(user.getSuId()); + moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); + moneyCardUseFlowDao.insert(moneyCardUseFlow); } /** @@ -747,7 +750,7 @@ // 如果购买的是充值卡 if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_CZK)) { - for(int i = 0; i < sysOrderItem.getCount(); i++) { + for (int i = 0; i < sysOrderItem.getCount(); i++) { ShoppingGoods moneyCar = shoppingGoodsDao.selectById(sysOrderItem.getGoodsId()); MoneyCardUse moneyCardUse = new MoneyCardUse(); moneyCardUse.setVipId(sourceOrder.getVipId()); @@ -759,13 +762,8 @@ moneyCardUse.setSource(Dictionary.TAOCAN_SOURCE_GM); moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); moneyCardUse.setCardName(moneyCar.getName()); - - if (Dictionary.FLAG_YES.equals(moneyCar.getCarIsAll())) { - moneyCardUse.setIsVipCar(Dictionary.FLAG_YES_Y); - } else { - // 非会籍卡 - moneyCardUse.setIsVipCar(Dictionary.FLAG_NO_N); - } + moneyCardUse.setIsVipCar(Dictionary.FLAG_NO_N); + moneyCardUse.setVipId(sourceOrder.getVipId()); // 是否为赠送 if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_YES)) { @@ -773,6 +771,7 @@ } else { moneyCardUse.setSource(Dictionary.TAOCAN_SOURCE_GM); } + //余次处理 if (moneyCar.getCarUseCount() == null || moneyCar.getCarUseCount() == 0) { moneyCardUse.setUseTotal(999999999); moneyCardUse.setLastCount(999999999); @@ -780,8 +779,7 @@ moneyCardUse.setUseTotal(moneyCar.getCarUseCount()); moneyCardUse.setLastCount(moneyCar.getCarUseCount()); } - moneyCardUse.setVipId(sourceOrder.getVipId()); - + //失效时间处理 Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); moneyCardUse.setFailTime(invalidTime); @@ -831,16 +829,16 @@ i++; } - boolean haQk=false; + boolean haQk = false; if (refundTotal == pageOrder.getArrears()) { haQk = true; } //更新收款状态 - if(haQk){ + if (haQk) { sourceOrder.setStatu(Dictionary.ORDER_STATU_YFK); - }else{ + } else { sourceOrder.setStatu(Dictionary.ORDER_STATU_QK); } @@ -1000,7 +998,8 @@ //综合卡中包含的项目 List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM); assembleList.forEach(item -> { - createProjuseByAssemble(order, sysOrderItem, item, null); + //TODO 补综合卡逻辑 + createProjuseByAssemble(order, sysOrderItem, item, null, null); }); //处理综合卡中包含的套餐 @@ -1021,9 +1020,9 @@ * 通过组合关系创建用户项目余次 */ private SysProjUse createProjuseByAssemble(SysOrder order, SysOrderItem sysOrderItem, - ShoppingGoodsAssemble goodsAssemble, Long taocanId) { + ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime) { //计算折扣 - Double zk=sysOrderItem.getZkPrice()/sysOrderItem.getPrice(); + Double zk = sysOrderItem.getZkPrice() / sysOrderItem.getPrice(); SysProjUse puse = new SysProjUse(); puse.setIsOver(Dictionary.DELETED_N); @@ -1037,9 +1036,9 @@ puse.setTaocanId(taocanId); puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); if (taocanId == null) { - puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() * zk ); + puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() * zk); } else { - puse.setPrice(goodsAssemble.getPrice() * zk ); + puse.setPrice(goodsAssemble.getPrice() * zk); } puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); // 赠送和打折后金额为0的都视为赠送项目 @@ -1048,10 +1047,7 @@ } else { puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); } - // 设置失效时间 - Calendar cal = Calendar.getInstance(); - cal.set(2200, 1, 1); - puse.setFailTime(cal.getTime()); + puse.setFailTime(failTime); sysProjUseDao.insert(puse); return puse; } @@ -1093,20 +1089,20 @@ taocanProjUse.setFailTime(invalidTime); sysProjUseDao.insert(taocanProjUse); //计划次数 - int surplusCount=0; + int surplusCount = 0; //总余额 Double sumBanance = 0D; //创建套餐绑定的项目 List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(projId, ShoppingGoods.SHOPPING_GOODS_TYPE_XM); for (ShoppingGoodsAssemble assemble : assembleList) { - SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId()); + SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(),taocanProjUse.getFailTime()); sumBanance += tempUse.getBalance(); - surplusCount+=tempUse.getSurplusCount(); + surplusCount += tempUse.getSurplusCount(); } - if(Dictionary.FLAG_NO_N.equals(taocanShoppingGoods.getIsCourse())){ + if (Dictionary.FLAG_NO_N.equals(taocanShoppingGoods.getIsCourse())) { //固定套餐,剩余次数等于绑定项目的次数 taocanProjUse.setSurplusCount(surplusCount); - }else{ + } else { //任选套餐剩余次数等于最大使用次数 taocanProjUse.setSurplusCount(taocanShoppingGoods.getCarUseCount()); } @@ -1148,6 +1144,7 @@ /** * 会员卡充值 + * * @param czVo */ @Override @@ -1197,7 +1194,7 @@ orderItem.setOrderId(order.getId()); orderItem.setOrderNo(order.getOrderNo()); orderItem.setArrears(0D); - ShoppingGoods shoppingGoods= shoppingGoodsDao.selectVipCzGoods(); + ShoppingGoods shoppingGoods = shoppingGoodsDao.selectVipCzGoods(); orderItem.setGoodsId(shoppingGoods.getId()); orderItem.setPayMethod(Dictionary.PAY_TYPE_MOENY); orderItem.setCashPay(czVo.getBjmoney()); @@ -1216,7 +1213,7 @@ //设置卡项使用流水 - MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); + MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); moneyCardUseFlow.setTotal(czVo.getBjmoney()); moneyCardUseFlow.setGiftMoney(czVo.getGiftMoney()); moneyCardUseFlow.setCarUseId(czVo.getCardId()); @@ -1225,7 +1222,7 @@ moneyCardUseFlow.setOrderNo(order.getOrderNo()); moneyCardUseFlow.setCreateTime(new Date()); moneyCardUseFlow.setOperationId(user.getSuId()); - moneyCardUseFlow.setBalance(cardUser.getGiftMoney()+cardUser.getRealMoney()); + moneyCardUseFlow.setBalance(cardUser.getGiftMoney() + cardUser.getRealMoney()); moneyCardUseFlowDao.insert(moneyCardUseFlow); order.setFlows(czVo.getFlows()); @@ -1281,7 +1278,8 @@ @Override public void refundOrderMoney(SysOrder pageOrder) { SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); - // 插入订单流水 + + // 修改订单状态 changeOrderStatu(pageOrder); List<SysOrderItem> returnItems = new ArrayList<>(); @@ -1325,7 +1323,7 @@ throw new GlobleException("数据异常"); } - for(int i = 0; i < item.getCount(); i++) { + for (int i = 0; i < item.getCount(); i++) { SysProjUse sysProjUse = sysProjUses.get(i); sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); @@ -1347,7 +1345,7 @@ queryCardUse.setOrderItemId(item.getOldItemId()); List<MoneyCardUse> moneyCardUses = moneyCardUseDao.selectByModel(queryCardUse); - for(int i = 0; i < item.getCount(); i++) { + for (int i = 0; i < item.getCount(); i++) { MoneyCardUse moneyCardUse = moneyCardUses.get(i); moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java index 3e21745..30bd8c9 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java @@ -11,15 +11,12 @@ import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; import com.matrix.system.hive.plugin.util.CollectionUtils; -import com.matrix.core.tools.DateUtil; import com.matrix.system.hive.plugin.util.MoneyUtil; import com.matrix.system.hive.service.SysProjUseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.xml.crypto.Data; -import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -407,23 +404,7 @@ return i; } - /** - * cardUser暂时没有用到 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public int returnMoneyTc(SysProjUse sysProjUse, MoneyCardUse cardUse, Long moneyCardUseId) { - //充值记录 - //SysRechargeFlow flow=new SysRechargeFlow(); - // 计算出套餐所有项目的剩余次数的钱 - getTotalMoney(sysProjUse, cardUse, moneyCardUseId); - //3、套餐下的项目状态改为退款 - sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_TK); - int j = sysProjUseDao.updateProjStatus(sysProjUse); - - return j; - } /*********************以下为项目使用情况操作***********************/ @@ -553,49 +534,7 @@ } - /** - * 退款 - * - * @param sysProjUse - * @return - */ - public int returnMoneyProj(SysProjUse sysProjUse, MoneyCardUse cardUse, Long moneyCardUseId) { - int i = 0; - sysProjUse = sysProjUseDao.selectById(sysProjUse.getId()); - //判断套餐是否存在欠款 - checkOrderStatu(sysProjUse); - if (!(sysProjUse.getStatus().equals(Dictionary.TAOCAN_STATUS_YX))) { - throw new GlobleException("不是有效项目"); - } - if (sysProjUse.getSource().equals(Dictionary.TAOCAN_SOURCE_ZR)) { - throw new GlobleException("转让的项目不能退款"); - } - if (sysProjUse.getSource().equals(Dictionary.TAOCAN_SOURCE_ZS)) { - throw new GlobleException("赠送的项目不能退款"); - } - StringBuilder content = new StringBuilder(); - ShoppingGoodsAssemble shoppingGoodsAssemble = shoppingGoodsAssembleDao.selectById(sysProjUse.getAssembleId()); - ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(shoppingGoodsAssemble.getShoppingGoodsId()); - content.append(shoppingGoods + "退款"); - if (cardUse != null) { - // 1、金额退到该用户的有效会籍卡中 - MoneyCardUse upCard = moneyCardUseDao.selectById(cardUse.getId()); - upCard.setRealMoney(upCard.getRealMoney() + sysProjUse.getBalance()); - ; - moneyCardUseDao.update(upCard); - content.append("到会籍卡(" + upCard.getCardName() + ")" + sysProjUse.getBalance() + "元") - .append(",余次:" + upCard.getLastCountName()) - .append(",本金余额:" + upCard.getRealMoney()) - .append(",有效期:" + DateUtil.dateToString(upCard.getFailTime(), DateUtil.DATE_FORMAT_MM)) - .append(",是否赠送:" + upCard.getSourceName()); - } else { - content.append("现金" + sysProjUse.getBalance() + "元"); - } - - sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_TK); - return sysProjUseDao.update(sysProjUse); - } /** * 设置为有效套餐 @@ -646,25 +585,6 @@ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "操作成功"); } - /** - * 退款项目 - */ - @Override - public double getTotalMoneyProj(SysProjUse sysProjUse) { - sysProjUse = sysProjUseDao.selectById(sysProjUse.getId()); - //判断套餐是否存在欠款 - checkOrderStatu(sysProjUse); - if (!(sysProjUse.getStatus().equals(Dictionary.TAOCAN_STATUS_YX))) { - throw new GlobleException("不是有效项目"); - } - if (sysProjUse.getSource().equals(Dictionary.TAOCAN_SOURCE_ZR)) { - throw new GlobleException("转让的项目不能退款"); - } - if (sysProjUse.getSource().contains(Dictionary.TAOCAN_SOURCE_ZS)) { - throw new GlobleException("赠送的项目不能退款"); - } - return sysProjUse.getBalance(); - } @Override @@ -673,9 +593,10 @@ } @Override - public List<SysProjUse> selectTaocanProjUse(Long taocanId) { + public List<SysProjUse> selectTaocanProjUse(Long taocanId, String status) { SysProjUse projUse = new SysProjUse(); projUse.setTaocanId(taocanId); + projUse.setStatus(status); return sysProjUseDao.selectByModel(projUse); } } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java index 3fa566e..922b7d9 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java @@ -74,7 +74,7 @@ * @return */ @Override - public int addVipDefaultCard(Long vipId){ + public MoneyCardUse addVipDefaultCard(Long vipId){ MoneyCardUse defaultCardUse=new MoneyCardUse(); defaultCardUse.setVipId(vipId); defaultCardUse.setCardName("储值卡"); @@ -83,7 +83,8 @@ defaultCardUse.setGiftMoney(0D); defaultCardUse.setSource("-"); defaultCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); - return moneyCardUseDao.insert(defaultCardUse); + moneyCardUseDao.insert(defaultCardUse); + return defaultCardUse; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/OrderFlowAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/OrderFlowAction.java new file mode 100644 index 0000000..a3ad197 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/OrderFlowAction.java @@ -0,0 +1,137 @@ +package com.matrix.system.hive.statistics; + +import com.matrix.core.pojo.AjaxResult; +import com.matrix.core.tools.DateUtil; +import com.matrix.core.tools.LogUtil; +import com.matrix.core.tools.StringUtils; +import com.matrix.core.tools.excl.ExcelSheetPO; +import com.matrix.core.tools.excl.ExcelUtil; +import com.matrix.core.tools.excl.ExcelVersion; +import com.matrix.system.common.tools.DataAuthUtil; +import com.matrix.system.hive.action.util.QueryUtil; +import com.matrix.system.hive.dao.SysOrderFlowDao; +import com.matrix.system.hive.dto.OrderFlowListDto; +import com.matrix.system.hive.vo.OrderFlowVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 交易流水统计 + */ +@CrossOrigin(origins = "*") +@Api(value = "OrderFlowAction", tags = "交易流水") +@RestController +@RequestMapping(value = "/admin/orderFlow") +public class OrderFlowAction { + + @Resource + private SysOrderFlowDao orderFlowDao; + /** + * 交易流水查询 + */ + + @ApiOperation(value = "查询交易流水") + @ApiResponses({ + @ApiResponse(code = 200, message = "OK", response = OrderFlowListDto.class) + }) + @PostMapping(value = "/findOrderFlow") + public @ResponseBody + AjaxResult findOrderFlow(@RequestBody OrderFlowListDto orderFlowListDto) { + if(StringUtils.isBlank(orderFlowListDto.getSort())){ + orderFlowListDto.setSort("createTime"); + orderFlowListDto.setOrder("desc"); + } + if (!DataAuthUtil.hasAllShopAuth()) { + QueryUtil.setQueryLimit(orderFlowListDto); + } else { + QueryUtil.setQueryLimitCom(orderFlowListDto); + } + List<OrderFlowVo> rows = orderFlowDao.selectInPage(orderFlowListDto); + Integer total = orderFlowDao.selectTotal(orderFlowListDto); + AjaxResult result = AjaxResult.buildSuccessInstance(rows, total); + return result; + } + + /** + * 导出Excel + */ + @GetMapping(value = "/exportOrderFlowExcel") + public void exportOrderFlowExcel(OrderFlowListDto orderFlowListDto, HttpServletResponse res) { + OutputStream os = null; + try { + if (!DataAuthUtil.hasAllShopAuth()) { + QueryUtil.setQueryLimit(orderFlowListDto); + } else { + QueryUtil.setQueryLimitCom(orderFlowListDto); + } + orderFlowListDto.setLimit(null); + List<OrderFlowVo> rows = orderFlowDao.selectInPage(orderFlowListDto); + res.setCharacterEncoding("UTF-8"); + res.setHeader("content-type", "application/octet-stream;charset=UTF-8"); + res.setContentType("application/octet-stream;charset=UTF-8"); + + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss"); + res.setHeader("Content-Disposition", "attachment;filename=" + + java.net.URLEncoder.encode("交易流水" + dateFormat.format(date) + ".xlsx".trim(), "UTF-8")); + os = res.getOutputStream(); + ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, disPoseExcelData(rows), os, true); + } catch (Exception e) { + LogUtil.error("交易流水导出异常", e); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e) { + LogUtil.error("关闭资源异常", e); + } + } + } + } + + private List<ExcelSheetPO> disPoseExcelData(List<OrderFlowVo> orderFlowVos) { + List<ExcelSheetPO> res = new ArrayList<>(); + ExcelSheetPO orderSheet = new ExcelSheetPO(); + orderSheet.setSheetName("交易流水"); + orderSheet.setTitle("交易流水"); + String[] header = new String[]{"订单编号", "交易内容", "交易时间", "交易类型", "交易金额", "会员姓名", + "支付方式", "支付流水号", "操作人", "门店名称"}; + orderSheet.setHeaders(header); + List<List<Object>> body = new ArrayList<>(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); + for (OrderFlowVo flowVo : orderFlowVos) { + List<Object> bodyItem = new ArrayList<>(); + bodyItem.add(flowVo.getOrderNo()); + bodyItem.add(flowVo.getFlowContent()); + bodyItem.add(DateUtil.dateFormatStr(flowVo.getCreateTime(),DateUtil.DATE_FORMAT_MM)); + bodyItem.add(flowVo.getFlowType()); + bodyItem.add(flowVo.getAmount()); + bodyItem.add(flowVo.getVipName()); + bodyItem.add(flowVo.getPayMethod()); + bodyItem.add(flowVo.getFlowNo()); + bodyItem.add(flowVo.getStaffName()); + bodyItem.add(flowVo.getShopName()); + body.add(bodyItem); + } + orderSheet.setDataList(body); + res.add(orderSheet); + return res; + } + + + + +} + diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/ServiceStatisticsAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/ServiceStatisticsAction.java index 532662d..81a5f11 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/ServiceStatisticsAction.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/ServiceStatisticsAction.java @@ -36,6 +36,7 @@ if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){ param.put("shopId",sysUsers.getShopId()); } + return AjaxResult.buildSuccessInstance(beauticianStateDao.selectItemDetail(param), beauticianStateDao.selectItemDetailTotal(param)); } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/vo/OrderFlowVo.java b/zq-erp/src/main/java/com/matrix/system/hive/vo/OrderFlowVo.java new file mode 100644 index 0000000..78ce807 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/vo/OrderFlowVo.java @@ -0,0 +1,152 @@ +package com.matrix.system.hive.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.matrix.core.tools.DateUtil; +import com.matrix.system.app.vo.OrderDetailItemVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author jyy + * @date 2021-01-27 + **/ +@ApiModel(value = "OrderFlowVo", description = "订单流水返回参数类") +public class OrderFlowVo { + + @ApiModelProperty(value = "流水id") + private Long id; + + @ApiModelProperty(value = "订单ID") + private String orderId; + + @ApiModelProperty(value = "订单号") + private String orderNo; + + @ApiModelProperty(value ="交易类型") + private String flowType; + + @ApiModelProperty(value ="支付方式") + private String payMethod; + + @ApiModelProperty(value = "会员姓名") + private String vipName; + + @ApiModelProperty(value = "交易内容") + private String flowContent; + + @ApiModelProperty(value = "交易金额") + private BigDecimal amount; + + @ApiModelProperty(value = "操作人姓名") + private String staffName; + + @ApiModelProperty(value = "支付流水号") + private String flowNo; + + @ApiModelProperty(value = "门店名称") + private String shopName; + + @JsonFormat(pattern = DateUtil.DATE_FORMAT_SS, timezone = "GMT+8") + @ApiModelProperty(value = "创建时间") + private Date createTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getFlowType() { + return flowType; + } + + public void setFlowType(String flowType) { + this.flowType = flowType; + } + + public String getPayMethod() { + return payMethod; + } + + public void setPayMethod(String payMethod) { + this.payMethod = payMethod; + } + + public String getVipName() { + return vipName; + } + + public void setVipName(String vipName) { + this.vipName = vipName; + } + + public String getFlowContent() { + return flowContent; + } + + public void setFlowContent(String flowContent) { + this.flowContent = flowContent; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public String getStaffName() { + return staffName; + } + + public void setStaffName(String staffName) { + this.staffName = staffName; + } + + public String getFlowNo() { + return flowNo; + } + + public void setFlowNo(String flowNo) { + this.flowNo = flowNo; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java index 2b18447..f2ed540 100644 --- a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java +++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpVipInfoController.java @@ -117,16 +117,7 @@ // 在session存放当前查询的客户 MoneyCardUse cardUseInfo = cardUseService.findByVipId(vips.get(0).getId()); if (cardUseInfo == null) { - cardUseInfo = new MoneyCardUse(); - cardUseInfo.setVipId(vips.get(0).getId()); - cardUseInfo.setCardName("储值卡"); - cardUseInfo.setIsVipCar(Dictionary.FLAG_YES_Y); - cardUseInfo.setRealMoney(0D); - cardUseInfo.setGiftMoney(0D); - cardUseInfo.setSource("-"); - cardUseInfo.setStatus(Dictionary.MONEYCARD_STATUS_YX); - cardUseInfo.setFailTime(DateUtil.stringToDate("2050-01-01 00:00",DateUtil.DATE_FORMAT_MM)); - moneyCardUseDao.insert(cardUseInfo); + cardUseInfo=vipInfoService.addVipDefaultCard(vips.get(0).getId()); } vips.get(0).setLevelCard(cardUseInfo); WebUtil.getSession().setAttribute(SystemConstance.CURRENT_CUSTOMER, vips.get(0)); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java index 1c07d32..abc7fbd 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java @@ -4,24 +4,16 @@ import com.matrix.biz.dao.BizUserDao; import com.matrix.component.rabbitmq.RabiitMqTemplate; import com.matrix.component.redis.RedisUserLoginUtils; -import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.AjaxResult; -import com.matrix.core.pojo.PaginationVO; import com.matrix.core.pojo.VerifyResult; import com.matrix.core.tools.DateUtil; -import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.StringUtils; -import com.matrix.core.tools.WebUtil; -import com.matrix.system.app.dto.ServiceOrderListDto; -import com.matrix.system.app.mapper.SysBeauticianStateMapper; -import com.matrix.system.app.mapper.SysProjServiceMapper; import com.matrix.system.app.mapper.SysProjUseMapper; import com.matrix.system.app.vo.*; import com.matrix.system.common.bean.SysUsers; import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.common.interceptor.HostInterceptor; -import com.matrix.system.common.tools.DataAuthUtil; import com.matrix.system.common.tools.LocationUtil; import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.*; @@ -30,14 +22,11 @@ import com.matrix.system.hive.service.*; import com.matrix.system.shopXcx.api.dto.ErpServiceCommentDto; import com.matrix.system.shopXcx.api.dto.ErpServiceOrderListDto; -import com.matrix.system.shopXcx.api.vo.ErpOrderDetailItemVo; import com.matrix.system.shopXcx.api.vo.ErpServiceOrderListVo; -import com.matrix.system.shopXcx.bean.ShopProduct; import com.matrix.system.shopXcx.dao.ShopProductDao; import com.matrix.system.shopXcx.dao.ShopSkuDao; import com.matrix.system.shopXcx.dto.YYDayOfWeek; import com.matrix.system.shopXcx.dto.YYmonth; -import com.matrix.system.shopXcx.mqTask.DTO.UserProjInfo; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -245,7 +234,7 @@ if (CollectionUtils.isNotEmpty(serviceTcVos)) { serviceTcVos.forEach(item -> { - List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId()); + List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus()); List<ServiceProjVo> taocanProj = SysProjUseMapper.INSTANCE.entityListToProjVoList(sysProjUses); item.setProj(taocanProj); }); diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml index 94d6c2d..c74aeca 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseDao.xml @@ -20,6 +20,7 @@ <result property="isVipCar" column="is_vip_car"/> <result property="remark" column="remark"/> <result property="cardName" column="card_name"/> + <result property="orderId" column="orderId"/> <!-- 对应会员信息 --> <association property="vipInfo" javaType="SysVipInfo" @@ -366,6 +367,7 @@ select a.id, a.order_item_id, + d.id AS orderId, a.use_total, a.last_count, a.real_money, @@ -380,7 +382,10 @@ a.remark, a.card_name from money_card_use a - where vip_id = #{record.vipId} + left join shopping_goods b on a.goods_id=b.id + left join sys_order_item c on a.ORDER_ITEM_ID=c.id + left join sys_order d on c.ORDER_ID=d.id + where a.vip_id = #{record.vipId} <if test="record!=null"> <if test="record.orderItemId != null and record.orderItemId !='' "> and a.order_item_id = #{record.orderItemId} @@ -420,7 +425,9 @@ select count(*) from money_card_use a left join shopping_goods b on a.goods_id=b.id - where vip_id = #{record.vipId} + left join sys_order_item c on a.ORDER_ITEM_ID=c.id + left join sys_order d on c.ORDER_ID=d.id + where a.vip_id = #{record.vipId} <if test="record!=null"> <if test="record.orderItemId != null and record.orderItemId !='' "> and a.order_item_id = #{record.orderItemId} diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml index 0227782..5e75ca7 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml @@ -1260,7 +1260,7 @@ ( a.headquarters=1 and ( ISNULL(a.use_shop) or LENGTH(trim(a.use_shop))<1 or FIND_IN_SET(#{record.shopId},a.use_shop))))]]> </if> <if test="record.companyId != null and record.companyId !='' "> - a.company_id=#{record.companyId} + and a.company_id=#{record.companyId} </if> <if test="record.goodType!=null"> and a.good_type=#{record.goodType} @@ -1289,6 +1289,9 @@ <![CDATA[ and ( a.shop_id = #{record.shopId} or ( a.headquarters=1 and ( ISNULL(a.use_shop) or LENGTH(trim(a.use_shop))<1 or FIND_IN_SET(#{record.shopId},a.use_shop))))]]> </if> + <if test="record.companyId != null and record.companyId !='' "> + and a.company_id=#{record.companyId} + </if> <if test="record.goodType!=null"> and a.good_type=#{record.goodType} </if> diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml index 7a5a0e5..6262844 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml @@ -410,6 +410,7 @@ <select id="selectItemDetail" resultType="java.util.HashMap" parameterType="java.util.HashMap"> select f.SHOP_NAME, + b.yy_time, b.consume_time, b.SERVICE_NO, d.su_name, @@ -420,7 +421,8 @@ a.COUNT, h.PRICE, h.SOURCE, - a.STATE + a.STATE, + a.extract from sys_beautician_state a left join sys_proj_services b on a.SERVICES_ID=b.ID left join shopping_goods c on a.proj_id=c.id diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml index 84fa609..eb0d269 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml @@ -75,4 +75,108 @@ where order_id=#{orderId} group by pay_method </select> + + <select id="selectInPage" resultType="com.matrix.system.hive.vo.OrderFlowVo"> + SELECT + a.id, + b.id as orderId, + a.create_time as createTime, + b.ORDER_NO as orderNo, + a.flow_content as flowContent, + a.flow_type as flowType, + a.amount as amount, + c.VIP_NAME as vipName, + a.pay_method as payMethod, + a.flow_no as flowNo, + d.shop_short_name as shopName, + e.su_name as staffName + from sys_order_flow a + LEFT JOIN sys_order b on a.order_id=b.ID + LEFT JOIN sys_vip_info c on a.vip_id=c.ID + LEFT JOIN sys_shop_info d on a.shop_id=d.ID + LEFT JOIN sys_users e on e.su_id=b.STAFF_ID + <where> + + and a.company_id=#{record.companyId} + + <if test="record.queryKey != null and record.queryKey != ''"> + and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) ) + </if> + <if test="record.oprationMan != null and record.oprationMan != ''"> + and instr(e.su_name, #{record.oprationMan}) + </if> + <if test="record.orderNo != null and record.orderNo != ''"> + and instr(b.ORDER_NO, #{record.orderNo}) + </if> + <if test="record.payMethod != null and record.payMethod != ''"> + and a.pay_method=#{record.payMethod} + </if> + + <if test="record.flowType != null and record.flowType != ''"> + and a.flow_type=#{record.flowType} + </if> + + <if test="record.startTime != null "> + and a.create_time >= #{record.startTime} + </if> + <if test="record.endTime != null "> + <![CDATA[and a.create_time <= #{record.endTime}]]> + </if> + <if test="record.shopId != null and record.shopId != ''"> + and a.shop_id=#{record.shopId} + </if> + </where> + <if test="record.sort !=null"> + order by + a.${record.sort} ${record.order} + </if> + <if test="record.offset >=0 and record.limit >0"> + limit + #{record.offset},#{record.limit} + </if> + + + </select> + + <select id="selectTotal" resultType="java.lang.Integer"> + SELECT count(*) + from sys_order_flow a + LEFT JOIN sys_order b on a.order_id=b.ID + LEFT JOIN sys_vip_info c on a.vip_id=c.ID + LEFT JOIN sys_shop_info d on a.shop_id=d.ID + LEFT JOIN sys_users e on e.su_id=b.STAFF_ID + <where> + + and a.company_id=#{record.companyId} + + <if test="record.queryKey != null and record.queryKey != ''"> + and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) ) + </if> + <if test="record.oprationMan != null and record.oprationMan != ''"> + and instr(e.su_name, #{record.oprationMan}) + </if> + <if test="record.orderNo != null and record.orderNo != ''"> + and instr(b.ORDER_NO, #{record.orderNo}) + </if> + <if test="record.payMethod != null and record.payMethod != ''"> + and a.pay_method=#{record.payMethod} + </if> + + <if test="record.flowType != null and record.flowType != ''"> + and a.flow_type=#{record.flowType} + </if> + + <if test="record.startTime != null "> + and a.create_time >= #{record.startTime} + </if> + <if test="record.endTime != null "> + <![CDATA[and a.create_time <= #{record.endTime}]]> + </if> + <if test="record.shopId != null and record.shopId != ''"> + and a.shop_id=#{record.shopId} + </if> + + </where> + </select> + </mapper> \ No newline at end of file diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml index c10462e..2b3a9aa 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml @@ -549,6 +549,7 @@ left join sys_proj_use g on b.puse_id=g.ID left join sys_shop_info h on a.SHOP_ID=h.ID <where> + and a.company_id=#{record.companyId} <if test="record.queryKey != null and record.queryKey != ''"> and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) ) </if> @@ -585,6 +586,7 @@ left join sys_users f on f.su_id=b.STAFF_ID left join sys_proj_use g on b.puse_id=g.ID <where> + and a.company_id=#{record.companyId} <if test="record.queryKey != null and record.queryKey != ''"> and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) ) </if> diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml index d3edbfd..0053d74 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml @@ -31,6 +31,7 @@ <result property="deductionNum" column="deductionNum"/> <result property="isCourse" column="is_course"/> <result property="timeLength" column="time_length"/> + <result property="orderId" column="orderId"/> <!-- 对应项目信息--> <association property="projInfo" javaType="ShoppingGoods" resultMap="com.matrix.system.hive.dao.ShoppingGoodsDao.ShoppingGoodsMap"/> @@ -331,10 +332,13 @@ <select id="selectInPage" resultMap="SysProjUseMap"> select a.*, + d.id as orderId, b.TIME_LENGTH, b.img from sys_proj_use a left join shopping_goods b on a.proj_id=b.id + left join sys_order_item c on a.ORDER_ITEM_ID=c.id + left join sys_order d on c.ORDER_ID=d.id where 1=1 <if test="record!=null"> <if test="record.id != null and record.id !='' "> @@ -440,70 +444,81 @@ <!-- 查询总条数 --> <select id="selectTotalRecord" resultType="java.lang.Integer"> select count(*) - from sys_proj_use + from sys_proj_use a + left join shopping_goods b on a.proj_id=b.id + left join sys_order_item c on a.ORDER_ITEM_ID=c.id + left join sys_order d on c.ORDER_ID=d.id where 1=1 <if test="record!=null"> <if test="record.id != null and record.id !='' "> - and ID = #{record.id} + and a.ID = #{record.id} + </if> + <if test="record.queryKey != null and record.queryKey !='' "> + and (instr(b.name, #{record.queryKey}) or instr(b.zjm, #{record.queryKey}) or instr(goods_no, #{record.queryKey})) </if> <if test="record.orderItemId != null and record.orderItemId !='' "> - and ORDER_ITEM_ID = #{record.orderItemId} + and a.ORDER_ITEM_ID = #{record.orderItemId} </if> <if test="record.projId != null and record.projId !='' "> - and PROJ_ID = #{record.projId} + and a.PROJ_ID = #{record.projId} </if> <if test="record.surplusCount != null and record.surplusCount !='' "> - and SURPLUS_COUNT = #{record.surplusCount} + and a.SURPLUS_COUNT = #{record.surplusCount} </if> <if test="record.isOver != null and record.isOver !='' "> - and IS_OVER = #{record.isOver} + and a.IS_OVER = #{record.isOver} </if> <!-- 查询具体某一个套餐的使用情况 --> <if test="record.taocanId != null and record.taocanId !=-1 and record.taocanId !=-2"> - and TAOCAN_ID = #{record.taocanId} + and a.TAOCAN_ID = #{record.taocanId} </if> <!-- 查询所有的项目使用情况 --> <if test="record.taocanId != null and record.taocanId ==-1 "> - and TAOCAN_ID IS NULL + and a.TAOCAN_ID IS NULL </if> <!-- 查询所有的套餐使用情况 --> <if test="record.taocanId != null and record.taocanId ==-2 "> - and TAOCAN_ID IS NOT NULL + and a.TAOCAN_ID IS NOT NULL </if> <if test="record.vipId != null and record.vipId !='' "> - and VIP_ID = #{record.vipId} + and a.VIP_ID = #{record.vipId} + </if> + <if test="record.failTime != null "> + and a.FAIL_TIME = #{record.failTime} + </if> + <if test="record.targetFailTime != null "> + and date_format(#{record.targetFailTime}, '%Y-%m-%d') > date_format(a.FAIL_TIME, '%Y-%m-%d') </if> <if test="record.price != null and record.price !='' "> - and PRICE = #{record.price} + and a.PRICE = #{record.price} </if> <if test="record.assembleId != null and record.assembleId !='' "> - and ASSEMBLE_ID = #{record.assembleId} + and a.ASSEMBLE_ID = #{record.assembleId} </if> <if test="record.source != null and record.source !='' "> - and SOURCE like concat('%',#{record.source},'%') + and a.SOURCE like concat('%',#{record.source},'%') </if> <if test="record.status != null and record.status !='' "> - and STATUS = #{record.status} + and a.STATUS = #{record.status} </if> <if test="record.platformFlag != null and record.platformFlag !='' "> - and PLATFORM_FLAG = #{record.platformFlag} - </if> - <if test="record.projName != null and record.projName !='' "> - and PROJ_NAME like concat('%',#{record.projName},'%') + and a.PLATFORM_FLAG = #{record.platformFlag} </if> <if test="record.type != null and record.type !='' "> - and type = #{record.type} + and a.type = #{record.type} + </if> + <if test="record.projName != null and record.projName !='' "> + and a.PROJ_NAME like concat('%',#{record.projName},'%') </if> <if test="record.balance != null and record.balance !='' "> - and balance = #{record.balance} + and a.balance = #{record.balance} </if> <if test="record.remark != null and record.remark !='' "> - and remark = #{record.remark} + and a.remark = #{record.remark} </if> - <if test="record.isCourse != null and record.isCourse !='' "> - and is_course = #{record.isCourse}, + and a.is_course = #{record.isCourse}, </if> </if> </select> diff --git a/zq-erp/src/main/resources/static/css/styleOne/style.min.css b/zq-erp/src/main/resources/static/css/styleOne/style.min.css index 5e1b542..5c24529 100644 --- a/zq-erp/src/main/resources/static/css/styleOne/style.min.css +++ b/zq-erp/src/main/resources/static/css/styleOne/style.min.css @@ -3013,6 +3013,7 @@ body, body.full-height-layout #page-wrapper, body.full-height-layout #wrapper, html { height: 100%; + overflow: hidden; } #page-wrapper { @@ -9157,4 +9158,10 @@ line-height: 50px; } -/*===========鑷畾涔夋牱寮廵nd==============================*/ \ No newline at end of file +/*===========鑷畾涔夋牱寮廵nd==============================*/ +/** +* 覆盖elementui一些无用样式 +*/ +.el-form-item{ + margin-bottom:10px !important; +} \ No newline at end of file diff --git a/zq-erp/src/main/resources/static/js/systools/AjaxProxyVue.js b/zq-erp/src/main/resources/static/js/systools/AjaxProxyVue.js index b11d542..ef97725 100644 --- a/zq-erp/src/main/resources/static/js/systools/AjaxProxyVue.js +++ b/zq-erp/src/main/resources/static/js/systools/AjaxProxyVue.js @@ -240,7 +240,16 @@ return root.children; }, - + /** json对象转Url参数**/ + jsonToUrlParam:function(obj){ + let str=""; + for(item in obj){ + if(obj[item]){ + str+=item+"="+obj[item]+"&" + } + } + return str; + } diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/jyls.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/jyls.html new file mode 100644 index 0000000..c3b2a39 --- /dev/null +++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/jyls.html @@ -0,0 +1,332 @@ +<!DOCTYPE HTML> +<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> +<head> + <meta charset="utf-8"> + <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> + <meta name="renderer" content="webkit|ie-comp|ie-stand"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" + content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> + <meta http-equiv="Cache-Control" content="no-siteapp"/> + <LINK rel="Bookmark" href="../images/favicon.ico"> + <!-- 本框架基本脚本和样式 --> + <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script> + <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}"> + <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> + <title></title> + <style> + .panel-body{ + overflow: hidden; + } + .buttonPanel{ + background: #ffffff; + padding: 10px 10px ; + margin: 0px 0px 10px 0px; + } + .rowPanel{ + background: #ffffff; + padding: 0px 10px ; + padding-top: 10px; + margin: 0px 0px 10px 0px; + } + .paginationStyle{ + background: #ffffff; + padding: 10px 10px; + margin: 0px 0px 10px 0px; + text-align: right; + } + </style> +</head> +<body> +<div class="panel-body" id="app"> + + <el-row class="buttonPanel"> + <el-button @click="exportExcel" type="primary" >导出</el-button> + </el-row> + + <el-row class="rowPanel" > + <el-form ref="form" :model="form" inline > + <el-form-item label="会员" prop="queryKey"> + <el-input v-model="form.queryKey" placeholder="请输入会员姓名/手机"></el-input> + </el-form-item> + + <el-form-item label="操作人" prop="oprationMan" > + <el-input v-model="form.oprationMan"></el-input> + </el-form-item> + + <el-form-item label="订单号" prop="orderNo"> + <el-input v-model="form.orderNo"></el-input> + </el-form-item> + + <el-form-item label="交易类型" prop="flowType"> + <el-select v-model="form.flowType" placeholder="请选择"> + <el-option + v-for="item in flowTypeList" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> + </el-form-item> + + <el-form-item label="支付方式" prop="payMethod"> + <el-select v-model="form.payMethod" placeholder="请选择"> + <el-option + v-for="item in payMethodList" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + + <el-form-item label="时间" prop="datetimeArr"> + <el-date-picker + v-model="form.datetimeArr" + type="daterange" + range-separator="至" format="yyyy-MM-dd HH:mm" + start-placeholder="开始日期" + end-placeholder="结束日期"> + </el-date-picker> + </el-form-item> + + <el-form-item label="交易门店" prop="shopId"> + <el-select v-model="form.shopId" placeholder="请选择"> + <el-option + v-for="item in shopList" + :key="item.shopShortName" + :label="item.shopShortName" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + + + + <el-button type="primary" @click="search" >搜索</el-button> + <el-button @click="resetForm('form')">重置</el-button> + </el-form> + </el-row> + + <el-row class="table-style" > + + <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange"> + <el-table-column + prop="orderNo" + label="订单号" + width="180"> + </el-table-column> + <el-table-column + prop="flowContent" + label="交易内容" + show-overflow-tooltip + width="240"> + </el-table-column> + <el-table-column + prop="createTime" + sortable="custom" + label="交易时间" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + prop="flowType" + sortable="custom" + label="交易类型"> + </el-table-column> + <el-table-column + prop="amount" + sortable="custom" + label="交易金额"> + </el-table-column> + <el-table-column + prop="vipName" + label="会员姓名"> + </el-table-column> + <el-table-column + prop="payMethod" + sortable="custom" + label="支付方式"> + </el-table-column> + <el-table-column + prop="flowNo" + label="支付流水号"> + </el-table-column> + <el-table-column + prop="staffName" + label="操作人"> + </el-table-column> + <el-table-column + prop="shopName" + label="门店名称"> + </el-table-column> + <el-table-column label="操作"> + <template slot-scope="scope"> + <el-button type="text" @click="openOrder(scope.$index, scope.row)" size="small">订单详情</el-button> + </template> + </el-table-column> + </el-table> + </el-row> + <el-row class="paginationStyle" > + <el-pagination background + @size-change="changePageSize" + @current-change="changeCurrentPage" + :current-page="table.currentPage" + :page-sizes="[10, 20, 30, 50]" + :page-size="table.pageSize" + layout="total, sizes, prev, pager, next, jumper" + :total="table.total"> + </el-pagination> + </el-row> + +</div> +</body> +<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> +<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script> +<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> +<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> +<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script> +<script type="text/javascript" th:inline="javascript"> + + var vue = new Vue({ + el: '#app', + data: { + table:{ + rows:[], + total:0, + pageSize:10, + currentPage:1, + }, + form:{ + name:null, + datetimeArr:'', + payMethod:'', + flowType:'', + orderNo:'', + oprationMan:'', + queryKey:'', + shopId:'', + }, + height:'calc(100vh - 240px)', + shopList:[{id:0,shopShortName:'全部'}], + flowTypeList:[ + {value:'',label:'全部'}, + {value:'购买',label:'购买'}, + {value:'退款',label:'退款'}, + {value:'还款',label:'还款'} + ], + payMethodList:[ + {value:'',label:'全部'}, + {value:'现金',label:'现金'}, + {value:'微信',label:'微信'}, + {value:'支付宝',label:'支付宝'}, + {value:'银行卡',label:'银行卡'}, + {value:'团购',label:'团购'}, + {value:'储值卡',label:'储值卡'}, + {value:'欠款',label:'欠款'} + ], + }, + created: function () { + let _this=this; + this.loadData(); + window.addEventListener("keydown", this.keydown); + AjaxProxy.requst({ + app:_this, + url:basePath+"/admin/shopInfo/findAll", + callback:function (data) { + data.rows.forEach(shop=>{ + _this.shopList.push(shop); + }); + } + + }) + + }, + methods: { + changePageSize(val) { + this.table.pageSize = val; + this.loadData(); + }, + changeCurrentPage(val) { + this.table.currentPage = val; + this.loadData(); + }, + resetForm(formName) { + this.$refs[formName].resetFields(); + }, + sortChange:function (column){ + if(column.order){ + if(column.order.indexOf("desc")){ + this.form.order="desc"; + }else{ + this.form.order="asc"; + } + this.form.sort=column.prop; + this.loadData(); + } + }, + loadData:function(){ + let _this = this; + let data=_this.getRequestParam(); + data.limit=_this.table.pageSize; + data.offset=_this.table.pageSize*(_this.table.currentPage-1); + AjaxProxy.requst({ + app: _this, + data:data, + url: basePath + '/admin/orderFlow/findOrderFlow', + callback: function (data) { + _this.table.rows = data.rows; + _this.table.total=data.total; + } + }); + }, + getRequestParam(){ + let _this = this; + return { + name:_this.form.name, + payMethod:_this.form.payMethod, + flowType:_this.form.flowType, + orderNo:_this.form.orderNo, + oprationMan:_this.form.oprationMan, + queryKey:_this.form.queryKey, + startTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[0]).format("YYYY-MM-DD HH:mm"):'', + endTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[1]).format("YYYY-MM-DD HH:mm"):'', + shopId:_this.form.shopId, + order:_this.form.order, + sort:_this.form.sort, + + } + }, + search:function(){ + this.table.currentPage=1; + this.loadData(); + }, + keydown(evt){ + if(evt.keyCode==13) { + this.search(); + } + }, + + openOrder(index,row){ + layer.full(layer.open({ + type : 2, + title : "订单详情", + maxmin : true, + content : [ basePath + '/admin/order/orderItem?id=' + row.orderId ] + })); + }, + //导出 + exportExcel(){ + window.location.href=basePath+"/admin/orderFlow/exportOrderFlowExcel?"+MTools.jsonToUrlParam(this.getRequestParam()); + } + + } + }); + + +</script> +</body> +</html> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/statistics-projSercice-item.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/statistics-projSercice-item.html index 02cf774..2238a29 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/statistics-projSercice-item.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/statistics-projSercice-item.html @@ -85,13 +85,15 @@ <tr> <th data-formatter="MGrid.indexfn" data-align="center" data-width="30px" >序号</th> <th data-field="SHOP_NAME" >门店</th> - <th data-field="consume_time" data-formatter="MGrid.getTime" data-sortable="true" >服务日期</th> + <th data-field="yy_time" data-formatter="MGrid.getTime" data-sortable="true" >预约时间</th> + <th data-field="consume_time" data-formatter="MGrid.getTime" data-sortable="true" >划扣时间</th> <th data-field="SERVICE_NO" >服务单号</th> <th data-field="PROJ_NAME" >服务名称</th> <th data-field="TYPE_NAME" >分类</th> <th data-field="VIP_NAME" >客户名</th> - <th data-field="COUNT" data-sortable="true" >次数</th> - <th data-field="PRICE" data-sortable="true" >单价</th> + <th data-field="COUNT" data-sortable="true">次数</th> + <th data-field="PRICE" data-sortable="true">划扣单价</th> + <th data-field="extract" data-sortable="true" >提成</th> <th data-field="su_name" >美疗师</th> <th data-field="SOURCE" >来源</th> </tr> @@ -115,7 +117,9 @@ //有删除权限 var delUrl=""; myGrid=MGrid.initGrid({ - url:basePath+"/admin/serviceStatistics/showList" + url:basePath+"/admin/serviceStatistics/showList", + sortName:"yy_time", + sortOrder:"desc" }); }); diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html index 76320e7..e2eeca7 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html @@ -62,7 +62,7 @@ <el-row type="flex" align="middle" style="padding: 0 0 10px 0;"> <el-col :span="5" style="text-align: center;">充值金额</el-col> <el-col :span="10" style="text-align: center; line-height: 50px;"> - <el-input v-model="rechargeMoney" placeholder="0.1元起充"></el-input> + <el-input v-model="rechargeMoney" @change="changeRechargeMoney" placeholder="0.1元起充"></el-input> </el-col> </el-row> @@ -236,6 +236,13 @@ }); }, methods : { + //修改充值金额同步修改业绩 + changeRechargeMoney(){ + let aMoeny=(this.rechargeMoney/this.achieveList.length).toFixed(2); + this.achieveList.forEach(item=>{ + item.achieveMoney=aMoeny; + }); + }, submitRecharge() { let _this = this; diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html index 2a13ba4..2be1c8b 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html @@ -257,6 +257,7 @@ <el-button matrix:btn="vipInfo-wuxiao" v-if="scope.row.status!='无效'" type="text" size="small" @click="tabProjInvalid(scope.$index, scope.row)">无效</el-button> <el-button matrix:btn="vipInfo-dongjie" v-if="scope.row.status!='冻结'" type="text" size="small" @click="tabProjCold(scope.$index, scope.row)">冻结</el-button> <el-button matrix:btn="vipInfo-cardEdit" type="text" size="small" @click="tabProjEdit(scope.$index, scope.row)">编辑</el-button> + <el-button type="text" @click="openOrder(scope.$index, scope.row)" size="small">订单</el-button> <el-button type="text" size="small" @click="openProjUseFlow(scope.$index, scope.row)">操作记录</el-button> </template> </el-table-column> @@ -293,6 +294,7 @@ <el-button matrix:btn="vipInfo-wuxiao" v-if="scope.row.status!='无效' && scope.row.taocanId == null" type="text" size="small" @click="tabProjInvalid(scope.$index, scope.row)">无效</el-button> <el-button matrix:btn="vipInfo-dongjie" v-if="scope.row.status!='冻结' && scope.row.taocanId == null" type="text" size="small" @click="tabProjCold(scope.$index, scope.row)">冻结</el-button> <el-button matrix:btn="vipInfo-cardEdit" v-if="scope.row.taocanId == null" type="text" size="small" @click="tabProjEdit(scope.$index, scope.row)">编辑</el-button> + <el-button type="text" v-if="scope.row.orderId != null" @click="openOrder(scope.$index, scope.row)" size="small">订单</el-button> <el-button type="text" size="small" @click="openProjUseFlow(scope.$index, scope.row)">操作记录</el-button> </template> </el-table-column> @@ -333,10 +335,6 @@ label="状态"> </el-table-column> <el-table-column - prop="isVipCar" - label="是否是会籍卡" :formatter="cardIsVipFormatter"> - </el-table-column> - <el-table-column prop="isOver" label="是否使用完成" :formatter="cardIsOrderFormatter"> </el-table-column> @@ -350,10 +348,11 @@ </el-table-column> <el-table-column label="操作" fixed="right" width="160"> <template slot-scope="scope"> - <el-button matrix:btn="vipInfo-youxiao" v-if="scope.row.status!='有效'" type="text" size="small" @click="tabProjValid(scope.$index, scope.row)">有效</el-button> - <el-button matrix:btn="vipInfo-wuxiao" v-if="scope.row.status!='无效'" type="text" size="small" @click="tabProjInvalid(scope.$index, scope.row)">无效</el-button> - <el-button matrix:btn="vipInfo-dongjie" v-if="scope.row.status!='冻结'" type="text" size="small" @click="tabProjCold(scope.$index, scope.row)">冻结</el-button> + <el-button matrix:btn="vipInfo-youxiao" v-if="scope.row.status!='有效' && scope.row.isVipCar =='N' " type="text" size="small" @click="tabProjValid(scope.$index, scope.row)">有效</el-button> + <el-button matrix:btn="vipInfo-wuxiao" v-if="scope.row.status!='无效' && scope.row.isVipCar =='N' " type="text" size="small" @click="tabProjInvalid(scope.$index, scope.row)">无效</el-button> + <el-button matrix:btn="vipInfo-dongjie" v-if="scope.row.status!='冻结' && scope.row.isVipCar =='N' " type="text" size="small" @click="tabProjCold(scope.$index, scope.row)">冻结</el-button> <el-button matrix:btn="vipInfo-cardEdit" type="text" size="small" @click="tabProjEdit(scope.$index, scope.row)">编辑</el-button> + <el-button type="text" v-if="scope.row.isVipCar =='N'" @click="openOrder(scope.$index, scope.row)" size="small">订单</el-button> <el-button type="text" size="small" @click="openMoneyCardUseFlow(scope.$index, scope.row)">操作记录</el-button> </template> </el-table-column> @@ -717,6 +716,15 @@ } }, methods : { + //打开订单详情页面 + openOrder(index,row){ + layer.full(layer.open({ + type : 2, + title : "订单详情", + maxmin : true, + content : [ basePath + '/admin/order/orderItem?id=' + row.orderId ] + })); + }, querySearch(queryString, cb) { $.AjaxProxy({ p: { @@ -1071,8 +1079,8 @@ params.state = serviceOrderTab.state; params.vipId = _this.vipInfo.id; if (serviceOrderTab.selectTime) { - params.beginTime = moment(serviceOrderTab.selectTime[0]).format("YYYY-MM-DD HH:mm"); - params.closureTime = moment(serviceOrderTab.selectTime[1]).format("YYYY-MM-DD HH:mm"); + params.beginTime = serviceOrderTab.selectTime?moment(serviceOrderTab.selectTime[0]).format("YYYY-MM-DD HH:mm"):''; + params.closureTime = serviceOrderTab.selectTime?moment(serviceOrderTab.selectTime[1]).format("YYYY-MM-DD HH:mm"):''; } $.AjaxProxy({ p:params @@ -1154,8 +1162,8 @@ params.statu = orderTab.state; params.vipId = _this.vipInfo.id; if (orderTab.selectTime) { - params.beginTimeVo = moment(orderTab.selectTime[0]).format("YYYY-MM-DD HH:mm"); - params.endTimeVo = moment(orderTab.selectTime[1]).format("YYYY-MM-DD HH:mm"); + params.beginTimeVo = orderTab.selectTime?moment(orderTab.selectTime[0]).format("YYYY-MM-DD HH:mm"):''; + params.endTimeVo = orderTab.selectTime?moment(orderTab.selectTime[1]).format("YYYY-MM-DD HH:mm"):''; } $.AjaxProxy({ p:params @@ -1229,8 +1237,8 @@ params.offset = (page.currentPage - 1) * page.pageSize; params.userId = _this.vipInfo.id; if (skinTab.selectTime) { - params.beginTime = moment(skinTab.selectTime[0]).format("YYYY-MM-DD"); - params.endTime = moment(skinTab.selectTime[1]).format("YYYY-MM-DD"); + params.beginTime = skinTab.selectTime?moment(skinTab.selectTime[0]).format("YYYY-MM-DD"):''; + params.endTime = skinTab.selectTime?moment(skinTab.selectTime[1]).format("YYYY-MM-DD"):''; } $.AjaxProxy({ p:params diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/jyls.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/jyls.html new file mode 100644 index 0000000..130f97d --- /dev/null +++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/jyls.html @@ -0,0 +1,306 @@ +<!DOCTYPE HTML> +<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> +<head> + <meta charset="utf-8"> + <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> + <meta name="renderer" content="webkit|ie-comp|ie-stand"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" + content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> + <meta http-equiv="Cache-Control" content="no-siteapp"/> + <LINK rel="Bookmark" href="../images/favicon.ico"> + <!-- 本框架基本脚本和样式 --> + <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script> + <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}"> + <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> + <title></title> + <style> + .panel-body{ + overflow: hidden; + } + .buttonPanel{ + background: #ffffff; + padding: 10px 10px ; + margin: 0px 0px 10px 0px; + } + .rowPanel{ + background: #ffffff; + padding: 0px 10px ; + padding-top: 10px; + margin: 0px 0px 10px 0px; + } + .paginationStyle{ + background: #ffffff; + padding: 10px 10px; + margin: 0px 0px 10px 0px; + text-align: right; + } + </style> +</head> +<body> +<div class="panel-body" id="app"> + + <el-row class="buttonPanel"> + <el-button @click="exportExcel" type="primary" >导出</el-button> + </el-row> + + <el-row class="rowPanel" > + <el-form ref="form" :model="form" inline > + <el-form-item label="会员" prop="queryKey"> + <el-input v-model="form.queryKey" placeholder="请输入会员姓名/手机"></el-input> + </el-form-item> + + <el-form-item label="操作人" prop="oprationMan" > + <el-input v-model="form.oprationMan"></el-input> + </el-form-item> + + <el-form-item label="订单号" prop="orderNo"> + <el-input v-model="form.orderNo"></el-input> + </el-form-item> + + <el-form-item label="交易类型" prop="flowType"> + <el-select v-model="form.flowType" placeholder="请选择"> + <el-option + v-for="item in flowTypeList" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> + </el-form-item> + + <el-form-item label="支付方式" prop="payMethod"> + <el-select v-model="form.payMethod" placeholder="请选择"> + <el-option + v-for="item in payMethodList" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + + <el-form-item label="时间" prop="datetimeArr"> + <el-date-picker + v-model="form.datetimeArr" + type="daterange" + range-separator="至" format="yyyy-MM-dd HH:mm" + start-placeholder="开始日期" + end-placeholder="结束日期"> + </el-date-picker> + </el-form-item> + + <el-button type="primary" @click="search" >搜索</el-button> + <el-button @click="resetForm('form')">重置</el-button> + </el-form> + </el-row> + + <el-row class="table-style" > + + <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange"> + <el-table-column + prop="orderNo" + label="订单号" + width="180"> + </el-table-column> + <el-table-column + prop="flowContent" + label="交易内容" + show-overflow-tooltip + width="240"> + </el-table-column> + <el-table-column + prop="createTime" + sortable="custom" + label="交易时间" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + prop="flowType" + sortable="custom" + label="交易类型"> + </el-table-column> + <el-table-column + prop="amount" + sortable="custom" + label="交易金额"> + </el-table-column> + <el-table-column + prop="vipName" + label="会员姓名"> + </el-table-column> + <el-table-column + prop="payMethod" + sortable="custom" + label="支付方式"> + </el-table-column> + <el-table-column + prop="flowNo" + label="支付流水号"> + </el-table-column> + <el-table-column + prop="staffName" + label="操作人"> + </el-table-column> + <el-table-column + prop="shopName" + label="门店名称"> + </el-table-column> + <el-table-column label="操作"> + <template slot-scope="scope"> + <el-button type="text" @click="openOrder(scope.$index, scope.row)" size="small">订单详情</el-button> + </template> + </el-table-column> + </el-table> + </el-row> + <el-row class="paginationStyle" > + <el-pagination background + @size-change="changePageSize" + @current-change="changeCurrentPage" + :current-page="table.currentPage" + :page-sizes="[10, 20, 30, 50]" + :page-size="table.pageSize" + layout="total, sizes, prev, pager, next, jumper" + :total="table.total"> + </el-pagination> + </el-row> + +</div> +</body> +<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> +<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script> +<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> +<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> +<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script> +<script type="text/javascript" th:inline="javascript"> + + var vue = new Vue({ + el: '#app', + data: { + table:{ + rows:[], + total:0, + pageSize:10, + currentPage:1, + }, + form:{ + name:null, + datetimeArr:'', + payMethod:'', + flowType:'', + orderNo:'', + oprationMan:'', + queryKey:'', + order:'', + sort:'' + }, + height:'calc(100vh - 240px)', + flowTypeList:[ + {value:'',label:'全部'}, + {value:'购买',label:'购买'}, + {value:'退款',label:'退款'}, + {value:'还款',label:'还款'} + ], + payMethodList:[ + {value:'',label:'全部'}, + {value:'现金',label:'现金'}, + {value:'微信',label:'微信'}, + {value:'支付宝',label:'支付宝'}, + {value:'银行卡',label:'银行卡'}, + {value:'团购',label:'团购'}, + {value:'储值卡',label:'储值卡'}, + {value:'欠款',label:'欠款'} + ], + }, + created: function () { + this.loadData(); + window.addEventListener("keydown", this.keydown); + }, + methods: { + changePageSize(val) { + this.table.pageSize = val; + this.loadData(); + }, + changeCurrentPage(val) { + this.table.currentPage = val; + this.loadData(); + }, + resetForm(formName) { + this.$refs[formName].resetFields(); + }, + sortChange:function (column){ + if(column.order){ + if(column.order.indexOf("desc")){ + this.form.order="desc"; + }else{ + this.form.order="asc"; + } + this.form.sort=column.prop; + this.loadData(); + } + }, + loadData:function(){ + let _this = this; + let data=_this.getRequestParam(); + data.limit=_this.table.pageSize; + data.offset=_this.table.pageSize*(_this.table.currentPage-1); + AjaxProxy.requst({ + app: _this, + data:data, + url: basePath + '/admin/orderFlow/findOrderFlow', + callback: function (data) { + _this.table.rows = data.rows; + _this.table.total=data.total; + } + }); + }, + getRequestParam(){ + let _this = this; + return { + name:_this.form.name, + payMethod:_this.form.payMethod, + flowType:_this.form.flowType, + orderNo:_this.form.orderNo, + oprationMan:_this.form.oprationMan, + queryKey:_this.form.queryKey, + startTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[0]).format("YYYY-MM-DD HH:mm"):'', + endTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[1]).format("YYYY-MM-DD HH:mm"):'', + shopId:_this.form.shopId, + order:_this.form.order, + sort:_this.form.sort, + } + }, + search:function(){ + this.table.currentPage=1; + this.loadData(); + }, + keydown(evt){ + if(evt.keyCode==13) { + this.search(); + } + }, + + openOrder(index,row){ + layer.full(layer.open({ + type : 2, + title : "订单详情", + maxmin : true, + content : [ basePath + '/admin/order/orderItem?id=' + row.orderId ] + })); + }, + //导出 + exportExcel(){ + window.location.href=basePath+"/admin/orderFlow/exportOrderFlowExcel?"+MTools.jsonToUrlParam(this.getRequestParam()); + } + + } + }); + + +</script> +</body> +</html> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/statistics-projSercice-item.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/statistics-projSercice-item.html index af8c3ce..80f18c5 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/statistics-projSercice-item.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/statistics-projSercice-item.html @@ -77,15 +77,18 @@ <thead> <tr> <th data-formatter="MGrid.indexfn" data-align="center" data-width="30px" >序号</th> - <th data-field="consume_time" data-formatter="MGrid.getTime" data-sortable="true" >服务日期</th> + <th data-field="SHOP_NAME" >门店</th> + <th data-field="yy_time" data-formatter="MGrid.getTime" data-sortable="true" >预约时间</th> + <th data-field="consume_time" data-formatter="MGrid.getTime" data-sortable="true" >划扣时间</th> <th data-field="SERVICE_NO" >服务单号</th> <th data-field="PROJ_NAME" >服务名称</th> <th data-field="TYPE_NAME" >分类</th> <th data-field="VIP_NAME" >客户名</th> - <th data-field="COUNT" data-sortable="true" >次数</th> - <th data-field="PRICE" data-sortable="true" >单价</th> - <th data-field="su_name" >美疗师</th> - <th data-field="SOURCE" >来源</th> + <th data-field="COUNT" data-sortable="true" >次数</th> + <th data-field="PRICE" data-sortable="true" >划扣单价</th> + <th data-field="extract" data-sortable="true" >提成</th> + <th data-field="su_name" >美疗师</th> + <th data-field="SOURCE" >来源</th> </tr> </thead> </table> @@ -107,7 +110,9 @@ //有删除权限 var delUrl=""; myGrid=MGrid.initGrid({ - url:basePath+"/admin/serviceStatistics/showList" + url:basePath+"/admin/serviceStatistics/showList", + sortName:"yy_time", + sortOrder:"desc" }); }); -- Gitblit v1.9.1