|
|
@@ -1,5 +1,7 @@
|
|
|
package com.uas.platform.b2b.mobile.service.impl;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
@@ -9,10 +11,13 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.mobile.dao.OutPlanDetailDao;
|
|
|
+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.service.OutPlanService;
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
|
@Service
|
|
|
public class OutPlanServiceImpl implements OutPlanService {
|
|
|
@@ -20,12 +25,27 @@ public class OutPlanServiceImpl implements OutPlanService {
|
|
|
@Autowired
|
|
|
private OutPlanDetailDao outPlanDetailDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
@Override
|
|
|
public ModelMap saveOutPlan(OutPlan outPlan, List<OutPlanDetail> outPlanDetails) {
|
|
|
ModelMap map = new ModelMap();
|
|
|
+ outPlan.setEnuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyMMhhss");
|
|
|
+ outPlan.setMp_code("OU" + sdf.format(new Date()));
|
|
|
+ outPlan.setMp_recorder(SystemSession.getUser().getUserName());
|
|
|
+ outPlan.setRecorderCode(SystemSession.getUser().getUserUU());
|
|
|
Set<OutPlanDetail> outDetail = new HashSet<OutPlanDetail>();
|
|
|
if (CollectionUtils.isEmpty(outPlanDetails)) {
|
|
|
for (OutPlanDetail outPlanDetail : outPlanDetails) {
|
|
|
+ outPlanDetail.setEnuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ outPlanDetail.setMpd_code("OUT" + sdf.format(new Date()));
|
|
|
+ outPlanDetail.setMpd_recorddate(new Date());
|
|
|
+ outPlanDetail.setMpd_status(MobileStatus.ENTERING.getPhrase());
|
|
|
+ outPlanDetail.setMpd_statuscode(MobileStatus.ENTERING.name());
|
|
|
+ outPlanDetail.setRecorderCode(SystemSession.getUser().getUserUU());
|
|
|
+ outPlanDetail.setMpd_recorder(SystemSession.getUser().getUserName());
|
|
|
outDetail.add(outPlanDetail);
|
|
|
outPlan.setOutPlanDetail(outDetail);
|
|
|
|
|
|
@@ -40,4 +60,28 @@ public class OutPlanServiceImpl implements OutPlanService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ModelMap getOutPlan() {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ Long emcode = SystemSession.getUser().getUserUU();
|
|
|
+ String sql = "select p.op_id mp_id,p.op_recorder mp_recorder,p.op_recordercode recorderCode,p.op_code mp_code,p.op_address mp_address,"
|
|
|
+ + "p.op_visittime mp_visittime,p.op_enuu enuu from mobile$outplan p where op_enuu = " + enuu
|
|
|
+ + " and op_recordercode = " + emcode + " order by op_id desc";
|
|
|
+ List<OutPlan> outPlans = commonDao.query(sql, OutPlan.class);
|
|
|
+ for (OutPlan outPlan : outPlans) {
|
|
|
+ String detailSql = "select p.opd_id mpd_id, p.opd_code mpd_code, p.opd_recordercode mpd_recordercode, p.opd_recorder mpd_recorder, p.opd_address mpd_address,"
|
|
|
+ + "p.opd_kind mpd_kind, p.opd_detno mpd_detno, p.opd_remark mpd_remark, p.opd_location mpd_location, p.opd_enuu mpd_enuu, p.opd_arrivedate mpd_arrivedate,"
|
|
|
+ + "p.opd_actdate mpd_actdate, p.opd_outdate mpd_outdate, p.opd_recorddate mpd_recorddate, p.opd_status mpd_status, p.opd_statuscode mpd_statuscode from mobile$outplandetail p where opd_opid = ?"
|
|
|
+ + " and opd_arrivedate>=to_char(sysdate) and opd_arrivedate<to_char(sysdate+1) order by opd_id desc";
|
|
|
+ List<OutPlanDetail> details = commonDao.query(detailSql, OutPlanDetail.class, outPlan.getMp_id());
|
|
|
+ Set<OutPlanDetail> planDetails = new HashSet<OutPlanDetail>();
|
|
|
+ planDetails.addAll(details);
|
|
|
+ outPlan.setOutPlanDetail(planDetails);
|
|
|
+ }
|
|
|
+ map.put("data", outPlans);
|
|
|
+ map.put("success", true);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
}
|