|
|
@@ -14,10 +14,12 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.DemandMapper;
|
|
|
+import com.goafanti.common.dao.UserMapper;
|
|
|
import com.goafanti.common.enums.DeleteStatus;
|
|
|
import com.goafanti.common.enums.DemandReleaseStatus;
|
|
|
import com.goafanti.common.enums.DemandStatus;
|
|
|
import com.goafanti.common.model.Demand;
|
|
|
+import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
@@ -31,6 +33,8 @@ import com.goafanti.demand.service.DemandService;
|
|
|
public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements DemandService {
|
|
|
@Autowired
|
|
|
private DemandMapper demandMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserMapper userMapper;
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
@@ -280,6 +284,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
|
|
|
d.setStatus(DemandStatus.ONGOING.getCode());
|
|
|
}
|
|
|
|
|
|
+ if (TokenManager.getToken() instanceof User){
|
|
|
+ User u = userMapper.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
+ d.setPrincipalId(u.getAid());
|
|
|
+ }
|
|
|
+
|
|
|
d.setCreateTime(now.getTime());
|
|
|
demandMapper.insert(d);
|
|
|
}
|
|
|
@@ -296,8 +305,6 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
|
|
|
}
|
|
|
d.setValidityPeriod(validityPeriod);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
Demand demand = demandMapper.selectByPrimaryKey(d.getId());
|
|
|
if (DemandReleaseStatus.RELEASED.getCode().equals(d.getReleaseStatus())
|
|
|
&& DemandReleaseStatus.UNRELEASE.getCode().equals(demand.getReleaseStatus())) {
|
|
|
@@ -312,7 +319,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
|
|
|
d.setStatus(DemandStatus.CREATE.getCode());
|
|
|
demandMapper.updateReleaseDate(demand.getId());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return demandMapper.updateByPrimaryKeySelective(d);
|
|
|
}
|
|
|
|
|
|
@@ -339,14 +346,14 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public Pagination<DemandListBo> listDemand(Integer serialNumber, String name, String keyword, Integer demandType,
|
|
|
- String validityPeriodStartDate, String validityPeriodEndDate, Integer status,
|
|
|
- Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
|
|
|
+ String validityPeriodStartDate, String validityPeriodEndDate, Integer status, Integer releaseStatus,
|
|
|
+ String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
Date vStart = null;
|
|
|
Date vEnd = null;
|
|
|
Date rStart = null;
|
|
|
Date rEnd = null;
|
|
|
-
|
|
|
+
|
|
|
params.put("employerId", TokenManager.getUserId());
|
|
|
|
|
|
if (!StringUtils.isBlank(validityPeriodStartDate)) {
|
|
|
@@ -424,7 +431,6 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
|
|
|
if (pSize == null || pSize < 0) {
|
|
|
pSize = 10;
|
|
|
}
|
|
|
- return (Pagination<DemandListBo>) findPage("findDemandListByPage", "findDemandCount",
|
|
|
- params, pNo, pSize);
|
|
|
+ return (Pagination<DemandListBo>) findPage("findDemandListByPage", "findDemandCount", params, pNo, pSize);
|
|
|
}
|
|
|
}
|