From 8f849b20a62ee0f6c867278a49415c088aadd666 Mon Sep 17 00:00:00 2001 From: liuyingfang <1357764963@qq.com> Date: Fri, 5 Jan 2024 19:33:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=90=8E=E5=8F=B0=E8=B7=9F?= =?UTF-8?q?=E8=BF=9B1.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/me/zhengjie/utils/PageUtil.java | 2 + .../main/java/me/zhengjie/utils/Result.java | 56 ++++++++ .../java/me/zhengjie/utils/StringUtils.java | 9 ++ .../me/zhengjie/config/ConfigurerAdapter.java | 2 +- .../rest/AuthorizationController.java | 8 ++ .../modules/shop/domain/TbShopInfo.java | 2 +- .../shop/repository/TbShopInfoRepository.java | 5 + .../shop/rest/TbShopInfoController.java | 8 ++ .../shop/service/TbShopInfoService.java | 2 + .../shop/service/dto/TbShopInfoDto.java | 2 + .../service/impl/TbShopInfoServiceImpl.java | 15 +- .../shopCurrency/domain/TbShopCurrency.java | 131 ++++++++++++++++++ .../repository/TbShopCurrencyRepository.java | 33 +++++ .../rest/TbShopCurrencyController.java | 95 +++++++++++++ .../service/TbShopCurrencyService.java | 90 ++++++++++++ .../service/dto/TbShopCurrencyDto.java | 94 +++++++++++++ .../dto/TbShopCurrencyQueryCriteria.java | 33 +++++ .../impl/TbShopCurrencyServiceImpl.java | 130 +++++++++++++++++ .../mapstruct/TbShopCurrencyMapper.java | 32 +++++ .../shopSpread/domain/TbShopCashSpread.java | 73 ++++++++++ .../TbShopCashSpreadRepository.java | 32 +++++ .../rest/TbShopCashSpreadController.java | 97 +++++++++++++ .../service/TbShopCashSpreadService.java | 84 +++++++++++ .../service/TbShopCashVo/TbShopCashVo.java | 11 ++ .../service/dto/TbShopCashSpreadDto.java | 49 +++++++ .../dto/TbShopCashSpreadQueryCriteria.java | 33 +++++ .../impl/TbShopCashSpreadServiceImpl.java | 117 ++++++++++++++++ .../mapstruct/TbShopCashSpreadMapper.java | 32 +++++ .../zhengjie/modules/system/domain/Menu.java | 2 + .../modules/system/domain/vo/MenuMetaVo.java | 2 + .../modules/system/service/dto/MenuDto.java | 2 + .../system/service/impl/MenuServiceImpl.java | 3 +- .../src/main/resources/config/application.yml | 1 + product/group/index.vue | 101 -------------- product/group/tbProductGroup.js | 27 ---- product/spec/tbProductSpec.js | 27 ---- 36 files changed, 1283 insertions(+), 159 deletions(-) create mode 100644 eladmin-common/src/main/java/me/zhengjie/utils/Result.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/domain/TbShopCurrency.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/repository/TbShopCurrencyRepository.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/rest/TbShopCurrencyController.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/TbShopCurrencyService.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyDto.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyQueryCriteria.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/impl/TbShopCurrencyServiceImpl.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/mapstruct/TbShopCurrencyMapper.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/domain/TbShopCashSpread.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/repository/TbShopCashSpreadRepository.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/rest/TbShopCashSpreadController.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashSpreadService.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashVo/TbShopCashVo.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadDto.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadQueryCriteria.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/impl/TbShopCashSpreadServiceImpl.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/mapstruct/TbShopCashSpreadMapper.java delete mode 100644 product/group/index.vue delete mode 100644 product/group/tbProductGroup.js delete mode 100644 product/spec/tbProductSpec.js diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java index 90838f30..1382584a 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/PageUtil.java @@ -61,4 +61,6 @@ public class PageUtil extends cn.hutool.core.util.PageUtil { return map; } + + } diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/Result.java b/eladmin-common/src/main/java/me/zhengjie/utils/Result.java new file mode 100644 index 00000000..6b163385 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/Result.java @@ -0,0 +1,56 @@ +package me.zhengjie.utils; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; + +import java.util.Date; + +/** + * @author lyf + */ +public class Result { +// private int code; +// private String message; +// private T data; +// private String respCode; +// +// private T list; +// +// private String totalCount; +// +// private String timestamp; +// +// public Result setCode(String resultCode) { +// this.code = resultCode; +// return this; +// } +// +// public Result(ResultCode resultCode, String message) { +// this(resultCode, message, null); +// } +// +// public Result(ResultCode resultCode, String message, T data) { +// this.code = resultCode.code(); +// this.message = message; +// this.data = data; +// timestamp = cn.hutool.core.date.DateUtil.format(new Date(), "yyyyMMddHHmmss"); +// } +// +// public Result(int code, String message, T data) { +// this.code = code; +// this.message = message; +// this.data = data; +// timestamp = cn.hutool.core.date.DateUtil.format(new Date(), "yyyyMMddHHmmss"); +// } +// +// public Result(int code, String message) { +// this.code = code; +// this.message = message; +// timestamp = DateUtil.format(new Date(), "yyyyMMddHHmmss"); +// } +// +// @Override +// public String toString() { +// return JSON.toJSONString(this); +// } +} diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java b/eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java index e0c262b0..25fe8c5b 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java @@ -31,6 +31,7 @@ import java.net.UnknownHostException; import java.util.Calendar; import java.util.Date; import java.util.Enumeration; +import java.util.HashMap; /** * @author Zheng Jie @@ -261,4 +262,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { return ""; } } + + public static HashMap stringChangeMap(String mapString){ + + JSONObject jsonObject = new JSONObject(mapString); + HashMap map = new HashMap<>(); + map.putAll(jsonObject); + return map; + } } diff --git a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java index a0093d68..ce0c2678 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java @@ -79,7 +79,7 @@ public class ConfigurerAdapter implements WebMvcConfigurer { supportMediaTypeList.add(MediaType.APPLICATION_JSON); FastJsonConfig config = new FastJsonConfig(); config.setDateFormat("yyyy-MM-dd HH:mm:ss"); - config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); + config.setSerializerFeatures(SerializerFeature.WriteMapNullValue); converter.setFastJsonConfig(config); converter.setSupportedMediaTypes(supportMediaTypeList); converter.setDefaultCharset(StandardCharsets.UTF_8); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java index a157874f..2488d21e 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java @@ -34,6 +34,8 @@ import me.zhengjie.modules.security.security.TokenProvider; import me.zhengjie.modules.security.service.dto.AuthUserDto; import me.zhengjie.modules.security.service.dto.JwtUserDto; import me.zhengjie.modules.security.service.OnlineUserService; +import me.zhengjie.modules.shop.domain.TbShopInfo; +import me.zhengjie.modules.shop.repository.TbShopInfoRepository; import me.zhengjie.utils.RsaUtils; import me.zhengjie.utils.RedisUtils; import me.zhengjie.utils.SecurityUtils; @@ -68,6 +70,7 @@ public class AuthorizationController { private final OnlineUserService onlineUserService; private final TokenProvider tokenProvider; private final AuthenticationManagerBuilder authenticationManagerBuilder; + private final TbShopInfoRepository tbShopInfoRepository; @Resource private LoginProperties loginProperties; @@ -100,9 +103,14 @@ public class AuthorizationController { // 保存在线信息 onlineUserService.save(jwtUserDto, token, request); // 返回 token 与 用户信息 + TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername()); Map authInfo = new HashMap(2) {{ put("token", properties.getTokenStartWith() + token); put("user", jwtUserDto); + if (byAccount!= null){ + put("shopId",byAccount.getId()); + } + }}; if (loginProperties.isSingleLogin()) { //踢掉之前已经登录的token diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/domain/TbShopInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/domain/TbShopInfo.java index a4c16b82..b3057288 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/domain/TbShopInfo.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/domain/TbShopInfo.java @@ -215,6 +215,6 @@ public class TbShopInfo implements Serializable { private String proxyId; public void copy(TbShopInfo source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false)); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/repository/TbShopInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/repository/TbShopInfoRepository.java index 22728305..90196905 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/repository/TbShopInfoRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/repository/TbShopInfoRepository.java @@ -16,8 +16,10 @@ package me.zhengjie.modules.shop.repository; import me.zhengjie.modules.shop.domain.TbShopInfo; +import org.apache.ibatis.annotations.Param; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; /** * @website https://eladmin.vip @@ -25,4 +27,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; * @date 2023-11-07 **/ public interface TbShopInfoRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query("select info from TbShopInfo info where info.account = :account") + TbShopInfo findByAccount(@Param("account") String account); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/rest/TbShopInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/rest/TbShopInfoController.java index e3fd06b6..1a718225 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/rest/TbShopInfoController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/rest/TbShopInfoController.java @@ -59,6 +59,14 @@ public class TbShopInfoController { return new ResponseEntity<>(tbShopInfoService.queryAll(criteria,pageable),HttpStatus.OK); } + @GetMapping("/{shopId}") + @Log("查询/shop/list") + @ApiOperation("查询/shop/list") + @PreAuthorize("@el.check('tbShopInfo:info')") + public Object queryInfo(@PathVariable("shopId") Integer shopId){ + return tbShopInfoService.findById(shopId); + } + @PostMapping @Log("新增/shop/list") @ApiOperation("新增/shop/list") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/TbShopInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/TbShopInfoService.java index ac554697..cc3acb37 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/TbShopInfoService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/TbShopInfoService.java @@ -53,7 +53,9 @@ public interface TbShopInfoService { * @return TbShopInfoDto */ TbShopInfoDto findById(Integer id); + TbShopInfo findByIdInfo(Integer id); + TbShopInfoDto finByAccount(String account); /** * 创建 * @param resources / diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/dto/TbShopInfoDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/dto/TbShopInfoDto.java index 3bd85d8b..f02d0ace 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/dto/TbShopInfoDto.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/dto/TbShopInfoDto.java @@ -15,6 +15,7 @@ */ package me.zhengjie.modules.shop.service.dto; +import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.math.BigDecimal; import java.io.Serializable; @@ -26,6 +27,7 @@ import java.io.Serializable; * @date 2023-11-07 **/ @Data +@JsonInclude(JsonInclude.Include.ALWAYS) public class TbShopInfoDto implements Serializable { /** 自增id */ diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/impl/TbShopInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/impl/TbShopInfoServiceImpl.java index 85a7b67f..7bd64b07 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/impl/TbShopInfoServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shop/service/impl/TbShopInfoServiceImpl.java @@ -33,6 +33,7 @@ import me.zhengjie.utils.QueryHelp; import java.util.List; import java.util.Map; import java.io.IOException; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -48,7 +49,8 @@ import java.util.LinkedHashMap; public class TbShopInfoServiceImpl implements TbShopInfoService { private final TbShopInfoRepository tbShopInfoRepository; - private final TbShopInfoMapper tbShopInfoMapper; + @Resource + private TbShopInfoMapper tbShopInfoMapper; @Override public Map queryAll(TbShopInfoQueryCriteria criteria, Pageable pageable){ @@ -69,6 +71,17 @@ public class TbShopInfoServiceImpl implements TbShopInfoService { return tbShopInfoMapper.toDto(tbShopInfo); } + @Override + public TbShopInfo findByIdInfo(Integer id) { + TbShopInfo tbShopInfo = tbShopInfoRepository.findById(id).orElseGet(TbShopInfo::new); + return tbShopInfo; + } + + @Override + public TbShopInfoDto finByAccount(String account) { + return null; + } + @Override @Transactional(rollbackFor = Exception.class) public TbShopInfoDto create(TbShopInfo resources) { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/domain/TbShopCurrency.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/domain/TbShopCurrency.java new file mode 100644 index 00000000..8055b24d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/domain/TbShopCurrency.java @@ -0,0 +1,131 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author lyf +* @date 2024-01-05 +**/ +@Entity +@Data +@Table(name="tb_shop_currency") +public class TbShopCurrency implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "自增id") + private Integer id; + + @Column(name = "`shop_id`") + @ApiModelProperty(value = "店铺Id") + private String shopId; + + @Column(name = "`prepare_amount`") + @ApiModelProperty(value = "备用金") + private BigDecimal prepareAmount; + + @Column(name = "`currency`") + @ApiModelProperty(value = "货币单位 ¥,$") + private String currency; + + @Column(name = "`decimals_digits`") + @ApiModelProperty(value = "小数位,0,1,2,无,元,角,分") + private Integer decimalsDigits; + + @Column(name = "`discount_round`") + @ApiModelProperty(value = "无,四舍五入,五舍六入none,round4up5,round5up6,round12up34") + private String discountRound; + + @Column(name = "`merchant_id`") + @ApiModelProperty(value = "商户Id") + private String merchantId; + + @Column(name = "`small_change`") + @ApiModelProperty(value = "订单抹零 -1无,0元 1角2分 0.5=0.5元") + private Integer smallChange; + + @Column(name = "`enable_custom_discount`") + @ApiModelProperty(value = "使折扣生效") + private Integer enableCustomDiscount; + + @Column(name = "`max_discount`") + @ApiModelProperty(value = "最大抹零金额(100)") + private BigDecimal maxDiscount; + + @Column(name = "`max_percent`") + @ApiModelProperty(value = "最大折扣百分比,,优先级高于max_discount") + private Double maxPercent; + + @Column(name = "`discount_configs`") + @ApiModelProperty(value = "折扣显示详情") + private String discountConfigs; + + @Column(name = "`biz_duration`") + @ApiModelProperty(value = "营业时间(弃用)") + private String bizDuration; + + @Column(name = "`allow_web_pay`") + @ApiModelProperty(value = "允许网络支付") + private Integer allowWebPay; + + @Column(name = "`is_auto_to_zero`") + @ApiModelProperty(value = "自动抹零,开启时,系统自动抹零") + private Integer isAutoToZero; + + @Column(name = "`is_include_tax_price`") + @ApiModelProperty(value = "商品含税") + private Integer isIncludeTaxPrice; + + @Column(name = "`service_charge`") + @ApiModelProperty(value = "服务费配置(小费)") + private String serviceCharge; + + @Column(name = "`tax_number`") + @ApiModelProperty(value = "税号") + private String taxNumber; + + @Column(name = "`created_at`") + @ApiModelProperty(value = "createdAt") + private Long createdAt; + + @Column(name = "`updated_at`") + @ApiModelProperty(value = "updatedAt") + private Long updatedAt; + + @Column(name = "`auto_lock_screen`") + @ApiModelProperty(value = "自动锁屏") + private Integer autoLockScreen; + + @Column(name = "`voice_notification`") + @ApiModelProperty(value = "语音通知") + private Integer voiceNotification; + + public void copy(TbShopCurrency source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/repository/TbShopCurrencyRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/repository/TbShopCurrencyRepository.java new file mode 100644 index 00000000..f51e45ba --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/repository/TbShopCurrencyRepository.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.repository; + +import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +public interface TbShopCurrencyRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query("SELECT currency from TbShopCurrency currency where currency.shopId = :shopId") + TbShopCurrency findByShopId(@Param("shopId")String shopId); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/rest/TbShopCurrencyController.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/rest/TbShopCurrencyController.java new file mode 100644 index 00000000..05b03904 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/rest/TbShopCurrencyController.java @@ -0,0 +1,95 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.rest; + +import me.zhengjie.annotation.Log; +import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency; +import me.zhengjie.modules.shopCurrency.service.TbShopCurrencyService; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "/shop/currency管理") +@RequestMapping("/api/tbShopCurrency") +public class TbShopCurrencyController { + + private final TbShopCurrencyService tbShopCurrencyService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('tbShopCurrency:list')") + public void exportTbShopCurrency(HttpServletResponse response, TbShopCurrencyQueryCriteria criteria) throws IOException { + tbShopCurrencyService.download(tbShopCurrencyService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询/shop/currency") + @ApiOperation("查询/shop/currency") + @PreAuthorize("@el.check('tbShopCurrency:list')") + public ResponseEntity queryTbShopCurrency(TbShopCurrencyQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(tbShopCurrencyService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping("/{shopId}") + @Log("查询/shop/currency/info") + @ApiOperation("查询/shop/currency/info") + @PreAuthorize("@el.check('tbShopCurrency:info')") + public Object queryTbShopCurrencyInfo(@PathVariable("shopId") String shopId){ + return tbShopCurrencyService.findByShopId(shopId); + } + + @PostMapping + @Log("新增/shop/currency") + @ApiOperation("新增/shop/currency") + @PreAuthorize("@el.check('tbShopCurrency:add')") + public ResponseEntity createTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){ + return new ResponseEntity<>(tbShopCurrencyService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改/shop/currency") + @ApiOperation("修改/shop/currency") + @PreAuthorize("@el.check('tbShopCurrency:edit')") + public ResponseEntity updateTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){ + tbShopCurrencyService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除/shop/currency") + @ApiOperation("删除/shop/currency") + @PreAuthorize("@el.check('tbShopCurrency:del')") + public ResponseEntity deleteTbShopCurrency(@RequestBody Integer[] ids) { + tbShopCurrencyService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/TbShopCurrencyService.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/TbShopCurrencyService.java new file mode 100644 index 00000000..0d0932a3 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/TbShopCurrencyService.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.service; + +import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author lyf +* @date 2024-01-05 +**/ +public interface TbShopCurrencyService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TbShopCurrencyQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TbShopCurrencyDto + */ + TbShopCurrencyDto findById(Integer id); + + /** + * 根据ID查询 + * @param id ID + * @return TbShopCurrencyDto + */ + TbShopCurrency findByShopId(String id); + + /** + * 创建 + * @param resources / + * @return TbShopCurrencyDto + */ + TbShopCurrencyDto create(TbShopCurrency resources); + + /** + * 编辑 + * @param resources / + */ + void update(TbShopCurrency resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Integer[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyDto.java new file mode 100644 index 00000000..26f66ec2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyDto.java @@ -0,0 +1,94 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.service.dto; + +import lombok.Data; +import java.math.BigDecimal; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author lyf +* @date 2024-01-05 +**/ +@Data +public class TbShopCurrencyDto implements Serializable { + + /** 自增id */ + private Integer id; + + /** 店铺Id */ + private String shopId; + + /** 备用金 */ + private BigDecimal prepareAmount; + + /** 货币单位 ¥,$ */ + private String currency; + + /** 小数位,0,1,2,无,元,角,分 */ + private Integer decimalsDigits; + + /** 无,四舍五入,五舍六入none,round4up5,round5up6,round12up34 */ + private String discountRound; + + /** 商户Id */ + private String merchantId; + + /** 订单抹零 -1无,0元 1角2分 0.5=0.5元 */ + private Integer smallChange; + + /** 使折扣生效 */ + private Integer enableCustomDiscount; + + /** 最大抹零金额(100) */ + private BigDecimal maxDiscount; + + /** 最大折扣百分比,,优先级高于max_discount */ + private Double maxPercent; + + /** 折扣显示详情 */ + private String discountConfigs; + + /** 营业时间(弃用) */ + private String bizDuration; + + /** 允许网络支付 */ + private Integer allowWebPay; + + /** 自动抹零,开启时,系统自动抹零 */ + private Integer isAutoToZero; + + /** 商品含税 */ + private Integer isIncludeTaxPrice; + + /** 服务费配置(小费) */ + private String serviceCharge; + + /** 税号 */ + private String taxNumber; + + private Long createdAt; + + private Long updatedAt; + + /** 自动锁屏 */ + private Integer autoLockScreen; + + /** 语音通知 */ + private Integer voiceNotification; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyQueryCriteria.java new file mode 100644 index 00000000..2b29e328 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/dto/TbShopCurrencyQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.service.dto; + +import lombok.Data; +import java.util.List; +import me.zhengjie.annotation.Query; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@Data +public class TbShopCurrencyQueryCriteria{ + + /** 精确 */ + @Query + private String shopId; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/impl/TbShopCurrencyServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/impl/TbShopCurrencyServiceImpl.java new file mode 100644 index 00000000..873e4274 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/impl/TbShopCurrencyServiceImpl.java @@ -0,0 +1,130 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.service.impl; + +import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import me.zhengjie.modules.shopCurrency.repository.TbShopCurrencyRepository; +import me.zhengjie.modules.shopCurrency.service.TbShopCurrencyService; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria; +import me.zhengjie.modules.shopCurrency.service.mapstruct.TbShopCurrencyMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author lyf +* @date 2024-01-05 +**/ +@Service +@RequiredArgsConstructor +public class TbShopCurrencyServiceImpl implements TbShopCurrencyService { + + private final TbShopCurrencyRepository tbShopCurrencyRepository; + private final TbShopCurrencyMapper tbShopCurrencyMapper; + + @Override + public Map queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable){ + Page page = tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbShopCurrencyMapper::toDto)); + } + + @Override + public List queryAll(TbShopCurrencyQueryCriteria criteria){ + return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public TbShopCurrencyDto findById(Integer id) { + TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(id).orElseGet(TbShopCurrency::new); + ValidationUtil.isNull(tbShopCurrency.getId(),"TbShopCurrency","id",id); + return tbShopCurrencyMapper.toDto(tbShopCurrency); + } + + @Override + public TbShopCurrency findByShopId(String id) { + TbShopCurrency byShopId = tbShopCurrencyRepository.findByShopId(id); + return byShopId; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TbShopCurrencyDto create(TbShopCurrency resources) { + return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TbShopCurrency resources) { + TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(resources.getId()).orElseGet(TbShopCurrency::new); + ValidationUtil.isNull( tbShopCurrency.getId(),"TbShopCurrency","id",resources.getId()); + tbShopCurrency.copy(resources); + tbShopCurrencyRepository.save(tbShopCurrency); + } + + @Override + public void deleteAll(Integer[] ids) { + for (Integer id : ids) { + tbShopCurrencyRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbShopCurrencyDto tbShopCurrency : all) { + Map map = new LinkedHashMap<>(); + map.put("店铺Id", tbShopCurrency.getShopId()); + map.put("备用金", tbShopCurrency.getPrepareAmount()); + map.put("货币单位 ¥,$", tbShopCurrency.getCurrency()); + map.put("小数位,0,1,2,无,元,角,分", tbShopCurrency.getDecimalsDigits()); + map.put("无,四舍五入,五舍六入none,round4up5,round5up6,round12up34", tbShopCurrency.getDiscountRound()); + map.put("商户Id", tbShopCurrency.getMerchantId()); + map.put("订单抹零 -1无,0元 1角2分 0.5=0.5元", tbShopCurrency.getSmallChange()); + map.put("使折扣生效", tbShopCurrency.getEnableCustomDiscount()); + map.put("最大抹零金额(100)", tbShopCurrency.getMaxDiscount()); + map.put("最大折扣百分比,,优先级高于max_discount", tbShopCurrency.getMaxPercent()); + map.put("折扣显示详情", tbShopCurrency.getDiscountConfigs()); + map.put("营业时间(弃用)", tbShopCurrency.getBizDuration()); + map.put("允许网络支付", tbShopCurrency.getAllowWebPay()); + map.put("自动抹零,开启时,系统自动抹零", tbShopCurrency.getIsAutoToZero()); + map.put("商品含税", tbShopCurrency.getIsIncludeTaxPrice()); + map.put("服务费配置(小费)", tbShopCurrency.getServiceCharge()); + map.put("税号", tbShopCurrency.getTaxNumber()); + map.put(" createdAt", tbShopCurrency.getCreatedAt()); + map.put(" updatedAt", tbShopCurrency.getUpdatedAt()); + map.put("自动锁屏", tbShopCurrency.getAutoLockScreen()); + map.put("语音通知", tbShopCurrency.getVoiceNotification()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/mapstruct/TbShopCurrencyMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/mapstruct/TbShopCurrencyMapper.java new file mode 100644 index 00000000..f84e95cd --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopCurrency/service/mapstruct/TbShopCurrencyMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopCurrency.service.mapstruct; + +import me.zhengjie.base.BaseMapper; +import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency; +import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TbShopCurrencyMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/domain/TbShopCashSpread.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/domain/TbShopCashSpread.java new file mode 100644 index 00000000..8365a653 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/domain/TbShopCashSpread.java @@ -0,0 +1,73 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author lyf +* @date 2024-01-05 +**/ +@Entity +@Data +@Table(name="tb_shop_cash_spread") +public class TbShopCashSpread implements Serializable { + + @Id + @Column(name = "`id`") + @ApiModelProperty(value = "shopId") + private Integer id; + + @Column(name = "`sale_receipt`") + @ApiModelProperty(value = "登陆密码") + private String saleReceipt; + + @Column(name = "`triplicate_receipt`") + @ApiModelProperty(value = "状态") + private String triplicateReceipt; + + @Column(name = "`screen_config`") + @ApiModelProperty(value = "到期提醒时间") + private String screenConfig; + + @Column(name = "`tag_config`") + @ApiModelProperty(value = "tagConfig") + private String tagConfig; + + @Column(name = "`scale_config`") + @ApiModelProperty(value = "scaleConfig") + private String scaleConfig; + + @Column(name = "`created_at`") + @ApiModelProperty(value = "createdAt") + private Long createdAt; + + @Column(name = "`updated_at`") + @ApiModelProperty(value = "updatedAt") + private Long updatedAt; + + public void copy(TbShopCashSpread source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/repository/TbShopCashSpreadRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/repository/TbShopCashSpreadRepository.java new file mode 100644 index 00000000..e1cea35c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/repository/TbShopCashSpreadRepository.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.repository; + +import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +public interface TbShopCashSpreadRepository extends JpaRepository, JpaSpecificationExecutor { + @Query("select spread from TbShopCashSpread spread where spread.id = :shopId") + TbShopCashSpread findByShopId(@Param("shopId")Integer shopId); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/rest/TbShopCashSpreadController.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/rest/TbShopCashSpreadController.java new file mode 100644 index 00000000..fd6b65ed --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/rest/TbShopCashSpreadController.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.rest; + +import me.zhengjie.annotation.Log; +import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread; +import me.zhengjie.modules.shopSpread.service.TbShopCashSpreadService; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria; +import me.zhengjie.utils.StringUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.HashMap; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "/shop/spread管理") +@RequestMapping("/api/tbShopCashSpread") +public class TbShopCashSpreadController { + + private final TbShopCashSpreadService tbShopCashSpreadService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('tbShopCashSpread:list')") + public void exportTbShopCashSpread(HttpServletResponse response, TbShopCashSpreadQueryCriteria criteria) throws IOException { + tbShopCashSpreadService.download(tbShopCashSpreadService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询/shop/spread") + @ApiOperation("查询/shop/spread") + @PreAuthorize("@el.check('tbShopCashSpread:list')") + public ResponseEntity queryTbShopCashSpread(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(tbShopCashSpreadService.queryAll(criteria,pageable),HttpStatus.OK); + } + @GetMapping("/{shopId}") + @Log("查询/shop/spread/info") + @ApiOperation("查询/shop/spread/info") + @PreAuthorize("@el.check('tbShopCashSpread:info')") + public Object queryTbShopCashSpreadInfo(@PathVariable("shopId") Integer shopId){ + TbShopCashSpread byShopId = tbShopCashSpreadService.findByShopId(shopId); + String screenConfig = byShopId.getScreenConfig(); + return StringUtils.stringChangeMap(screenConfig); + } + @PostMapping + @Log("新增/shop/spread") + @ApiOperation("新增/shop/spread") + @PreAuthorize("@el.check('tbShopCashSpread:add')") + public ResponseEntity createTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){ + return new ResponseEntity<>(tbShopCashSpreadService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改/shop/spread") + @ApiOperation("修改/shop/spread") + @PreAuthorize("@el.check('tbShopCashSpread:edit')") + public ResponseEntity updateTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){ + tbShopCashSpreadService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除/shop/spread") + @ApiOperation("删除/shop/spread") + @PreAuthorize("@el.check('tbShopCashSpread:del')") + public ResponseEntity deleteTbShopCashSpread(@RequestBody String[] ids) { + tbShopCashSpreadService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashSpreadService.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashSpreadService.java new file mode 100644 index 00000000..bb1c6929 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashSpreadService.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.service; + +import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author lyf +* @date 2024-01-05 +**/ +public interface TbShopCashSpreadService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TbShopCashSpreadQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TbShopCashSpreadDto + */ + TbShopCashSpreadDto findById(String id); + TbShopCashSpread findByShopId(Integer id); + + /** + * 创建 + * @param resources / + * @return TbShopCashSpreadDto + */ + TbShopCashSpreadDto create(TbShopCashSpread resources); + + /** + * 编辑 + * @param resources / + */ + void update(TbShopCashSpread resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(String[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashVo/TbShopCashVo.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashVo/TbShopCashVo.java new file mode 100644 index 00000000..828fca74 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/TbShopCashVo/TbShopCashVo.java @@ -0,0 +1,11 @@ +package me.zhengjie.modules.shopSpread.service.TbShopCashVo; + +import java.util.Map; + +/** + * @author lyf + */ +public class TbShopCashVo { + private Map adList; + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadDto.java new file mode 100644 index 00000000..198ad622 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadDto.java @@ -0,0 +1,49 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author lyf +* @date 2024-01-05 +**/ +@Data +public class TbShopCashSpreadDto implements Serializable { + + /** shopId */ + private Integer id; + + /** 登陆密码 */ + private String saleReceipt; + + /** 状态 */ + private String triplicateReceipt; + + /** 到期提醒时间 */ + private String screenConfig; + + private String tagConfig; + + private String scaleConfig; + + private Long createdAt; + + private Long updatedAt; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadQueryCriteria.java new file mode 100644 index 00000000..15baa7da --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/dto/TbShopCashSpreadQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.service.dto; + +import lombok.Data; +import java.util.List; +import me.zhengjie.annotation.Query; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@Data +public class TbShopCashSpreadQueryCriteria{ + + /** 精确 */ + @Query + private Integer id; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/impl/TbShopCashSpreadServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/impl/TbShopCashSpreadServiceImpl.java new file mode 100644 index 00000000..d21cffb9 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/impl/TbShopCashSpreadServiceImpl.java @@ -0,0 +1,117 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.service.impl; + +import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import me.zhengjie.modules.shopSpread.repository.TbShopCashSpreadRepository; +import me.zhengjie.modules.shopSpread.service.TbShopCashSpreadService; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria; +import me.zhengjie.modules.shopSpread.service.mapstruct.TbShopCashSpreadMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import cn.hutool.core.util.IdUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author lyf +* @date 2024-01-05 +**/ +@Service +@RequiredArgsConstructor +public class TbShopCashSpreadServiceImpl implements TbShopCashSpreadService { + + private final TbShopCashSpreadRepository tbShopCashSpreadRepository; + private final TbShopCashSpreadMapper tbShopCashSpreadMapper; + + @Override + public Map queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){ + Page page = tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbShopCashSpreadMapper::toDto)); + } + + @Override + public List queryAll(TbShopCashSpreadQueryCriteria criteria){ + return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public TbShopCashSpreadDto findById(String id) { + TbShopCashSpread tbShopCashSpread = tbShopCashSpreadRepository.findById(id).orElseGet(TbShopCashSpread::new); + ValidationUtil.isNull(tbShopCashSpread.getId(),"TbShopCashSpread","id",id); + return tbShopCashSpreadMapper.toDto(tbShopCashSpread); + } + + @Override + public TbShopCashSpread findByShopId(Integer id) { + TbShopCashSpread byShopId = tbShopCashSpreadRepository.findByShopId(id); + return byShopId; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TbShopCashSpreadDto create(TbShopCashSpread resources) { + return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TbShopCashSpread resources) { +// TbShopCashSpread tbShopCashSpread = tbShopCashSpreadRepository.findById(resources.getId()).orElseGet(TbShopCashSpread::new); +// ValidationUtil.isNull( tbShopCashSpread.getId(),"TbShopCashSpread","id",resources.getId()); +// tbShopCashSpread.copy(resources); +// tbShopCashSpreadRepository.save(tbShopCashSpread); + } + + @Override + public void deleteAll(String[] ids) { + for (String id : ids) { + tbShopCashSpreadRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbShopCashSpreadDto tbShopCashSpread : all) { + Map map = new LinkedHashMap<>(); + map.put("登陆密码", tbShopCashSpread.getSaleReceipt()); + map.put("状态", tbShopCashSpread.getTriplicateReceipt()); + map.put("到期提醒时间", tbShopCashSpread.getScreenConfig()); + map.put(" tagConfig", tbShopCashSpread.getTagConfig()); + map.put(" scaleConfig", tbShopCashSpread.getScaleConfig()); + map.put(" createdAt", tbShopCashSpread.getCreatedAt()); + map.put(" updatedAt", tbShopCashSpread.getUpdatedAt()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/mapstruct/TbShopCashSpreadMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/mapstruct/TbShopCashSpreadMapper.java new file mode 100644 index 00000000..5b891d68 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/shopSpread/service/mapstruct/TbShopCashSpreadMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.shopSpread.service.mapstruct; + +import me.zhengjie.base.BaseMapper; +import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread; +import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author lyf +* @date 2024-01-05 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TbShopCashSpreadMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java index b2ea225d..c74be950 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java @@ -91,6 +91,8 @@ public class Menu extends BaseEntity implements Serializable { @ApiModelProperty(value = "外链菜单") private Boolean iFrame; + @ApiModelProperty(value = "是否选中父级菜单") + private String activeMenu; @Override public boolean equals(Object o) { if (this == o) { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java index 647baa88..76539c08 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/vo/MenuMetaVo.java @@ -32,4 +32,6 @@ public class MenuMetaVo implements Serializable { private String icon; private Boolean noCache; + + private String activeMenu; } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java index d60dd290..c6fafada 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java @@ -60,6 +60,8 @@ public class MenuDto extends BaseDTO implements Serializable { private String icon; + private String activeMenu; + public Boolean getHasChildren() { return subCount > 0; } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java index ca8297e7..1b5c71fb 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java @@ -181,6 +181,7 @@ public class MenuServiceImpl implements MenuService { menu.setComponentName(resources.getComponentName()); menu.setPermission(resources.getPermission()); menu.setType(resources.getType()); + menu.setActiveMenu(resources.getActiveMenu()); menuRepository.save(menu); // 计算父级菜单节点数目 updateSubCnt(oldPid); @@ -280,7 +281,7 @@ public class MenuServiceImpl implements MenuService { menuVo.setComponent(menuDTO.getComponent()); } } - menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(),menuDTO.getIcon(),!menuDTO.getCache())); + menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(),menuDTO.getIcon(),!menuDTO.getCache(),menuDTO.getActiveMenu())); if(CollectionUtil.isNotEmpty(menuDtoList)){ menuVo.setAlwaysShow(true); menuVo.setRedirect("noredirect"); diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml index e0b8af56..55e71f09 100644 --- a/eladmin-system/src/main/resources/config/application.yml +++ b/eladmin-system/src/main/resources/config/application.yml @@ -8,6 +8,7 @@ spring: active: dev jackson: time-zone: GMT+8 + default-property-inclusion: always data: redis: repositories: diff --git a/product/group/index.vue b/product/group/index.vue deleted file mode 100644 index a2f75a87..00000000 --- a/product/group/index.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - - - diff --git a/product/group/tbProductGroup.js b/product/group/tbProductGroup.js deleted file mode 100644 index 9f9e9bff..00000000 --- a/product/group/tbProductGroup.js +++ /dev/null @@ -1,27 +0,0 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/tbProductGroup', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/tbProductGroup/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/tbProductGroup', - method: 'put', - data - }) -} - -export default { add, edit, del } diff --git a/product/spec/tbProductSpec.js b/product/spec/tbProductSpec.js deleted file mode 100644 index 89449755..00000000 --- a/product/spec/tbProductSpec.js +++ /dev/null @@ -1,27 +0,0 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/tbProductSpec', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/tbProductSpec/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/tbProductSpec', - method: 'put', - data - }) -} - -export default { add, edit, del }