收银后台跟进1.5
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<String, Object> authInfo = new HashMap<String, Object>(2) {{
|
||||
put("token", properties.getTokenStartWith() + token);
|
||||
put("user", jwtUserDto);
|
||||
if (byAccount!= null){
|
||||
put("shopId",byAccount.getId());
|
||||
}
|
||||
|
||||
}};
|
||||
if (loginProperties.isSingleLogin()) {
|
||||
//踢掉之前已经登录的token
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<TbShopInfo, Integer>, JpaSpecificationExecutor<TbShopInfo> {
|
||||
|
||||
@Query("select info from TbShopInfo info where info.account = :account")
|
||||
TbShopInfo findByAccount(@Param("account") String account);
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
@@ -53,7 +53,9 @@ public interface TbShopInfoService {
|
||||
* @return TbShopInfoDto
|
||||
*/
|
||||
TbShopInfoDto findById(Integer id);
|
||||
TbShopInfo findByIdInfo(Integer id);
|
||||
|
||||
TbShopInfoDto finByAccount(String account);
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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<String,Object> 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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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<TbShopCurrency, Integer>, JpaSpecificationExecutor<TbShopCurrency> {
|
||||
|
||||
@Query("SELECT currency from TbShopCurrency currency where currency.shopId = :shopId")
|
||||
TbShopCurrency findByShopId(@Param("shopId")String shopId);
|
||||
}
|
||||
@@ -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<Object> 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<Object> 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<Object> 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<Object> deleteTbShopCurrency(@RequestBody Integer[] ids) {
|
||||
tbShopCurrencyService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -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<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbShopCurrencyDto>
|
||||
*/
|
||||
List<TbShopCurrencyDto> 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<TbShopCurrencyDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<String,Object> queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbShopCurrency> page = tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbShopCurrencyMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopCurrencyDto> 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<TbShopCurrencyDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbShopCurrencyDto tbShopCurrency : all) {
|
||||
Map<String,Object> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<TbShopCurrencyDto, TbShopCurrency> {
|
||||
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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<TbShopCashSpread, String>, JpaSpecificationExecutor<TbShopCashSpread> {
|
||||
@Query("select spread from TbShopCashSpread spread where spread.id = :shopId")
|
||||
TbShopCashSpread findByShopId(@Param("shopId")Integer shopId);
|
||||
}
|
||||
@@ -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<Object> 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<Object> 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<Object> 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<Object> deleteTbShopCashSpread(@RequestBody String[] ids) {
|
||||
tbShopCashSpreadService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -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<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbShopCashSpreadDto>
|
||||
*/
|
||||
List<TbShopCashSpreadDto> 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<TbShopCashSpreadDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package me.zhengjie.modules.shopSpread.service.TbShopCashVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
public class TbShopCashVo {
|
||||
private Map<String, Object> adList;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<String,Object> queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbShopCashSpread> page = tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbShopCashSpreadMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopCashSpreadDto> 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<TbShopCashSpreadDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbShopCashSpreadDto tbShopCashSpread : all) {
|
||||
Map<String,Object> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<TbShopCashSpreadDto, TbShopCashSpread> {
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -32,4 +32,6 @@ public class MenuMetaVo implements Serializable {
|
||||
private String icon;
|
||||
|
||||
private Boolean noCache;
|
||||
|
||||
private String activeMenu;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ public class MenuDto extends BaseDTO implements Serializable {
|
||||
|
||||
private String icon;
|
||||
|
||||
private String activeMenu;
|
||||
|
||||
public Boolean getHasChildren() {
|
||||
return subCount > 0;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -8,6 +8,7 @@ spring:
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
default-property-inclusion: always
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
|
||||
Reference in New Issue
Block a user