|
|
|
@ -1,9 +1,20 @@
|
|
|
|
|
package info.bukova.isspst.services.dbinfo;
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.Constants;
|
|
|
|
|
import info.bukova.isspst.dao.BaseDao;
|
|
|
|
|
import info.bukova.isspst.dao.RequirementDao;
|
|
|
|
|
import info.bukova.isspst.dao.TripBillApprovalDao;
|
|
|
|
|
import info.bukova.isspst.dao.TripRequirementDao;
|
|
|
|
|
import info.bukova.isspst.data.DbInfo;
|
|
|
|
|
import info.bukova.isspst.data.RequirementBase;
|
|
|
|
|
import info.bukova.isspst.data.RequirementState;
|
|
|
|
|
import info.bukova.isspst.services.AbstractService;
|
|
|
|
|
import info.bukova.isspst.services.requirement.RequirementBaseService;
|
|
|
|
|
import info.bukova.isspst.services.requirement.RequirementService;
|
|
|
|
|
import info.bukova.isspst.services.requirement.TripRequirementService;
|
|
|
|
|
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
|
|
|
|
import org.hibernate.SQLQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -11,6 +22,20 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfoService
|
|
|
|
|
{
|
|
|
|
|
@Autowired
|
|
|
|
|
private TripBillApprovalService tripBillApprovalService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TripBillApprovalDao tripBillApprovalDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TripRequirementService tripRequirement;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TripRequirementDao tripRequirementDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RequirementService requirementService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RequirementDao requirementDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DbInfo getDbInfo()
|
|
|
|
|
{
|
|
|
|
|
DbInfo dbInfo = null;
|
|
|
|
@ -211,10 +236,26 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
|
|
|
|
sq.executeUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dbVersion < 7) {
|
|
|
|
|
setApproveDate((RequirementBaseService)tripBillApprovalService, (BaseDao)tripBillApprovalDao);
|
|
|
|
|
setApproveDate((RequirementBaseService)tripRequirement, (BaseDao)tripRequirementDao);
|
|
|
|
|
setApproveDate((RequirementBaseService)requirementService, (BaseDao)requirementDao);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.updateDatabaseVersion();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setApproveDate(RequirementBaseService<RequirementBase> service, BaseDao<RequirementBase> daoReq) {
|
|
|
|
|
for (RequirementBase req : service.getAll()) {
|
|
|
|
|
if (req.getState() == RequirementState.APPROVED) {
|
|
|
|
|
service.loadAuthItems(req);
|
|
|
|
|
req.setApproveDate(req.getLastApproveDate());
|
|
|
|
|
daoReq.modify(req);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateDatabaseVersion()
|
|
|
|
|