|
@@ -1,22 +1,32 @@
|
|
|
package com.goafanti.techproject.service.impl;
|
|
package com.goafanti.techproject.service.impl;
|
|
|
|
|
|
|
|
|
|
+import java.util.Calendar;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import com.goafanti.common.dao.TechProjectLogMapper;
|
|
|
import com.goafanti.common.dao.TechProjectMapper;
|
|
import com.goafanti.common.dao.TechProjectMapper;
|
|
|
-import com.goafanti.common.model.OrgRatepay;
|
|
|
|
|
|
|
+import com.goafanti.common.model.Admin;
|
|
|
|
|
+import com.goafanti.common.model.TechProject;
|
|
|
|
|
+import com.goafanti.common.model.TechProjectLog;
|
|
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
|
|
+import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.techproject.bo.TechProjectClientListBo;
|
|
import com.goafanti.techproject.bo.TechProjectClientListBo;
|
|
|
|
|
+import com.goafanti.techproject.bo.TechProjectManageListBo;
|
|
|
import com.goafanti.techproject.service.TechProjectService;
|
|
import com.goafanti.techproject.service.TechProjectService;
|
|
|
@Service
|
|
@Service
|
|
|
public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> implements TechProjectService {
|
|
public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> implements TechProjectService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TechProjectMapper techProjectMapper;
|
|
private TechProjectMapper techProjectMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TechProjectLogMapper techProjectLogMapper;
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
@Override
|
|
@@ -36,4 +46,74 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
|
|
|
"findTechProjectClientCount", params, pageNo, pageSize);
|
|
"findTechProjectClientCount", params, pageNo, pageSize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int updateTechProject(TechProject t, TechProjectLog log, Date recordTime) {
|
|
|
|
|
+ if (null != recordTime && null != log.getState()) {
|
|
|
|
|
+ log.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ log.setPid(t.getId());
|
|
|
|
|
+ log.setRecordTime(recordTime);
|
|
|
|
|
+ switch (log.getState()) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ t.setCreateTime(recordTime);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ t.setAcceptDate(recordTime);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ t.setApprovedDate(recordTime);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ t.setState(log.getState());
|
|
|
|
|
+ techProjectLogMapper.insert(log);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return techProjectMapper.updateByPrimaryKey(t);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void applyTechProject(TechProject techProject, String uid, String aid) {
|
|
|
|
|
+ techProject.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
+ techProject.setRecordTime(now.getTime());
|
|
|
|
|
+ techProject.setState(0);
|
|
|
|
|
+ techProject.setDeletedSign(0);
|
|
|
|
|
+ techProjectMapper.insert(techProject);
|
|
|
|
|
+
|
|
|
|
|
+ TechProjectLog log = new TechProjectLog();
|
|
|
|
|
+ log.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ log.setPid(techProject.getId());
|
|
|
|
|
+ log.setRecordTime(techProject.getRecordTime());
|
|
|
|
|
+ log.setPrincipal(aid);
|
|
|
|
|
+ log.setState(0);
|
|
|
|
|
+ if (TokenManager.getToken() instanceof Admin) {
|
|
|
|
|
+ log.setOperator(TokenManager.getAdminId());
|
|
|
|
|
+ }
|
|
|
|
|
+ techProjectLogMapper.insert(log);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Pagination<TechProjectManageListBo> listManageTechProject(String province, String uid, Integer pageNo,
|
|
|
|
|
+ Integer pageSize) {
|
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
|
+ if (!StringUtils.isBlank(province)){
|
|
|
|
|
+ params.put("province", province);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtils.isBlank(uid)){
|
|
|
|
|
+ params.put("uid", uid);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (pageNo == null || pageNo < 0) {
|
|
|
|
|
+ pageNo = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (pageSize == null || pageSize < 0) {
|
|
|
|
|
+ pageSize = 10;
|
|
|
|
|
+ }
|
|
|
|
|
+ return (Pagination<TechProjectManageListBo>)findPage("findTechProjectManageListByPage",
|
|
|
|
|
+ "findTechProjectManageCount", params, pageNo, pageSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|