package com.goafanti.demand.service.impl; import java.util.Calendar; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.goafanti.common.dao.DemandOrderLogMapper; import com.goafanti.common.dao.DemandOrderMapper; import com.goafanti.common.enums.DeleteStatus; import com.goafanti.common.enums.DemandOrderStatus; import com.goafanti.common.model.DemandOrder; import com.goafanti.common.model.DemandOrderLog; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.demand.service.DemandOrderService; @Service public class DemandOrderServiceImpl implements DemandOrderService { @Autowired private DemandOrderMapper demandOrderMapper; @Autowired private DemandOrderLogMapper demandOrderLogMapper; @Override public DemandOrder selectDemandOrderByUidAndDemandId(String uid, String id) { return demandOrderMapper.selectDemandOrderByUidAndDemandId(uid, id); } @Override public void saveDemandOrder(DemandOrder demandOrder, DemandOrderLog dol) { demandOrder.setId(UUID.randomUUID().toString().toString()); Calendar now = Calendar.getInstance(); now.set(Calendar.MILLISECOND, 0); demandOrder.setCreateTime(now.getTime()); demandOrder.setUid(TokenManager.getUserId()); demandOrder.setDeletedSign(DeleteStatus.UNDELETE.getCode()); demandOrder.setStatus(DemandOrderStatus.CREATE.getCode()); demandOrderMapper.insert(demandOrder); dol.setId(UUID.randomUUID().toString()); dol.setDemandOrderId(demandOrder.getId()); dol.setRecordTime(demandOrder.getCreateTime()); dol.setStatus(demandOrder.getStatus()); demandOrderLogMapper.insert(dol); } @Override public DemandOrder selectByPrimaryKey(String id) { return demandOrderMapper.selectByPrimaryKey(id); } }