OutsourceOrgServiceImpl.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package com.goafanti.order.service.impl;
  2. import java.util.Date;
  3. import java.util.HashMap;
  4. import java.util.List;
  5. import java.util.Map;
  6. import org.apache.commons.lang3.StringUtils;
  7. import org.hibernate.validator.constraints.Mod11Check.ProcessingDirection;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Service;
  10. import com.goafanti.common.dao.OutsourceOrganizationMapper;
  11. import com.goafanti.common.dao.TOrderLogMapper;
  12. import com.goafanti.common.dao.TOrderNewMapper;
  13. import com.goafanti.common.dao.TOrderOutsourceMapper;
  14. import com.goafanti.common.enums.OrderLogProcess;
  15. import com.goafanti.common.model.OutsourceOrganization;
  16. import com.goafanti.common.model.TOrderLog;
  17. import com.goafanti.common.model.TOrderNew;
  18. import com.goafanti.core.mybatis.BaseMybatisDao;
  19. import com.goafanti.core.mybatis.page.Pagination;
  20. import com.goafanti.core.shiro.token.TokenManager;
  21. import com.goafanti.order.bo.OrderOutsourceBo;
  22. import com.goafanti.order.bo.OrderOutsourceDtails;
  23. import com.goafanti.order.bo.OutsourceOrganizationBo;
  24. import com.goafanti.order.enums.ProcessStatus;
  25. import com.goafanti.order.service.OrderService;
  26. import com.goafanti.order.service.OutsourceOrgService;
  27. @Service
  28. public class OutsourceOrgServiceImpl extends BaseMybatisDao<TOrderOutsourceMapper> implements OutsourceOrgService {
  29. @Autowired
  30. private OutsourceOrganizationMapper outsourceOrganizationMapper;
  31. @Autowired
  32. private TOrderOutsourceMapper tOrderOutsourceMapper;
  33. @Autowired
  34. private TOrderNewMapper tOrderNewMapper;
  35. @Autowired
  36. private OrderService orderService;
  37. @Autowired
  38. private TOrderLogMapper tOrderLogMapper;
  39. @Override
  40. public int addOutsourceOrg(OutsourceOrganization o) {
  41. return outsourceOrganizationMapper.insertSelective(o);
  42. }
  43. @Override
  44. public int updateOutsourceOrg(OutsourceOrganization o) {
  45. return outsourceOrganizationMapper.updateByPrimaryKeySelective(o);
  46. }
  47. @Override
  48. public int deleteOutsourceOrg(Integer id) {
  49. return outsourceOrganizationMapper.deleteByPrimaryKey(id);
  50. }
  51. @Override
  52. public List<OutsourceOrganizationBo> selectOutsourceOrg(String orderNo,String tid) {
  53. List<OutsourceOrganizationBo> l=outsourceOrganizationMapper.selectOutsourceOrg(orderNo,tid);
  54. return l;
  55. }
  56. @Override
  57. public List<OutsourceOrganizationBo> selectOrderOutsourceOrg(String orderNo) {
  58. return outsourceOrganizationMapper.selectOrderOutsourceOrg(orderNo);
  59. }
  60. @Override
  61. @SuppressWarnings("unchecked")
  62. public Pagination<OrderOutsourceBo> orderOutsourceList(String name, String contractNo, String starTime,
  63. String endTime,Integer refundStatus, Integer pageNo, Integer pageSize) {
  64. Map<String, Object> params = new HashMap<String, Object>();
  65. if(pageSize==null||pageSize<0)pageSize=10;
  66. if(pageNo==null||pageNo<0)pageNo=1;
  67. if (StringUtils.isNotBlank(name)) params.put("name", name);
  68. if(refundStatus != null) params.put("refundStatus", refundStatus);
  69. if (StringUtils.isNotBlank(contractNo)) params.put("contractNo", contractNo);
  70. if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
  71. if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
  72. Pagination<OrderOutsourceBo> p = (Pagination<OrderOutsourceBo>)findPage("orderOutsourceList", "orderOutsourceCount", params, pageNo, pageSize);
  73. return p;
  74. }
  75. @Override
  76. public OrderOutsourceDtails orderOutsourceDtails(String orderNo) {
  77. return tOrderOutsourceMapper.selectByOrderNo(orderNo);
  78. }
  79. @Override
  80. public int updateAuditOutsource(OrderOutsourceDtails o) {
  81. o.setAuditTime(new Date());
  82. TOrderNew t=new TOrderNew();
  83. if (o.getRefundStatus()==1) {
  84. t.setOrderNo(o.getOrderNo());
  85. t.setOrderStatus(2);//订单审核标记通过
  86. t.setProcessStatus(ProcessStatus.YPCWGLY.getCode());
  87. addOrderLog(o.getOrderNo(),OrderLogProcess.WBSH.getCode());
  88. tOrderNewMapper.updateByPrimaryKeySelective(t);
  89. }else {
  90. t.setOrderStatus(3);
  91. addOrderLog(o.getOrderNo(),OrderLogProcess.WBBH.getCode());
  92. }
  93. return tOrderOutsourceMapper.updateByPrimaryKeySelective(o);
  94. }
  95. public void addOrderLog(String orderNo, Integer code) {
  96. TOrderLog tl=new TOrderLog();
  97. tl.setOrderNo(orderNo);
  98. tl.setProcess(code);
  99. tl.setAid(TokenManager.getAdminId());
  100. tOrderLogMapper.insertSelective(tl);
  101. }
  102. @SuppressWarnings("unchecked")
  103. @Override
  104. public Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String contractNo, String starTime,
  105. String endTime, Integer refundStatus, Integer pageNo, Integer pageSize) {
  106. Map<String, Object> params = new HashMap<String, Object>();
  107. if(pageSize==null||pageSize<0)pageSize=10;
  108. if(pageNo==null||pageNo<0)pageNo=1;
  109. if (StringUtils.isNotBlank(name)) params.put("name", name);
  110. params.put("deps", orderService.selectMyDeps());
  111. if(refundStatus != null) params.put("refundStatus", refundStatus);
  112. if (StringUtils.isNotBlank(contractNo)) params.put("contractNo", contractNo);
  113. if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
  114. if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
  115. Pagination<OrderOutsourceBo> p = (Pagination<OrderOutsourceBo>)findPage("salesmanOrderOutsourceList", "salesmanOrderOutsourceCount", params, pageNo, pageSize);
  116. return p;
  117. }
  118. }