From f2070facdb5715e7349df69cfe257289c680d292 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期三, 23 四月 2025 18:12:46 +0800 Subject: [PATCH] 前端联调 --- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java | 4 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java | 4 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopWithdrawMapper.xml | 39 ++++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java | 8 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 86 ++++++--- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsVO.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 1 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java | 6 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ShopAnalysisDTO.java | 6 ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java | 6 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java | 25 ++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderManagePageListVO.java | 2 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml | 21 +- ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java | 28 +- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 3 ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml | 6 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java | 2 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopWithdrawMapper.java | 5 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java | 3 ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java | 4 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java | 4 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java | 30 ++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java | 2 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 4 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java | 13 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java | 29 +++ ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java | 5 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 80 ++++---- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/ChargeOrder.java | 3 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsTopVO.java | 3 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml | 21 ++ ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java | 19 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 12 42 files changed, 357 insertions(+), 160 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java index e62b89b..303c4a2 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java @@ -181,7 +181,9 @@ private String qrCode; - + @ApiModelProperty("消费绿电分数") + @TableField(exist = false) + private Integer customPoint; @ApiModelProperty("绑定门店id列表") @TableField(exist = false) diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/ChargeOrder.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/ChargeOrder.java index 4621d3c..6da08cb 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/ChargeOrder.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/ChargeOrder.java @@ -46,6 +46,7 @@ private BigDecimal serviceAmount; // 电站价总金额 private BigDecimal totalAmount; - + //获得积分 + private Integer point; } \ No newline at end of file diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java index c6bdd6c..8f56c78 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java @@ -91,6 +91,12 @@ @TableField("status") private Integer status; + @ApiModelProperty(value = "活动状态(1-未开始,2-进行中,3-已结束)") + + @TableField(exist = false) + private Integer activityStatus; + + @ApiModelProperty(value = "排序") @TableField("sort") private Integer sort; diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java index 5bbecd7..7d08220 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java @@ -39,6 +39,7 @@ @ApiModelProperty(value = "添加时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; @ApiModelProperty(value = "商品id") @@ -56,13 +57,12 @@ @ApiModelProperty(value = "活动开始日期") @TableField("start_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @ApiModelProperty(value = "活动结束日期") @TableField("end_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; @ApiModelProperty(value = "是否上架:0否 1是") @@ -73,6 +73,10 @@ @TableField(exist = false) private BigDecimal sellingPrice; + @ApiModelProperty(value = "活动价格") + @TableField(exist = false) + private BigDecimal activityPrice; + @TableField(exist = false) private GoodsSeckill goodsSeckills; diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java index df2c92b..d19a884 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java @@ -86,6 +86,9 @@ @TableField(exist = false) private String shopName; + @ApiModelProperty(value = "联系电话") + @TableField(exist = false) + private String phone; @ApiModelProperty("报备商户号") @TableField("tradeMerchantNo") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ShopAnalysisDTO.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ShopAnalysisDTO.java index 8181869..b61e3a9 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ShopAnalysisDTO.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ShopAnalysisDTO.java @@ -12,11 +12,9 @@ private Integer shopId; - @JsonFormat(pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",shape = JsonFormat.Shape.STRING) private LocalDate startTime; - @JsonFormat(pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd",shape = JsonFormat.Shape.STRING) private LocalDate endTime; } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java index edd76b1..c802c77 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java @@ -66,8 +66,8 @@ } @Override - public R<Shop> getServiceProvider(Long appUserId) { - return R.fail("获取服务商失败"); + public R<List<String>> getServiceProvider(Long appUserId) { + return R.fail("获取用户店铺失败"); } @Override diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java index c6543c9..ccdaac6 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java @@ -64,7 +64,7 @@ * 获取所有门店 * @return */ - @PostMapping("/shop/getAllShop") + @GetMapping("/shop/getAllShop") R<List<Shop>> getAllShop(); @@ -75,7 +75,7 @@ * 获取指定用户的服务商 */ @GetMapping("/shop/getServiceProvider") - R<Shop> getServiceProvider(@RequestParam("appUserId") Long appUserId); + R<List<String>> getServiceProvider(@RequestParam("appUserId") Long appUserId); /** * 获取指定用户的高级服务商 diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java index 7a41e30..344560f 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysConfig.java @@ -1,5 +1,7 @@ package com.ruoyi.system.api.domain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel.ColumnType; import com.ruoyi.common.core.web.domain.BaseModel; @@ -15,6 +17,7 @@ * * @author ruoyi */ +@TableName("sys_config") public class SysConfig extends BaseModel { private static final long serialVersionUID = 1L; @@ -22,6 +25,7 @@ * 参数主键 */ @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) + @TableField("config_id") private Long configId; /** @@ -40,6 +44,7 @@ * 参数键值 */ @Excel(name = "参数键值") + @TableField("config_value") private String configValue; /** diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java index a7de5d6..2138c23 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java @@ -26,7 +26,7 @@ } public static void main(String[] args) { - String myString = "968484"; + String myString = "a123456"; System.err.println("MD5 of '" + myString + "' is: " + generateMD5(myString)); } } \ No newline at end of file diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java index 29c1ca7..d7820a7 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java @@ -117,10 +117,10 @@ public static void main(String[] args) { - String s = encryptPassword("123456"); + String s = encryptPassword("dc483e80a7a0bd9ef71d8cf973673924"); System.err.println(s); - System.err.println(matchesPassword("123456", "$2a$10$QTL3AZW2YMtRu/jMEOzYmeeAB7c3aIq/4VyuvqtyEAARVYfhXyFRi")); - System.err.println(matchesPassword("123456", "$2a$10$Mg1l9OMJ/gFTQZmDql.21OVgGulPTQgze/cZWNe5plRpRDRjq79Ju")); + System.err.println(matchesPassword("dc483e80a7a0bd9ef71d8cf973673924", "$2a$10$2ZQZbvvVRq3DqaWJ9bzGAe4mQIpF/uGqb2GxMtINatKAP/n1ZKnNO")); + System.err.println(matchesPassword("", "$2a$10$Mg1l9OMJ/gFTQZmDql.21OVgGulPTQgze/cZWNe5plRpRDRjq79Ju")); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java index d59d4b1..d7dc0f9 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java @@ -53,6 +53,13 @@ public R getInfo(@PathVariable("configId") Long configId) { return R.ok(configService.selectConfigById(configId)); } + /** + * 获取积分配置 兑换商品、充值积分 + */ + @GetMapping(value = "/getPointConfigInfo") + public R getPointConfigInfo() { + return R.ok(configService.getPointConfigInfo()); + } /** * 根据参数键名查询参数值 @@ -81,7 +88,7 @@ @Log(title = "参数管理", businessType = BusinessType.UPDATE) @PutMapping("/editPointConfig") public AjaxResult editPointConfig(@RequestParam("configId")Long configId, @RequestParam("configValue")String configValue) { - if(configId!=6||configId!=8){ + if(configId!=6L&&configId!=8L){ return AjaxResult.error("请选择积分配置id"); } SysConfig config=new SysConfig(); @@ -90,6 +97,26 @@ config.setUpdateBy(SecurityUtils.getUsername()); return toAjax(configService.updateConfig(config)); } + + /** + * 修改积分参数配置 + */ + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PutMapping("/editPointConfig2") + public AjaxResult editPointConfig2(@RequestParam("configValue1")String configValue1, + @RequestParam("configValue2")String configValue2) { + SysConfig config=new SysConfig(); + config.setConfigId(6L); + config.setConfigValue(configValue1); + config.setUpdateBy(SecurityUtils.getUsername()); + configService.updateConfig(config); + SysConfig config2=new SysConfig(); + config2.setConfigId(8L); + config2.setConfigValue(configValue2); + config2.setUpdateBy(SecurityUtils.getUsername()); + configService.updateConfig(config2); + return success(); + } /** * 修改参数配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index ed7634f..1518812 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -116,7 +116,7 @@ */ @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping("/add") - @ApiOperation(value = "添加系统用户", tags = {"管理后台-账号管理", "门店后台-部门管理"}) + @ApiOperation(value = "添加系统用户", tags = {"管理后台-账号管理"}) public AjaxResult add(@RequestBody SysUser user) { user.setUserName(user.getPhonenumber()); Long userid = tokenService.getLoginUser().getUserid(); @@ -409,8 +409,6 @@ public AjaxResult resetPwd(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); - - //todo 双重加密,在登录时校验 修改密码时校验 user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); user.setUpdateBy(SecurityUtils.getUsername()); return toAjax(userService.resetPwd(user)); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java index 744c656..ec79a66 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java @@ -76,4 +76,6 @@ * @return 结果 */ public int deleteConfigByIds(Long[] configIds); + + List<SysConfig> getPointConfigInfo(); } \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index ea846ca..9a63159 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -1,8 +1,10 @@ package com.ruoyi.system.service; import com.ruoyi.system.api.domain.SysConfig; +import io.swagger.models.auth.In; import java.util.List; +import java.util.Map; /** * 参数配置 服务层 @@ -80,4 +82,6 @@ * @return 结果 */ public boolean checkConfigKeyUnique(SysConfig config); + + Map<Long, String> getPointConfigInfo(); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 6049b40..a920605 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.exception.ServiceException; @@ -9,12 +10,13 @@ import com.ruoyi.system.api.domain.SysConfig; import com.ruoyi.system.mapper.SysConfigMapper; import com.ruoyi.system.service.ISysConfigService; +import jdk.nashorn.internal.runtime.regexp.joni.Config; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; +import javax.xml.namespace.QName; +import java.util.*; /** * 参数配置 服务层实现 @@ -175,7 +177,18 @@ } return UserConstants.UNIQUE; } - + + @Override + public Map<Long, String> getPointConfigInfo() { + Map<Long,String> map=new HashMap<>(); + List<SysConfig> list = configMapper.getPointConfigInfo(); + list.forEach(config -> { + map.put(config.getConfigId(),config.getConfigValue()); + }); + + return map; + } + /** * 设置cache key * diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml index da9735e..6b14ef0 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysConfigMapper.xml @@ -68,7 +68,11 @@ <include refid="selectConfigVo"/> where config_key = #{configKey} limit 1 </select> - + <select id="getPointConfigInfo" resultMap="SysConfigResult"> + <include refid="selectConfigVo"/> + where config_id IN (6, 8) + </select> + <insert id="insertConfig" parameterType="com.ruoyi.system.api.domain.SysConfig"> insert into sys_config ( <if test="configName != null and configName != '' ">config_name,</if> diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index d3ac8a7..704a60f 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -1,6 +1,7 @@ package com.ruoyi.account.controller; +import cn.hutool.http.HttpResponse; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -19,6 +20,7 @@ import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.utils.poi.ExcelUtil; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.redis.service.RedisService; @@ -42,6 +44,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -422,52 +425,24 @@ -/* @GetMapping("/detail") @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) - public R<AppUser> detail(Long id, Integer shopId) { - Long userid = tokenService.getLoginUser().getUserid(); - SysUser sysUser = sysUserClient.getSysUser(userid).getData(); + public R<AppUser> detail(Long id) { AppUser byId = appUserService.getById(id); - Shop shop1 = shopClient.getServiceProvider(byId.getId()).getData(); - if(null != shop1){ - byId.setShopName(shop1.getName()); - byId.setShopId(shop1.getId()); + //获取店铺名称 + List<String> shopNames=shopClient.getServiceProvider(byId.getId()).getData(); + if(null != shopNames){ + byId.setShopNames(shopNames); } - R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id); - if (shopByUserId.getData() != null) { - List<String> shopName = new ArrayList<>(); - for (Shop datum : shopByUserId.getData()) { - shopName.add(datum.getName()); - } - byId.setShopNames(shopName); - } - - //最后下单时间 - R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id); - if (lastOrder.getData() != null) { - byId.setLastOrderTime(lastOrder.getData().getCreateTime()); - } - //消费总金额 - if(null == shopId || 1 == sysUser.getRoleType()){ - shopId = -1; - } - if(null == shopId && 2 == sysUser.getRoleType()){ - shopId = sysUser.getObjectId(); - } - R<List<Order>> orderR = remoteOrderGoodsClient.byUserId(id, shopId); - List<Order> orderList = orderR.getData(); - if (!CollectionUtils.isEmpty(orderList)){ - BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); - byId.setShopAmount(paymentAmount); - }else { - byId.setShopAmount(BigDecimal.ZERO); - } + Integer customPoint =(byId.getExchangePoint()==null?0:byId.getExchangePoint())+ + (byId.getTransferableOutPoint()==null?0:byId.getTransferableOutPoint())- + (byId.getCancelPoint()==null?0:byId.getCancelPoint()); + byId.setCustomPoint(customPoint); + return R.ok(byId); } -*/ @@ -528,7 +503,7 @@ /** * 工作台-顶部 */ - @GetMapping("/homeStatistics/statistics") + @GetMapping("/statistics") @ApiOperation(value = "统计", tags = {"后台-工作台-顶部"}) public R<UserStatistics> statistics() { QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>(); @@ -570,7 +545,7 @@ queryWrapper.eq("del_flag", 0);//未删除的 queryWrapper.ne("status", 3);//未注销的 if (userId != null) { - queryWrapper.eq("user_id", userId); + queryWrapper.eq("id", userId); } //统计充值积分 Map<String, Object> result = appUserService.getMap(queryWrapper); @@ -676,6 +651,20 @@ return R.ok(pageInfo); } + /** + * 导出用户积分列表 + */ + @ResponseBody + @GetMapping("/exportUserPoint") + @ApiOperation(value = "导出用户积分列表", tags = "后台-财务统计-用户积分统计") + public void exportUserPoint(HttpServletResponse response, @RequestParam(value = "name",required = false) String name) { + + List<UserPointStatisticsVO> exportList=appUserMapper.exportUserPoint(name); + ExcelUtil<UserPointStatisticsVO> util = new ExcelUtil<UserPointStatisticsVO>(UserPointStatisticsVO.class); + util.exportExcel(response, exportList, "用户积分汇总"); + } + + @PostMapping("/saveOrUpdateAppUser") Long saveOrUpdateAppUser(@RequestBody AppUser appuser){ if (appuser.getId() == null) { @@ -688,5 +677,16 @@ } + @GetMapping("/getAllUser") + @ApiOperation(value = "获取所有用户") + public R<List<AppUser>> getAllUser() { + LambdaQueryWrapper<AppUser> queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.select(AppUser::getId,AppUser::getName); + queryWrapper.eq(AppUser::getDelFlag,0);//未删除的 + queryWrapper.ne(AppUser::getStatus, 3);//未注销的 + List<AppUser> list = appUserService.list(queryWrapper); + return R.ok(list); + } + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java index fcab68d..e554dbd 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java @@ -101,17 +101,18 @@ } - @PostMapping("/appUserShop/insert") + @PostMapping("/insert") R insert(@RequestBody AppUserShop appUserShop){ appUserShopService.save(appUserShop); return R.ok(); } - @DeleteMapping("/appUserShop/delete") - R delete(@RequestParam("id") Integer id,@RequestParam("userId") Long originalUserId){ - QueryWrapper<AppUserShop> wrapper = new QueryWrapper<>(); - wrapper.eq("shop_id", id); - wrapper.eq("app_user_id", originalUserId); + @DeleteMapping("/delete") + R delete(@RequestParam("id") Integer id,@RequestParam("userId") Long userId){ + LambdaQueryWrapper<AppUserShop> wrapper = new LambdaQueryWrapper<AppUserShop>(); + wrapper.eq(AppUserShop::getShopId, id); + wrapper.eq(AppUserShop::getAppUserId, userId); appUserShopService.remove(wrapper); return R.ok(); } + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java index 1c0e0cc..44cf3d3 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java @@ -223,14 +223,30 @@ */ @GetMapping("/getUserPointStatisticsPageList") @ApiOperation(value = "用户积分统计", tags = "管理后台-财务统计-用户积分统计") - public R<UserPointStatisticsOutVO> getUserPointStatisticsPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, + public R<PageInfo<UserPointStatisticsPageVO>> getUserPointStatisticsPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "phone",required = false) String phone, @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, @RequestParam(value = "endTime",required = false) LocalDateTime endTime, @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { - UserPointStatisticsOutVO userPointStatisticsOutVO = new UserPointStatisticsOutVO(); + //查找记录 + PageInfo<UserPointStatisticsPageVO> pageInfo=userPointService.getUserPointStatisticsPageList(types,name,phone,beginTime,endTime,pageCurr,pageSize); + return R.ok(pageInfo); + } + + /** + * 用户积分统计 + */ + @GetMapping("/getUserPointStatisticsTop") + @ApiOperation(value = "用户积分统计-顶部", tags = "管理后台-财务统计-用户积分统计") + public R<UserPointStatisticsTopVO> getUserPointStatisticsTop(@RequestParam(value = "types",required = false) Collection<Integer> types, + @RequestParam(value = "name",required = false) String name, + @RequestParam(value = "phone",required = false) String phone, + @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, + @RequestParam(value = "endTime",required = false) LocalDateTime endTime + ) { + UserPointStatisticsTopVO userPointStatisticsOutVO = new UserPointStatisticsTopVO(); //充值绿电分 Integer chargePoint=userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,17); @@ -240,11 +256,6 @@ Integer usePoint=(exchangePoint==null?0:exchangePoint )-( cancelPoint==null?0:cancelPoint); userPointStatisticsOutVO.setChargeTotalPoint(chargePoint==null?0:chargePoint); userPointStatisticsOutVO.setUseTotalPoint(usePoint); - - //查找记录 - PageInfo<UserPointStatisticsPageVO> pageInfo=userPointService.getUserPointStatisticsPageList(types,name,phone,beginTime,endTime,pageCurr,pageSize); - userPointStatisticsOutVO.setPageInfo(pageInfo); - return R.ok(userPointStatisticsOutVO); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java index 39560e7..b97758e 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java @@ -42,4 +42,6 @@ List<UserPointStatisticsVO> getUserPointPageList(PageInfo<UserPointStatisticsVO> pageInfo,@Param("name") String name); + + List<UserPointStatisticsVO> exportUserPoint(String name); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index 296e169..0b39038 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -541,6 +541,9 @@ public PageInfo<UserPointStatisticsVO> getUserPointPageList(String name, Integer pageCurr, Integer pageSize) { PageInfo<UserPointStatisticsVO> pageInfo=new PageInfo<>(pageCurr,pageSize); List<UserPointStatisticsVO> list=baseMapper.getUserPointPageList(pageInfo, name); + list.forEach(x->{ + x.setIdStr(String.valueOf(x.getId())); + }); pageInfo.setRecords(list); return pageInfo; } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsOutVO.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsTopVO.java similarity index 66% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsOutVO.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsTopVO.java index 25789c0..81321d8 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsOutVO.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsTopVO.java @@ -4,8 +4,7 @@ import lombok.Data; @Data -public class UserPointStatisticsOutVO { +public class UserPointStatisticsTopVO { private Integer chargeTotalPoint; private Integer useTotalPoint; - PageInfo<UserPointStatisticsPageVO> pageInfo; } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsVO.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsVO.java index 70c093a..bf4255e 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsVO.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointStatisticsVO.java @@ -1,6 +1,7 @@ package com.ruoyi.account.vo; import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; +import com.ruoyi.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -10,11 +11,17 @@ @ApiModelProperty("用户id") private Long id; @ApiModelProperty("用户姓名") + @Excel(name = "用户姓名") private String name; @ApiModelProperty("绿电分总数") + @Excel(name = "绿电分总数") private Integer totalPoint; @ApiModelProperty("已使用绿电分数") + @Excel(name = "已使用绿电分数") private Integer usePoint; @ApiModelProperty("可用绿电分数") + @Excel(name = "可用绿电分数") private Integer availablePoint; + @ApiModelProperty("用户名idStr") + private String idStr; } diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml index 3c8d0c4..3740802 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml @@ -26,9 +26,9 @@ id, name, phone, avatar, vip_id, wx_openid, ali_openid, status, create_time, del_flag, first_add, last_login_time, invite_user_id, shop_id, part_point, part_grow_point, shop_point, share_point, shop_amount, last_shop_time </sql> - - - + + + <select id="getNearbyReferrer" resultType="com.ruoyi.account.vo.NearbyReferrerVo"> select id, @@ -174,4 +174,19 @@ and `name` like CONCAT('%',#{name},'%') </if> </select> + <select id="exportUserPoint" resultType="com.ruoyi.account.vo.UserPointStatisticsVO"> + select + id, + name, + (recharge_point + transferable_in_point)as `totalPoint`, + (exchange_point - cancel_point + transferable_out_point) as `usePoint`, + available_point + from + t_app_user + where + del_flag=0 + <if test="null != name and name!= '' "> + and `name` like CONCAT('%',#{name},'%') + </if> + </select> </mapper> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java index f836ffc..ddf309a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java @@ -323,6 +323,7 @@ return R.fail("导入订单-保存用户积分流水失败"); } //保存到数据库 + chargeOrder.setPoint(point); chargeOrderService.save(chargeOrder); return R.ok(); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index ceb0e8a..9c486ab 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -297,6 +297,7 @@ if (null != shop) { orderPageListVo.setShopName(shop.getName()); } + orderPageListVo.setIdStr(orderPageListVo.getId().toString()); } return pageInfo.setRecords(list); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderManagePageListVO.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderManagePageListVO.java index 660598d..c5fd5df 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderManagePageListVO.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderManagePageListVO.java @@ -14,6 +14,8 @@ public class OrderManagePageListVO { @ApiModelProperty("订单id") private Long id; + @ApiModelProperty("订单idStr") + private String idStr; @ApiModelProperty("订单编号") @Excel(name = "订单编号") private String orderNumber; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java index 6232702..472659c 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java @@ -61,6 +61,7 @@ goods.setIntegral(getPoint(goods.getSellingPrice())); goods.setDelFlag(0); goods.setCreateTime(LocalDateTime.now()); + goodsService.addGoods(goods); return R.ok(); } @@ -116,10 +117,10 @@ */ @GetMapping("/manageGoodsList") @ApiOperation(value = "商品列表", tags = {"管理后台-商品管理"}) - public R<IPage<Goods>> manageGoodsList(@ApiParam("页码") @RequestParam Integer pageNum, + public R<PageInfo<Goods>> manageGoodsList(@ApiParam("页码") @RequestParam Integer pageNum, @ApiParam("每一页数据大小") Integer pageSize, Goods goods){ - return R.ok(goodsService.getManageGoodsList(new Page<>(pageNum, pageSize), goods)); + return goodsService.getManageGoodsList(pageNum,pageSize,goods); } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java index 7824684..0fd3d14 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -9,17 +10,11 @@ import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.order.feignClient.OrderClient; -import com.ruoyi.other.api.domain.Goods; -import com.ruoyi.other.api.domain.GoodsSeckill; -import com.ruoyi.other.api.domain.SeckillActivityInfo; -import com.ruoyi.other.api.domain.Shop; +import com.ruoyi.other.api.domain.*; import com.ruoyi.other.api.feignClient.ShopClient; import com.ruoyi.other.api.vo.GetSeckillActivityInfo; import com.ruoyi.other.mapper.SeckillActivityInfoMapper; -import com.ruoyi.other.service.GoodsSeckillService; -import com.ruoyi.other.service.GoodsService; -import com.ruoyi.other.service.SeckillActivityInfoService; -import com.ruoyi.other.service.ShopService; +import com.ruoyi.other.service.*; import com.ruoyi.other.vo.SeckillActivityDetailVO; import com.ruoyi.other.vo.SeckillActivityVO; import io.swagger.annotations.Api; @@ -62,6 +57,10 @@ private OrderClient orderClient; @Resource private ShopService shopService; + @Autowired + private GoodsCategoryService goodsCategoryService; + @Autowired + private GoodsShopService goodsShopService; /** @@ -207,20 +206,27 @@ SeckillActivityVO vo = new SeckillActivityVO(); SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getById(id); + if (seckillActivityInfo==null)return R.fail("秒杀活动不存在"); Goods goods = goodsService.getById(seckillActivityInfo.getGoodId()); + QueryWrapper<GoodsShop> queryWrapper = new QueryWrapper<GoodsShop>(); + queryWrapper.eq("goods_id", goods.getId()); + GoodsShop goodsShop = goodsShopService.getOne(queryWrapper); GoodsSeckill goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>() .eq(GoodsSeckill::getSeckillActivityInfoId, seckillActivityInfo.getId())); - + GoodsCategory category = goodsCategoryService.getById(goods.getGoodsCategoryId()); + Shop shop = shopService.getById(goodsShop.getShopId()); vo.setId(seckillActivityInfo.getId().toString()); vo.setGoodsId(seckillActivityInfo.getGoodId()); vo.setGoodsName(goods.getName()); - vo.setGoodsCategoryName(goods.getCategoryName()); + vo.setGoodsCategoryName(category.getName()); vo.setSellingPrice(goods.getSellingPrice()); + vo.setOriginalPrice(goods.getOriginalPrice()); vo.setActivityPrice(goodsSeckill.getSellingPrice()); vo.setMaxNum(seckillActivityInfo.getMaxNum());//活动限购 vo.setStartTime(seckillActivityInfo.getStartTime()); vo.setEndTime(seckillActivityInfo.getEndTime()); - + vo.setShopId(goodsShop.getShopId()); + vo.setShopName(shop.getName()); return R.ok(vo); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java index 1dcd913..46c0496 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java @@ -428,9 +428,9 @@ * @return */ @GetMapping("/getShopBalanceStatementPageList") - public R<PageInfo<ShopBalanceStatementVO>> getShopBalanceStatementPageList(@RequestParam("types") Collection<Integer> types, + public R<PageInfo<ShopBalanceStatementVO>> getShopBalanceStatementPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, @RequestParam(value = "objectId", required = false) Long objectId, - @RequestParam(value = "id") Integer id, + @RequestParam(value = "id",required = false) Integer id, @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { PageInfo<ShopBalanceStatementVO> pageInfo=shopBalanceStatementService.getShopBalanceStatementPageList(types,objectId,id,pageCurr,pageSize); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 666e57f..076abfc 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -223,41 +223,57 @@ @PutMapping("/editShop") @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台-门店管理"}) public R<Void> editShop(@RequestBody Shop shop){ - //修改店长 + + //判断是否修改店长 + Shop byId = shopService.getById(shop.getId()); + String phone = shop.getPhone(); - AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); - if (appUser == null){ - return R.fail("该手机号未注册"); + if (!phone.equals(byId.getPhone())){ + //修改店长 + AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); + if (appUser == null){ + return R.fail("该手机号未注册"); + } + + Long originalUserId = byId.getAppUserId(); + //添加用户id到shop信息中 + shop.setAppUserId(appUser.getId()); + //删除店铺关系 + R deleteR = appUserShopClient.delete(shop.getId(), originalUserId); + if (deleteR.getCode()!=200){ + throw new RuntimeException("删除用户门店关系失败"); + } + //添加shopuser + AppUserShop appUserShop = new AppUserShop(); + appUserShop.setAppUserId(appUser.getId()); + appUserShop.setShopId(shop.getId()); + R appUserShopR = appUserShopClient.insert(appUserShop); + if (appUserShopR.getCode()!=200){ + throw new RuntimeException("添加用户门店关系失败"); + } + } - Long originalUserId = shop.getAppUserId(); - //添加用户id到shop信息中 - shop.setAppUserId(appUser.getId()); - //删除店铺关系 - R deleteR = appUserShopClient.delete(shop.getId(), originalUserId); - if (deleteR.getCode()!=200){ - throw new RuntimeException("删除用户门店关系失败"); - } + + //删除客服电话 QueryWrapper<Phone> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("shop_id", shop.getId()); - phoneService.remove(queryWrapper); + Phone one = phoneService.getOne(queryWrapper); + if (!one.getPhoneOne().equals(shop.getServiceTel())){ + phoneService.removeById(one.getId()); + //添加客服phone + Phone phone1 = new Phone(); + phone1.setType(2);//门店 + phone1.setPhoneOne(shop.getServiceTel()); + phone1.setShopId(shop.getId()); + phoneService.save(phone1); + } + //修改店铺 shopService.updateById(shop); - //添加shopuser - AppUserShop appUserShop = new AppUserShop(); - appUserShop.setAppUserId(appUser.getId()); - appUserShop.setShopId(shop.getId()); - R appUserShopR = appUserShopClient.insert(appUserShop); - if (appUserShopR.getCode()!=200){ - throw new RuntimeException("添加用户门店关系失败"); - } - //添加客服phone - Phone phone1 = new Phone(); - phone1.setType(2);//门店 - phone1.setPhoneOne(shop.getServiceTel()); - phone1.setShopId(shop.getId()); - phoneService.save(phone1); + + return R.ok(); } @@ -637,9 +653,9 @@ /** * 获取所有门店 */ - @PostMapping("/getAllShop") + @GetMapping("/getAllShop") public R<List<Shop>> getAllShop(){ - List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0)); + List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().select(Shop::getName,Shop::getId).eq(Shop::getDelFlag, 0)); return R.ok(list); } @@ -680,6 +696,16 @@ List<ReceiverBankChannel> list = receiverBankChannelService.list(new LambdaQueryWrapper<ReceiverBankChannel>() .like(ReceiverBankChannel::getName, name)); return R.ok(list); + } + + @GetMapping("/getServiceProvider") + R<List<String>> getServiceProvider(@RequestParam("appUserId") Long appUserId){ + LambdaQueryWrapper<Shop> queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(Shop::getAppUserId, appUserId); + queryWrapper.eq(Shop::getDelFlag,0); + List<Shop> shops = shopMapper.selectList(queryWrapper); + List<String> collect = shops.stream().map(Shop::getName).distinct().collect(Collectors.toList()); + return R.ok(collect); } @@ -734,7 +760,7 @@ @GetMapping("/getBalanceList") @ApiOperation(value = "门店余额列表", tags = {"后台-财务统计-余额列表"}) - R<PageInfo<ShopBalanceListVO>> getBalanceList(@ApiParam("门店名称")@RequestParam("name") String name, + R<PageInfo<ShopBalanceListVO>> getBalanceList(@ApiParam("门店名称")@RequestParam(value = "name",required = false) String name, @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize){ PageInfo<ShopBalanceListVO> pageInfo=shopService.getBalanceList(name,pageCurr,pageSize); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java index a14a1d3..a246495 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java @@ -3,6 +3,7 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -16,6 +17,7 @@ import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.ShopBalanceStatement; import com.ruoyi.other.api.domain.ShopWithdraw; +import com.ruoyi.other.mapper.ShopWithdrawMapper; import com.ruoyi.other.service.ShopBalanceStatementService; import com.ruoyi.other.service.ShopService; import com.ruoyi.other.service.ShopWithdrawService; @@ -30,6 +32,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -69,6 +72,8 @@ @Resource private SysUserClient sysUserClient; + @Autowired + private ShopWithdrawMapper shopWithdrawMapper; @GetMapping("/getShopById") @@ -119,22 +124,25 @@ @ApiParam("手机号") String phone, @ApiParam("审核状态(0=待审核,1=审核通过,2=审核失败)")Integer auditStatus) { //模糊查询手机号 - List<Long> collect=null; + List<Integer> shopIds=null; if (StringUtils.isNotEmpty(phone)) { - List<AppUser> data = appUserClient.getAppUserByPhoneNoFilter(phone).getData(); - collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(collect)) { + QueryWrapper<Shop> queryWrapper=new QueryWrapper<>(); + queryWrapper.like(StringUtils.isNotEmpty(phone),"phone", phone); + shopIds=shopService.list(queryWrapper).stream().map(Shop::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(shopIds)) { return R.ok(new PageInfo<>()); } } + if (shopId!=null && !shopIds.contains(shopId)){ + shopIds.add(shopId); + } - Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>() - .eq(shopId!=null,ShopWithdraw::getShopId,shopId) - .eq(auditStatus!=null,ShopWithdraw::getAuditStatus,auditStatus) - .in(collect!=null,ShopWithdraw::getCreateUserId,collect) - .orderByDesc(ShopWithdraw::getCreateTime) - - ); + PageInfo<ShopWithdraw> page=new PageInfo<>(pageNum,pageSize); + List<ShopWithdraw> list =shopWithdrawMapper.page(page,shopIds,auditStatus); + list.forEach(x->{ + x.setIdStr(x.getId().toString()); + }); + page.setRecords(list); return R.ok(page); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java index e3ddef9..fcffa56 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java @@ -21,7 +21,7 @@ List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, @Param("shopId") Integer shopId); - IPage<Goods> selectManageGoodsList(@Param("page") IPage<Goods> page, @Param("goods") Goods goods); + List<Goods> selectManageGoodsList( PageInfo<Goods> page, @Param("goods") Goods goods); /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java index 90ee5c0..0e670d4 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java @@ -31,7 +31,7 @@ List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, @Param("shopId") Integer shopId); - List<ShopBalanceListVO> getBalanceList(PageInfo<ShopBalanceListVO> pageInfo, String name); + List<ShopBalanceListVO> getBalanceList(PageInfo<ShopBalanceListVO> pageInfo,@Param("name") String name); - List<ShopBalanceExcel> shopBalanceExcel(String name); + List<ShopBalanceExcel> shopBalanceExcel(@Param("name")String name); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopWithdrawMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopWithdrawMapper.java index 91f40d5..546d3eb 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopWithdrawMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopWithdrawMapper.java @@ -1,7 +1,11 @@ package com.ruoyi.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.ShopWithdraw; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -13,4 +17,5 @@ */ public interface ShopWithdrawMapper extends BaseMapper<ShopWithdraw> { + List<ShopWithdraw> page(PageInfo<ShopWithdraw> page, @Param("shopIds") List<Integer> shopIds, @Param("auditStatus") Integer auditStatus); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java index 5b20058..b6f446d 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.dto.AddGoodsDTO; @@ -30,7 +31,7 @@ void updateManageGoods(Goods goods); - IPage<Goods> getManageGoodsList(Page<Goods> page, Goods goods); + R<PageInfo<Goods>> getManageGoodsList(Integer pageNum, Integer pageSize, Goods goods); Goods getManageGoodsDetail(Long goodsId); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 82b3273..dee2baf 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -264,13 +264,11 @@ } @Override - public IPage<Goods> getManageGoodsList(Page<Goods> page, Goods goods) { - IPage<Goods> goodsIPage = goodsMapper.selectManageGoodsList(page, goods); - /* goodsIPage.getRecords().forEach(goods1 -> { - Integer data = orderClient.getGoodsSaleNum(goods1.getId(), 1).getData(); - goods1.setSaleNum(data); - });*/ - return goodsIPage; + public R getManageGoodsList(Integer pageNum,Integer pageSize, Goods goods) { + PageInfo<Goods> pageInfo = new PageInfo<>(pageNum,pageSize); + List<Goods> list = goodsMapper.selectManageGoodsList(pageInfo, goods); + pageInfo.setRecords(list); + return R.ok(pageInfo); } @Override diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java index 41c6d6d..be0ddac 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java @@ -203,9 +203,9 @@ throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在"); } seckillActivityInfo.setId(null); - seckillActivityInfo.setCreateTime(LocalDateTime.now()); seckillActivityInfo.setDelFlag(0); seckillActivityInfo.setIsShelves(0);//下架状态 + seckillActivityInfo.setSellingPrice(seckillActivityInfo.getActivityPrice()); this.baseMapper.insert(seckillActivityInfo); //添加价格积分 GoodsSeckill goodsSeckill = new GoodsSeckill(); @@ -258,6 +258,7 @@ if(null==one){ throw new RuntimeException("该秒杀活动不存在"); } + seckillActivityInfo.setSellingPrice(seckillActivityInfo.getActivityPrice()); this.baseMapper.updateById(seckillActivityInfo);//修改限购数量、开始时间、结束时间 //修改价格积分 diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml index 7e51925..04d7108 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml @@ -50,7 +50,7 @@ AND ts.id = #{goods.shopId} </if> </where> - ORDER BY tg.sort DESC + ORDER BY IFNULL(tg.sort,0) DESC </select> diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml index 388dde0..212a02c 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml @@ -53,7 +53,7 @@ WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0 </select> <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO"> - SELECT + SELECT DISTINCT tsai.id, tg.id goodsId, tg.`name` goodsName, @@ -61,7 +61,6 @@ tg.sale_num saleNum, tgc.`name` goodsCategoryName, tsai.max_num maxNum, - tg.home_page_picture, tgse.selling_price activityPrice, tg.selling_price sellingPrice, @@ -74,11 +73,12 @@ FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id - LEFT JOIN t_goods_category tgc ON tgc.id = tg.goods_category_id - LEFT JOIN t_goods_shop tgs ON tg.id = tgs.goods_id - LEFT JOIN t_shop ts ON tgs.shop_id = ts.id + LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id + INNER JOIN t_goods_shop tgs ON tg.id = tgs.goods_id + INNER JOIN t_shop ts ON tgs.shop_id = ts.id LEFT JOIN t_goods_seckill tgse ON tsai.id = tgse.seckill_activity_info_id WHERE tsai.del_flag = 0 + <if test="goods.id != null"> AND tsai.id = #{goods.id} </if> @@ -94,15 +94,18 @@ <if test="goods.shopId != null"> AND tgs.shop_id = #{goods.shopId} </if> - <if test="goods.status != null and goods.status ==1"> + <if test="goods.activityStatus != null and goods.activityStatus ==1"> AND tsai.start_time <![CDATA[>]]> NOW() </if> - <if test="goods.status != null and goods.status ==2"> + <if test="goods.activityStatus != null and goods.activityStatus ==2"> AND tsai.start_time <![CDATA[<=]]> NOW() AND tsai.end_time <![CDATA[>]]> NOW() </if> - <if test="goods.status != null and goods.status ==3"> + <if test="goods.activityStatus != null and goods.activityStatus ==3"> AND tsai.end_time <![CDATA[<]]> NOW() </if> - order by tsai.create_time desc + <if test="goods.status!= null "> + and tsai.is_shelves =#{goods.status} + </if> + order by tsai.start_time desc </select> </mapper> \ No newline at end of file diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopWithdrawMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopWithdrawMapper.xml new file mode 100644 index 0000000..6be858f --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopWithdrawMapper.xml @@ -0,0 +1,39 @@ +<?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.ruoyi.other.mapper.ShopWithdrawMapper"> + + <select id="page" resultType="com.ruoyi.other.api.domain.ShopWithdraw"> + select tsw.id , + tsw.shop_id, + tsw.money, + tsw.audit_status, + tsw.audit_user_id, + tsw.audit_time, + tsw.audit_msg, + tsw.status, + tsw.remark, + tsw.arrival_time, + tsw.create_time, + tsw.create_user_id, + tsw.tradeMerchantNo, + tsw.receiverAccountNoEnc, + tsw.receiverAccountType, + tsw.receiverBankChannelNo, + ts.name as shopName, + ts.phone + from `t_shop_withdraw` tsw + left join t_shop ts on tsw.shop_id=ts.id + where + tsw.del_flag=0 + <if test="auditStatus!=null"> + and tsw.audit_status=#{auditStatus} + </if> + <if test="null != shopIds and shopIds.size() > 0"> + and tsw.shop_id in + <foreach collection="shopIds" item="shopId" open="(" separator="," close=")"> + #{shopId} + </foreach> + </if> + + </select> +</mapper> \ No newline at end of file -- Gitblit v1.7.1