|
|
@@ -1,6 +1,8 @@
|
|
|
package com.uas.platform.b2b.mobile.service.impl;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
@@ -8,15 +10,19 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
+import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.dao.OfficeTaskDao;
|
|
|
+import com.uas.platform.b2b.dao.UserBaseInfoDao;
|
|
|
+import com.uas.platform.b2b.mobile.VisitRecordDao;
|
|
|
import com.uas.platform.b2b.mobile.dao.OutPlanDao;
|
|
|
import com.uas.platform.b2b.mobile.dao.OutSignDao;
|
|
|
import com.uas.platform.b2b.mobile.dao.UserCenterDao;
|
|
|
+import com.uas.platform.b2b.mobile.enumeration.MobileStatus;
|
|
|
import com.uas.platform.b2b.mobile.model.OutPlan;
|
|
|
import com.uas.platform.b2b.mobile.model.OutPlanDetail;
|
|
|
import com.uas.platform.b2b.mobile.model.OutSign;
|
|
|
import com.uas.platform.b2b.mobile.model.UserCenter;
|
|
|
+import com.uas.platform.b2b.mobile.model.VisitRecord;
|
|
|
import com.uas.platform.b2b.mobile.model.WorkSchedule;
|
|
|
import com.uas.platform.b2b.mobile.service.WorkScheduleService;
|
|
|
import com.uas.platform.b2b.model.OfficeTask;
|
|
|
@@ -38,6 +44,15 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
|
|
|
@Autowired
|
|
|
private OfficeTaskDao officeTaskDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserBaseInfoDao userBaseInfoDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private VisitRecordDao visitRecordDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
@Override
|
|
|
public ModelMap getWorkSchedule(Long emcode, Long enuu) {
|
|
|
ModelMap map = new ModelMap();
|
|
|
@@ -45,7 +60,6 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
|
|
|
if (user != null) {
|
|
|
WorkSchedule workSchedule = new WorkSchedule();
|
|
|
List<OutPlan> meOutPlans = outPlanDao.findByRecorderCodeAndEnuu(emcode, enuu);
|
|
|
- System.out.println(JSON.toJSON(meOutPlans));
|
|
|
List<OutPlanInfo> planInfos = new ArrayList<OutPlanInfo>();
|
|
|
if (!CollectionUtils.isEmpty(meOutPlans)) {
|
|
|
for (OutPlan ou : meOutPlans) {
|
|
|
@@ -69,11 +83,11 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
|
|
|
planInfos.add(info);
|
|
|
}
|
|
|
}
|
|
|
- // List<OutSign> meOutSigns = outSignDao.findByEnuuAndEmcode(enuu,
|
|
|
- // emcode);
|
|
|
List<OfficeTask> task = officeTaskDao.findByUuAndDomancode(enuu, emcode);
|
|
|
+ List<VisitRecord> records = getRecordsInOneMonth(emcode, enuu);
|
|
|
workSchedule.setTask(task);
|
|
|
workSchedule.setOutPlan(planInfos);
|
|
|
+ workSchedule.setVisitRecord(records);
|
|
|
map.put("me", workSchedule);
|
|
|
if (user.getIsAdmin().equals(Constant.YES)) {// 管理员,获取下属任务等
|
|
|
WorkSchedule workSchedules = new WorkSchedule();
|
|
|
@@ -121,12 +135,58 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ List<VisitRecord> virecords = new ArrayList<VisitRecord>();
|
|
|
+ if (!CollectionUtils.isEmpty(records)) {
|
|
|
+ for (VisitRecord record : records) {
|
|
|
+ VisitRecord rec = new VisitRecord();
|
|
|
+ rec.setVr_detail(record.getVr_detail());
|
|
|
+ rec.setVr_cuaddress(record.getVr_cuaddress());
|
|
|
+ rec.setVr_emname(record.getVr_emname());
|
|
|
+ rec.setVr_id(record.getVr_id());
|
|
|
+ rec.setVr_startdate(record.getVr_startdate());
|
|
|
+ rec.setVr_enddate(record.getVr_enddate());
|
|
|
+ rec.setVr_title(record.getVr_title());
|
|
|
+ rec.setVr_cuname(record.getVr_cuname());
|
|
|
+ rec.setVr_cucontact(record.getVr_cucontact());
|
|
|
+ virecords.add(rec);
|
|
|
+ }
|
|
|
+ }
|
|
|
workSchedules.setTask(othTasks);
|
|
|
workSchedules.setOutPlan(othOutPlans);
|
|
|
+ workSchedules.setVisitRecord(virecords);
|
|
|
map.put("other", workSchedules);
|
|
|
}
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ModelMap saveVisitRecord(VisitRecord visitRecord) {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyMMddss");
|
|
|
+ visitRecord.setStatuscode(MobileStatus.COMMITED.getPhrase());
|
|
|
+ visitRecord.setStatuscode(MobileStatus.COMMITED.name());
|
|
|
+ visitRecord.setCode("VR" + sdf.format(new Date()));
|
|
|
+ visitRecord.setVr_emname(userBaseInfoDao.findByUserUU(visitRecord.getEmuu()).getUserName());
|
|
|
+ visitRecord.setVr_date(new Date());
|
|
|
+ visitRecord = visitRecordDao.save(visitRecord);
|
|
|
+ if (visitRecord.getVr_id() != null) {
|
|
|
+ map.put("vr_id", visitRecord.getVr_id());
|
|
|
+ map.put("success", true);
|
|
|
+ } else {
|
|
|
+ map.put("success", false);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<VisitRecord> getRecordsInOneMonth(Long emuu, Long enuu) {
|
|
|
+ String sql = "select p.vr_detail vr_detail, p.vr_emname vr_emname, p.vr_id vr_id, p.vr_startdate vr_startdate, p.vr_cuaddress vr_ceaddress, "
|
|
|
+ + "p.vr_title vr_title, p.vr_enddate vr_enddate, p.vr_cucontact vr_cucontact, p.vr_cuname vr_cuname from mobile$visitrecord p where "
|
|
|
+ + "vr_emuu = " + emuu + " and vr_enuu = " + enuu
|
|
|
+ + " and p.vr_date between add_months(sysdate,-1) and sysdate ";
|
|
|
+ List<VisitRecord> records = commonDao.queryForList(sql, VisitRecord.class);
|
|
|
+ return records;
|
|
|
+ }
|
|
|
+
|
|
|
}
|