收银后台跟进

This commit is contained in:
liuyingfang
2023-12-29 18:19:31 +08:00
parent 4fb7901066
commit 5858bf19a5
9 changed files with 98 additions and 31 deletions

View File

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

View File

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

View File

@@ -28,79 +28,79 @@ import me.zhengjie.annotation.Query;
@Data
public class TbOrderInfoQueryCriteria{
/** ¾«È· */
/** 精确 */
@Query
private Integer id;
/** ¾«È· */
/** 精确 */
@Query
private String orderNo;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal productAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal payAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal cashPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal wxPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal aliPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal depositPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal bankPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal virtualPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private BigDecimal otherPaidAmount;
/** ¾«È· */
/** 精确 */
@Query
private String sendType;
/** ¾«È· */
/** 精确 */
@Query
private String status;
/** ¾«È· */
/** 精确 */
@Query
private String shopId;
/** ¾«È· */
/** 精确 */
@Query
private String memberId;
/** ¾«È· */
/** 精确 */
@Query
private String userId;
/** ¾«È· */
/** 精确 */
@Query
private Long paidTime;
/** ¾«È· */
/** 精确 */
@Query
private Long createdAt;
/** ¾«È· */
/** 精确 */
@Query
private Integer isAccepted;
}

View File

@@ -18,6 +18,7 @@ package me.zhengjie.modules.productGroup.repository;
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* @website https://eladmin.vip
@@ -25,4 +26,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2023-12-16
**/
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);
}

View File

@@ -104,9 +104,8 @@ public class TbProductGroupController {
}
@PostMapping("/addProductInfo")
public ResponseEntity<Object> addProductInfo(@RequestBody AddProduct addProduct){
tbProductGroupService.updateProductIds();
public ResponseEntity<Object> addProductInfo(@RequestBody AddProduct addProduct,@RequestAttribute(value = "userName", required = false) String userName){
return new ResponseEntity<>(tbProductGroupService.updateProductIds(addProduct,userName),HttpStatus.OK);
}
}

View File

@@ -84,5 +84,5 @@ public interface TbProductGroupService {
*/
void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException;
ResponseEntity<Object> updateProductIds(AddProduct addProduct);
ResponseEntity<Object> updateProductIds(AddProduct addProduct,String userName);
}

View File

@@ -17,6 +17,8 @@ package me.zhengjie.modules.productGroup.service.impl;
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
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.FileUtil;
import lombok.RequiredArgsConstructor;
@@ -36,6 +38,7 @@ import me.zhengjie.utils.QueryHelp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -53,9 +56,13 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
private final TbProductGroupRepository tbProductGroupRepository;
private final TbProductGroupMapper tbProductGroupMapper;
@Resource
private OnlineUserService onlineUserService;
@Override
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));
}
@@ -115,17 +122,22 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
}
@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){
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
}
TbProductGroup productGroup = tbProductGroupMapper.queryById(addProduct.getProductId());
TbProductGroupDto productGroup = this.findById(addProduct.getProductId());
if (productGroup == null){
return new ResponseEntity<>("没有找到改分类", HttpStatus.NOT_ACCEPTABLE);
}
TbProductGroup tbProductGroup = new TbProductGroup();
StringBuilder sb = new StringBuilder();
// //如果没有
if (productGroup.getProductIds() == null) {
for (String s : addProduct.getIds()) {
sb.append(s);
@@ -134,10 +146,24 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
tbProductGroup.setProductIds(sb.toString());
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);
}
}

View File

@@ -18,7 +18,9 @@ package me.zhengjie.modules.productGroup.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.productGroup.domain.TbProductGroup;
import me.zhengjie.modules.productGroup.service.dto.TbProductGroupDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
@@ -29,7 +31,4 @@ import org.mapstruct.ReportingPolicy;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
int update(TbProductGroup tbProductGroup);
TbProductGroup queryById(Integer id);
}

View File

@@ -13,4 +13,7 @@ public class AddProduct {
Integer productId;
String key;
String userName;
}