| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.NeedProblemUnitTaskDTO; |
| | | import com.panzhihua.service_dangjian.dao.NeedProblemInventoryDAO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_dangjian.dao.NeedProblemUnitTaskDAO; |
| | | import com.panzhihua.service_dangjian.service.NeedProblemInventoryService; |
| | | import com.panzhihua.service_dangjian.service.NeedProblemUnitTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | public class NeedProblemUnitTaskServiceImpl extends ServiceImpl<NeedProblemUnitTaskDAO, NeedProblemUnitTaskDTO> |
| | | implements NeedProblemUnitTaskService |
| | | { |
| | | |
| | | //任务 问题接口 |
| | | @Resource |
| | | private NeedProblemInventoryService inventoryService; |
| | | |
| | | @Override |
| | | public IPage<NeedProblemUnitTaskDTO> getList(int pageNum, int pageSize, String unitId) |
| | | public IPage<NeedProblemUnitTaskDTO> getList(int pageNum, int pageSize, String unitId,String kind,String status) |
| | | { |
| | | Page page = new Page<>(pageNum,pageSize); |
| | | return baseMapper.getList(page,unitId); |
| | | return baseMapper.getList(page,unitId,kind,status); |
| | | } |
| | | |
| | | @Override |
| | | public NeedProblemUnitTaskDTO getDetails(String id) |
| | | { |
| | | return baseMapper.getDetails(id); |
| | | NeedProblemUnitTaskDTO item=baseMapper.getDetails(id); |
| | | |
| | | //当前时间 |
| | | long newTime = System.currentTimeMillis(); |
| | | //活动报名时间 |
| | | long applyStartTime = item.getClaimStartTime().getTime(); |
| | | //报名结束时间 |
| | | long applyEndTime = item.getClaimEndTime().getTime(); |
| | | //活动开始时间 |
| | | long activityStartTime = item.getNeedStartTime().getTime(); |
| | | //活动结束时间 |
| | | long activityEndTime = item.getNeedEndTime().getTime(); |
| | | |
| | | |
| | | switch (item.getStatus()) { |
| | | //状态 (1认领中 |
| | | case "1": |
| | | if (newTime > applyEndTime) { |
| | | //报名结束 |
| | | NeedProblemUnitTaskDTO vo = new NeedProblemUnitTaskDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("2"); |
| | | item.setStatus("2"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | |
| | | break; |
| | | // 2进行中 |
| | | case "2": |
| | | if (newTime > activityEndTime) { |
| | | NeedProblemUnitTaskDTO vo = new NeedProblemUnitTaskDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("3"); |
| | | item.setStatus("3"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | break; |
| | | //3已完成) |
| | | case "3": |
| | | |
| | | break; |
| | | } |
| | | |
| | | return item; |
| | | } |
| | | |
| | | @Override |
| | | public int addData(NeedProblemUnitTaskDTO item) { |
| | | return baseMapper.addData(item); |
| | | public R addData(NeedProblemUnitTaskDTO item) |
| | | { |
| | | //任务问题详情 |
| | | NeedProblemInventoryDTO inventoryDTO=inventoryService.getDetails(item.getTaskId(),item.getUserId()); |
| | | long times=System.currentTimeMillis(); |
| | | if(times<inventoryDTO.getClaimStartTime().getTime()) |
| | | { |
| | | return R.fail("报名未开始"); |
| | | } |
| | | |
| | | if(StringUtils.equals(inventoryDTO.getJoinNum(),inventoryDTO.getClaimNum())) |
| | | { |
| | | return R.fail("认领人数已满"); |
| | | } |
| | | |
| | | if(times>inventoryDTO.getClaimEndTime().getTime()) |
| | | { |
| | | return R.fail("报名已结束"); |
| | | } |
| | | int num=baseMapper.isGet(item.getTaskId(),item.getUnitId()); |
| | | if(num>0) |
| | | { |
| | | return R.fail("该单位已接单"); |
| | | } |
| | | return R.ok(baseMapper.addData(item)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int expurgateData(String id) { |
| | | public int expurgateData(String id) |
| | | { |
| | | return baseMapper.expurgateData(id); |
| | | } |
| | | |
| | | |
| | | |
| | | } |