From 3f2224f18f5745c5f0d2156d9df0969592bfa9c4 Mon Sep 17 00:00:00 2001 From: haotianmingyue <2421912570@qq.com> Date: Mon, 18 Nov 2024 15:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BF=AE=E6=94=B9=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E4=BD=8D=E4=BB=B7=E6=A0=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backstage/BackstageController.java | 42 +++++++++++++---- .../domain/dto/ChangeSourcePriceDto.java | 34 ++++++++++++++ .../system/domain/dto/SourcePriceDto.java | 46 +++++++++++++++++++ .../ruoyi/system/mapper/SysSourceMapper.java | 3 ++ .../system/service/ISysSourceService.java | 8 ++++ .../service/impl/SysSourceServiceImpl.java | 8 ++++ .../mapper/system/SysSourceMapper.xml | 3 ++ 7 files changed, 135 insertions(+), 9 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/ChangeSourcePriceDto.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/SourcePriceDto.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/backstage/BackstageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/backstage/BackstageController.java index bfb00f65..e1d21363 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/backstage/BackstageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/backstage/BackstageController.java @@ -96,7 +96,7 @@ public class BackstageController { @PostMapping("/changeUserStatus") public AjaxResult changeUserState(@RequestBody UpdateUserStateDto updateUserStateDto){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)){ + if(isAuthority(Constants.USER_TYPE_ADMIN)){ String username = updateUserStateDto.getUsername(); String status = updateUserStateDto.getStatus(); @@ -118,7 +118,7 @@ public class BackstageController { @GetMapping("/getUserCount") public AjaxResult getUserCount(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)) { + if(isAuthority(Constants.USER_TYPE_ADMIN)) { AjaxResult ajax = new AjaxResult(); @@ -134,7 +134,7 @@ public class BackstageController { @GetMapping("/getSeUserCount") public AjaxResult getSeUserCount(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)){ + if(isAuthority(Constants.USER_TYPE_ADMIN)){ AjaxResult ajax = new AjaxResult(); // startPage(); List seUserCount = sysUserCountService.getSeUserCount(); @@ -149,7 +149,7 @@ public class BackstageController { // 获取所有用户作品 @GetMapping("/getAllUserWork") public AjaxResult getAllUserWork(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)){ + if(isAuthority(Constants.USER_TYPE_ADMIN)){ AjaxResult ajax = new AjaxResult(); startPage(); List userWorkList = userWorkService.selectUserWorkList(new UserWork()); @@ -164,7 +164,7 @@ public class BackstageController { // 获取近7天作品总数 @GetMapping("/getSeUserWorkCount") public AjaxResult getSeUserWorkCount(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)){ + if(isAuthority(Constants.USER_TYPE_ADMIN)){ AjaxResult ajax = new AjaxResult(); startPage(); List seUserWorkCount = sysUserWorkCountService.getSeUserWorkCount(); @@ -237,7 +237,7 @@ public class BackstageController { * 获取所有城市数景区数资源位数*/ @GetMapping("stCityScenicSource") public AjaxResult getAllCity(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)) { + if(isAuthority(Constants.USER_TYPE_ADMIN)) { int city_count = sysCityService.selectSysCityList(new SysCity()).size(); int scenic_count = sysScenicService.selectSysScenicList(new SysScenic()).size(); @@ -257,7 +257,7 @@ public class BackstageController { * 获取所有资源位详情*/ @GetMapping("getAllSource") public AjaxResult getAllSource(){ - if(isAtuthority(Constants.USER_TYPE_ADMIN)){ + if(isAuthority(Constants.USER_TYPE_ADMIN)){ startPage(); List sysSourceList = sysSourceService.selectSysSourceList(new SysSource()); AjaxResult ajax = new AjaxResult(); @@ -271,7 +271,7 @@ public class BackstageController { @PostMapping("/changeSourceBackground") public AjaxResult updateUserInfo(@RequestParam("changeSourceBackgroundDto") String changeSourceBackgroundDt,@RequestParam("work") MultipartFile work) { - if(isAtuthority(Constants.USER_TYPE_ADMIN)) { + if(isAuthority(Constants.USER_TYPE_ADMIN)) { @@ -324,6 +324,30 @@ public class BackstageController { // return AjaxResult.success(); } + //修改资源位价格, + // 参数: 城市,景区,区域,价格 + @PostMapping("/changeSourcePrice") + public AjaxResult changeSourcePrice(@RequestBody ChangeSourcePriceDto changeSourcePriceDto){ + if(isAuthority(Constants.USER_TYPE_ADMIN)) { + String city = changeSourcePriceDto.getCity(); + String scenic = changeSourcePriceDto.getScenic(); + String part = changeSourcePriceDto.getPart(); + SourcePriceDto price = changeSourcePriceDto.getPrice(); + + System.out.println(price.toString()); + + int back = sysSourceService.updateDefaultSourcePrice(city, scenic, part, price.toString()); + + if(back > 0){ + return success("更新资源位默认价格成功"); + } + return error("更新资源位默认价格失败"); + + } + return error("无权限"); + + } + @@ -395,7 +419,7 @@ public class BackstageController { rspData.setMsg("无权限"); return rspData; } - private boolean isAtuthority(String type){ + private boolean isAuthority(String type){ SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); SysUser user1 = sysUserService.selectUserById(userId); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/ChangeSourcePriceDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/ChangeSourcePriceDto.java new file mode 100644 index 00000000..f8b92cbd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/ChangeSourcePriceDto.java @@ -0,0 +1,34 @@ +package com.ruoyi.system.domain.dto; + +public class ChangeSourcePriceDto { + private String city; + private String scenic; + private String part; + private SourcePriceDto price; + + public String getCity() { + return city; + } + public void setCity(String city) { + this.city = city; + } + public String getScenic() { + return scenic; + } + public void setScenic(String scenic) { + this.scenic = scenic; + } + public String getPart() { + return part; + } + public void setPart(String part) { + this.part = part; + } + public SourcePriceDto getPrice() { + return price; + } + public void setPrice(SourcePriceDto price) { + this.price = price; + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/SourcePriceDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/SourcePriceDto.java new file mode 100644 index 00000000..836e6b7c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/SourcePriceDto.java @@ -0,0 +1,46 @@ +package com.ruoyi.system.domain.dto; + +public class SourcePriceDto { + private String one; + private String seven; + private String fifteen; + private String thirty; + + public String getOne() { + return one; + } + public void setOne(String one) { + this.one = one; + } + public String getSeven() { + return seven; + } + + public void setSeven(String seven) { + this.seven = seven; + } + + public String getFifteen() { + return fifteen; + } + + public void setFifteen(String fifteen) { + this.fifteen = fifteen; + } + + public String getThirty() { + return thirty; + } + + public void setThirty(String thirty) { + this.thirty = thirty; + } + public String toString(){ + return "{" + + "\"one\": " + one + + ", \"seven\": " + seven + + ", \"fifteen\": " + fifteen + + ", \"thirty\": " + thirty +"}"; + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysSourceMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysSourceMapper.java index 4b4f61f5..d0054059 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysSourceMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysSourceMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.system.mapper; import java.util.List; import com.ruoyi.system.domain.SysSource; +import com.ruoyi.system.domain.dto.SourcePriceDto; import org.apache.ibatis.annotations.Param; /** @@ -49,6 +50,8 @@ public interface SysSourceMapper * */ public int updateDefaultSourceWorkAddress(@Param("city") String city,@Param("scenic") String scenic,@Param("part") String part,@Param("sourceStatus") String sourceStatus, @Param("workAddress")String workAddress); + public int updateDefaultSourcePrice(@Param("city") String city,@Param("scenic") String scenic,@Param("part") String part, @Param("price") String price); + /** * 删除资源位 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysSourceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysSourceService.java index 713f854d..4841fa56 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysSourceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysSourceService.java @@ -2,6 +2,8 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.SysSource; +import com.ruoyi.system.domain.dto.ChangeSourcePriceDto; +import com.ruoyi.system.domain.dto.SourcePriceDto; /** * 资源位Service接口 @@ -48,6 +50,12 @@ public interface ISysSourceService * */ public int updateDefaultSourceWorkAddress(String city, String scenic, String part, String sourceStatus, String workAddress); + /* + *更新默认价格 + */ + public int updateDefaultSourcePrice(String city, String scenic, String part, String price); + + /** * 批量删除资源位 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysSourceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysSourceServiceImpl.java index d5b9a762..1621f6d2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysSourceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysSourceServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.ruoyi.system.domain.dto.SourcePriceDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.SysSourceMapper; @@ -73,6 +75,12 @@ public class SysSourceServiceImpl implements ISysSourceService } + @Override + public int updateDefaultSourcePrice(String city, String scenic, String part, String price){ + return sysSourceMapper.updateDefaultSourcePrice(city, scenic, part, price); + + } + /** * 批量删除资源位 * diff --git a/ruoyi-system/src/main/resources/mapper/system/SysSourceMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysSourceMapper.xml index 2a7884a0..d4a670fe 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysSourceMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysSourceMapper.xml @@ -111,6 +111,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sys_source set work_address = #{workAddress} where city = #{city} and scenic = #{scenic} and part = #{part} and source_status = #{sourceStatus} + + update sys_source set price = #{price} where city = #{city} and scenic = #{scenic} and part = #{part} + delete from sys_source where source_id = #{sourceId}