| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package com.goafanti.order.service.impl;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.apache.commons.lang3.StringUtils;
- import org.hibernate.validator.constraints.Mod11Check.ProcessingDirection;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.common.dao.OutsourceOrganizationMapper;
- import com.goafanti.common.dao.TOrderLogMapper;
- import com.goafanti.common.dao.TOrderNewMapper;
- import com.goafanti.common.dao.TOrderOutsourceMapper;
- import com.goafanti.common.enums.OrderLogProcess;
- import com.goafanti.common.model.OutsourceOrganization;
- import com.goafanti.common.model.TOrderLog;
- import com.goafanti.common.model.TOrderNew;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.order.bo.OrderOutsourceBo;
- import com.goafanti.order.bo.OrderOutsourceDtails;
- import com.goafanti.order.bo.OutsourceOrganizationBo;
- import com.goafanti.order.enums.ProcessStatus;
- import com.goafanti.order.service.OrderService;
- import com.goafanti.order.service.OutsourceOrgService;
- @Service
- public class OutsourceOrgServiceImpl extends BaseMybatisDao<TOrderOutsourceMapper> implements OutsourceOrgService {
- @Autowired
- private OutsourceOrganizationMapper outsourceOrganizationMapper;
- @Autowired
- private TOrderOutsourceMapper tOrderOutsourceMapper;
- @Autowired
- private TOrderNewMapper tOrderNewMapper;
- @Autowired
- private OrderService orderService;
- @Autowired
- private TOrderLogMapper tOrderLogMapper;
- @Override
- public int addOutsourceOrg(OutsourceOrganization o) {
- return outsourceOrganizationMapper.insertSelective(o);
- }
- @Override
- public int updateOutsourceOrg(OutsourceOrganization o) {
- return outsourceOrganizationMapper.updateByPrimaryKeySelective(o);
- }
- @Override
- public int deleteOutsourceOrg(Integer id) {
- return outsourceOrganizationMapper.deleteByPrimaryKey(id);
- }
- @Override
- public List<OutsourceOrganizationBo> selectOutsourceOrg(String orderNo,String tid) {
- List<OutsourceOrganizationBo> l=outsourceOrganizationMapper.selectOutsourceOrg(orderNo,tid);
- return l;
- }
- @Override
- public List<OutsourceOrganizationBo> selectOrderOutsourceOrg(String orderNo) {
-
- return outsourceOrganizationMapper.selectOrderOutsourceOrg(orderNo);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Pagination<OrderOutsourceBo> orderOutsourceList(String name, String contractNo, String starTime,
- String endTime,Integer refundStatus, Integer pageNo, Integer pageSize) {
- Map<String, Object> params = new HashMap<String, Object>();
- if(pageSize==null||pageSize<0)pageSize=10;
- if(pageNo==null||pageNo<0)pageNo=1;
- if (StringUtils.isNotBlank(name)) params.put("name", name);
- if(refundStatus != null) params.put("refundStatus", refundStatus);
- if (StringUtils.isNotBlank(contractNo)) params.put("contractNo", contractNo);
- if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
- if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
- Pagination<OrderOutsourceBo> p = (Pagination<OrderOutsourceBo>)findPage("orderOutsourceList", "orderOutsourceCount", params, pageNo, pageSize);
- return p;
- }
- @Override
- public OrderOutsourceDtails orderOutsourceDtails(String orderNo) {
- return tOrderOutsourceMapper.selectByOrderNo(orderNo);
- }
- @Override
- public int updateAuditOutsource(OrderOutsourceDtails o) {
- o.setAuditTime(new Date());
- TOrderNew t=new TOrderNew();
- if (o.getRefundStatus()==1) {
- t.setOrderNo(o.getOrderNo());
- t.setOrderStatus(2);//订单审核标记通过
- t.setProcessStatus(ProcessStatus.YPCWGLY.getCode());
- addOrderLog(o.getOrderNo(),OrderLogProcess.WBSH.getCode());
- tOrderNewMapper.updateByPrimaryKeySelective(t);
- }else {
- t.setOrderStatus(3);
- addOrderLog(o.getOrderNo(),OrderLogProcess.WBBH.getCode());
- }
- return tOrderOutsourceMapper.updateByPrimaryKeySelective(o);
- }
-
- public void addOrderLog(String orderNo, Integer code) {
- TOrderLog tl=new TOrderLog();
- tl.setOrderNo(orderNo);
- tl.setProcess(code);
- tl.setAid(TokenManager.getAdminId());
- tOrderLogMapper.insertSelective(tl);
-
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<OrderOutsourceBo> salesmanOrderOutsourceList(String name, String contractNo, String starTime,
- String endTime, Integer refundStatus, Integer pageNo, Integer pageSize) {
- Map<String, Object> params = new HashMap<String, Object>();
- if(pageSize==null||pageSize<0)pageSize=10;
- if(pageNo==null||pageNo<0)pageNo=1;
- if (StringUtils.isNotBlank(name)) params.put("name", name);
- params.put("deps", orderService.selectMyDeps());
- if(refundStatus != null) params.put("refundStatus", refundStatus);
- if (StringUtils.isNotBlank(contractNo)) params.put("contractNo", contractNo);
- if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
- if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
- Pagination<OrderOutsourceBo> p = (Pagination<OrderOutsourceBo>)findPage("salesmanOrderOutsourceList", "salesmanOrderOutsourceCount", params, pageNo, pageSize);
- return p;
- }
- }
|