From c4558ef096db556d234bf04fe797dc2d17ec13ee Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 20 八月 2024 19:12:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java | 10 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TGoodsMapper.java | 1 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/TAccountingStrategyQuery.java | 3 ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/SteategyPassDto.java | 14 ++ ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TAccountingStrategyVO.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 13 ++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ExchangeDto.java | 19 +++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 54 ++++++++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/EnterpriseQuery.java | 10 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TGoodsService.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 12 ++ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java | 52 ++++++-- ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TAccountingStrategy.java | 4 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java | 53 +++++++- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 9 + ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml | 5 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java | 34 +++++ ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml | 10 + 20 files changed, 285 insertions(+), 27 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/EnterpriseQuery.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/EnterpriseQuery.java new file mode 100644 index 0000000..dca0181 --- /dev/null +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/EnterpriseQuery.java @@ -0,0 +1,10 @@ +package com.ruoyi.account.api.dto; + +import com.ruoyi.common.core.web.domain.BasePojo; +import com.ruoyi.common.core.web.page.BasePage; +import lombok.Data; + +@Data +public class EnterpriseQuery extends BasePage { + private String phone; +} diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TAccountingStrategy.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TAccountingStrategy.java index f6c9c95..37f71b0 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TAccountingStrategy.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TAccountingStrategy.java @@ -39,6 +39,10 @@ @TableField("site_id") private Integer siteId; + @ApiModelProperty(value = "申请人id") + @TableField("user_id") + private Long userId; + @ApiModelProperty(value = "策略名称") @TableField("name") private String name; diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/TAccountingStrategyQuery.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/TAccountingStrategyQuery.java index bd7fd41..80ffa4d 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/TAccountingStrategyQuery.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/TAccountingStrategyQuery.java @@ -11,5 +11,8 @@ @ApiModelProperty(value = "计费策略名称") private String name; + @ApiModelProperty(value = "1=待审核一级,2=待审核二级,3=审核通过,4=驳回") + private Integer auditStatus; + } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TAccountingStrategyVO.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TAccountingStrategyVO.java index 5e7a7ff..40ea660 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TAccountingStrategyVO.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TAccountingStrategyVO.java @@ -21,6 +21,8 @@ @ApiModelProperty(value = "二級审核人员") private String twoUserName; + @ApiModelProperty(value = "申请人名字") + private String userName; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index 4177dd3..fae4223 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -4,8 +4,10 @@ import com.ruoyi.order.api.feignClient.ChargingOrderClient; import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.order.api.model.TExchangeOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; import com.ruoyi.order.api.vo.TActivityVO; +import com.ruoyi.other.api.dto.ExchangeDto; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; @@ -41,6 +43,17 @@ } @Override + public R<Long> getExchangeById(Integer goodsIds, Long userId) { + return R.fail("根据订单数" + cause.getMessage()); + } + + @Override + public R<Long> exchangeCreate(ExchangeDto exchangeDto) { + return R.fail("创建订单" + cause.getMessage()); + } + + + @Override public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { return R.fail("查询活动费用统计失败:" + cause.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java index 9e59397..dea8dce 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java @@ -4,12 +4,15 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; import com.ruoyi.order.api.factory.OrderFallbackFactory; +import com.ruoyi.order.api.model.TExchangeOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; import com.ruoyi.order.api.vo.TActivityVO; +import com.ruoyi.other.api.dto.ExchangeDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -30,6 +33,12 @@ */ @PostMapping("/t-exchange-order/getCodeByOrderId") public R<List<String>> getCodeByOrderId(String goodsIds); + //查询已兑换的订单数 + @PostMapping("/t-exchange-order/getById") + public R<Long> getExchangeById(@RequestParam("goodId") Integer goodId,@RequestParam("userId") Long userId); + @PostMapping("/t-exchange-order/create") + public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); + /** * 管理后台 活动费用统计 * @param diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ExchangeDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ExchangeDto.java new file mode 100644 index 0000000..5c180d3 --- /dev/null +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ExchangeDto.java @@ -0,0 +1,19 @@ +package com.ruoyi.other.api.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ExchangeDto { + @ApiModelProperty("商品id") + Integer goodId; + @ApiModelProperty("地址id") + Integer addressId; + @ApiModelProperty("备注") + String remark; + @ApiModelProperty(hidden = true) + Long userId; + @ApiModelProperty(hidden = true) + Integer userId; + +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/SteategyPassDto.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/SteategyPassDto.java new file mode 100644 index 0000000..0f1a80b --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/SteategyPassDto.java @@ -0,0 +1,14 @@ +package com.ruoyi.common.core.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SteategyPassDto { + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("1通过2拒绝") + private Integer pass; + @ApiModelProperty("ID") + private Integer id; +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index 6bd43d4..24374de 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -162,6 +162,18 @@ return siteService.addSite(site); } + + + @ResponseBody + @PostMapping("/getSiteInfo") + @ApiOperation(value = "获取站点详情", tags = {"管理后台-站点管理"}) + public AjaxResult<Site> getSiteInfo(@PathVariable Integer id){ + Site site = siteService.getById(id); + return AjaxResult.success(site); + } + + + @ResponseBody @PostMapping("/editSite") @ApiOperation(value = "编辑站点", tags = {"管理后台-站点管理"}) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java index 68d1800..f85d2ea 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java @@ -15,6 +15,7 @@ import com.ruoyi.chargingPile.service.TAccountingStrategyService; import com.ruoyi.chargingPile.service.TChargingPileService; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.dto.SteategyPassDto; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.BaseDelete; import com.ruoyi.common.core.web.page.PageInfo; @@ -45,7 +46,7 @@ * @author xiaochen * @since 2024-08-06 */ -@Api(tags = "计费策略") + @RestController @RequestMapping("/t-accounting-strategy") public class TAccountingStrategyController { @@ -177,24 +178,45 @@ @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "查询计费审核分页列表") @PostMapping(value = "/auth/pageList") - public AjaxResult authPageList(@RequestBody TAccountingStrategyQuery query) { - Long userid = tokenService.getLoginUser().getUserid(); - Page<TAccountingStrategy> page = accountingStrategyService.lambdaQuery() - .in(TAccountingStrategy::getFirstUserId, userid) - .or().in(TAccountingStrategy::getTwoUserId, userid) - .page(Page.of(query.getPageCurr(), query.getPageSize())); + public AjaxResult<PageInfo<TAccountingStrategyVO>> authPageList(@RequestBody TAccountingStrategyQuery query) { - List<TAccountingStrategy> records = page.getRecords(); - for (TAccountingStrategy record : records) { - if (record.getAuditStatus()==2){ - if (record.getFirstUserId().equals(userid)){ - record.setAuditStatus(3); - } + + + return AjaxResult.ok(accountingStrategyService.pageList(query)); + } + + @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "审核") + @PostMapping(value = "/auth/pass") + public AjaxResult<PageInfo<TAccountingStrategyVO>> authPass(@RequestBody SteategyPassDto steategyPassDto) { + TAccountingStrategy byId = accountingStrategyService.getById(steategyPassDto.getId()); + Long userId = tokenService.getLoginUser().getSysUser().getUserId(); + if (byId.getAuditStatus()==1&&byId.getFirstUserId()!=userId){ + return AjaxResult.error("您不是一级审核人员,无法审核"); + } + if (byId.getAuditStatus()==2&&byId.getTwoUserId()!=userId){ + return AjaxResult.error("您不是二级审核人员,无法审核"); + } + if (steategyPassDto.getPass()==1){ + if (byId.getAuditStatus()==1){ + + byId.setAuditStatus(2); + byId.setFirstRemark(steategyPassDto.getRemark()); + + }else if (byId.getAuditStatus()==2){ + byId.setAuditStatus(3); + byId.setTwoRemark(steategyPassDto.getRemark()); } - + }else { + byId.setAuditStatus(4); } - return AjaxResult.ok(accountingStrategyService.pageList(query)); + return AjaxResult.success(); + + + + + + } /** diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java index e91f208..85897a2 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java @@ -40,7 +40,7 @@ * 建桩申请 */ @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) - @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") + @ApiOperation(tags = {"小程序-建桩申请","后台-申请表单-申请建桩"},value = "建桩申请") @PostMapping(value = "/add") public AjaxResult<Boolean> add(@RequestBody TApplyChargingPile dto) { // 用户id diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java index fd43fd1..405cc3f 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java @@ -8,8 +8,12 @@ import com.ruoyi.chargingPile.mapper.TAccountingStrategyMapper; import com.ruoyi.chargingPile.service.TAccountingStrategyService; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.other.api.feignClient.OtherClient; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.feignClient.SysUserClient; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; /** @@ -23,10 +27,16 @@ @Service public class TAccountingStrategyServiceImpl extends ServiceImpl<TAccountingStrategyMapper, TAccountingStrategy> implements TAccountingStrategyService { + @Resource + private SysUserClient sysUserClient; @Override public PageInfo<TAccountingStrategyVO> pageList(TAccountingStrategyQuery query) { PageInfo<TAccountingStrategyVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TAccountingStrategyVO> list = this.baseMapper.pageList(query,pageInfo); + for (TAccountingStrategyVO tAccountingStrategyVO : list) { + SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); + tAccountingStrategyVO.setUserName(data.getNickName()); + } pageInfo.setRecords(list); return pageInfo; } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml index cb53cae..852f794 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml +++ b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml @@ -26,12 +26,15 @@ </sql> <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO"> SELECT - id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag + id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,user_id FROM t_accounting_strategy <where> <if test="query.name != null and query.name != ''"> AND `name` LIKE concat('%',#{query.name}, '%') </if> + <if test="query.auditStatus != null"> + AND audit_status = #{query.auditStatus} + </if> AND site_id IS NULL AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} </where> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java index 4dc48ac..149b813 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java @@ -16,6 +16,7 @@ import com.ruoyi.other.service.TActivityService; import com.ruoyi.other.service.TCouponService; import com.ruoyi.other.service.TGoodsService; +import com.ruoyi.system.api.domain.SysUser; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -149,6 +151,7 @@ } return R.ok(list); } + /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java index f612c11..4881695 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java @@ -1,6 +1,9 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.account.api.dto.EnterpriseQuery; +import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; @@ -10,10 +13,10 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -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.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -29,6 +32,8 @@ private final TEnterpriseUserApplicationService enterpriseUserApplicationService; private final TokenService tokenService; + @Resource + private AppUserClient appUserClient; @Autowired public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService, TokenService tokenService) { @@ -40,7 +45,7 @@ * 添加计费策略管理 */ @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) - @ApiOperation(tags = {"小程序-计费策略"},value = "添加集团用户申请") + @ApiOperation(tags = {"小程序-集团用户","后台-申请表单-集团用户"},value = "添加集团用户申请") @PostMapping(value = "/add") public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { // 用户id @@ -49,13 +54,43 @@ } - @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") @PostMapping(value = "/page") - public AjaxResult<Boolean> page(@RequestBody TEnterpriseUserApplication dto) { + public AjaxResult<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) { // 用户id - dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); - return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); + if (enterpriseQuery.getPhone()!=null) { + List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData(); + if (userIds.isEmpty()){ + return AjaxResult.warn("未查询到用户"); + } + Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); + return AjaxResult.ok(page); + }else { + Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); + return AjaxResult.ok(page); + } + } + + + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") + @GetMapping(value = "/remark") + public AjaxResult pass(Integer id,String remark) { + // 用户id + TEnterpriseUserApplication byId = enterpriseUserApplicationService.getById(id); + byId.setRemark(remark); + enterpriseUserApplicationService.updateById(byId); + return AjaxResult.success(); + } + + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") + @DeleteMapping(value = "/delete") + public AjaxResult delete(String ids) { + String[] split = ids.split(","); + for (String s : split) { + enterpriseUserApplicationService.removeById(s); + } + return AjaxResult.success(); + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 29dd21b..d91debd 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -1,12 +1,18 @@ package com.ruoyi.other.controller; +import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.BasePage; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.other.api.domain.TActivity; import com.ruoyi.other.api.domain.TGoods; import com.ruoyi.other.api.dto.AdvertisingDTO; +import com.ruoyi.other.api.dto.ExchangeDto; import com.ruoyi.other.api.dto.GoodsDTO; import com.ruoyi.other.service.TActivityService; import com.ruoyi.other.service.TAdvertisingService; @@ -14,6 +20,8 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; /** * <p> @@ -30,6 +38,12 @@ private TGoodsService goodsService; @Autowired private TActivityService activityService; + @Resource + private TokenService tokenService; + @Resource + private AppUserClient appUserClient; + @Resource + private OrderClient orderClient; @@ -62,7 +76,7 @@ @GetMapping("/getInfo") - @ApiOperation(tags = {"管理后台-商品管理"},value = "商品查看详情") + @ApiOperation(tags = {"管理后台-商品管理","小程序-兑换商城"},value = "商品查看详情") public AjaxResult<TGoods> getInfo(Integer id) { return AjaxResult.ok(goodsService.getById(id)); } @@ -74,6 +88,44 @@ public AjaxResult<PageInfo<TGoods>> pageList(@RequestBody GoodsDTO dto) { return AjaxResult.ok(goodsService.pageList(dto)); } + + + @ApiOperation(tags = {"小程序-兑换商城"},value = "商品列表分页查询") + @PostMapping(value = "/app/pageList") + public AjaxResult<PageInfo<TGoods>> apppageList(BasePage basePage) { + return AjaxResult.ok(goodsService.pageList1(basePage)); + } + + @ApiOperation(tags = {"小程序-兑换商城"},value = "兑换商品") + @PostMapping(value = "/app/shop") + public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { + //查询当前商品信息 + TGoods good = goodsService.getById(exchangeDto.getGoodId()); + + //检查当前用户积分是否够 + Long userId = tokenService.getLoginUserApplet().getUserId(); + TAppUser user = appUserClient.getUserById(userId).getData(); + if (user.getPoints()<good.getRedeemPoints()){ + return AjaxResult.error("当前用户积分不足"); + } + //检查当前用户是否到达兑换上限 + Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId).getData(); + if (good.getLimitExchangeTimes()!=-1&&count>=good.getLimitExchangeTimes()){ + return AjaxResult.error("当前用户已到达兑换上限"); + } + //生成积分兑换成功的订单 + orderClient.exchangeCreate(exchangeDto); + + //如果是优惠卷,赠送优惠卷给用户 + + + + + //生成消耗积分的记录 + + + } + /** * 根据id获取商品信息 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TGoodsMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TGoodsMapper.java index 2f73928..491b8ad 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TGoodsMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TGoodsMapper.java @@ -20,5 +20,6 @@ public interface TGoodsMapper extends BaseMapper<TGoods> { List<TGoods> pageList(@Param("pageInfo")PageInfo<TGoods> pageInfo, @Param("req") GoodsDTO dto); + List<TGoods> pageList1(@Param("pageInfo")PageInfo<TGoods> pageInfo); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TGoodsService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TGoodsService.java index 99d40ec..d37be56 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TGoodsService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TGoodsService.java @@ -1,6 +1,7 @@ package com.ruoyi.other.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.web.page.BasePage; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.TGoods; import com.ruoyi.other.api.dto.GoodsDTO; @@ -16,5 +17,6 @@ public interface TGoodsService extends IService<TGoods> { PageInfo<TGoods> pageList(GoodsDTO dto); + PageInfo<TGoods> pageList1(BasePage basePage); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java index f0de342..7372668 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.other.service.impl; +import com.ruoyi.common.core.web.page.BasePage; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.other.api.domain.TGoods; @@ -55,4 +56,37 @@ pageInfo.setRecords(list); return pageInfo; } + @Override + public PageInfo<TGoods> pageList1(BasePage basePage) { + GoodsDTO dto = new GoodsDTO(); + dto.setType(2); + dto.setStatus(1); + dto.setPageCurr(basePage.getPageCurr()); + dto.setPageSize(basePage.getPageSize()); + PageInfo<TGoods> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); + List<TGoods> list = this.baseMapper.pageList1(pageInfo); + + StringBuilder stringBuilder = new StringBuilder(); + for (TGoods temp : list) { + stringBuilder.append(temp.getId()).append(","); + } + if (StringUtils.hasLength(stringBuilder)){ + // 去除最后一个字符 + stringBuilder.deleteCharAt(stringBuilder.length()-1); + } + if (list.isEmpty()) { + pageInfo.setRecords(list); + return pageInfo; + } + String string = stringBuilder.toString(); + // 订单号加上商品类型 + String res = string+"-"+dto.getType(); + + List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); + for (int i = 0; i < list.size(); i++) { + list.get(i).setSalesCount(data.get(i)); + } + pageInfo.setRecords(list); + return pageInfo; + } } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml index a602e33..552b98c 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml @@ -50,4 +50,14 @@ ORDER BY create_time DESC </select> + <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> + select * from t_goods + <where> + AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} + </where> + ORDER BY + CASE WHEN `inventory` = 0 THEN 0 ELSE 1 END DESC, + `redeem_points` ASC; + </select> + </mapper> -- Gitblit v1.7.1