ApiService.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.pj.api.service;
  2. import cn.hutool.core.bean.BeanUtil;
  3. import com.pj.api.bo.InOutRecordBO;
  4. import com.pj.project.tb_business.TbBusiness;
  5. import com.pj.project.tb_business.TbBusinessService;
  6. import com.pj.project.tb_costomer.TbCostomer;
  7. import com.pj.project.tb_costomer.TbCostomerService;
  8. import com.pj.utils.so.SoMap;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.springframework.stereotype.Service;
  11. import org.springframework.transaction.annotation.Transactional;
  12. import javax.annotation.Resource;
  13. import java.util.ArrayList;
  14. import java.util.List;
  15. /**
  16. */
  17. @Service
  18. @Transactional(rollbackFor = Exception.class)
  19. @Slf4j
  20. public class ApiService {
  21. @Resource
  22. TbCostomerService tbCostomerService;
  23. @Resource
  24. TbBusinessService tbBusinessService;
  25. public List<InOutRecordBO> getInOutRecord(SoMap so){
  26. List<TbBusiness> businessList = tbBusinessService.getList(so);
  27. List<InOutRecordBO> recordList = new ArrayList<>();
  28. for (TbBusiness business : businessList) {
  29. InOutRecordBO record = new InOutRecordBO();
  30. BeanUtil.copyProperties(business, record);
  31. TbCostomer costomer = tbCostomerService.getById(business.getCustomerId());
  32. record.setBusinessId(business.getId()).setCustomerContact(costomer.getPhone()).setDutyPeople(costomer.getDutyPeople());
  33. if(record.getRealInTime() != null && record.getOutDayTime() != null){
  34. record.setStatus(3);//已出场
  35. }else if(record.getRealInTime() != null && record.getOutDayTime() == null){
  36. record.setStatus(2);//已入场
  37. }else{
  38. record.setStatus(1);//未入场
  39. }
  40. recordList.add(record);
  41. }
  42. return recordList;
  43. }
  44. public List<TbCostomer> getCustomerList(SoMap so) {
  45. List<TbCostomer> list = tbCostomerService.getList(so);
  46. return list;
  47. }
  48. public void confirmCustomer(Long customerId) {
  49. //
  50. TbCostomer costomer = tbCostomerService.getById(customerId);
  51. if(costomer != null && costomer.getJudgeStatus() == 1){
  52. tbCostomerService.judge(customerId + "", 2, "H5端审核");
  53. }
  54. }
  55. }