增加激活码以及权限更改还有商户增加
This commit is contained in:
124
eladmin-common/src/main/java/me/zhengjie/utils/MD5Utils.java
Normal file
124
eladmin-common/src/main/java/me/zhengjie/utils/MD5Utils.java
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
package me.zhengjie.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
public class MD5Utils {
|
||||||
|
private static String byteArrayToHexString(byte b[]) {
|
||||||
|
StringBuffer resultSb = new StringBuffer();
|
||||||
|
for (int i = 0; i < b.length; i++)
|
||||||
|
resultSb.append(byteToHexString(b[i]));
|
||||||
|
|
||||||
|
return resultSb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String byteToHexString(byte b) {
|
||||||
|
int n = b;
|
||||||
|
if (n < 0)
|
||||||
|
n += 256;
|
||||||
|
int d1 = n / 16;
|
||||||
|
int d2 = n % 16;
|
||||||
|
return hexDigits[d1] + hexDigits[d2];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String MD5Encode(String origin, String charsetname) {
|
||||||
|
String resultString = null;
|
||||||
|
try {
|
||||||
|
resultString = origin;
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
if (charsetname == null || "".equals(charsetname))
|
||||||
|
resultString = byteArrayToHexString(md.digest(resultString
|
||||||
|
.getBytes()));
|
||||||
|
else
|
||||||
|
resultString = byteArrayToHexString(md.digest(resultString
|
||||||
|
.getBytes(charsetname)));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
}
|
||||||
|
return resultString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
|
||||||
|
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MD5指纹算法
|
||||||
|
*
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String md5(String str) {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||||
|
messageDigest.update(str.getBytes());
|
||||||
|
return bytesToHexString(messageDigest.digest());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 将二进制转换成16进制
|
||||||
|
*
|
||||||
|
* @param src
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String bytesToHexString(byte[] src) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder("");
|
||||||
|
if (src == null || src.length <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < src.length; i++) {
|
||||||
|
int v = src[i] & 0xFF;
|
||||||
|
String hv = Integer.toHexString(v);
|
||||||
|
if (hv.length() < 2) {
|
||||||
|
stringBuilder.append(0);
|
||||||
|
}
|
||||||
|
stringBuilder.append(hv);
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String encrypt(String plainText) {
|
||||||
|
try {
|
||||||
|
return encrypt(plainText,true);
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: encrypt
|
||||||
|
* @Description: TODO(16位或32位密码)
|
||||||
|
* @param @param
|
||||||
|
* plainText
|
||||||
|
* @param @param
|
||||||
|
* flag true为32位,false为16位
|
||||||
|
* @throws UnsupportedEncodingException
|
||||||
|
*/
|
||||||
|
public static String encrypt(String plainText, boolean flag) throws UnsupportedEncodingException {
|
||||||
|
try {
|
||||||
|
if (ObjectUtil.isEmpty(plainText)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
String encrStr = byteArrayToHexString(md.digest(plainText.getBytes("UTF-8")));
|
||||||
|
if (flag)
|
||||||
|
return encrStr;
|
||||||
|
else
|
||||||
|
return encrStr.substring(8, 24);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package me.zhengjie.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
@Configuration
|
||||||
|
public class JacksonConfig {
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
@ConditionalOnMissingBean(ObjectMapper.class)
|
||||||
|
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||||
|
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
||||||
|
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
|
||||||
|
@Override
|
||||||
|
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||||
|
jsonGenerator.writeString("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package me.zhengjie.config;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class fastJsonConfig extends WebMvcConfigurationSupport {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用阿里 fastjson 作为JSON MessageConverter
|
||||||
|
* @param converters
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
|
||||||
|
FastJsonConfig config = new FastJsonConfig();
|
||||||
|
config.setSerializerFeatures(
|
||||||
|
// 保留map空的字段
|
||||||
|
SerializerFeature.WriteMapNullValue,
|
||||||
|
// 将String类型的null转成""
|
||||||
|
SerializerFeature.WriteNullStringAsEmpty,
|
||||||
|
// 将Number类型的null转成0
|
||||||
|
SerializerFeature.WriteNullNumberAsZero,
|
||||||
|
// 将List类型的null转成[]
|
||||||
|
SerializerFeature.WriteNullListAsEmpty,
|
||||||
|
// 将Boolean类型的null转成false
|
||||||
|
SerializerFeature.WriteNullBooleanAsFalse,
|
||||||
|
// 避免循环引用
|
||||||
|
SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
|
||||||
|
converter.setFastJsonConfig(config);
|
||||||
|
converter.setDefaultCharset(Charset.forName("UTF-8"));
|
||||||
|
List<MediaType> mediaTypeList = new ArrayList<>();
|
||||||
|
// 解决中文乱码问题,相当于在Controller上的@RequestMapping中加了个属性produces = "application/json"
|
||||||
|
mediaTypeList.add(MediaType.APPLICATION_JSON);
|
||||||
|
converter.setSupportedMediaTypes(mediaTypeList);
|
||||||
|
converters.add(converter);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,7 +56,6 @@ public class TbProductController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/product")
|
@Log("查询/product")
|
||||||
@ApiOperation("查询/product")
|
@ApiOperation("查询/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:list')")
|
|
||||||
public ResponseEntity<Object> queryTbProduct(TbProductQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbProduct(TbProductQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -64,14 +63,12 @@ public class TbProductController {
|
|||||||
@GetMapping("/{product}")
|
@GetMapping("/{product}")
|
||||||
@Log("查询/product")
|
@Log("查询/product")
|
||||||
@ApiOperation("查询/product")
|
@ApiOperation("查询/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:list')")
|
|
||||||
public Object queryTbProductInfo(@PathVariable("product") Integer product)throws Exception{
|
public Object queryTbProductInfo(@PathVariable("product") Integer product)throws Exception{
|
||||||
return tbProductService.findByProductId(product);
|
return tbProductService.findByProductId(product);
|
||||||
}
|
}
|
||||||
@GetMapping ("/productList")
|
@GetMapping ("/productList")
|
||||||
@Log("查询/product")
|
@Log("查询/product")
|
||||||
@ApiOperation("查询/product")
|
@ApiOperation("查询/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:list')")
|
|
||||||
public Object queryTbProductInfo(@RequestParam List<String> productList){
|
public Object queryTbProductInfo(@RequestParam List<String> productList){
|
||||||
return tbProductService.findByProductList(productList);
|
return tbProductService.findByProductList(productList);
|
||||||
}
|
}
|
||||||
@@ -80,7 +77,6 @@ public class TbProductController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/product")
|
@Log("新增/product")
|
||||||
@ApiOperation("新增/product")
|
@ApiOperation("新增/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:add')")
|
|
||||||
public ResponseEntity<Object> createTbProduct(@Validated @RequestBody TbProductVo resources){
|
public ResponseEntity<Object> createTbProduct(@Validated @RequestBody TbProductVo resources){
|
||||||
return new ResponseEntity<>(tbProductService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbProductService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -88,7 +84,6 @@ public class TbProductController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/product")
|
@Log("修改/product")
|
||||||
@ApiOperation("修改/product")
|
@ApiOperation("修改/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbProduct(@Validated @RequestBody TbProductVo resources){
|
public ResponseEntity<Object> updateTbProduct(@Validated @RequestBody TbProductVo resources){
|
||||||
tbProductService.update(resources);
|
tbProductService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -97,7 +92,6 @@ public class TbProductController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/product")
|
@Log("删除/product")
|
||||||
@ApiOperation("删除/product")
|
@ApiOperation("删除/product")
|
||||||
@PreAuthorize("@el.check('tbProduct:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbProduct(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbProduct(@RequestBody Integer[] ids) {
|
||||||
tbProductService.deleteAll(ids);
|
tbProductService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
productSkuResult.setCreatedAt(Instant.now().toEpochMilli());
|
productSkuResult.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
productSkuResult.setUpdatedAt(Instant.now().toEpochMilli());
|
productSkuResult.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
productSkuResult.setTagSnap(resources.getSkuSnap());
|
productSkuResult.setTagSnap(resources.getSkuSnap());
|
||||||
productSkuResult.setId(Integer.valueOf(save.getShopId()));
|
productSkuResult.setId(save.getId());
|
||||||
tbProductSkuResultRepository.save(productSkuResult);
|
tbProductSkuResultRepository.save(productSkuResult);
|
||||||
}
|
}
|
||||||
return resources;
|
return resources;
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class TbShopCategoryController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询product/category")
|
@Log("查询product/category")
|
||||||
@ApiOperation("查询product/category")
|
@ApiOperation("查询product/category")
|
||||||
@PreAuthorize("@el.check('tbShopCategory:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopCategory(TbShopCategoryQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopCategory(TbShopCategoryQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,6 @@ public class TbShopCategoryController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增product/category")
|
@Log("新增product/category")
|
||||||
@ApiOperation("新增product/category")
|
@ApiOperation("新增product/category")
|
||||||
@PreAuthorize("@el.check('tbShopCategory:add')")
|
|
||||||
public ResponseEntity<Object> createTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
public ResponseEntity<Object> createTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
||||||
return new ResponseEntity<>(tbShopCategoryService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopCategoryService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,6 @@ public class TbShopCategoryController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改product/category")
|
@Log("修改product/category")
|
||||||
@ApiOperation("修改product/category")
|
@ApiOperation("修改product/category")
|
||||||
@PreAuthorize("@el.check('tbShopCategory:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
public ResponseEntity<Object> updateTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
||||||
tbShopCategoryService.update(resources);
|
tbShopCategoryService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -79,7 +76,6 @@ public class TbShopCategoryController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除product/category")
|
@Log("删除product/category")
|
||||||
@ApiOperation("删除product/category")
|
@ApiOperation("删除product/category")
|
||||||
@PreAuthorize("@el.check('tbShopCategory:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbShopCategory(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbShopCategory(@RequestBody Integer[] ids) {
|
||||||
|
|
||||||
tbShopCategoryService.deleteAll(ids);
|
tbShopCategoryService.deleteAll(ids);
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ public class TbProductGroupController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询product/group")
|
@Log("查询product/group")
|
||||||
@ApiOperation("查询product/group")
|
@ApiOperation("查询product/group")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:list')")
|
|
||||||
public ResponseEntity<Object> queryTbProductGroup(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbProductGroup(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbProductGroupService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbProductGroupService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,6 @@ public class TbProductGroupController {
|
|||||||
@GetMapping("/{productGroup}")
|
@GetMapping("/{productGroup}")
|
||||||
@Log("查询product/group")
|
@Log("查询product/group")
|
||||||
@ApiOperation("查询product/group")
|
@ApiOperation("查询product/group")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:list')")
|
|
||||||
public ResponseEntity<Object> queryTbProductGroup(@PathVariable("productGroup") Integer productGroup){
|
public ResponseEntity<Object> queryTbProductGroup(@PathVariable("productGroup") Integer productGroup){
|
||||||
return new ResponseEntity<>(tbProductGroupService.findByIdProduct(productGroup),HttpStatus.OK);
|
return new ResponseEntity<>(tbProductGroupService.findByIdProduct(productGroup),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -78,7 +76,6 @@ public class TbProductGroupController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增product/group")
|
@Log("新增product/group")
|
||||||
@ApiOperation("新增product/group")
|
@ApiOperation("新增product/group")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:add')")
|
|
||||||
public ResponseEntity<Object> createTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
public ResponseEntity<Object> createTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
||||||
return new ResponseEntity<>(tbProductGroupService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbProductGroupService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -86,7 +83,6 @@ public class TbProductGroupController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改product/group")
|
@Log("修改product/group")
|
||||||
@ApiOperation("修改product/group")
|
@ApiOperation("修改product/group")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
public ResponseEntity<Object> updateTbProductGroup(@Validated @RequestBody TbProductGroup resources){
|
||||||
tbProductGroupService.update(resources);
|
tbProductGroupService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -95,7 +91,6 @@ public class TbProductGroupController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除product/group")
|
@Log("删除product/group")
|
||||||
@ApiOperation("删除product/group")
|
@ApiOperation("删除product/group")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbProductGroup(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbProductGroup(@RequestBody Integer[] ids) {
|
||||||
tbProductGroupService.deleteAll(ids);
|
tbProductGroupService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class TbProductSpecController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询product/spec")
|
@Log("查询product/spec")
|
||||||
@ApiOperation("查询product/spec")
|
@ApiOperation("查询product/spec")
|
||||||
@PreAuthorize("@el.check('tbProductSpec:list')")
|
|
||||||
public ResponseEntity<Object> queryTbProductSpec(TbProductSpecQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbProductSpec(TbProductSpecQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbProductSpecService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbProductSpecService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -63,7 +62,6 @@ public class TbProductSpecController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增product/spec")
|
@Log("新增product/spec")
|
||||||
@ApiOperation("新增product/spec")
|
@ApiOperation("新增product/spec")
|
||||||
@PreAuthorize("@el.check('tbProductSpec:add')")
|
|
||||||
public ResponseEntity<Object> createTbProductSpec(@Validated @RequestBody SpecDto resources){
|
public ResponseEntity<Object> createTbProductSpec(@Validated @RequestBody SpecDto resources){
|
||||||
return new ResponseEntity<>(tbProductSpecService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbProductSpecService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -71,7 +69,6 @@ public class TbProductSpecController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改product/spec")
|
@Log("修改product/spec")
|
||||||
@ApiOperation("修改product/spec")
|
@ApiOperation("修改product/spec")
|
||||||
@PreAuthorize("@el.check('tbProductSpec:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbProductSpec(@Validated @RequestBody TbProductSpec resources){
|
public ResponseEntity<Object> updateTbProductSpec(@Validated @RequestBody TbProductSpec resources){
|
||||||
tbProductSpecService.update(resources);
|
tbProductSpecService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -80,7 +77,6 @@ public class TbProductSpecController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除product/spec")
|
@Log("删除product/spec")
|
||||||
@ApiOperation("删除product/spec")
|
@ApiOperation("删除product/spec")
|
||||||
@PreAuthorize("@el.check('tbProductSpec:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbProductSpec(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbProductSpec(@RequestBody Integer[] ids) {
|
||||||
tbProductSpecService.deleteAll(ids);
|
tbProductSpecService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.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-02-08
|
||||||
|
**/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="tb_merchant_account")
|
||||||
|
public class TbMerchantAccount implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "`id`")
|
||||||
|
@ApiModelProperty(value = "自增id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(name = "`account`",nullable = false)
|
||||||
|
@NotBlank
|
||||||
|
@ApiModelProperty(value = "登陆帐号")
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
@Column(name = "`password`")
|
||||||
|
@ApiModelProperty(value = "登陆密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Column(name = "`merchant_id`")
|
||||||
|
@ApiModelProperty(value = "商家Id")
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
@Column(name = "`shop_id`")
|
||||||
|
@ApiModelProperty(value = "门店Id")
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
@Column(name = "`shop_snap`")
|
||||||
|
@ApiModelProperty(value = "shopSnap")
|
||||||
|
private String shopSnap;
|
||||||
|
|
||||||
|
@Column(name = "`is_admin`")
|
||||||
|
@ApiModelProperty(value = "是否管理员")
|
||||||
|
private Integer isAdmin;
|
||||||
|
|
||||||
|
@Column(name = "`is_mercantile`")
|
||||||
|
@ApiModelProperty(value = "是否商户:1商户帐号0-店铺帐号")
|
||||||
|
private Integer isMercantile;
|
||||||
|
|
||||||
|
@Column(name = "`name`")
|
||||||
|
@ApiModelProperty(value = "姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "`sex`")
|
||||||
|
@ApiModelProperty(value = "性别:0女 1 男")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Column(name = "`email`")
|
||||||
|
@ApiModelProperty(value = "邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Column(name = "`head_img`")
|
||||||
|
@ApiModelProperty(value = "头像")
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
@Column(name = "`telephone`")
|
||||||
|
@ApiModelProperty(value = "联系电话")
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
@Column(name = "`status`",nullable = false)
|
||||||
|
@NotNull
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Column(name = "`sort`")
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Column(name = "`role_id`")
|
||||||
|
@ApiModelProperty(value = "roleId")
|
||||||
|
private Integer roleId;
|
||||||
|
|
||||||
|
@Column(name = "`last_login_at`")
|
||||||
|
@ApiModelProperty(value = "最后登陆时间")
|
||||||
|
private Integer lastLoginAt;
|
||||||
|
|
||||||
|
@Column(name = "`mp_open_id`")
|
||||||
|
@ApiModelProperty(value = "公众号openId")
|
||||||
|
private String mpOpenId;
|
||||||
|
|
||||||
|
@Column(name = "`msg_able`")
|
||||||
|
@ApiModelProperty(value = "是否接收消息通知")
|
||||||
|
private Integer msgAble;
|
||||||
|
|
||||||
|
@Column(name = "`created_at`")
|
||||||
|
@ApiModelProperty(value = "createdAt")
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
@Column(name = "`updated_at`")
|
||||||
|
@ApiModelProperty(value = "updatedAt")
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
public void copy(TbMerchantAccount source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.repository;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-08
|
||||||
|
**/
|
||||||
|
public interface TbMerchantAccountRepository extends JpaRepository<TbMerchantAccount, Integer>, JpaSpecificationExecutor<TbMerchantAccount> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.rest;
|
||||||
|
|
||||||
|
import me.zhengjie.annotation.Log;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.TbMerchantAccountService;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountQueryCriteria;
|
||||||
|
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-02-08
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "/merchant/account管理")
|
||||||
|
@RequestMapping("/api/tbMerchantAccount")
|
||||||
|
public class TbMerchantAccountController {
|
||||||
|
|
||||||
|
private final TbMerchantAccountService tbMerchantAccountService;
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantAccount:list')")
|
||||||
|
public void exportTbMerchantAccount(HttpServletResponse response, TbMerchantAccountQueryCriteria criteria) throws IOException {
|
||||||
|
tbMerchantAccountService.download(tbMerchantAccountService.queryAll(criteria), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询/merchant/account")
|
||||||
|
@ApiOperation("查询/merchant/account")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantAccount:list')")
|
||||||
|
public ResponseEntity<Object> queryTbMerchantAccount(TbMerchantAccountQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity<>(tbMerchantAccountService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增/merchant/account")
|
||||||
|
@ApiOperation("新增/merchant/account")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantAccount:add')")
|
||||||
|
public ResponseEntity<Object> createTbMerchantAccount(@Validated @RequestBody TbMerchantAccount resources){
|
||||||
|
return new ResponseEntity<>(tbMerchantAccountService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改/merchant/account")
|
||||||
|
@ApiOperation("修改/merchant/account")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantAccount:edit')")
|
||||||
|
public ResponseEntity<Object> updateTbMerchantAccount(@Validated @RequestBody TbMerchantAccount resources){
|
||||||
|
tbMerchantAccountService.update(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Log("删除/merchant/account")
|
||||||
|
@ApiOperation("删除/merchant/account")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantAccount:del')")
|
||||||
|
public ResponseEntity<Object> deleteTbMerchantAccount(@RequestBody Integer[] ids) {
|
||||||
|
tbMerchantAccountService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.service;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountQueryCriteria;
|
||||||
|
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-02-08
|
||||||
|
**/
|
||||||
|
public interface TbMerchantAccountService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
Map<String,Object> queryAll(TbMerchantAccountQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<TbMerchantAccountDto>
|
||||||
|
*/
|
||||||
|
List<TbMerchantAccountDto> queryAll(TbMerchantAccountQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param id ID
|
||||||
|
* @return TbMerchantAccountDto
|
||||||
|
*/
|
||||||
|
TbMerchantAccountDto findById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param resources /
|
||||||
|
* @return TbMerchantAccountDto
|
||||||
|
*/
|
||||||
|
TbMerchantAccountDto create(TbMerchantAccount resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param resources /
|
||||||
|
*/
|
||||||
|
void update(TbMerchantAccount resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Integer[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<TbMerchantAccountDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-08
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbMerchantAccountDto implements Serializable {
|
||||||
|
|
||||||
|
/** 自增id */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 登陆帐号 */
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/** 登陆密码 */
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/** 商家Id */
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
/** 门店Id */
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
private String shopSnap;
|
||||||
|
|
||||||
|
/** 是否管理员 */
|
||||||
|
private Integer isAdmin;
|
||||||
|
|
||||||
|
/** 是否商户:1商户帐号0-店铺帐号 */
|
||||||
|
private Integer isMercantile;
|
||||||
|
|
||||||
|
/** 姓名 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 性别:0女 1 男 */
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
/** 邮箱 */
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 头像 */
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
/** 联系电话 */
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
/** 状态 */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private Integer roleId;
|
||||||
|
|
||||||
|
/** 最后登陆时间 */
|
||||||
|
private Integer lastLoginAt;
|
||||||
|
|
||||||
|
/** 公众号openId */
|
||||||
|
private String mpOpenId;
|
||||||
|
|
||||||
|
/** 是否接收消息通知 */
|
||||||
|
private Integer msgAble;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-08
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbMerchantAccountQueryCriteria{
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private String shopId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.merchantAccount.service.impl;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
|
import me.zhengjie.utils.FileUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.repository.TbMerchantAccountRepository;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.TbMerchantAccountService;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountQueryCriteria;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.mapstruct.TbMerchantAccountMapper;
|
||||||
|
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-02-08
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TbMerchantAccountServiceImpl implements TbMerchantAccountService {
|
||||||
|
|
||||||
|
private final TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||||
|
private final TbMerchantAccountMapper tbMerchantAccountMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryAll(TbMerchantAccountQueryCriteria criteria, Pageable pageable){
|
||||||
|
Page<TbMerchantAccount> page = tbMerchantAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
return PageUtil.toPage(page.map(tbMerchantAccountMapper::toDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TbMerchantAccountDto> queryAll(TbMerchantAccountQueryCriteria criteria){
|
||||||
|
return tbMerchantAccountMapper.toDto(tbMerchantAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public TbMerchantAccountDto findById(Integer id) {
|
||||||
|
TbMerchantAccount tbMerchantAccount = tbMerchantAccountRepository.findById(id).orElseGet(TbMerchantAccount::new);
|
||||||
|
ValidationUtil.isNull(tbMerchantAccount.getId(),"TbMerchantAccount","id",id);
|
||||||
|
return tbMerchantAccountMapper.toDto(tbMerchantAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public TbMerchantAccountDto create(TbMerchantAccount resources) {
|
||||||
|
return tbMerchantAccountMapper.toDto(tbMerchantAccountRepository.save(resources));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(TbMerchantAccount resources) {
|
||||||
|
TbMerchantAccount tbMerchantAccount = tbMerchantAccountRepository.findById(resources.getId()).orElseGet(TbMerchantAccount::new);
|
||||||
|
ValidationUtil.isNull( tbMerchantAccount.getId(),"TbMerchantAccount","id",resources.getId());
|
||||||
|
tbMerchantAccount.copy(resources);
|
||||||
|
tbMerchantAccountRepository.save(tbMerchantAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Integer[] ids) {
|
||||||
|
for (Integer id : ids) {
|
||||||
|
tbMerchantAccountRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<TbMerchantAccountDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (TbMerchantAccountDto tbMerchantAccount : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("登陆帐号", tbMerchantAccount.getAccount());
|
||||||
|
map.put("登陆密码", tbMerchantAccount.getPassword());
|
||||||
|
map.put("商家Id", tbMerchantAccount.getMerchantId());
|
||||||
|
map.put("门店Id", tbMerchantAccount.getShopId());
|
||||||
|
map.put(" shopSnap", tbMerchantAccount.getShopSnap());
|
||||||
|
map.put("是否管理员", tbMerchantAccount.getIsAdmin());
|
||||||
|
map.put("是否商户:1商户帐号0-店铺帐号", tbMerchantAccount.getIsMercantile());
|
||||||
|
map.put("姓名", tbMerchantAccount.getName());
|
||||||
|
map.put("性别:0女 1 男", tbMerchantAccount.getSex());
|
||||||
|
map.put("邮箱", tbMerchantAccount.getEmail());
|
||||||
|
map.put("头像", tbMerchantAccount.getHeadImg());
|
||||||
|
map.put("联系电话", tbMerchantAccount.getTelephone());
|
||||||
|
map.put("状态", tbMerchantAccount.getStatus());
|
||||||
|
map.put("排序", tbMerchantAccount.getSort());
|
||||||
|
map.put(" roleId", tbMerchantAccount.getRoleId());
|
||||||
|
map.put("最后登陆时间", tbMerchantAccount.getLastLoginAt());
|
||||||
|
map.put("公众号openId", tbMerchantAccount.getMpOpenId());
|
||||||
|
map.put("是否接收消息通知", tbMerchantAccount.getMsgAble());
|
||||||
|
map.put(" createdAt", tbMerchantAccount.getCreatedAt());
|
||||||
|
map.put(" updatedAt", tbMerchantAccount.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.shopInfo.merchantAccount.service.mapstruct;
|
||||||
|
|
||||||
|
import me.zhengjie.base.BaseMapper;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.service.dto.TbMerchantAccountDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-08
|
||||||
|
**/
|
||||||
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface TbMerchantAccountMapper extends BaseMapper<TbMerchantAccountDto, TbMerchantAccount> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ public class TbShopInfo implements Serializable {
|
|||||||
@Id
|
@Id
|
||||||
@Column(name = "`id`")
|
@Column(name = "`id`")
|
||||||
@ApiModelProperty(value = "自增id")
|
@ApiModelProperty(value = "自增id")
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Column(name = "`account`")
|
@Column(name = "`account`")
|
||||||
@@ -213,6 +214,9 @@ public class TbShopInfo implements Serializable {
|
|||||||
@Column(name = "`proxy_id`")
|
@Column(name = "`proxy_id`")
|
||||||
@ApiModelProperty(value = "proxyId")
|
@ApiModelProperty(value = "proxyId")
|
||||||
private String proxyId;
|
private String proxyId;
|
||||||
|
@Column(name = "profiles")
|
||||||
|
@ApiModelProperty(value = "未激活 no 试用probation 正式release")
|
||||||
|
private String profiles="";
|
||||||
|
|
||||||
public void copy(TbShopInfo source){
|
public void copy(TbShopInfo source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package me.zhengjie.modules.shopInfo.shop.repository;
|
package me.zhengjie.modules.shopInfo.shop.repository;
|
||||||
|
|
||||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
@@ -30,4 +31,6 @@ public interface TbShopInfoRepository extends JpaRepository<TbShopInfo, Integer>
|
|||||||
|
|
||||||
@Query("select info from TbShopInfo info where info.account = :account")
|
@Query("select info from TbShopInfo info where info.account = :account")
|
||||||
TbShopInfo findByAccount(@Param("account") String account);
|
TbShopInfo findByAccount(@Param("account") String account);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ package me.zhengjie.modules.shopInfo.shop.rest;
|
|||||||
import me.zhengjie.annotation.Log;
|
import me.zhengjie.annotation.Log;
|
||||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
||||||
|
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -71,7 +72,7 @@ public class TbShopInfoController {
|
|||||||
@Log("新增/shop/list")
|
@Log("新增/shop/list")
|
||||||
@ApiOperation("新增/shop/list")
|
@ApiOperation("新增/shop/list")
|
||||||
@PreAuthorize("@el.check('tbShopInfo:add')")
|
@PreAuthorize("@el.check('tbShopInfo:add')")
|
||||||
public ResponseEntity<Object> createTbShopInfo(@Validated @RequestBody TbShopInfo resources){
|
public ResponseEntity<Object> createTbShopInfo(@Validated @RequestBody TbShopInfoDto resources){
|
||||||
return new ResponseEntity<>(tbShopInfoService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopInfoService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public interface TbShopInfoService {
|
|||||||
* @param resources /
|
* @param resources /
|
||||||
* @return TbShopInfoDto
|
* @return TbShopInfoDto
|
||||||
*/
|
*/
|
||||||
TbShopInfoDto create(TbShopInfo resources);
|
TbShopInfoDto create(TbShopInfoDto resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ package me.zhengjie.modules.shopInfo.shop.service.dto;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ public class TbShopInfoDto implements Serializable {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/** 店铺帐号 */
|
/** 店铺帐号 */
|
||||||
|
@NotBlank(message = "店铺账号不能为空")
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
/** 店铺代号,策略方式为city +店铺号(8位) */
|
/** 店铺代号,策略方式为city +店铺号(8位) */
|
||||||
@@ -46,6 +49,7 @@ public class TbShopInfoDto implements Serializable {
|
|||||||
private String merchantId;
|
private String merchantId;
|
||||||
|
|
||||||
/** 店铺名称 */
|
/** 店铺名称 */
|
||||||
|
@NotBlank(message = "店铺账号不能为空")
|
||||||
private String shopName;
|
private String shopName;
|
||||||
|
|
||||||
/** 连锁店扩展店名 */
|
/** 连锁店扩展店名 */
|
||||||
@@ -64,6 +68,7 @@ public class TbShopInfoDto implements Serializable {
|
|||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/** 店铺log */
|
/** 店铺log */
|
||||||
|
@NotBlank(message = "店铺logo不能为空")
|
||||||
private String logo;
|
private String logo;
|
||||||
|
|
||||||
/** 是否参与代收 0--不参与 1参与 */
|
/** 是否参与代收 0--不参与 1参与 */
|
||||||
@@ -156,4 +161,12 @@ public class TbShopInfoDto implements Serializable {
|
|||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
|
|
||||||
private String proxyId;
|
private String proxyId;
|
||||||
|
/**
|
||||||
|
* 激活码
|
||||||
|
*/
|
||||||
|
private String registerCode;
|
||||||
|
@NotBlank(message = "密码不能为空")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String profiles;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ public class TbShopInfoQueryCriteria{
|
|||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
/** 精确 */
|
/** 精确 */
|
||||||
@Query
|
@Query(type = Query.Type.LEFT_LIKE)
|
||||||
private String shopName;
|
private String shopName;
|
||||||
|
|
||||||
/** 精确 */
|
/** 精确 */
|
||||||
|
|||||||
@@ -15,29 +15,39 @@
|
|||||||
*/
|
*/
|
||||||
package me.zhengjie.modules.shopInfo.shop.service.impl;
|
package me.zhengjie.modules.shopInfo.shop.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import lombok.Data;
|
||||||
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.exception.BadRequestException;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.repository.TbMerchantAccountRepository;
|
||||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
import me.zhengjie.utils.FileUtil;
|
import me.zhengjie.modules.shopInfo.shopRegister.repository.TbMerchantRegisterRepository;
|
||||||
|
import me.zhengjie.modules.system.domain.Dept;
|
||||||
|
import me.zhengjie.modules.system.domain.Job;
|
||||||
|
import me.zhengjie.modules.system.domain.Role;
|
||||||
|
import me.zhengjie.modules.system.domain.User;
|
||||||
|
import me.zhengjie.modules.system.repository.UserRepository;
|
||||||
|
import me.zhengjie.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import me.zhengjie.modules.shopInfo.shop.repository.TbShopInfoRepository;
|
import me.zhengjie.modules.shopInfo.shop.repository.TbShopInfoRepository;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
||||||
import me.zhengjie.modules.shopInfo.shop.service.mapstruct.TbShopInfoMapper;
|
import me.zhengjie.modules.shopInfo.shop.service.mapstruct.TbShopInfoMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import me.zhengjie.utils.PageUtil;
|
|
||||||
import me.zhengjie.utils.QueryHelp;
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.time.Instant;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
@@ -53,13 +63,27 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TbShopInfoMapper tbShopInfoMapper;
|
private TbShopInfoMapper tbShopInfoMapper;
|
||||||
|
|
||||||
|
private final TbMerchantAccountRepository merchantAccountRepository;
|
||||||
|
|
||||||
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
|
private final TbMerchantRegisterRepository merchantRegisterRepository;
|
||||||
|
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria, Pageable pageable){
|
public Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria, Pageable pageable){
|
||||||
// if (!"admin".equals(criteria.getAccount())){
|
// if (!"admin".equals(criteria.getAccount())){
|
||||||
// throw new BadRequestException("登录账号有误");
|
// throw new BadRequestException("登录账号有误");
|
||||||
// }
|
// }
|
||||||
Page<TbShopInfo> page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<TbShopInfo> page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
return PageUtil.toPage(page.map(tbShopInfoMapper::toDto));
|
List<TbShopInfo> content = page.getContent();
|
||||||
|
for (TbShopInfo data: content){
|
||||||
|
if (data.getProfiles() == null){
|
||||||
|
data.setProfiles("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageUtil.toPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -88,8 +112,74 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TbShopInfoDto create(TbShopInfo resources) {
|
public TbShopInfoDto create(TbShopInfoDto resources) {
|
||||||
return tbShopInfoMapper.toDto(tbShopInfoRepository.save(resources));
|
if ("release".equals(resources.getProfiles())){
|
||||||
|
if (resources.getRegisterCode() == null){
|
||||||
|
throw new BadRequestException("未绑定激活码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(resources.getAccount());
|
||||||
|
if (byAccount != null){
|
||||||
|
throw new BadRequestException("登录名重复");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbShopInfo tbShopInfo = new TbShopInfo();
|
||||||
|
BeanUtils.copyProperties(resources,tbShopInfo);
|
||||||
|
tbShopInfo.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
//增加商户详情
|
||||||
|
TbShopInfo save = tbShopInfoRepository.save(tbShopInfo);
|
||||||
|
//增加商户登录账号
|
||||||
|
TbMerchantAccount tbMerchantAccount = new TbMerchantAccount();
|
||||||
|
tbMerchantAccount.setAccount(resources.getAccount());
|
||||||
|
tbMerchantAccount.setPassword(MD5Utils.encrypt(resources.getPassword()));
|
||||||
|
tbMerchantAccount.setShopId(String.valueOf(save.getId()));
|
||||||
|
tbMerchantAccount.setIsAdmin(0);
|
||||||
|
tbMerchantAccount.setIsMercantile(0);
|
||||||
|
tbMerchantAccount.setStatus(1);
|
||||||
|
tbMerchantAccount.setMsgAble(0);
|
||||||
|
merchantAccountRepository.save(tbMerchantAccount);
|
||||||
|
//添加收银系统后台账号
|
||||||
|
User user = new User();
|
||||||
|
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||||
|
user.setUsername(resources.getAccount());
|
||||||
|
user.setPhone(resources.getPhone());
|
||||||
|
user.setCreateBy("admin");
|
||||||
|
user.setEnabled(true);
|
||||||
|
|
||||||
|
Dept dept = new Dept();
|
||||||
|
dept.setId(18L);
|
||||||
|
user.setDept(dept);
|
||||||
|
|
||||||
|
Set<Role> roles = new HashSet<>();
|
||||||
|
Role role = new Role();
|
||||||
|
role.setId(2L);
|
||||||
|
roles.add(role);
|
||||||
|
user.setRoles(roles);
|
||||||
|
|
||||||
|
Set<Job> jobs = new HashSet<>();
|
||||||
|
Job job = new Job();
|
||||||
|
job.setId(10L);
|
||||||
|
jobs.add(job);
|
||||||
|
user.setJobs(jobs);
|
||||||
|
userRepository.save(user);
|
||||||
|
|
||||||
|
if (resources.getRegisterCode() != null){
|
||||||
|
//激活码绑定
|
||||||
|
TbMerchantRegister tbMerchantRegister = merchantRegisterRepository.findByRegisterCode(resources.getRegisterCode());
|
||||||
|
if(tbMerchantRegister == null){
|
||||||
|
throw new BadRequestException("激活码有误");
|
||||||
|
}
|
||||||
|
if (tbMerchantRegister.getStatus() == 1){
|
||||||
|
throw new BadRequestException("激活码已激活,不能重复绑定");
|
||||||
|
}
|
||||||
|
tbMerchantRegister.setStatus(1);
|
||||||
|
tbMerchantAccount.setShopId(String.valueOf(save.getId()));
|
||||||
|
tbMerchantAccount.setName(save.getShopName());
|
||||||
|
merchantRegisterRepository.save(tbMerchantRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tbShopInfoMapper.toDto(new TbShopInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class TbShopAreaController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/shop/area")
|
@Log("查询/shop/area")
|
||||||
@ApiOperation("查询/shop/area")
|
@ApiOperation("查询/shop/area")
|
||||||
@PreAuthorize("@el.check('tbShopArea:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopArea(TbShopAreaQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopArea(TbShopAreaQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopAreaService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopAreaService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,6 @@ public class TbShopAreaController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/shop/area")
|
@Log("新增/shop/area")
|
||||||
@ApiOperation("新增/shop/area")
|
@ApiOperation("新增/shop/area")
|
||||||
@PreAuthorize("@el.check('tbShopArea:add')")
|
|
||||||
public ResponseEntity<Object> createTbShopArea(@Validated @RequestBody TbShopArea resources){
|
public ResponseEntity<Object> createTbShopArea(@Validated @RequestBody TbShopArea resources){
|
||||||
return new ResponseEntity<>(tbShopAreaService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopAreaService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,6 @@ public class TbShopAreaController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/shop/area")
|
@Log("修改/shop/area")
|
||||||
@ApiOperation("修改/shop/area")
|
@ApiOperation("修改/shop/area")
|
||||||
@PreAuthorize("@el.check('tbShopArea:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbShopArea(@Validated @RequestBody TbShopArea resources){
|
public ResponseEntity<Object> updateTbShopArea(@Validated @RequestBody TbShopArea resources){
|
||||||
tbShopAreaService.update(resources);
|
tbShopAreaService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -79,7 +76,6 @@ public class TbShopAreaController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/shop/area")
|
@Log("删除/shop/area")
|
||||||
@ApiOperation("删除/shop/area")
|
@ApiOperation("删除/shop/area")
|
||||||
@PreAuthorize("@el.check('tbShopArea:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbShopArea(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbShopArea(@RequestBody Integer[] ids) {
|
||||||
tbShopAreaService.deleteAll(ids);
|
tbShopAreaService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class TbShopPurveyorController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/shop/purveyor")
|
@Log("查询/shop/purveyor")
|
||||||
@ApiOperation("查询/shop/purveyor")
|
@ApiOperation("查询/shop/purveyor")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyor:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopPurveyor(TbShopPurveyorQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopPurveyor(TbShopPurveyorQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopPurveyorService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopPurveyorService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,6 @@ public class TbShopPurveyorController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/shop/purveyor")
|
@Log("新增/shop/purveyor")
|
||||||
@ApiOperation("新增/shop/purveyor")
|
@ApiOperation("新增/shop/purveyor")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyor:add')")
|
|
||||||
public ResponseEntity<Object> createTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
|
public ResponseEntity<Object> createTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
|
||||||
return new ResponseEntity<>(tbShopPurveyorService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopPurveyorService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,6 @@ public class TbShopPurveyorController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/shop/purveyor")
|
@Log("修改/shop/purveyor")
|
||||||
@ApiOperation("修改/shop/purveyor")
|
@ApiOperation("修改/shop/purveyor")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyor:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
|
public ResponseEntity<Object> updateTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
|
||||||
tbShopPurveyorService.update(resources);
|
tbShopPurveyorService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -79,7 +76,6 @@ public class TbShopPurveyorController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/shop/purveyor")
|
@Log("删除/shop/purveyor")
|
||||||
@ApiOperation("删除/shop/purveyor")
|
@ApiOperation("删除/shop/purveyor")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyor:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbShopPurveyor(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbShopPurveyor(@RequestBody Integer[] ids) {
|
||||||
tbShopPurveyorService.deleteAll(ids);
|
tbShopPurveyorService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ public class TbShopPurveyorTransactController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/shop/purveyorTransact")
|
@Log("查询/shop/purveyorTransact")
|
||||||
@ApiOperation("查询/shop/purveyorTransact")
|
@ApiOperation("查询/shop/purveyorTransact")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyorTransact:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopPurveyorTransactSum(TbShopPurveyorTransactQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopPurveyorTransactSum(TbShopPurveyorTransactQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopPurveyorTransactService.queryTransactDate(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopPurveyorTransactService.queryTransactDate(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -89,7 +88,6 @@ public class TbShopPurveyorTransactController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/shop/purveyorTransact")
|
@Log("新增/shop/purveyorTransact")
|
||||||
@ApiOperation("新增/shop/purveyorTransact")
|
@ApiOperation("新增/shop/purveyorTransact")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyorTransact:add')")
|
|
||||||
public ResponseEntity<Object> createTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
|
public ResponseEntity<Object> createTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
|
||||||
return new ResponseEntity<>(tbShopPurveyorTransactService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopPurveyorTransactService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -97,7 +95,6 @@ public class TbShopPurveyorTransactController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/shop/purveyorTransact")
|
@Log("修改/shop/purveyorTransact")
|
||||||
@ApiOperation("修改/shop/purveyorTransact")
|
@ApiOperation("修改/shop/purveyorTransact")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyorTransact:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
|
public ResponseEntity<Object> updateTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
|
||||||
tbShopPurveyorTransactService.update(resources);
|
tbShopPurveyorTransactService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -106,7 +103,6 @@ public class TbShopPurveyorTransactController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/shop/purveyorTransact")
|
@Log("删除/shop/purveyorTransact")
|
||||||
@ApiOperation("删除/shop/purveyorTransact")
|
@ApiOperation("删除/shop/purveyorTransact")
|
||||||
@PreAuthorize("@el.check('tbShopPurveyorTransact:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbShopPurveyorTransact(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbShopPurveyorTransact(@RequestBody Integer[] ids) {
|
||||||
tbShopPurveyorTransactService.deleteAll(ids);
|
tbShopPurveyorTransactService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package me.zhengjie.modules.shopInfo.shopReceiptSales.domain;
|
package me.zhengjie.modules.shopInfo.shopReceiptSales.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -40,43 +41,43 @@ public class TbReceiptSales implements Serializable {
|
|||||||
|
|
||||||
@Column(name = "`title`")
|
@Column(name = "`title`")
|
||||||
@ApiModelProperty(value = "标题")
|
@ApiModelProperty(value = "标题")
|
||||||
private String title;
|
private String title="";
|
||||||
|
|
||||||
@Column(name = "`logo`")
|
@Column(name = "`logo`")
|
||||||
@ApiModelProperty(value = "是否显示公司Logo")
|
@ApiModelProperty(value = "是否显示公司Logo")
|
||||||
private String logo;
|
private String logo="";
|
||||||
|
|
||||||
@Column(name = "`show_contact_info`")
|
@Column(name = "`show_contact_info`")
|
||||||
@ApiModelProperty(value = "打印联系电话等信息")
|
@ApiModelProperty(value = "打印联系电话等信息")
|
||||||
private Integer showContactInfo;
|
private Integer showContactInfo=0;
|
||||||
|
|
||||||
@Column(name = "`show_member`")
|
@Column(name = "`show_member`")
|
||||||
@ApiModelProperty(value = "打印会员开关 0?1")
|
@ApiModelProperty(value = "打印会员开关 0?1")
|
||||||
private Integer showMember;
|
private Integer showMember=0;
|
||||||
|
|
||||||
@Column(name = "`show_member_code`")
|
@Column(name = "`show_member_code`")
|
||||||
@ApiModelProperty(value = "打印会员编号开关")
|
@ApiModelProperty(value = "打印会员编号开关")
|
||||||
private Integer showMemberCode;
|
private Integer showMemberCode=0;
|
||||||
|
|
||||||
@Column(name = "`show_member_score`")
|
@Column(name = "`show_member_score`")
|
||||||
@ApiModelProperty(value = "打印会员积分")
|
@ApiModelProperty(value = "打印会员积分")
|
||||||
private Integer showMemberScore;
|
private Integer showMemberScore=0;
|
||||||
|
|
||||||
@Column(name = "`show_member_wallet`")
|
@Column(name = "`show_member_wallet`")
|
||||||
@ApiModelProperty(value = "打印会员余额开关 0?1")
|
@ApiModelProperty(value = "打印会员余额开关 0?1")
|
||||||
private Integer showMemberWallet;
|
private Integer showMemberWallet=0;
|
||||||
|
|
||||||
@Column(name = "`footer_remark`")
|
@Column(name = "`footer_remark`")
|
||||||
@ApiModelProperty(value = "店铺Id")
|
@ApiModelProperty(value = "店铺Id")
|
||||||
private String footerRemark;
|
private String footerRemark="";
|
||||||
|
|
||||||
@Column(name = "`show_cash_charge`")
|
@Column(name = "`show_cash_charge`")
|
||||||
@ApiModelProperty(value = "打印找零")
|
@ApiModelProperty(value = "打印找零")
|
||||||
private Integer showCashCharge;
|
private Integer showCashCharge=0;
|
||||||
|
|
||||||
@Column(name = "`show_serial_no`")
|
@Column(name = "`show_serial_no`")
|
||||||
@ApiModelProperty(value = "流水号")
|
@ApiModelProperty(value = "流水号")
|
||||||
private Integer showSerialNo;
|
private Integer showSerialNo=0;
|
||||||
|
|
||||||
@Column(name = "`big_serial_no`")
|
@Column(name = "`big_serial_no`")
|
||||||
@ApiModelProperty(value = "用大号字打印流水号 在showSerialNo可用前提下")
|
@ApiModelProperty(value = "用大号字打印流水号 在showSerialNo可用前提下")
|
||||||
@@ -92,7 +93,7 @@ public class TbReceiptSales implements Serializable {
|
|||||||
|
|
||||||
@Column(name = "`footer_text`")
|
@Column(name = "`footer_text`")
|
||||||
@ApiModelProperty(value = "尾部文字")
|
@ApiModelProperty(value = "尾部文字")
|
||||||
private String footerText;
|
private String footerText="";
|
||||||
|
|
||||||
@Column(name = "`footer_text_align`")
|
@Column(name = "`footer_text_align`")
|
||||||
@ApiModelProperty(value = "文字 对齐方式")
|
@ApiModelProperty(value = "文字 对齐方式")
|
||||||
@@ -100,7 +101,7 @@ public class TbReceiptSales implements Serializable {
|
|||||||
|
|
||||||
@Column(name = "`footer_image`")
|
@Column(name = "`footer_image`")
|
||||||
@ApiModelProperty(value = "尾部图像")
|
@ApiModelProperty(value = "尾部图像")
|
||||||
private String footerImage;
|
private String footerImage="";
|
||||||
|
|
||||||
@Column(name = "`pre_print`")
|
@Column(name = "`pre_print`")
|
||||||
@ApiModelProperty(value = "预打印,YES开启 NO不开启")
|
@ApiModelProperty(value = "预打印,YES开启 NO不开启")
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class TbReceiptSalesController {
|
|||||||
@ApiOperation("查询/shop/receiptSales")
|
@ApiOperation("查询/shop/receiptSales")
|
||||||
@PreAuthorize("@el.check('tbReceiptSales:info')")
|
@PreAuthorize("@el.check('tbReceiptSales:info')")
|
||||||
public Object queryTbReceiptSalesInfo(@PathVariable("shopId")Integer shopId){
|
public Object queryTbReceiptSalesInfo(@PathVariable("shopId")Integer shopId){
|
||||||
|
|
||||||
return tbReceiptSalesService.findById(shopId);
|
return tbReceiptSalesService.findById(shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class TbReceiptSalesServiceImpl implements TbReceiptSalesService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public TbReceiptSalesDto findById(Integer id) {
|
public TbReceiptSalesDto findById(Integer id) {
|
||||||
TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(id).orElseGet(TbReceiptSales::new);
|
TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(id).orElseGet(TbReceiptSales::new);
|
||||||
ValidationUtil.isNull(tbReceiptSales.getId(),"TbReceiptSales","id",id);
|
|
||||||
return tbReceiptSalesMapper.toDto(tbReceiptSales);
|
return tbReceiptSalesMapper.toDto(tbReceiptSales);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
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-02-23
|
||||||
|
**/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="tb_merchant_register")
|
||||||
|
public class TbMerchantRegister implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "`id`")
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(name = "`register_code`")
|
||||||
|
@ApiModelProperty(value = "激活码")
|
||||||
|
private String registerCode;
|
||||||
|
|
||||||
|
@Column(name = "`app_code`")
|
||||||
|
@ApiModelProperty(value = "授权token")
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
@Column(name = "`telephone`")
|
||||||
|
@ApiModelProperty(value = "telephone")
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
@Column(name = "`merchant_id`")
|
||||||
|
@ApiModelProperty(value = "merchantId")
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
@Column(name = "`shop_id`")
|
||||||
|
@ApiModelProperty(value = "店铺id")
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
@Column(name = "`type`")
|
||||||
|
@ApiModelProperty(value = "版本类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name = "`amount`")
|
||||||
|
@ApiModelProperty(value = "激活码金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Column(name = "`period_year`")
|
||||||
|
@ApiModelProperty(value = "激活时长(月)")
|
||||||
|
private Integer periodYear;
|
||||||
|
|
||||||
|
@Column(name = "`name`")
|
||||||
|
@ApiModelProperty(value = "name")
|
||||||
|
private String name = "";
|
||||||
|
|
||||||
|
@Column(name = "`address`")
|
||||||
|
@ApiModelProperty(value = "address")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Column(name = "`logo`")
|
||||||
|
@ApiModelProperty(value = "logo")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
@Column(name = "`industry`")
|
||||||
|
@ApiModelProperty(value = "industry")
|
||||||
|
private String industry;
|
||||||
|
|
||||||
|
@Column(name = "`industry_name`")
|
||||||
|
@ApiModelProperty(value = "industryName")
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
@Column(name = "`status`")
|
||||||
|
@ApiModelProperty(value = "状态0未使用1已使用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Column(name = "`limit_shop_number`")
|
||||||
|
@ApiModelProperty(value = "limitShopNumber")
|
||||||
|
private Integer limitShopNumber;
|
||||||
|
|
||||||
|
@Column(name = "`source_path`")
|
||||||
|
@ApiModelProperty(value = "sourcePath")
|
||||||
|
private String sourcePath;
|
||||||
|
|
||||||
|
@Column(name = "`created_at`")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
@Column(name = "`updated_at`")
|
||||||
|
@ApiModelProperty(value = "updatedAt")
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
@Column(name = "proxy_id")
|
||||||
|
@ApiModelProperty(value = "代理id")
|
||||||
|
private String proxyId;
|
||||||
|
|
||||||
|
|
||||||
|
public void copy(TbMerchantRegister 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.shopInfo.shopRegister.repository;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
|
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-02-23
|
||||||
|
**/
|
||||||
|
public interface TbMerchantRegisterRepository extends JpaRepository<TbMerchantRegister, Integer>, JpaSpecificationExecutor<TbMerchantRegister> {
|
||||||
|
|
||||||
|
@Query("select register from TbMerchantRegister register where register.registerCode =:registerCode")
|
||||||
|
TbMerchantRegister findByRegisterCode(@Param("registerCode") String registerCode);
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.rest;
|
||||||
|
|
||||||
|
import me.zhengjie.annotation.Log;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.TbMerchantRegisterService;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterQueryCriteria;
|
||||||
|
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-02-23
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "/shop/register管理")
|
||||||
|
@RequestMapping("/api/tbMerchantRegister")
|
||||||
|
public class TbMerchantRegisterController {
|
||||||
|
|
||||||
|
private final TbMerchantRegisterService tbMerchantRegisterService;
|
||||||
|
|
||||||
|
// @Log("导出数据")
|
||||||
|
// @ApiOperation("导出数据")
|
||||||
|
// @GetMapping(value = "/download")
|
||||||
|
// @PreAuthorize("@el.check('tbMerchantRegister:list')")
|
||||||
|
// public void exportTbMerchantRegister(HttpServletResponse response, TbMerchantRegisterQueryCriteria criteria) throws IOException {
|
||||||
|
// tbMerchantRegisterService.download(tbMerchantRegisterService.queryAll(criteria), response);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@Log("查询/shop/register")
|
||||||
|
@ApiOperation("查询/shop/register")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantRegister:list')")
|
||||||
|
public ResponseEntity<Object> queryTbMerchantRegister(@RequestBody TbMerchantRegisterQueryCriteria criteria){
|
||||||
|
return new ResponseEntity<>(tbMerchantRegisterService.queryAll(criteria),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增/shop/register")
|
||||||
|
@ApiOperation("新增/shop/register")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantRegister:add')")
|
||||||
|
public ResponseEntity<Object> createTbMerchantRegister(@Validated @RequestBody TbMerchantRegisterDto resources){
|
||||||
|
return new ResponseEntity<>(tbMerchantRegisterService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改/shop/register")
|
||||||
|
@ApiOperation("修改/shop/register")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantRegister:edit')")
|
||||||
|
public ResponseEntity<Object> updateTbMerchantRegister(@Validated @RequestBody TbMerchantRegister resources){
|
||||||
|
tbMerchantRegisterService.update(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Log("删除/shop/register")
|
||||||
|
@ApiOperation("删除/shop/register")
|
||||||
|
@PreAuthorize("@el.check('tbMerchantRegister:del')")
|
||||||
|
public ResponseEntity<Object> deleteTbMerchantRegister(@RequestBody Integer[] ids) {
|
||||||
|
tbMerchantRegisterService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.service;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterQueryCriteria;
|
||||||
|
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-02-23
|
||||||
|
**/
|
||||||
|
public interface TbMerchantRegisterService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
Map<String,Object> queryAll(TbMerchantRegisterQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<TbMerchantRegisterDto>
|
||||||
|
*/
|
||||||
|
// List<TbMerchantRegisterDto> queryAll(TbMerchantRegisterQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param id ID
|
||||||
|
* @return TbMerchantRegisterDto
|
||||||
|
*/
|
||||||
|
TbMerchantRegisterDto findById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param resources /
|
||||||
|
* @return TbMerchantRegisterDto
|
||||||
|
*/
|
||||||
|
TbMerchantRegisterDto create(TbMerchantRegisterDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param resources /
|
||||||
|
*/
|
||||||
|
void update(TbMerchantRegister resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Integer[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<TbMerchantRegisterDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbMerchantRegisterDto implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 激活码 */
|
||||||
|
private String registerCode;
|
||||||
|
|
||||||
|
/** 授权token */
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
/** 店铺id */
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/** 版本类型 */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 激活码金额 */
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/** 激活时长(月) */
|
||||||
|
private Integer periodYear;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
private String industry;
|
||||||
|
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
/** 状态0未使用1已使用 */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private Integer limitShopNumber;
|
||||||
|
|
||||||
|
private String sourcePath;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
private Integer number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-23
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbMerchantRegisterQueryCriteria{
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private Integer status;
|
||||||
|
/** BETWEEN */
|
||||||
|
@Query(type = Query.Type.BETWEEN)
|
||||||
|
private List<Long> createdAt;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.LEFT_LIKE)
|
||||||
|
private String proxyName;
|
||||||
|
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
private Integer size;
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* 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.shopInfo.shopRegister.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.api.R;
|
||||||
|
import me.zhengjie.exception.BadRequestException;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
|
import me.zhengjie.utils.FileUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.repository.TbMerchantRegisterRepository;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.TbMerchantRegisterService;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterQueryCriteria;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.mapstruct.TbMerchantRegisterMapper;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
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.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description 服务实现
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-23
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TbMerchantRegisterServiceImpl implements TbMerchantRegisterService {
|
||||||
|
|
||||||
|
private final TbMerchantRegisterRepository tbMerchantRegisterRepository;
|
||||||
|
private final TbMerchantRegisterMapper tbMerchantRegisterMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryAll(TbMerchantRegisterQueryCriteria criteria){
|
||||||
|
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
||||||
|
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||||
|
|
||||||
|
|
||||||
|
Page<TbMerchantRegister> page = tbMerchantRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
for (TbMerchantRegister data : page.getContent()) {
|
||||||
|
data.setName(data.getName() == null?"":data.getName());
|
||||||
|
data.setTelephone(data.getTelephone() == null?"": data.getTelephone());
|
||||||
|
data.setType(data.getType() == null?"": data.getType());
|
||||||
|
data.setProxyId(data.getProxyId() == null?"":data.getProxyId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageUtil.toPage(page.getContent(),page.getTotalElements());
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<TbMerchantRegisterDto> queryAll(TbMerchantRegisterQueryCriteria criteria){
|
||||||
|
// return tbMerchantRegisterMapper.toDto(tbMerchantRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public TbMerchantRegisterDto findById(Integer id) {
|
||||||
|
TbMerchantRegister tbMerchantRegister = tbMerchantRegisterRepository.findById(id).orElseGet(TbMerchantRegister::new);
|
||||||
|
ValidationUtil.isNull(tbMerchantRegister.getId(),"TbMerchantRegister","id",id);
|
||||||
|
return tbMerchantRegisterMapper.toDto(tbMerchantRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public TbMerchantRegisterDto create(TbMerchantRegisterDto resources) {
|
||||||
|
if (resources.getNumber()>10){
|
||||||
|
throw new BadRequestException("每次最多生成10条激活码");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < resources.getNumber(); i++) {
|
||||||
|
TbMerchantRegister tbMerchantRegister = new TbMerchantRegister();
|
||||||
|
tbMerchantRegister.setRegisterCode(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||||
|
tbMerchantRegister.setStatus(0);
|
||||||
|
tbMerchantRegister.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
tbMerchantRegister.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
tbMerchantRegister.setPeriodYear(resources.getPeriodYear());
|
||||||
|
tbMerchantRegisterRepository.save(tbMerchantRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tbMerchantRegisterMapper.toDto(new TbMerchantRegister());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
System.out.println(uuid);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(TbMerchantRegister resources) {
|
||||||
|
TbMerchantRegister tbMerchantRegister = tbMerchantRegisterRepository.findById(resources.getId()).orElseGet(TbMerchantRegister::new);
|
||||||
|
ValidationUtil.isNull( tbMerchantRegister.getId(),"TbMerchantRegister","id",resources.getId());
|
||||||
|
tbMerchantRegister.copy(resources);
|
||||||
|
tbMerchantRegisterRepository.save(tbMerchantRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Integer[] ids) {
|
||||||
|
for (Integer id : ids) {
|
||||||
|
tbMerchantRegisterRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<TbMerchantRegisterDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (TbMerchantRegisterDto tbMerchantRegister : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("激活码", tbMerchantRegister.getRegisterCode());
|
||||||
|
map.put("授权token", tbMerchantRegister.getAppCode());
|
||||||
|
map.put(" telephone", tbMerchantRegister.getTelephone());
|
||||||
|
map.put(" merchantId", tbMerchantRegister.getMerchantId());
|
||||||
|
map.put("店铺id", tbMerchantRegister.getShopId());
|
||||||
|
map.put("版本类型", tbMerchantRegister.getType());
|
||||||
|
map.put("激活码金额", tbMerchantRegister.getAmount());
|
||||||
|
map.put("激活时长(月)", tbMerchantRegister.getPeriodYear());
|
||||||
|
map.put(" name", tbMerchantRegister.getName());
|
||||||
|
map.put(" address", tbMerchantRegister.getAddress());
|
||||||
|
map.put(" logo", tbMerchantRegister.getLogo());
|
||||||
|
map.put(" industry", tbMerchantRegister.getIndustry());
|
||||||
|
map.put(" industryName", tbMerchantRegister.getIndustryName());
|
||||||
|
map.put("状态0未使用1已使用", tbMerchantRegister.getStatus());
|
||||||
|
map.put(" limitShopNumber", tbMerchantRegister.getLimitShopNumber());
|
||||||
|
map.put(" sourcePath", tbMerchantRegister.getSourcePath());
|
||||||
|
map.put("创建时间", tbMerchantRegister.getCreatedAt());
|
||||||
|
map.put(" updatedAt", tbMerchantRegister.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.shopInfo.shopRegister.service.mapstruct;
|
||||||
|
|
||||||
|
import me.zhengjie.base.BaseMapper;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-23
|
||||||
|
**/
|
||||||
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface TbMerchantRegisterMapper extends BaseMapper<TbMerchantRegisterDto, TbMerchantRegister> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -54,7 +54,6 @@ public class TbShopUnitController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/shop/unit")
|
@Log("查询/shop/unit")
|
||||||
@ApiOperation("查询/shop/unit")
|
@ApiOperation("查询/shop/unit")
|
||||||
@PreAuthorize("@el.check('tbShopUnit:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopUnit(TbShopUnitQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopUnit(TbShopUnitQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,6 @@ public class TbShopUnitController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/shop/unit")
|
@Log("新增/shop/unit")
|
||||||
@ApiOperation("新增/shop/unit")
|
@ApiOperation("新增/shop/unit")
|
||||||
@PreAuthorize("@el.check('tbShopUnit:add')")
|
|
||||||
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
|
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
|
||||||
return new ResponseEntity<>(tbShopUnitService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopUnitService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,6 @@ public class TbShopUnitController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/shop/unit")
|
@Log("修改/shop/unit")
|
||||||
@ApiOperation("修改/shop/unit")
|
@ApiOperation("修改/shop/unit")
|
||||||
@PreAuthorize("@el.check('tbShopUnit:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbShopUnit(@Validated @RequestBody TbShopUnit resources){
|
public ResponseEntity<Object> updateTbShopUnit(@Validated @RequestBody TbShopUnit resources){
|
||||||
tbShopUnitService.update(resources);
|
tbShopUnitService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -79,7 +76,6 @@ public class TbShopUnitController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/shop/unit")
|
@Log("删除/shop/unit")
|
||||||
@ApiOperation("删除/shop/unit")
|
@ApiOperation("删除/shop/unit")
|
||||||
@PreAuthorize("@el.check('tbShopUnit:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbShopUnit(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbShopUnit(@RequestBody Integer[] ids) {
|
||||||
tbShopUnitService.deleteAll(ids);
|
tbShopUnitService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class TbShopTableController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/shop/table")
|
@Log("查询/shop/table")
|
||||||
@ApiOperation("查询/shop/table")
|
@ApiOperation("查询/shop/table")
|
||||||
@PreAuthorize("@el.check('tbShopTable:list')")
|
|
||||||
public ResponseEntity<Object> queryTbShopTable(TbShopTableQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopTable(TbShopTableQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbShopTableService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopTableService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,9 @@ public class User extends BaseEntity implements Serializable {
|
|||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
@Email
|
@Email
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty(value = "邮箱")
|
@ApiModelProperty(value = "邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty(value = "电话号码")
|
@ApiModelProperty(value = "电话号码")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ import me.zhengjie.config.FileProperties;
|
|||||||
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.exception.BadRequestException;
|
||||||
import me.zhengjie.modules.security.service.OnlineUserService;
|
import me.zhengjie.modules.security.service.OnlineUserService;
|
||||||
import me.zhengjie.modules.security.service.UserCacheManager;
|
import me.zhengjie.modules.security.service.UserCacheManager;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.domain.TbMerchantAccount;
|
||||||
|
import me.zhengjie.modules.shopInfo.merchantAccount.repository.TbMerchantAccountRepository;
|
||||||
|
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||||
|
import me.zhengjie.modules.shopInfo.shop.repository.TbShopInfoRepository;
|
||||||
import me.zhengjie.modules.system.domain.User;
|
import me.zhengjie.modules.system.domain.User;
|
||||||
import me.zhengjie.exception.EntityExistException;
|
import me.zhengjie.exception.EntityExistException;
|
||||||
import me.zhengjie.exception.EntityNotFoundException;
|
import me.zhengjie.exception.EntityNotFoundException;
|
||||||
@@ -59,6 +63,10 @@ public class UserServiceImpl implements UserService {
|
|||||||
private final UserCacheManager userCacheManager;
|
private final UserCacheManager userCacheManager;
|
||||||
private final OnlineUserService onlineUserService;
|
private final OnlineUserService onlineUserService;
|
||||||
private final UserLoginMapper userLoginMapper;
|
private final UserLoginMapper userLoginMapper;
|
||||||
|
private final TbMerchantAccountRepository merchantAccountRepository;
|
||||||
|
private final TbShopInfoRepository shopInfoRepository;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
|
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class TbUserInfoController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询/userInfo/list")
|
@Log("查询/userInfo/list")
|
||||||
@ApiOperation("查询/userInfo/list")
|
@ApiOperation("查询/userInfo/list")
|
||||||
@PreAuthorize("@el.check('tbUserInfo:list')")
|
|
||||||
public ResponseEntity<Object> queryTbUserInfo(TbUserInfoQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbUserInfo(TbUserInfoQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbUserInfoService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbUserInfoService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,6 @@ public class TbUserInfoController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增/userInfo/list")
|
@Log("新增/userInfo/list")
|
||||||
@ApiOperation("新增/userInfo/list")
|
@ApiOperation("新增/userInfo/list")
|
||||||
@PreAuthorize("@el.check('tbUserInfo:add')")
|
|
||||||
public ResponseEntity<Object> createTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
public ResponseEntity<Object> createTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
||||||
return new ResponseEntity<>(tbUserInfoService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbUserInfoService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,6 @@ public class TbUserInfoController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改/userInfo/list")
|
@Log("修改/userInfo/list")
|
||||||
@ApiOperation("修改/userInfo/list")
|
@ApiOperation("修改/userInfo/list")
|
||||||
@PreAuthorize("@el.check('tbUserInfo:edit')")
|
|
||||||
public ResponseEntity<Object> updateTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
public ResponseEntity<Object> updateTbUserInfo(@Validated @RequestBody TbUserInfo resources){
|
||||||
tbUserInfoService.update(resources);
|
tbUserInfoService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
@@ -79,7 +76,6 @@ public class TbUserInfoController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@Log("删除/userInfo/list")
|
@Log("删除/userInfo/list")
|
||||||
@ApiOperation("删除/userInfo/list")
|
@ApiOperation("删除/userInfo/list")
|
||||||
@PreAuthorize("@el.check('tbUserInfo:del')")
|
|
||||||
public ResponseEntity<Object> deleteTbUserInfo(@RequestBody Integer[] ids) {
|
public ResponseEntity<Object> deleteTbUserInfo(@RequestBody Integer[] ids) {
|
||||||
tbUserInfoService.deleteAll(ids);
|
tbUserInfoService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -55,4 +55,7 @@ public class TbUserInfoQueryCriteria{
|
|||||||
/** 精确 */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private Long lastLogInAt;
|
private Long lastLogInAt;
|
||||||
|
|
||||||
|
@Query
|
||||||
|
private String shopId;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user