收银后台跟进
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
package me.zhengjie.interceptor;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public class UserInterceptor implements HandlerInterceptor {
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception{
|
||||||
|
String userName = request.getHeader("userName");
|
||||||
|
request.setAttribute("userName", userName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package me.zhengjie.interceptor;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry){
|
||||||
|
registry.addInterceptor(new UserInterceptor());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,79 +28,79 @@ import me.zhengjie.annotation.Query;
|
|||||||
@Data
|
@Data
|
||||||
public class TbOrderInfoQueryCriteria{
|
public class TbOrderInfoQueryCriteria{
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal productAmount;
|
private BigDecimal productAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal payAmount;
|
private BigDecimal payAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal cashPaidAmount;
|
private BigDecimal cashPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal wxPaidAmount;
|
private BigDecimal wxPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal aliPaidAmount;
|
private BigDecimal aliPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal depositPaidAmount;
|
private BigDecimal depositPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal bankPaidAmount;
|
private BigDecimal bankPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal virtualPaidAmount;
|
private BigDecimal virtualPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private BigDecimal otherPaidAmount;
|
private BigDecimal otherPaidAmount;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String sendType;
|
private String sendType;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String shopId;
|
private String shopId;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String memberId;
|
private String memberId;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private Long paidTime;
|
private Long paidTime;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private Long createdAt;
|
private Long createdAt;
|
||||||
|
|
||||||
/** ¾«È· */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
private Integer isAccepted;
|
private Integer isAccepted;
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ package me.zhengjie.modules.productGroup.repository;
|
|||||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||||
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;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
@@ -25,4 +26,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
* @date 2023-12-16
|
* @date 2023-12-16
|
||||||
**/
|
**/
|
||||||
public interface TbProductGroupRepository extends JpaRepository<TbProductGroup, Integer>, JpaSpecificationExecutor<TbProductGroup> {
|
public interface TbProductGroupRepository extends JpaRepository<TbProductGroup, Integer>, JpaSpecificationExecutor<TbProductGroup> {
|
||||||
|
|
||||||
|
// @Query("SELECT u FROM User u WHERE u.userName = :userName")
|
||||||
|
// User findByUserName(@Param("userName") String userName);
|
||||||
}
|
}
|
||||||
@@ -104,9 +104,8 @@ public class TbProductGroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/addProductInfo")
|
@PostMapping("/addProductInfo")
|
||||||
public ResponseEntity<Object> addProductInfo(@RequestBody AddProduct addProduct){
|
public ResponseEntity<Object> addProductInfo(@RequestBody AddProduct addProduct,@RequestAttribute(value = "userName", required = false) String userName){
|
||||||
|
return new ResponseEntity<>(tbProductGroupService.updateProductIds(addProduct,userName),HttpStatus.OK);
|
||||||
|
|
||||||
tbProductGroupService.updateProductIds();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -84,5 +84,5 @@ public interface TbProductGroupService {
|
|||||||
*/
|
*/
|
||||||
void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException;
|
void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
ResponseEntity<Object> updateProductIds(AddProduct addProduct);
|
ResponseEntity<Object> updateProductIds(AddProduct addProduct,String userName);
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,8 @@ package me.zhengjie.modules.productGroup.service.impl;
|
|||||||
|
|
||||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||||
import me.zhengjie.modules.productGroup.service.vo.AddProduct;
|
import me.zhengjie.modules.productGroup.service.vo.AddProduct;
|
||||||
|
import me.zhengjie.modules.security.service.OnlineUserService;
|
||||||
|
import me.zhengjie.modules.security.service.dto.OnlineUserDto;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
import me.zhengjie.utils.FileUtil;
|
import me.zhengjie.utils.FileUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -36,6 +38,7 @@ import me.zhengjie.utils.QueryHelp;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -53,9 +56,13 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
|||||||
private final TbProductGroupRepository tbProductGroupRepository;
|
private final TbProductGroupRepository tbProductGroupRepository;
|
||||||
private final TbProductGroupMapper tbProductGroupMapper;
|
private final TbProductGroupMapper tbProductGroupMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OnlineUserService onlineUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
public Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable){
|
||||||
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
|
||||||
|
QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
|
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,17 +122,22 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Object> updateProductIds(AddProduct addProduct) {
|
public ResponseEntity<Object> updateProductIds(AddProduct addProduct,String userName) {
|
||||||
|
OnlineUserDto onlineUser = onlineUserService.getOne(addProduct.getKey());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (addProduct.getIds().size()<1){
|
if (addProduct.getIds().size()<1){
|
||||||
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
|
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
|
||||||
}
|
}
|
||||||
TbProductGroup productGroup = tbProductGroupMapper.queryById(addProduct.getProductId());
|
TbProductGroupDto productGroup = this.findById(addProduct.getProductId());
|
||||||
|
|
||||||
if (productGroup == null){
|
if (productGroup == null){
|
||||||
return new ResponseEntity<>("没有找到改分类", HttpStatus.NOT_ACCEPTABLE);
|
return new ResponseEntity<>("没有找到改分类", HttpStatus.NOT_ACCEPTABLE);
|
||||||
}
|
}
|
||||||
TbProductGroup tbProductGroup = new TbProductGroup();
|
TbProductGroup tbProductGroup = new TbProductGroup();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
// //如果没有
|
||||||
if (productGroup.getProductIds() == null) {
|
if (productGroup.getProductIds() == null) {
|
||||||
for (String s : addProduct.getIds()) {
|
for (String s : addProduct.getIds()) {
|
||||||
sb.append(s);
|
sb.append(s);
|
||||||
@@ -134,10 +146,24 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
|||||||
|
|
||||||
tbProductGroup.setProductIds(sb.toString());
|
tbProductGroup.setProductIds(sb.toString());
|
||||||
tbProductGroup.setId(addProduct.getProductId());
|
tbProductGroup.setId(addProduct.getProductId());
|
||||||
tbProductGroupMapper.update(tbProductGroup);
|
this.update(tbProductGroup);
|
||||||
|
}else {
|
||||||
|
//如果有
|
||||||
|
for (String s : addProduct.getIds()) {
|
||||||
|
sb.append(s);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.append(productGroup.getProductIds());
|
||||||
|
|
||||||
|
tbProductGroup.setProductIds(sb.toString());
|
||||||
|
tbProductGroup.setId(addProduct.getProductId());
|
||||||
|
this.update(tbProductGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,9 @@ package me.zhengjie.modules.productGroup.service.mapstruct;
|
|||||||
import me.zhengjie.base.BaseMapper;
|
import me.zhengjie.base.BaseMapper;
|
||||||
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
|
||||||
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
|
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +31,4 @@ import org.mapstruct.ReportingPolicy;
|
|||||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
|
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
|
||||||
|
|
||||||
int update(TbProductGroup tbProductGroup);
|
|
||||||
|
|
||||||
TbProductGroup queryById(Integer id);
|
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,7 @@ public class AddProduct {
|
|||||||
|
|
||||||
Integer productId;
|
Integer productId;
|
||||||
|
|
||||||
|
String key;
|
||||||
|
|
||||||
|
String userName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user