待支付金额 大于等于 已支付金额时 状态为已付款
否则为 待付款
This commit is contained in:
@@ -24,11 +24,11 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author lyf
|
||||||
* @description 服务实现
|
* @website https://eladmin.vip
|
||||||
* @author lyf
|
* @description 服务实现
|
||||||
* @date 2024-01-23
|
* @date 2024-01-23
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransactService {
|
public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransactService {
|
||||||
@@ -44,17 +44,17 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
Page<TbShopPurveyorTransact> pageShopPurveyor = tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
Page<TbShopPurveyorTransact> pageShopPurveyor = tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("content",pageShopPurveyor.getContent());
|
map.put("content", pageShopPurveyor.getContent());
|
||||||
map.put("totalElements",pageShopPurveyor.getTotalElements());
|
map.put("totalElements", pageShopPurveyor.getTotalElements());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PurveyorTransactVO> queryTransactDate(TbShopPurveyorTransactQueryCriteria criteria){
|
public Page<PurveyorTransactVO> queryTransactDate(TbShopPurveyorTransactQueryCriteria criteria) {
|
||||||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize());
|
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize());
|
||||||
Page<PurveyorTransactVO> purveyorTransactVOS = tbShopPurveyorTransactRepository.queryTransactDate(criteria.getType(), criteria.getShopId(), criteria.getPurveyorName(), pageable);
|
Page<PurveyorTransactVO> purveyorTransactVOS = tbShopPurveyorTransactRepository.queryTransactDate(criteria.getType(), criteria.getShopId(), criteria.getPurveyorName(), pageable);
|
||||||
for (PurveyorTransactVO purveyorTransactVO : purveyorTransactVOS.getContent()) {
|
for (PurveyorTransactVO purveyorTransactVO : purveyorTransactVOS.getContent()) {
|
||||||
purveyorTransactVO.setType(purveyorTransactVO.getWaitCount().intValue()<1?1:0);
|
purveyorTransactVO.setType(purveyorTransactVO.getWaitCount().intValue() < 1 ? 1 : 0);
|
||||||
}
|
}
|
||||||
return purveyorTransactVOS;
|
return purveyorTransactVOS;
|
||||||
|
|
||||||
@@ -65,20 +65,20 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
Map<String, Object> bySum = tbShopPurveyorTransactRepository.findBySum(criteria.getPurveyorId(), criteria.getType());
|
Map<String, Object> bySum = tbShopPurveyorTransactRepository.findBySum(criteria.getPurveyorId(), criteria.getType());
|
||||||
Map<String, Object> byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType(), 0);
|
Map<String, Object> byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType(), 0);
|
||||||
Map<String, Object> sumMap = new HashMap<>(bySum);
|
Map<String, Object> sumMap = new HashMap<>(bySum);
|
||||||
sumMap.put("waitNumber",byStatusSum.get("waitNumber"));
|
sumMap.put("waitNumber", byStatusSum.get("waitNumber"));
|
||||||
return sumMap;
|
return sumMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TbShopPurveyorTransactDto> queryAll(TbShopPurveyorTransactQueryCriteria criteria){
|
public List<TbShopPurveyorTransactDto> queryAll(TbShopPurveyorTransactQueryCriteria criteria) {
|
||||||
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public TbShopPurveyorTransactDto findById(Integer id) {
|
public TbShopPurveyorTransactDto findById(Integer id) {
|
||||||
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(id).orElseGet(TbShopPurveyorTransact::new);
|
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(id).orElseGet(TbShopPurveyorTransact::new);
|
||||||
ValidationUtil.isNull(tbShopPurveyorTransact.getId(),"TbShopPurveyorTransact","id",id);
|
ValidationUtil.isNull(tbShopPurveyorTransact.getId(), "TbShopPurveyorTransact", "id", id);
|
||||||
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransact);
|
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransact);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(TbShopPurveyorTransact resources) {
|
public void update(TbShopPurveyorTransact resources) {
|
||||||
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(resources.getId()).orElseGet(TbShopPurveyorTransact::new);
|
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(resources.getId()).orElseGet(TbShopPurveyorTransact::new);
|
||||||
ValidationUtil.isNull( tbShopPurveyorTransact.getId(),"TbShopPurveyorTransact","id",resources.getId());
|
ValidationUtil.isNull(tbShopPurveyorTransact.getId(), "TbShopPurveyorTransact", "id", resources.getId());
|
||||||
tbShopPurveyorTransact.copy(resources);
|
tbShopPurveyorTransact.copy(resources);
|
||||||
tbShopPurveyorTransactRepository.save(tbShopPurveyorTransact);
|
tbShopPurveyorTransactRepository.save(tbShopPurveyorTransact);
|
||||||
}
|
}
|
||||||
@@ -101,12 +101,14 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void payTransact(TbShopPurveyorTransact resources) {
|
public void payTransact(TbShopPurveyorTransact resources) {
|
||||||
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(resources.getId()).orElseGet(TbShopPurveyorTransact::new);
|
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(resources.getId()).orElseGet(TbShopPurveyorTransact::new);
|
||||||
ValidationUtil.isNull( tbShopPurveyorTransact.getId(),"TbShopPurveyorTransact","id",resources.getId());
|
ValidationUtil.isNull(tbShopPurveyorTransact.getId(), "TbShopPurveyorTransact", "id", resources.getId());
|
||||||
tbShopPurveyorTransact.setPaidAmount(tbShopPurveyorTransact.getPaidAmount().add(resources.getPaidAmount()));
|
tbShopPurveyorTransact.setPaidAmount(tbShopPurveyorTransact.getPaidAmount().add(resources.getPaidAmount()));
|
||||||
tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getWaitAmount().subtract(resources.getPaidAmount()));
|
tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getWaitAmount().subtract(resources.getPaidAmount()));
|
||||||
tbShopPurveyorTransact.setPaidAt(System.currentTimeMillis());
|
tbShopPurveyorTransact.setPaidAt(System.currentTimeMillis());
|
||||||
if(tbShopPurveyorTransact.getWaitAmount().subtract(resources.getPaidAmount()).equals(0)){
|
if (tbShopPurveyorTransact.getWaitAmount().compareTo(tbShopPurveyorTransact.getPaidAmount()) <= 0) {
|
||||||
tbShopPurveyorTransact.setStatus(1);
|
tbShopPurveyorTransact.setStatus(1);
|
||||||
|
}else {
|
||||||
|
tbShopPurveyorTransact.setStatus(0);
|
||||||
}
|
}
|
||||||
tbShopPurveyorTransactRepository.save(tbShopPurveyorTransact);
|
tbShopPurveyorTransactRepository.save(tbShopPurveyorTransact);
|
||||||
}
|
}
|
||||||
@@ -123,7 +125,7 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
public void download(List<TbShopPurveyorTransactDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<TbShopPurveyorTransactDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (TbShopPurveyorTransactDto tbShopPurveyorTransact : all) {
|
for (TbShopPurveyorTransactDto tbShopPurveyorTransact : all) {
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("店铺Id", tbShopPurveyorTransact.getShopId());
|
map.put("店铺Id", tbShopPurveyorTransact.getShopId());
|
||||||
map.put("供应商名字", tbShopPurveyorTransact.getPurveyorName());
|
map.put("供应商名字", tbShopPurveyorTransact.getPurveyorName());
|
||||||
map.put("供应商Id", tbShopPurveyorTransact.getPurveyorId());
|
map.put("供应商Id", tbShopPurveyorTransact.getPurveyorId());
|
||||||
|
|||||||
Reference in New Issue
Block a user