From ec87cf1ee2b9382bf9d089711f0ff82ae8e7077c Mon Sep 17 00:00:00 2001 From: jyy <jyy> Date: Wed, 09 Jun 2021 20:44:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/api_score_meger' into api_score_meger --- zq-erp/pom.xml | 2 zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java | 80 ++ zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java | 41 + zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java | 14 zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java | 49 + zq-erp/src/main/resources/config/application.properties | 4 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml | 7 zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java | 33 + zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html | 11 zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html | 34 + zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java | 56 + zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java | 11 zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html | 366 ++++++++++++ zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java | 26 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml | 101 +++ zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java | 8 zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java | 33 + zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java | 6 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 45 + zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html | 11 zq-erp/src/main/java/filecopy.java | 80 ++ zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html | 402 +++++++++++++ zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html | 21 zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java | 2 zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html | 21 zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java | 129 ++++ zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml | 38 + zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml | 24 zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java | 42 + zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java | 5 30 files changed, 1,636 insertions(+), 66 deletions(-) diff --git a/zq-erp/pom.xml b/zq-erp/pom.xml index 3bdc5c1..ed1dc1f 100644 --- a/zq-erp/pom.xml +++ b/zq-erp/pom.xml @@ -401,7 +401,7 @@ <exclude>config/xcx/*</exclude> <exclude>config/xcshop/*</exclude> - <!-- --> + <!----> <exclude>config/config.json</exclude> <exclude>config/application.properties</exclude> <exclude>config/system.properties</exclude> diff --git a/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java b/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java index c61852d..03cb319 100644 --- a/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java +++ b/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java @@ -66,13 +66,13 @@ .excludePathPatterns("/webjars/**"); // 用户认证拦截 - registry.addInterceptor(userLoginInterceptor) - .addPathPatterns("/**") - .excludePathPatterns("/common/**") - .excludePathPatterns("/resource/**") - .excludePathPatterns("/swagger**/**") - .excludePathPatterns("/webjars/**") - .excludePathPatterns("/api/**"); +// registry.addInterceptor(userLoginInterceptor) +// .addPathPatterns("/**") +// .excludePathPatterns("/common/**") +// .excludePathPatterns("/resource/**") +// .excludePathPatterns("/swagger**/**") +// .excludePathPatterns("/webjars/**") +// .excludePathPatterns("/api/**"); // url权限拦截 registry.addInterceptor(suAuthorityInterceptor).addPathPatterns("/**/su/**"); diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java index 2c08183..fe414cc 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.matrix.core.anotations.Extend; import com.matrix.core.tools.DateUtil; +import com.matrix.system.app.dto.BasePageDto; +import com.matrix.system.common.bean.EntityDTOExt; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; @@ -11,7 +13,7 @@ * * @date 2019-03-24 23:55 */ -public class AchieveNew implements Serializable{ +public class AchieveNew extends EntityDTOExt { @Extend private static final long serialVersionUID = 1L; @@ -26,7 +28,7 @@ /** - * 美疗师id + * 美疗师id 把这个字段视为正式的业绩归属人 */ private Long beaultId; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java new file mode 100644 index 0000000..07e7594 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java @@ -0,0 +1,33 @@ +package com.matrix.system.hive.bean; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.matrix.system.hiveErp.pojo.AchieveRuleItem; +import com.matrix.system.score.entity.BaseEntity; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * 业绩规则 + * @author JIANGYOUYAO + * @date 2021/6/3 0003 + */ +@Data +@TableName("achieve_rule") +public class AchieveRule extends BaseEntity { + + @NotEmpty(message = "规则名称不能为空") + private String name; + + + private String rules; + + private Long companyId; + + @TableField(exist=false) + @NotEmpty(message = "规则不能为空") + private List<AchieveRuleItem> ruleItemList; + +} 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 d0a63cb..0787c91 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 @@ -1,6 +1,8 @@ package com.matrix.system.hive.bean; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import com.matrix.core.anotations.Extend; import com.matrix.core.tools.DateUtil; @@ -14,9 +16,10 @@ * * @date 2016-09-17 10:17 */ + public class MoneyCardUse { - + @TableId(value = "id",type = IdType.AUTO) private Long id; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java index 7dfeeff..9824694 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java @@ -433,12 +433,38 @@ * 任选套餐是否无限次 N-否 Y-是 */ private String isInfinite; + /** + *业绩规则id + */ + private Long achieveRuleId; + + /** + *业绩规则名称 + */ + @Extend + private String achieveRuleName; /** * 支付方式 1-充值本金 2-赠送金额 3-积分 */ private String payMethods; + public String getAchieveRuleName() { + return achieveRuleName; + } + + public void setAchieveRuleName(String achieveRuleName) { + this.achieveRuleName = achieveRuleName; + } + + public Long getAchieveRuleId() { + return achieveRuleId; + } + + public void setAchieveRuleId(Long achieveRuleId) { + this.achieveRuleId = achieveRuleId; + } + public String getPayMethods() { return payMethods; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java index 835d02c..f160d12 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java @@ -42,7 +42,7 @@ private Date orderTime; /** - * 收款 + * calculationType: 1, */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") private Date payTime; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java index d8421e3..bcde36d 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java @@ -1,10 +1,15 @@ package com.matrix.system.hive.dao; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.matrix.core.pojo.PaginationVO; import com.matrix.system.app.vo.OrderDetailAchieveItemVo; import com.matrix.system.app.vo.RankingVo; import com.matrix.system.app.vo.UserAchieveVo; import com.matrix.system.hive.bean.AchieveNew; +import com.matrix.system.hive.dto.AchieveNewStatisticsDto; +import com.matrix.system.hive.vo.AchieveNewStatisticsVo; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -18,7 +23,7 @@ */ -public interface AchieveNewDao{ +public interface AchieveNewDao extends BaseMapper<AchieveNew> { public int insert(@Param("item") AchieveNew achieveNew); @@ -82,4 +87,5 @@ int updateAchieveNumOfPeople(@Param("list") List<AchieveNew> list, @Param("num") Double num); + IPage<AchieveNewStatisticsVo> achieveNewStatistics(Page<AchieveNewStatisticsVo> page, @Param("record")AchieveNewStatisticsDto queryDto); } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java new file mode 100644 index 0000000..08034c3 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java @@ -0,0 +1,11 @@ +package com.matrix.system.hive.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.matrix.system.hive.bean.AchieveRule; + +/** + * 业绩规则dao + */ +public interface AchieveRuleDao extends BaseMapper<AchieveRule> { + +} \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java b/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java new file mode 100644 index 0000000..f4b4816 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java @@ -0,0 +1,41 @@ +package com.matrix.system.hive.dto; + +import com.google.common.base.CaseFormat; +import com.matrix.core.pojo.BasePageQueryDto; +import com.matrix.core.tools.StringUtils; +import lombok.Data; + +@Data +public class AchieveNewStatisticsDto extends BasePageQueryDto { + + //规则名称 + String achieveRuleId; + + + //业绩归属人id + String staffName; + + + //门店名称 + Long shopId; + + //公司id + Long companyId; + + //订单类型 + String orderType; + + @Override + public void setSort(String sort) { + if(StringUtils.isNotBlank(sort)){ + if ("ruleName".equals(sort)) { + super.setSort("u.name"); + } else { + super.setSort(CaseFormat.LOWER_CAMEL.to + (CaseFormat.LOWER_UNDERSCORE, sort)); + } + }else{ + super.setSort(sort); + } + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java new file mode 100644 index 0000000..601c8fe --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java @@ -0,0 +1,33 @@ +package com.matrix.system.hive.service; + +import cn.hutool.json.JSONUtil; +import com.matrix.system.hive.bean.AchieveRule; +import com.matrix.system.hive.dao.AchieveRuleDao; +import com.matrix.system.hiveErp.pojo.AchieveRuleItem; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 业绩规则服务 + * @author JIANGYOUYAO + * @date 2021/6/3 0003 + */ +@Service +@AllArgsConstructor +public class AchieveRuleService { + + AchieveRuleDao achieveRuleDao; + + + /** + * 根据id查询 AchieveRule + * @param id + * @return + */ + public AchieveRule selectById(Long id){ + AchieveRule achieveRule = achieveRuleDao.selectById(id); + achieveRule.setRuleItemList(JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class)); + return achieveRule; + } + +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java index f0c6d88..201047f 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java @@ -1,6 +1,7 @@ package com.matrix.system.hive.service.imp; import cn.hutool.core.collection.CollUtil; +import cn.hutool.json.JSONUtil; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.PaginationVO; @@ -16,13 +17,11 @@ import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.*; -import com.matrix.system.hive.dao.AchieveNewDao; -import com.matrix.system.hive.dao.ShoppingGoodsDao; -import com.matrix.system.hive.dao.SysBeauticianStateDao; -import com.matrix.system.hive.dao.SysProjUseDao; +import com.matrix.system.hive.dao.*; import com.matrix.system.hive.plugin.util.CollectionUtils; import com.matrix.system.hive.service.AchieveNewService; import com.matrix.system.hive.service.SysProjServicesService; +import com.matrix.system.hiveErp.pojo.AchieveRuleItem; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -185,8 +184,14 @@ // 是否为赠送业绩 if (Dictionary.TAOCAN_SOURCE_ZS.equals(projUse.getSource())) { achieveNew.setFreeConsume(projUse.getPrice()*beauticianState.getCount()); + //计算提成 + achieveNew.setProjPercentage( + calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_ZS,achieveNew.getFreeConsume(),beauticianState.getProjId())); } else { achieveNew.setHisConsume(projUse.getPrice()*beauticianState.getCount()); + //计算提成 + achieveNew.setProjPercentage( + calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_BJ,achieveNew.getHisConsume(),beauticianState.getProjId())); } achieveNew.setT2(projUse.getSource()); achieveNew.setDatatime(new Date()); @@ -239,6 +244,36 @@ } + @Autowired + AchieveRuleDao achieveRuleDao; + + private Double calculationProjPercentage(int type, Double consume, Long goodsId) { + ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(goodsId); + if(shoppingGoods.getAchieveRuleId()!=null){ + + AchieveRule achieveRule = achieveRuleDao.selectById(shoppingGoods.getAchieveRuleId()); + if(achieveRule!=null){ + List<AchieveRuleItem> achieveRuleItems = JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class); + double percentage=0D; + for(AchieveRuleItem item:achieveRuleItems){ + if(item.getAchieveType()==type + && (item.getLower() == consume + || (item.getLower()< consume && consume < item.getUpper() ))){ + + if(AchieveRuleItem.ACHIEVE_TYPE_FIXED==item.getCalculationType()){ + percentage=item.getAchieve(); + }else{ + percentage= consume * (item.getAchieve()/100); + } + break; + } + } + return percentage; + } + } + return 0D; + } + /** * 顾问人头业绩 * @param achieveNew @@ -264,7 +299,6 @@ for (AchieveNew achieveNew : orderItem.getAchieveList()) { if (achieveNew !=null && achieveNew.getGoodsCash()!=null) { buildAchieve(pageOrder, orderItem, achieveNew); - // 新增美疗师业绩 achieveNewList.add(achieveNew); } } @@ -290,7 +324,10 @@ } achieveNew.setVipId(pageOrder.getVipId()); - achieveNew.setSaleId(pageOrder.getStaffId()); + if(achieveNew.getSaleId()==null){ + achieveNew.setSaleId(pageOrder.getStaffId()); + } + if (pageOrder.getPayTime() != null) { achieveNew.setDatatime(pageOrder.getPayTime()); 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 3d19de0..0384cfd 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 @@ -497,6 +497,12 @@ if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) { throw new GlobleException("该订单已经收过款,请刷新页面再试!"); } + + //交易业绩设置是否合理 + + checkAchieveIsOk(pageOrder); + + // 更新收款时间 pageOrder.setPayTime(new Date()); pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); @@ -530,6 +536,28 @@ //设置会员积分 addVipScore(pageOrder); + } + + /** + * 交易业绩设置是否合理 + * @param pageOrder + */ + private void checkAchieveIsOk(SysOrder pageOrder) { + double huakouSum = pageOrder.getItems().stream() + .mapToDouble( + item -> + item.getAchieveList().stream() + .filter(achieveNew -> "划扣".equals(achieveNew.getPayMethod())) + .mapToDouble(achieve -> achieve.getGoodsCash()).sum() + ).sum(); + + double czkPay= pageOrder.getFlows().stream() + .filter(sysOrderFlow -> "储值卡".equals(sysOrderFlow.getPayMethod())) + .mapToDouble(sysOrderFlow ->sysOrderFlow.getAmount().doubleValue()).sum(); + + if(czkPay!=huakouSum){ + throw new GlobleException("划扣业绩不等于储值卡扣款金额,请修改业绩设置!"); + } } /** @@ -1205,13 +1233,20 @@ } else { puse.setPrice(goodsAssemble.getPrice() * zk); } - puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); + // 赠送和打折后金额为0的都视为赠送项目 if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { puse.setSource(Dictionary.TAOCAN_SOURCE_GM); } else { + //赠送产品按原价计算消耗 puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); + if (taocanId == null) { + puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() ); + } else { + puse.setPrice(goodsAssemble.getPrice()); + } } + puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); puse.setFailTime(failTime); sysProjUseDao.insert(puse); return puse; @@ -1291,18 +1326,22 @@ puse.setVipId(order.getVipId()); puse.setStatus(Dictionary.TAOCAN_STATUS_YX); puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); - puse.setBalance(sysOrderItem.getZkPrice()); - puse.setPrice(sysOrderItem.getZkPrice()); + + puse.setProjName(sysOrderItem.getShoppingGoods().getName()); // 赠送和打折后金额为0的都视为赠送项目 if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { puse.setSource(Dictionary.TAOCAN_SOURCE_GM); + puse.setPrice(sysOrderItem.getZkPrice()); } else { puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); + //赠送产品按原价计算消耗 + puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice()); } // 设置失效时间 Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); puse.setFailTime(invalidTime); + puse.setBalance(sysOrderItem.getShoppingGoods().getSealPice()*puse.getSurplusCount()); sysProjUseDao.insert(puse); } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java index 95ac4ed..ba436dc 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java @@ -1,5 +1,7 @@ package com.matrix.system.hive.statistics; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.pojo.PaginationVO; @@ -13,14 +15,17 @@ import com.matrix.system.hive.action.util.QueryUtil; import com.matrix.system.hive.bean.AchieveNew; import com.matrix.system.hive.dao.AchieveNewDao; +import com.matrix.system.hive.dto.AchieveNewStatisticsDto; import com.matrix.system.hive.plugin.util.CollectionUtils; import com.matrix.system.hive.service.AchieveNewService; import com.matrix.system.hive.service.SysOrderItemService; import com.matrix.system.hive.service.SysOrderService; +import com.matrix.system.hive.vo.AchieveNewStatisticsVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -53,6 +58,25 @@ @Autowired private AchieveNewDao achieveNewDao; + + + /** + * 员工业绩统计 + */ + @PostMapping(value = "/achieveNewStatistics") + public @ResponseBody + AjaxResult achieveNewStatistics(@RequestBody AchieveNewStatisticsDto queryDto){ + SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); + + queryDto.setCompanyId(sysUsers.getCompanyId()); + + Page<AchieveNewStatisticsVo> page = new Page(queryDto.getPageNum(), queryDto.getPageSize()); + IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto); + AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal()); + return result; + } + + /** * 门店每日单据明细表 */ @@ -74,11 +98,16 @@ */ @RequestMapping(value = "/findDailyInfoNew") public @ResponseBody - AjaxResult findDailyInfoNew(AchieveNew achieveNew, PaginationVO pageVo) { + AjaxResult findDailyInfoNew(@RequestBody AchieveNew achieveNew) { SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); + achieveNew.setCompanyId(sysUsers.getCompanyId()); if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){ achieveNew.setShopId(sysUsers.getShopId()); } + PaginationVO pageVo = new PaginationVO(); + + pageVo.setOffset(achieveNew.getOffset()); + pageVo.setLimit(achieveNew.getLimit()); pageVo.setSort("datatime"); pageVo.setOrder("desc"); AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, achieveNewService.findDayFlow(achieveNew, pageVo), @@ -86,6 +115,55 @@ return result; } + @RequestMapping(value = "/exportAchieveNewStatisticsExcel") + public void exportAchieveNewStatisticsExcel(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNewStatisticsDto queryDto) throws IOException { + //这里是从数据库里查数据并组装成我们想要的数据结构的过程 + List<ExcelSheetPO> res = new ArrayList<>(); + ExcelSheetPO orderSheet = new ExcelSheetPO(); + String title = "员工业绩统计"; + orderSheet.setSheetName(title); + orderSheet.setTitle(title); + String[] header = {"规则名称", "门店名称", "业绩归属人", "业绩创建人", "订单金额", "现金", "划扣", "本金消耗", "赠送消耗" + , "服务提成", "人头", "项目个数", "服务时间", "订单类型"}; + orderSheet.setHeaders(header); + SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); + if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){ + queryDto.setShopId(sysUsers.getShopId()); + } + queryDto.setCompanyId(sysUsers.getCompanyId()); + Page<AchieveNewStatisticsVo> page = new Page(1, Long.MAX_VALUE); + IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto); + List<AchieveNewStatisticsVo> dataList = rows.getRecords(); + List<List<Object>> list = new ArrayList<>(); + if (dataList.size() > 0) { + for (AchieveNewStatisticsVo item : dataList) { + List<Object> temp = new ArrayList<>(); + temp.add(item.getRuleName()); + temp.add(item.getShopName()); + temp.add(item.getGuwen()); + temp.add(item.getCreateBy()); + temp.add(item.getZkTotal()); + temp.add(item.getGoodsCash()); + temp.add(item.getCardCash()); + temp.add(item.getHisConsume()); + temp.add(item.getFreeConsume()); + temp.add(item.getProjPercentage()); + temp.add(item.getNumberOfPeople()); + temp.add(item.getProjNum()); + temp.add(item.getProjTime()); + temp.add(item.getOrderType()); + list.add(temp); + } + } + orderSheet.setDataList(list); + res.add(orderSheet); + response = ResponseHeadUtil.setExcelHead(response); + response.setHeader("Content-Disposition", + "attachment;filename=" + java.net.URLEncoder.encode(title + DateUtil.getTimeMark() + ".xlsx".trim(), "UTF-8")); + OutputStream os = response.getOutputStream(); + com.matrix.core.tools.excl.ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true); + } + @RequestMapping(value = "/exportDailyInfoNew") public void exportDailyInfoNew(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNew achieveNew) throws IOException { //这里是从数据库里查数据并组装成我们想要的数据结构的过程 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java b/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java new file mode 100644 index 0000000..b48a597 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java @@ -0,0 +1,42 @@ +package com.matrix.system.hive.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class AchieveNewStatisticsVo { + //规则名称 + String ruleName; + //业绩归属人 + String guwen; + //业绩归属人id + Long gwid; + //订单创建人 + String createBy; + //创建人id + Long createId; + //订单金额 + BigDecimal zkTotal; + //消耗金额 + BigDecimal hisConsume; + //赠送消耗 + BigDecimal freeConsume; + //项目提成 + BigDecimal projPercentage; + // 人头数 + Double numberOfPeople; + //项目数 + Double projNum; + //项目时长 + Integer projTime; + //现金支付 + BigDecimal goodsCash; + //卡项支付 + BigDecimal cardCash; + //门店名称 + String shopName; + //订单类型 + String orderType; + +} diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java new file mode 100644 index 0000000..ee9deaf --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java @@ -0,0 +1,129 @@ +package com.matrix.system.hiveErp.action; + +import cn.hutool.core.date.DateTime; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.matrix.core.constance.MatrixConstance; +import com.matrix.core.pojo.AjaxResult; +import com.matrix.core.pojo.BasePageQueryDto; +import com.matrix.core.tools.StringUtils; +import com.matrix.core.tools.WebUtil; +import com.matrix.system.common.bean.SysUsers; +import com.matrix.system.common.dao.SysUsersDao; +import com.matrix.system.hive.action.util.QueryUtil; +import com.matrix.system.hive.bean.AchieveRule; +import com.matrix.system.hive.dao.AchieveRuleDao; +import com.matrix.system.hiveErp.pojo.AchieveRuleItem; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 业绩规则Api + * + * @author jiangyouyao + * @date 2021-06-03 + **/ +@RestController +@AllArgsConstructor +@RequestMapping(value = "/admin/achieveRule") +public class AchieveRuleAction { + + private AchieveRuleDao achieveRuleDao; + + + private SysUsersDao sysUsersDao; + + + /** + * 新增业绩规则 + * @param achieveRule + * @return + */ + @PostMapping("/add") + public AjaxResult add(@RequestBody @Validated AchieveRule achieveRule) { + + + + String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList()); + achieveRule.setRules(rules); + + QueryUtil.setQueryLimitCom(achieveRule); + SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); + achieveRule.setCreateTime(DateTime.now()); + achieveRule.setUpdateTime(DateTime.now()); + achieveRule.setCreateBy(user.getSuName()); + achieveRule.setUpdateBy(user.getSuName()); + achieveRuleDao.insert(achieveRule); + return AjaxResult.buildSuccessInstance("新增成功"); + } + + /** + * 修改业绩规则 + * + * @param achieveRule + * @return + */ + @PostMapping("/update") + public AjaxResult update(@RequestBody @Validated AchieveRule achieveRule) { + + if (achieveRule.getId() == null) { + return AjaxResult.buildFailInstance("id不能为空"); + } + + String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList()); + achieveRule.setRules(rules); + + SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); + achieveRule.setUpdateBy(user.getSuName()); + achieveRule.setUpdateTime(DateTime.now()); + achieveRuleDao.updateById(achieveRule); + return AjaxResult.buildSuccessInstance("修改成功"); + } + + /** + * 删除id + * + * @param id + * @return + */ + @GetMapping("/removeById/{id}") + public AjaxResult removeById(@PathVariable Long id) { + achieveRuleDao.deleteById(id); + return AjaxResult.buildSuccessInstance("删除成功"); + } + + + /** + * 分页查询规则 + * + * @param pageDto + * @return + */ + @PostMapping("/selectList") + public AjaxResult selectList(@RequestBody BasePageQueryDto pageDto) { + + SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); + Page<AchieveRule> page = new Page<>(pageDto.getPageNum(), pageDto.getPageSize()); + LambdaQueryWrapper<AchieveRule> lambdaQueryWrapper = new LambdaQueryWrapper<AchieveRule>() + .eq(AchieveRule::getCompanyId, user.getCompanyId()); + if (StringUtils.isNotBlank(pageDto.getKeywords())) { + lambdaQueryWrapper.like(AchieveRule::getName, pageDto.getKeywords()); + } + IPage<AchieveRule> achieveRuleIPage = achieveRuleDao.selectPage(page, lambdaQueryWrapper); + achieveRuleIPage.getRecords().stream().forEach(item->{ + item.setRuleItemList(JSONUtil.toList(JSONUtil.parseArray(item.getRules()), AchieveRuleItem.class)); + item.setRules(null); + }); + + AjaxResult result = AjaxResult.buildSuccessInstance(achieveRuleIPage.getRecords(), achieveRuleIPage.getTotal()); + return result; + } + + @PostMapping("/selectListForm") + public AjaxResult selectListForm(BasePageQueryDto pageDto) { + return selectList(pageDto); + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java new file mode 100644 index 0000000..8eec4db --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java @@ -0,0 +1,56 @@ +package com.matrix.system.hiveErp.pojo; + +import lombok.Data; + +/** + * 绩效规则明细 + * @author JIANGYOUYAO + * @date 2021/6/3 0003 + */ +@Data +public class AchieveRuleItem { + /** + * 类型,1本金消耗 + */ + public static final int ACHIEVE_TYPE_BJ=1; + /** + * 类型,2赠送消耗 + */ + public static final int ACHIEVE_TYPE_ZS =2; + /** + * 计算类型 1 固定值 + */ + public static final int ACHIEVE_TYPE_FIXED=1; + /** + * 计算类型 2百分比 + */ + public static final int ACHIEVE_TYPE_PERCENTAGE=2; + + + /** + * 类型,1本金消耗,2赠送消耗 + */ + private Integer achieveType; + + /** + * 计算类型 1 固定值,2百分比 + */ + private Integer calculationType; + + /** + * 区间-低 + */ + private Double Lower ; + + /** + * 区间-高 + */ + private Double upper ; + + /** + * 业绩值 + */ + private Double achieve; + + +} diff --git a/zq-erp/src/main/java/filecopy.java b/zq-erp/src/main/java/filecopy.java new file mode 100644 index 0000000..544d6cb --- /dev/null +++ b/zq-erp/src/main/java/filecopy.java @@ -0,0 +1,80 @@ +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +/** + * 文件对比复制 + * @author JIANGYOUYAO + * @date 2021/6/7 0007 + */ +public class filecopy { + + + static String targetFilePath="/mnt/sdc/webresource"; + + static String sourceFilePaht="/mnt/sdc/webresourceback"; + + public static void main(String[] args) throws IOException { + + + File sourceFile=new File(sourceFilePaht); + traverseFolder(sourceFile); + + + } + + + public static void traverseFolder(File file) throws IOException { + + if (file.exists()) { + File[] files = file.listFiles(); + if (null == files || files.length == 0) { + System.out.println("文件夹是空的!"); + return; + } else { + for (File file2 : files) { + if (file2.isDirectory()) { + //对比target是否存在 + final String s = file2.getCanonicalPath().replaceAll("webresourceback", "webresource"); + File f=new File(s); + if(!f.exists()){ + System.out.println("复制文件:" + file2.getAbsolutePath()); + f.mkdir(); + }else{ + System.out.println("文件:" + file2.getAbsolutePath()+"存在"); + } + traverseFolder(file2); + } else { + + //对比target是否存在,不存在则copy + final String s = file2.getCanonicalPath().replaceAll("webresourceback", "webresource"); + File f=new File(s); + if(!f.exists()){ + System.out.println("复制文件:" + file2.getAbsolutePath()); + FileInputStream in=new FileInputStream(file2); + FileOutputStream out=new FileOutputStream(f); + byte[] buff=new byte[1024]; + int length=in.read(buff); + while (length>0){ + out.write(buff,0,length); + length=in.read(buff); + } + out.close(); + in.close(); + + }else{ + System.out.println("文件:" + file2.getAbsolutePath()+"存在"); + } + + } + } + } + } else { + System.out.println("文件不存在!"); + } + } + + + +} diff --git a/zq-erp/src/main/resources/config/application.properties b/zq-erp/src/main/resources/config/application.properties index fa1e322..7589d03 100644 --- a/zq-erp/src/main/resources/config/application.properties +++ b/zq-erp/src/main/resources/config/application.properties @@ -4,10 +4,6 @@ #线上测试环境 # -#spring.datasource.username=ct_test -#spring.datasource.password=123456 -#spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 - spring.datasource.username=ct_test spring.datasource.password=123456 spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml index fb605a0..651ca07 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml @@ -95,6 +95,7 @@ left join sys_proj_services l on a.service_order_id=l.id left join sys_order_item j on a.order_item_id=j.ID <where> + and a.company_id = #{record.companyId} <if test="record!=null"> <if test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) "> @@ -118,9 +119,7 @@ <if test="record.beaultId != null and record.beaultId !='' "> and a.beault_id = #{record.beaultId} </if> - <if test="record.companyId != null and record.companyId !='' "> - and a.company_id = #{record.companyId} - </if> + <if test="record.beaultId != null and record.beaultId !='' "> and a.beault_id = #{record.beaultId} </if> @@ -196,7 +195,41 @@ </where> </select> +<!-- + 统计员工业绩 + +select + u.name, + g.su_name guwen, + cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total, + cast(SUM(a.his_consume) AS decimal(15,2)), + cast(SUM(a.free_consume) AS decimal(15,2)), + cast(SUM(a.proj_percentage) AS decimal(15,2)), + cast(SUM(a.number_of_people) AS decimal(15,2)), + cast(SUM(a.proj_num) AS decimal(15,2)), + cast(SUM(a.proj_time) AS decimal(15,2)), + h.shop_short_name shop_name, + a.order_type, + a.achieveType + from + achieve_new 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_vip_level d on c.LEVEL_ID=d.id + left join shopping_goods e on a.shopping_goods_id=e.id + LEFT JOIN sys_users f on a.beault_id=f.su_id + LEFT JOIN sys_users g on a.sale_id = g.su_id + LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID + LEFT JOIN shopping_goods_category i ON e.cate_id = i.id + left join sys_proj_services l on a.service_order_id=l.id + left join sys_order_item j on a.order_item_id=j.ID + left join achieve_rule u on u.id=e.achieve_rule_id + where h.shop_short_name='龙华店' + GROUP BY g.su_name , a.order_type, h.id,a.achieveType + ORDER BY g.su_name + +--> <select id="findSumDailyInfoNew" resultMap="AchieveNewMap"> @@ -1090,6 +1123,68 @@ and date_format(datatime, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d') </select> + <select id="achieveNewStatistics" resultType="com.matrix.system.hive.vo.AchieveNewStatisticsVo"> + + select + u.name ruleName, + f.su_name guwen, + f.su_id gwid, + g.su_name createBy, + g.su_id createId, + cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total, + cast(SUM(a.his_consume) AS decimal(15,2)) his_consume, + cast(SUM(a.free_consume) AS decimal(15,2)) free_consume, + cast(SUM(a.proj_percentage) AS decimal(15,2)) proj_percentage, + cast(SUM(a.number_of_people) AS decimal(15,2)) number_of_people, + cast(SUM(a.proj_num) AS decimal(15,2)) proj_num, + cast(SUM(case when a.pay_method = '划扣' then goods_cash end )AS decimal(15,2)) card_cash, + cast(SUM(a.proj_time) AS decimal(15,2)) proj_time, + cast(SUM(case when a.pay_method = '现金' then goods_cash end )AS decimal(15,2)) goods_cash, + h.shop_short_name shop_name, + a.order_type + from + achieve_new 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_vip_level d on c.LEVEL_ID=d.id + left join shopping_goods e on a.shopping_goods_id=e.id + LEFT JOIN sys_users f on a.beault_id=f.su_id + LEFT JOIN sys_users g on a.sale_id = g.su_id + LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID + LEFT JOIN shopping_goods_category i ON e.cate_id = i.id + left join sys_proj_services l on a.service_order_id=l.id + left join sys_order_item j on a.order_item_id=j.ID + left join achieve_rule u on u.id=e.achieve_rule_id + <where> + and a.company_id = #{record.companyId} + <if test="record.shopId != null"> + and a.shop_id = #{record.shopId} + </if> + <if test="record.achieveRuleId != null"> + and u.id = #{record.achieveRuleId} + </if> + + <if test="record.staffName != null and record.staffName!=''"> + <!-- 创建人和归属人都有业绩 --> + and (f.su_name like concat('%',#{record.staffName},'%') or g.su_name like concat('%',#{record.staffName},'%') ) + </if> + + <if test="record.orderType != null and record.orderType != '' "> + and a.order_type= #{record.orderType} + </if> + <if test="record.beginTime != null "> + and a.datatime >= #{record.beginTime} + </if> + <if test="record.endTime != null "> + <![CDATA[and a.datatime <= #{record.endTime}]]> + </if> + + </where> + GROUP BY g.su_id , f.su_id, a.order_type, h.id,a.achieveType,u.name + <if test="record.sort !=null and record.sort!=''"> order by ${record.sort} ${record.order}</if> + + </select> + <update id="updateAchieveNumOfPeople"> <foreach collection="list" item="item" index="index" diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml new file mode 100644 index 0000000..a6c3707 --- /dev/null +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.matrix.system.hive.dao.AchieveRuleDao"> + +</mapper> \ No newline at end of file diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml index a60b9d8..4bb2b75 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml @@ -17,7 +17,7 @@ <result property="staffId" column="staff_id" /> <result property="vipName" column="vip_name" /> <result property="tel" column="tel" /> - <result property="bizUserId" column="sys_vip_info_id" /> + <result property="bizUserId" column="biz_user_id" /> <result property="formId" column="form_id" /> <result property="productId" column="product_id" /> @@ -42,7 +42,7 @@ <result property="staffId" column="staff_id" /> <result property="vipName" column="vip_name" /> <result property="tel" column="tel" /> - <result property="bizUserId" column="sys_vip_info_id" /> + <result property="bizUserId" column="biz_user_id" /> <result property="productId" column="product_id" /> <result property="orderNo" column="order_no" /> <result property="formId" column="form_id" /> @@ -66,7 +66,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id, order_no, form_id @@ -129,7 +129,7 @@ tel = #{tel}, </if> <if test="(bizUserId!=null and bizUserId!='') or (bizUserId!='' and bizUserId==0)"> - sys_vip_info_id = #{bizUserId}, + biz_user_id = #{bizUserId}, </if> <if test="(productId!=null and productId!='') or (productId!='' and productId==0)"> product_id = #{productId}, @@ -199,7 +199,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id, order_no, form_id, @@ -303,7 +303,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id from onlinebooking where 1=1 @@ -417,7 +417,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id, order_no from onlinebooking @@ -442,7 +442,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id from onlinebooking where 1=1 @@ -495,7 +495,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id, order_no from onlinebooking @@ -547,7 +547,7 @@ staff_id, vip_name, tel, - sys_vip_info_id, + biz_user_id, product_id, order_no, form_id, @@ -565,7 +565,7 @@ and vip_Id = #{record.vipId} </if> <if test="(record.bizUserId!=null and record.bizUserId!='') or (record.bizUserId!='' and record.bizUserId==0)"> - and sys_vip_info_id = #{record.bizUserId} + and biz_user_id = #{record.bizUserId} </if> <if test="(record.time!=null and record.time!='') or (record.time!='' and record.time==0)"> and time = #{record.time} @@ -611,7 +611,7 @@ and vip_Id = #{record.vipId} </if> <if test="(record.bizUserId!=null and record.bizUserId!='') or (record.bizUserId!='' and record.bizUserId==0)"> - and sys_vip_info_id = #{record.bizUserId} + and biz_user_id = #{record.bizUserId} </if> <if test="(record.time!=null and record.time!='') or (record.time!='' and record.time==0)"> and time = #{record.time} 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 0c6cb3c..d0ff42f 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml @@ -85,12 +85,15 @@ <result property="goodsSortName" column="goodsSortName" /> + <result property="achieveRuleName" column="achieveRuleName" /> + <result property="payMethods" column="pay_methods" /> <result property="invalidTime" column="invalid_time" /> <result property="useValid" column="use_valid" /> <result property="buyValid" column="buy_valid" /> <result property="isInfinite" column="is_infinite" /> + <result property="achieveRuleId" column="achieve_rule_id" /> @@ -160,11 +163,14 @@ <!-- 服务项目信息 --> <result property="proReward" column="proReward" /> <result property="timeLength" column="TIME_LENGTH" /> + <result property="achieveRuleId" column="achieve_rule_id" /> <!-- 扩展属性 --> <result property="cateName" column="cate_name" /> <result property="goodsSortName" column="goodsSortName" /> + <result property="achieveRuleName" column="achieveRuleName" /> + </resultMap> @@ -301,7 +307,9 @@ use_valid, invalid_time, pay_methods, - is_infinite + is_infinite, + achieve_rule_id + ) VALUES ( #{id}, @@ -362,7 +370,9 @@ #{useValid}, #{invalidTime}, #{payMethods}, - #{isInfinite} + #{isInfinite}, + #{achieveRuleId} + ) </insert> @@ -538,6 +548,10 @@ <if test="isInfinite != null and isInfinite !='' "> is_infinite = #{isInfinite}, </if> + + <if test="achieveRuleId != null and achieveRuleId !='' "> + achieve_rule_id = #{achieveRuleId}, + </if> invalid_time = #{invalidTime}, buy_valid = #{buyValid}, use_valid = #{useValid}, @@ -576,8 +590,9 @@ <select id="selectInPage" resultMap="ShoppingGoodsMap"> select a.*, - (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, - (select NAME from shopping_goods_category t where t.id=a.cate_id) cate_name, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, + (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) as goodsSortName, + (select NAME from shopping_goods_category t where t.id=a.cate_id) as cate_name, (select shop_name from sys_shop_info h where a.SHOP_ID=h.ID ) as shop_name from shopping_goods a where 1=1 @@ -652,6 +667,11 @@ </if> + <if test="record.achieveRuleId != null and record.achieveRuleId !='' "> + and achieve_rule_id = #{record.achieveRuleId} + </if> + + <if test="record.headquarters != null and record.headquarters !='' "> and headquarters = #{record.headquarters} @@ -718,7 +738,9 @@ <if test="record.isVipCar != null and record.isVipCar !='' "> and is_vip_car = #{record.isVipCar} </if> - + <if test="record.achieveRuleId != null and record.achieveRuleId !='' "> + and achieve_rule_id = #{record.achieveRuleId} + </if> <if test="record.isCourse != null and record.isCourse !=''"> and is_course = #{record.isCourse} @@ -763,6 +785,7 @@ <select id="selectAll" resultMap="ShoppingGoodsSimpleMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) @@ -868,6 +891,7 @@ <select id="findByCode" resultMap="ShoppingGoodsMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) @@ -880,6 +904,7 @@ <select id="selectSimpleMapById" resultMap="ShoppingGoodsSimpleMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) @@ -899,6 +924,7 @@ <select id="selectByModel" resultMap="ShoppingGoodsMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) @@ -978,6 +1004,7 @@ <select id="selectByModel1" resultMap="ShoppingGoodsMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) @@ -1056,6 +1083,7 @@ <select id="selectInPageNoTaocan" resultMap="ShoppingGoodsMap"> select *, + (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName, (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName, (select NAME from shopping_goods_category t where t.id=cate_id) diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html new file mode 100644 index 0000000..c82e927 --- /dev/null +++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html @@ -0,0 +1,402 @@ +<!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="openForm('add')" 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.keyword" placeholder="请输入规则名称"></el-input> + </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="name" + label="规则名称"> + </el-table-column> + <el-table-column + prop="updateTime" + sortable="custom" + label="修改时间" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + prop="updateBy" + label="修改人"> + </el-table-column> + + <el-table-column + prop="createTime" + sortable="custom" + label="创建时间" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + prop="createBy" + label="创建人" + width="180"> + </el-table-column> + + <el-table-column label="操作"> + <template slot-scope="scope"> + <el-button type="text" @click="openForm('modify', scope.row)" size="small">修改</el-button> + <el-button type="text" @click="remove(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> + + <el-dialog + :title="title" + :visible.sync="dialogVisible" + width="60%" + :before-close="handleClose"> + + <el-form :model="formData" ref="ruleForm" label-width="100px" class="demo-ruleForm"> + + <el-form-item label="规则名称" > + <el-input style="width: 200px" v-model="formData.name"></el-input> + <el-button type="primary" @click="addRuleItem()" size="small">添加规则</el-button> + </el-form-item> + + <el-form-item label="绩效方案" > + <el-table + :data="formData.ruleItemList" + style="width: 100%"> + <el-table-column + label="业绩类型" + > + <template slot-scope="scope"> + <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型"> + <el-option label="本金消耗" :value="1"></el-option> + <el-option label="赠送消耗" :value="2"></el-option> + </el-select> + </template> + </el-table-column> + <el-table-column + label="计算方式" + > + <template slot-scope="scope"> + <el-select v-model="scope.row.calculationType" placeholder="请选择计算方式"> + <el-option label="固定金额" :value="1"></el-option> + <el-option label="百分比(%)" :value="2"></el-option> + </el-select> + </template> + </el-table-column> + <el-table-column + label="区间" + width="240"> + <template slot-scope="scope"> + <el-input style="width: 100px" v-model="scope.row.lower"></el-input> + - + <el-input style="width: 100px" v-model="scope.row.upper"></el-input> + </template> + </el-table-column> + <el-table-column + label="业绩"> + <template slot-scope="scope"> + <el-input v-model="scope.row.achieve"></el-input> + </template> + </el-table-column> + <el-table-column label="操作"> + <template slot-scope="scope"> + <el-button type="text" @click="removeRuleItem(scope.$index, scope.row)" size="small">删除</el-button> + </template> + </el-table-column> + </el-table> + </el-form-item> + + + + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogVisible = false">取 消</el-button> + <el-button type="primary" @click="submitForm">确 定</el-button> + </span> +</el-dialog> + + +</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: { + queryKey: null, + }, + + height: 'calc(100vh - 240px)', + dialogVisible: false, + title: '', + formData: { + name: '', + ruleItemList: [ + { + achieveType: 1, + calculationType: 1, + lower: '', + upper: '', + achieve: '', + } + ] + }, + + type: '', + + }, + 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.pageSize = _this.table.pageSize; + data.pageNum = _this.table.currentPage; + AjaxProxy.requst({ + app: _this, + data: data, + url: basePath + '/admin/achieveRule/selectList', + callback: function (data) { + _this.table.rows = data.rows; + _this.table.total = data.total; + } + }); + }, + getRequestParam() { + let _this = this; + return { + queryKey: _this.form.queryKey, + } + }, + search: function () { + this.table.currentPage = 1; + this.loadData(); + }, + keydown(evt) { + if (evt.keyCode == 13) { + this.search(); + } + }, + + remove(index, row) { + let _this = this; + this.$confirm('确认删除该规则吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + AjaxProxy.requst({ + app: _this, + type: 'GET', + url: basePath + "/admin/achieveRule/removeById/" + row.id, + callback: function (data) { + _this.loadData(); + _this.$message({ + type: 'success', + message: data.info, + }); + } + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消删除' + }); + }); + }, + //开启表单弹窗 + openForm(type, data) { + + if (type == 'add') { + this.title = '新增规则'; + //this.$refs['formName'].resetFields(); + + } else { + this.title = '修改规则'; + this.formData = data; + } + this.type = type; + this.dialogVisible = true; + }, + //提交表单 + submitForm() { + let url = basePath + "/admin/achieveRule/add"; + if (this.type == 'modify') { + url = basePath + "/admin/achieveRule/update"; + } + let data=this.formData; + + if(MTools.isBlank(data.name)){this.$message.error("请输入规则名称");return;} + + if(data.ruleItemList.length<1){ + this.$message.error("最少需要一个计算规则");;return;} + let flag=true; + data.ruleItemList.forEach(item=>{ + if(MTools.isBlank(item.lower)){ + this.$message.error("请输入业绩下限");flag=false;} + else if(MTools.isBlank(item.upper)){ + this.$message.error("请输入业绩上限");flag=false;} + else if(MTools.isBlank(item.achieve)){ + this.$message.error("请输入业绩金额或者比例");flag=false;} + }) + if(flag){ + var _this=this; + AjaxProxy.requst({ + app: _this, + data:data, + url:url, + callback: function (data) { + _this.$message.success(data.info); + _this.loadData(); + _this.dialogVisible = false; + _this.formData={ + name: '', + ruleItemList: [ + { + achieveType: 1, + calculationType: 1, + lower: '', + upper: '', + achieve: '', + } + ] + }; + } + }); + + } + }, + handleClose(done) { + this.$confirm('确认关闭?') + .then(_ => { + done(); + }) + .catch(_ => { + }); + }, + addRuleItem(){ + this.formData.ruleItemList.push( + { + achieveType: 1, + calculationType: 1, + lower: '', + upper: '', + achieve: '', + } + ); + }, + removeRuleItem(index,row){ + this.formData.ruleItemList.splice(index, 1); + }, + + + } + + }); + + +</script> +</body> +</html> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html new file mode 100644 index 0000000..34ecd48 --- /dev/null +++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html @@ -0,0 +1,366 @@ +<!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="业绩规则" > + <el-select v-model="form.achieveRuleId" filterable placeholder="请选择业绩规则"> + <el-option + v-for="item in achieveRulsList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + + <el-form-item label="员工姓名" > + <el-input v-model="form.staffName"></el-input> + </el-form-item> + + + <el-form-item label="统计门店" > + <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-form-item label="订单类型" > + <el-select v-model="form.orderType" placeholder="请选择"> + <el-option + v-for="item in orderTypeList" + :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 + sortable="custom" + prop="ruleName" + label="规则名称" + width="180"> + </el-table-column> + <el-table-column + prop="shopName" + label="门店名称" + show-overflow-tooltip + width="240"> + </el-table-column> + <el-table-column + prop="guwen" + label="业绩归属人" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + prop="createBy" + label="业绩创建人" + show-overflow-tooltip + width="180"> + </el-table-column> + <el-table-column + sortable="custom" + prop="zkTotal" + label="订单金额"> + </el-table-column> + <el-table-column + sortable="custom" + prop="goodsCash" + label="现金"> + </el-table-column> + <el-table-column + sortable="custom" + prop="cardCash" + label="划扣"> + </el-table-column> + <el-table-column + sortable="custom" + prop="hisConsume" + label="本金消耗"> + </el-table-column> + <el-table-column + sortable="custom" + prop="freeConsume" + label="赠送消耗"> + </el-table-column> + <el-table-column + sortable="custom" + prop="projPercentage" + label="服务提成"> + </el-table-column> + <el-table-column + sortable="custom" + prop="numberOfPeople" + label="人头"> + </el-table-column> + + <el-table-column + sortable="custom" + prop="projNum" + label="项目个数"> + </el-table-column> + + <el-table-column + sortable="custom" + prop="projTime" + label="服务时间"> + </el-table-column> + + <el-table-column + sortable="custom" + prop="orderType" + label="订单类型"> + </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:{ + achieveRuleId:null, + staffName:null, + shopId:null, + orderType:'', + order:'', + sort:'', + beginTime:'', + endTime:'', + }, + height:'calc(100vh - 240px)', + + //提成规则 + achieveRulsList:[], + //业绩用户列表 + userList: [], + shopList:[{id:0,shopShortName:'全部'}], + + orderTypeList:[ + {value:'',label:'全部'}, + {value:'订单',label:'订单'}, + {value:'服务单',label:'服务单'}, + + ], + }, + created: function () { + let _this=this; + //获取业绩用户列表 + AjaxProxy.requst({ + app: _this, + url: basePath + '/admin/shopAll', + callback: function (data) { + _this.userList = data.rows; + } + }); + AjaxProxy.requst({ + app:_this, + url:basePath+"/admin/shopInfo/findAll", + callback:function (data) { + data.rows.forEach(shop=>{ + _this.shopList.push(shop); + }); + } + + }) + this.getAchieveRule(); + 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(); + this.form={ + achieveRuleId:null, + staffName:null, + shopId:null, + orderType:'', + order:'', + sort:'', + beginTime:'', + endTime:'', + }; + }, + 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.pageSize=_this.table.pageSize; + data.pageNum=_this.table.currentPage; + AjaxProxy.requst({ + app: _this, + data:data, + url: basePath + '/admin/achieve/achieveNewStatistics', + callback: function (data) { + _this.table.rows = data.rows; + _this.table.total=data.total; + } + }); + }, + + /** + * 获取规则 + */ + getAchieveRule(){ + let _this = this; + AjaxProxy.requst({ + app: _this, + data: {pageNum:1,pageSize:1000}, + url: basePath + "/admin/achieveRule/selectList", + callback: function (data) { + _this.achieveRulsList=data.rows; + } + }); + }, + + getRequestParam(){ + let _this = this; + return { + achieveRuleId:_this.form.achieveRuleId, + staffName:_this.form.staffName, + shopId:_this.form.shopId, + orderType:_this.form.orderType, + beginTime:_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"):'', + order:_this.form.order, + sort:_this.form.sort, + } + }, + search:function(){ + this.table.currentPage=1; + this.loadData(); + }, + keydown(evt){ + if(evt.keyCode==13) { + this.search(); + } + }, + + //导出 + exportExcel(){ + window.location.href=basePath+"/admin/achieve/exportAchieveNewStatisticsExcel?"+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/daily-list-new.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html index f19c967..2243f43 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html @@ -149,7 +149,6 @@ <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:src="@{/js/systools/MJsBase.js}"></script> <script type="text/javascript" th:inline="javascript"> var vue = new Vue({ el : "#app", @@ -184,10 +183,11 @@ }, methods : { queryTableData () { + let _this = this; - var form = _this.form; - var page = _this.page; - var params = _this.form; + let form = _this.form; + let page = _this.page; + let params = _this.form; params.limit = page.size; params.offset = (page.currentPage - 1) * page.size; @@ -195,11 +195,14 @@ params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):''; params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):''; } - $.AjaxProxy({ - p:params - }).invoke(basePath + "/admin/achieve/findDailyInfoNew", function (loj) { - _this.tableData = loj.getValue("rows"); - _this.page.total = loj.getResult().total; + AjaxProxy.requst({ + app: _this, + data: params, + url: basePath + "/admin/achieve/findDailyInfoNew", + callback: function (loj) { + _this.tableData = loj.rows; + _this.page.total = loj.total; + } }); }, queryCustomColumns() { diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html index 225ed3c..212a682 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html @@ -83,6 +83,19 @@ </el-form-item> </el-col> + <el-col :offset="2" :span="10" v-if="form.goodType!='家居产品'"> + <el-form-item label="业绩规则" prop="achieveRuleId"> + <el-select v-model="form.achieveRuleId" filterable placeholder="请选择业绩规则"> + <el-option + v-for="item in achieveRulsList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> <el-row> @@ -1097,7 +1110,8 @@ loading_zhk: false, /******综合卡表格数据END********/ - + //提成规则 + achieveRulsList:[], //默认充值卡选中项 defaultCates: [], @@ -1145,6 +1159,8 @@ useDateNum : '', buyDateNum : '', payMethods : '', + achieveRuleId:'', + }, submitUrl: '/admin/shoppinggoods/addShoppingGoods', modifySubmitUrl: '/admin/shoppinggoods/modifyShoppingGoods', @@ -1174,6 +1190,7 @@ this.getGoodstype(); this.getDictionary(); this.getShopInfo(); + this.getAchieveRule(); if(goodType=='家居产品'){ this.getSupplierList(); } @@ -1194,6 +1211,21 @@ methods: { /** + * 获取规则 + */ + getAchieveRule(){ + let _this = this; + AjaxProxy.requst({ + app: _this, + data: {pageNum:1,pageSize:1000}, + url: basePath + "/admin/achieveRule/selectList", + callback: function (data) { + _this.achieveRulsList=data.rows; + } + }); + }, + + /** * 商品分类树形组件格式化 */ normalizer(node) { diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html index 8608af7..77b6bba 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html @@ -62,6 +62,16 @@ <option value=''>请选择项目状态</option> </select> </div> + <div class="form-group mr-20"> + <label for="staus">业绩规则</label> + <select class="form-control autoFull" name="achieveRuleId" + data-filed="name" + data-value="id" + th:data-url="@{/admin/achieveRule/selectListForm}" + data-param="{pageNum:1,pageSize:1000}"> + <option value=''>请选择业绩规则</option> + </select> + </div> <div class="form-group mr-20"> <label for="isPresent">是否赠送</label> @@ -114,6 +124,7 @@ <th data-field="isPresent">是否赠送</th> <th data-field="goodType" data-sortable="true">类型</th> <th data-field="cateName">分类</th> + <th data-field="achieveRuleName" >业绩规则</th> <th data-field="createTime" data-sortable="true" data-formatter="MGrid.getTime">创建时间</th> </tr> </thead> diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html index b2d8c30..a9e5af4 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html @@ -63,6 +63,16 @@ <option value=''>请选择项目状态</option> </select> </div> + <div class="form-group mr-20"> + <label for="staus">业绩规则</label> + <select class="form-control autoFull" name="achieveRuleId" + data-filed="name" + data-value="id" + th:data-url="@{/admin/achieveRule/selectListForm}" + data-param="{pageNum:1,pageSize:1000}"> + <option value=''>请选择业绩规则</option> + </select> + </div> <div class="form-group mr-20"> <label for="isPresent">是否赠送</label> @@ -110,6 +120,7 @@ <th data-field="isPresent">是否赠送</th> <th data-field="goodType" data-sortable="true">类型</th> <th data-field="cateName" >分类</th> + <th data-field="achieveRuleName" >业绩规则</th> <th data-field="createTime" data-sortable="true" data-formatter="MGrid.getTime">创建时间</th> </tr> </thead> diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html index 611e200..8da1de1 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html @@ -151,7 +151,6 @@ <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:src="@{/js/systools/MJsBase.js}"></script> <script type="text/javascript" th:inline="javascript"> var vue = new Vue({ el : "#app", @@ -187,10 +186,11 @@ }, methods : { queryTableData () { + let _this = this; - var form = _this.form; - var page = _this.page; - var params = _this.form; + let form = _this.form; + let page = _this.page; + let params = _this.form; params.limit = page.size; params.offset = (page.currentPage - 1) * page.size; @@ -198,11 +198,14 @@ params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):''; params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):''; } - $.AjaxProxy({ - p:params - }).invoke(basePath + "/admin/achieve/findDailyInfoNew", function (loj) { - _this.tableData = loj.getValue("rows"); - _this.page.total = loj.getResult().total; + AjaxProxy.requst({ + app: _this, + data: params, + url: basePath + "/admin/achieve/findDailyInfoNew", + callback: function (loj) { + _this.tableData = loj.rows; + _this.page.total = loj.total; + } }); }, queryCustomColumns() { -- Gitblit v1.9.1