收银后台跟进1.5

This commit is contained in:
liuyingfang
2024-01-05 19:33:44 +08:00
parent d4f35b7014
commit 8f849b20a6
36 changed files with 1283 additions and 159 deletions

View File

@@ -61,4 +61,6 @@ public class PageUtil extends cn.hutool.core.util.PageUtil {
return map;
}
}

View File

@@ -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<T> {
// private int code;
// private String message;
// private T data;
// private String respCode;
//
// private T list;
//
// private String totalCount;
//
// private String timestamp;
//
// public Result<T> 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);
// }
}

View File

@@ -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<String,Object> stringChangeMap(String mapString){
JSONObject jsonObject = new JSONObject(mapString);
HashMap<String, Object> map = new HashMap<>();
map.putAll(jsonObject);
return map;
}
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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));
}
}

View File

@@ -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);
}

View File

@@ -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")

View File

@@ -53,7 +53,9 @@ public interface TbShopInfoService {
* @return TbShopInfoDto
*/
TbShopInfoDto findById(Integer id);
TbShopInfo findByIdInfo(Integer id);
TbShopInfoDto finByAccount(String account);
/**
* 创建
* @param resources /

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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 = "小数位012")
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));
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
/** 小数位012分 */
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;
}

View File

@@ -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;
}

View File

@@ -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("小数位012", 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);
}
}

View File

@@ -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> {
}

View File

@@ -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));
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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> {
}

View File

@@ -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) {

View File

@@ -32,4 +32,6 @@ public class MenuMetaVo implements Serializable {
private String icon;
private Boolean noCache;
private String activeMenu;
}

View File

@@ -60,6 +60,8 @@ public class MenuDto extends BaseDTO implements Serializable {
private String icon;
private String activeMenu;
public Boolean getHasChildren() {
return subCount > 0;
}

View File

@@ -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");

View File

@@ -8,6 +8,7 @@ spring:
active: dev
jackson:
time-zone: GMT+8
default-property-inclusion: always
data:
redis:
repositories:

View File

@@ -1,101 +0,0 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="分组名称" prop="name">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
<el-form-item label="图标">
<el-input v-model="form.pic" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否显示1显示 0不显示" prop="isShow">
<el-input v-model="form.isShow" style="width: 370px;" />
</el-form-item>
<el-form-item label="分类描述">
<el-input v-model="form.detail" style="width: 370px;" />
</el-form-item>
<el-form-item label="商品Id列表">
<el-input v-model="form.productIds" style="width: 370px;" />
</el-form-item>
<el-form-item label="createdAt">
<el-input v-model="form.createdAt" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="分组名称" />
<el-table-column prop="pic" label="图标" />
<el-table-column prop="isShow" label="是否显示1显示 0不显示" />
<el-table-column prop="detail" label="分类描述" />
<el-table-column prop="productIds" label="商品Id列表" />
<el-table-column prop="createdAt" label="createdAt" />
<el-table-column v-if="checkPer(['admin','tbProductGroup:edit','tbProductGroup:del'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudTbProductGroup from '@/api/tbProductGroup'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = { id: null, name: null, merchantId: null, shopId: null, pic: null, isShow: null, detail: null, style: null, sort: null, productIds: null, createdAt: null, updatedAt: null }
export default {
name: 'TbProductGroup',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: 'product/group', url: 'api/tbProductGroup', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTbProductGroup }})
},
data() {
return {
permission: {
add: ['admin', 'tbProductGroup:add'],
edit: ['admin', 'tbProductGroup:edit'],
del: ['admin', 'tbProductGroup:del']
},
rules: {
name: [
{ required: true, message: '分组名称不能为空', trigger: 'blur' }
],
isShow: [
{ required: true, message: '是否显示1显示 0不显示不能为空', trigger: 'blur' }
]
} }
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
}
}
}
</script>
<style scoped>
</style>

View File

@@ -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 }

View File

@@ -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 }