|
|
@@ -282,11 +282,11 @@ public class STKServiceImpl implements STKService {
|
|
|
if(customerVisitDTO.getType() == null || "".equals(customerVisitDTO.getType())) {
|
|
|
return Result.error("拜访类型不能为空!");
|
|
|
}
|
|
|
- String caller;
|
|
|
+ String caller_VisitRecord;
|
|
|
if ("客户拜访".equals(customerVisitDTO.getType())){
|
|
|
- caller="OfficeClerk";
|
|
|
+ caller_VisitRecord="OfficeClerk";
|
|
|
}else if ("原厂拜访".equals(customerVisitDTO.getType())){
|
|
|
- caller="VisitRecord!Vender";
|
|
|
+ caller_VisitRecord="VisitRecord!Vender";
|
|
|
}
|
|
|
String nexttime = customerVisitDTO.getNexttime() == null || "".equals(customerVisitDTO.getNexttime()) ? "''" : "to_date('"+customerVisitDTO.getNexttime()+"','yyyy-mm-dd hh24:mi:ss')";
|
|
|
String code = baseDao.sGetMaxNumber("VisitRecord", 2);
|
|
|
@@ -295,7 +295,7 @@ public class STKServiceImpl implements STKService {
|
|
|
Sql.add("insert into VisitRecord(vr_id,vr_code,vr_recorder,vr_recordercode,vr_recorddate,vr_status,vr_statuscode," +
|
|
|
"vr_visittime,vr_visitend,vr_nexttime,vr_visitplace,vr_khsj_user," +
|
|
|
"vr_nichecode,vr_nichename,vr_cuuu,vr_cuname,vr_cucontact,vr_zhwu_user,vr_tel,vr_jtfs_user,vr_title,vr_class,vr_nichestep,vr_detail,vr_attach)" +
|
|
|
- "values("+id+",'"+code+"','"+customerVisitDTO.getRecorder()+"','"+customerVisitDTO.getRecordercode()+"',to_date('"+customerVisitDTO.getRecorddate()+"','yyyy-mm-dd hh24:mi:ss'),'已审核','AUDITED'," +
|
|
|
+ "values("+id+",'"+code+"','"+customerVisitDTO.getRecorder()+"','"+customerVisitDTO.getRecordercode()+"',to_date('"+customerVisitDTO.getRecorddate()+"','yyyy-mm-dd hh24:mi:ss'),'在录入','ENTERING'," +
|
|
|
"to_date('"+customerVisitDTO.getVisittime()+"','yyyy-mm-dd hh24:mi:ss'),to_date('"+customerVisitDTO.getVisitend()+"','yyyy-mm-dd hh24:mi:ss'),"+nexttime+"," +
|
|
|
"'"+customerVisitDTO.getVisitplace()+"','"+customerVisitDTO.getKhsj_user()+"'," +
|
|
|
"'"+customerVisitDTO.getNichecode()+"','"+customerVisitDTO.getNichename()+"','"+customerVisitDTO.getCuuu()+"','"+customerVisitDTO.getCuname()+"','"+customerVisitDTO.getCucontact()+"'," +
|
|
|
@@ -307,10 +307,72 @@ public class STKServiceImpl implements STKService {
|
|
|
"values(Players_seq.nextval,"+id+","+emp.getDetno()+",'"+emp.getCode()+"','"+emp.getName()+"','"+emp.getSex()+"','"+emp.getPosition()+"','"+emp.getTel()+"','"+emp.getEmail()+"','"+emp.getRemark()+"')");
|
|
|
}
|
|
|
baseDao.execute(Sql);
|
|
|
+
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("id", id);
|
|
|
map.put("code", code);
|
|
|
- return Result.success(map);
|
|
|
+
|
|
|
+ String LoginUrl="http://120.132.120.244:8099/ERP/api/pda/login.action";
|
|
|
+ String URL="http://120.132.120.244:8099/ERP/crm/customermgr/submitVisitRecord.action";
|
|
|
+ String master="BT";
|
|
|
+ String caller="WorkDaily";
|
|
|
+ String empcode = customerVisitDTO.getRecordercode();
|
|
|
+ Object em_password = baseDao.getFieldDataByCondition("employee", "em_password", "em_code='" + empcode + "'");
|
|
|
+
|
|
|
+ String j_username = null;
|
|
|
+ String j_password = null;
|
|
|
+ if(em_password != null){
|
|
|
+ j_username = empcode;
|
|
|
+ j_password = em_password.toString();
|
|
|
+ }else{
|
|
|
+ map.put("message", "员工账号不正确!");
|
|
|
+ return Result.error(map);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String JsonResponse = loginERP(j_username, j_password, master, LoginUrl);
|
|
|
+// String resultResponse = submitWorkDaily(id, caller, JsonResponse, URL);
|
|
|
+// map.put("id", id);
|
|
|
+// map.put("code", resultResponse);
|
|
|
+// return Result.success(map);
|
|
|
+ Map<String, Object> mapResponse = objectMapper.readValue(JsonResponse, new TypeReference<Map<String, Object>>() {});
|
|
|
+ if(mapResponse != null && mapResponse.get("sessionId")!=null){
|
|
|
+ String sessionId = mapResponse.get("sessionId").toString();
|
|
|
+ String cookie = "JSESSIONID="+sessionId;
|
|
|
+ String resultResponse = submitWorkDaily(id, caller, cookie, URL);
|
|
|
+ Map<String, Object> resultMapResponse = objectMapper.readValue(resultResponse, new TypeReference<Map<String, Object>>() {});
|
|
|
+
|
|
|
+ if(resultMapResponse != null && resultMapResponse.get("success") != null){
|
|
|
+ String success = resultMapResponse.get("success").toString();
|
|
|
+ if("true".equals(success)){
|
|
|
+ map.put("message", "对接成功!");
|
|
|
+ return Result.success(map);
|
|
|
+ }else{
|
|
|
+ return Result.error();
|
|
|
+ }
|
|
|
+ }else if (resultMapResponse != null && resultMapResponse.get("exceptionInfo") != null){
|
|
|
+ map.put("message", resultMapResponse.get("exceptionInfo").toString());
|
|
|
+ return Result.error(map);
|
|
|
+ }else{
|
|
|
+ return Result.error();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(mapResponse != null && mapResponse.get("success") != null){
|
|
|
+ if("false".equals(mapResponse.get("success").toString())){
|
|
|
+ if(mapResponse.get("reason") != null) {
|
|
|
+ map.put("message", mapResponse.get("reason").toString());
|
|
|
+ }
|
|
|
+ return Result.error(map);
|
|
|
+ }else{
|
|
|
+ return Result.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.error();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ map.put("message", "人员登录异常!");
|
|
|
+ return Result.error(map);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 全局OkHttp客户端
|
|
|
@@ -392,7 +454,7 @@ public class STKServiceImpl implements STKService {
|
|
|
"wd_status,wd_statuscode,wd_comment,wd_plan,wd_experience,wd_context,wd_empid,wd_attachs,wd_tip)" +
|
|
|
" values('"+code+"',to_date('"+workDailyDTO.getEntrydate()+"','yyyy-mm-dd'),to_date('"+workDailyDTO.getDate()+"','yyyy-mm-dd')," +
|
|
|
"'"+workDailyDTO.getEmpcode()+"','"+workDailyDTO.getEmp()+"',"+id+",'"+workDailyDTO.getDepart()+"',''," +
|
|
|
- "'"+workDailyDTO.getJoname()+"','已审核','AUDITED','"+workDailyDTO.getComment()+"','"+workDailyDTO.getPlan()+"','"+workDailyDTO.getExperience()+"'," +
|
|
|
+ "'"+workDailyDTO.getJoname()+"','在录入','ENTERING','"+workDailyDTO.getComment()+"','"+workDailyDTO.getPlan()+"','"+workDailyDTO.getExperience()+"'," +
|
|
|
"'"+workDailyDTO.getContext()+"',"+workDailyDTO.getEmpid()+",'"+workDailyDTO.getAttachs()+"','"+workDailyDTO.getTip()+"')");
|
|
|
baseDao.execute(Sql);
|
|
|
Map<String,Object> map = new HashMap<>();
|