|
@@ -7,6 +7,8 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.kingdee.shr.api.OSFWSClient;
|
|
|
+import com.kingdee.shr.api.Response;
|
|
|
+import com.kingdee.shr.api.SHRClient;
|
|
|
import com.qy.worksheetsystem.model.entity.JobBooking;
|
|
|
import com.qy.worksheetsystem.model.entity.JobBookingEntry;
|
|
|
import com.qy.worksheetsystem.model.mapper.PersonWorkMapper;
|
|
@@ -18,11 +20,13 @@ import com.qy.worksheetsystem.util.SnowflakeUtils;
|
|
|
import com.qy.worksheetsystem.vo.WorkHoursReport;
|
|
|
import com.qy.worksheetsystem.vo.WorkHoursReportEntry;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.http.HttpException;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
@@ -56,9 +60,32 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
private String serviceName;
|
|
|
@Value("${HR.ais.codingRuleService}")
|
|
|
private String codingRuleService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Object> insertWork(Map<String, Object> param) {
|
|
|
+ Map<String, Object> result = null;
|
|
|
+ SHRClient shrClient = null;
|
|
|
+ try {
|
|
|
+ Map<String, String> person = (Map<String, String>) param.get("person");
|
|
|
+ shrClient = new SHRClient(url, person.get("userNumber"));
|
|
|
+ result = this.insertWork(param, shrClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ if (null != shrClient)
|
|
|
+ shrClient.logout(url, shrClient.getGlobalToken(), shrClient.getGlobalHttpClient());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> insertWork(Map<String,Object> param){
|
|
|
+ public Map<String, Object> insertWork(Map<String, Object> param, SHRClient shrClient) {
|
|
|
List<Map<String, Object>> billList = Lists.newArrayList();
|
|
|
List<Map<String, Object>> workList = Lists.newArrayList();
|
|
|
int begin = (int) param.get("begin");
|
|
@@ -72,8 +99,6 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
Map<String, Object> reMap = Maps.newHashMap();
|
|
|
try {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
- OSFWSClient client = new OSFWSClient();
|
|
|
Integer Hours = 0;
|
|
|
for (WorkHoursReportEntry jobWorkEntry : jobWork.getEntries()) {
|
|
|
String workingHours = jobWorkEntry.getWorkingHours();
|
|
@@ -81,13 +106,16 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
Hours += Hour.intValue();
|
|
|
String projectId = jobWorkEntry.getProjectId();
|
|
|
List<Map<String, String>> pros = projectMapper.getProjectManagementInfoBYId(projectId);
|
|
|
- if (pros.size()<=0){
|
|
|
+ if (pros.size() <= 0) {
|
|
|
throw new Exception("没有找到项目,请检查");
|
|
|
}
|
|
|
String number = SnowflakeUtils.getInstance().getSnowflake().nextIdStr();
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- String str = client.proceedOSF(url,codingRuleService,map);
|
|
|
- if(StrUtil.isNotBlank(str)) {
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ String str = "";
|
|
|
+
|
|
|
+ Response response = shrClient.executeServiceByLongConnection(url, codingRuleService, map);
|
|
|
+ str = (String) response.getData();
|
|
|
+ if (StrUtil.isNotBlank(str)) {
|
|
|
if (JSONUtil.isTypeJSON(str)) {
|
|
|
JSONObject j = JSONUtil.parseObj(str);
|
|
|
String code = j.getStr("code");
|
|
@@ -98,7 +126,7 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
}
|
|
|
|
|
|
Map<String, Object> billMap = new HashMap<>();
|
|
|
- String billID = personWorkMapper.selectBillKey(new Long(number));
|
|
|
+ String billID = personWorkMapper.selectBillKey(String.valueOf(number));
|
|
|
billMap.put("id", billID);
|
|
|
billMap.put("affiliatedProject", projectId);
|
|
|
billMap.put("fillingStartDate", jobWork.getBeginTime());
|
|
@@ -111,6 +139,7 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
Date createTime = new Date();
|
|
|
billMap.put("creator", person.get("userID"));
|
|
|
billMap.put("lastUpdateUser", person.get("userID"));
|
|
|
+ billMap.put("jobContent", jobWorkEntry.getJobContent());
|
|
|
for (int i = begin; i <= end; i++) {
|
|
|
Map<String, Object> objectMap = Maps.newHashMap();
|
|
|
String iday = "01";
|
|
@@ -139,13 +168,13 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
|
|
|
int bInt = personWorkMapper.insertBill(billList);
|
|
|
int wInt = personWorkMapper.insertWork(workList);
|
|
|
- reMap.put("billList",billList);
|
|
|
- reMap.put("workList",workList);
|
|
|
- reMap.put("code", (billList.size()+workList.size())==(bInt+wInt));
|
|
|
+ reMap.put("billList", billList);
|
|
|
+ reMap.put("workList", workList);
|
|
|
+ reMap.put("code", (billList.size() + workList.size()) == (bInt + wInt));
|
|
|
return reMap;
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- for(Map<String,Object> bill:billList) {
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ for (Map<String, Object> bill : billList) {
|
|
|
this.deleteWork(person.get("personNumber"), (String) bill.get("id"));
|
|
|
}
|
|
|
reMap.put("errMsg", e.getMessage());
|
|
@@ -156,14 +185,14 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getAvailableDateInfoById(String number, String id, String startDate, String endDate) {
|
|
|
- Map<String,String> person = personService.getPersonByJobNo(number);
|
|
|
- List<Map<String,Object>> list = personWorkMapper.getAvailableDateInfoById(person.get("id"),id,startDate,endDate);
|
|
|
- for(Map<String,Object> map : list){
|
|
|
+ Map<String, String> person = personService.getPersonByJobNo(number);
|
|
|
+ List<Map<String, Object>> list = personWorkMapper.getAvailableDateInfoById(person.get("id"), id, startDate, endDate);
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
|
|
BigDecimal workHours = (BigDecimal) map.get("workHours");
|
|
|
- if(null!=workHours) {
|
|
|
+ if (null != workHours) {
|
|
|
map.put("availableWorkHours", h8.subtract(workHours));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
map.put("workHours", BigDecimal.ZERO);
|
|
|
map.put("availableWorkHours", h8);
|
|
|
}
|
|
@@ -173,14 +202,14 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getAvailableDateInfo(String number, String startDate, String endDate) {
|
|
|
- Map<String,String> person = personService.getPersonByJobNo(number);
|
|
|
- List<Map<String,Object>> list = personWorkMapper.getAvailableDateInfo(person.get("id"),startDate,endDate);
|
|
|
- for(Map<String,Object> map : list){
|
|
|
+ Map<String, String> person = personService.getPersonByJobNo(number);
|
|
|
+ List<Map<String, Object>> list = personWorkMapper.getAvailableDateInfo(person.get("id"), startDate, endDate);
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
|
|
BigDecimal workHours = (BigDecimal) map.get("workHours");
|
|
|
- if(null!=workHours) {
|
|
|
+ if (null != workHours) {
|
|
|
map.put("availableWorkHours", h8.subtract(workHours));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
map.put("workHours", BigDecimal.ZERO);
|
|
|
map.put("availableWorkHours", h8);
|
|
|
}
|
|
@@ -189,143 +218,283 @@ public class PersonWorkServiceImpl implements PersonWorkService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getPersonWorkList(String number,String beginTime, String endTime, Boolean state) {
|
|
|
- List<Map<String,Object>> list = personWorkMapper.getPersonWorkList(number,beginTime,endTime,state);
|
|
|
+ public List<Map<String, Object>> getPersonWorkList(String number, String beginTime, String endTime, Boolean state) {
|
|
|
+ List<Map<String, Object>> list = personWorkMapper.getPersonWorkList(number, beginTime, endTime, state);
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getPersonWorkListV3(String number, String beginTime, String endTime, Boolean state) {
|
|
|
+ List<JobBooking> list = personWorkMapper.getPersonWorkListV2(number, beginTime, endTime, state);
|
|
|
+ BigDecimal unapprovedHours = BigDecimal.ZERO;
|
|
|
+ BigDecimal approveHours = BigDecimal.ZERO;
|
|
|
+ BigDecimal workingHours = BigDecimal.ZERO;
|
|
|
+ BigDecimal work8 = new BigDecimal(8);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ for (JobBooking job : list) {
|
|
|
+ BigDecimal hours = BigDecimal.ZERO;
|
|
|
+ BigDecimal days = BigDecimal.ZERO;
|
|
|
+ String billState = String.valueOf(job.get("state"));
|
|
|
+ for (JobBookingEntry jobEntry : (List<JobBookingEntry>) job.get("entries")) {
|
|
|
+ BigDecimal work = new BigDecimal(jobEntry.getWorkingHours());
|
|
|
+ workingHours = workingHours.add(work);
|
|
|
+ hours = work;
|
|
|
+ days = days.add(work);
|
|
|
+ if ("3".equals(billState)) {
|
|
|
+ approveHours = approveHours.add(work);
|
|
|
+ } else {
|
|
|
+ unapprovedHours = unapprovedHours.add(work);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ job.put("WorkingHours", hours.toPlainString());
|
|
|
+ job.put("days", days.divide(work8, 4));
|
|
|
+ }
|
|
|
+ map.put("datalist", list);
|
|
|
+ map.put("approveDays", approveHours.divide(work8, 4));
|
|
|
+ map.put("unapprovedDays", unapprovedHours.divide(work8, 4));
|
|
|
+ map.put("workingDays", workingHours.divide(work8, 4));
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
- public List<JobBooking> getPersonWorkListV2(String number, String beginTime, String endTime, Boolean state) {
|
|
|
- List<JobBooking> list = personWorkMapper.getPersonWorkListV2(number,beginTime,endTime,state);
|
|
|
- for(JobBooking job : list){
|
|
|
- BigDecimal workingHours = BigDecimal.ZERO;
|
|
|
+ public List<JobBooking> getPersonWorkListV2(String number, String beginTime, String endTime, Boolean state) {
|
|
|
+ List<JobBooking> list = personWorkMapper.getPersonWorkListV2(number, beginTime, endTime, state);
|
|
|
+ BigDecimal workingHours = BigDecimal.ZERO;
|
|
|
+ for (JobBooking job : list) {
|
|
|
+
|
|
|
BigDecimal hours = BigDecimal.ZERO;
|
|
|
- for(JobBookingEntry jobEntry : (List<JobBookingEntry>)job.get("entries")){
|
|
|
+ for (JobBookingEntry jobEntry : (List<JobBookingEntry>) job.get("entries")) {
|
|
|
BigDecimal work = new BigDecimal(jobEntry.getWorkingHours());
|
|
|
- workingHours=workingHours.add(work);
|
|
|
- hours=work;
|
|
|
+ workingHours = workingHours.add(work);
|
|
|
+ hours = work;
|
|
|
}
|
|
|
- job.put("WorkingHours",hours.toPlainString());
|
|
|
+ job.put("WorkingHours", hours.toPlainString());
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getPersonWorkSumInfo(String number,String beginTime,String endTime,Boolean state){
|
|
|
- List<Map<String,Object>> list =personWorkMapper.getPersonWorkSumInfo(number,beginTime,endTime,state);
|
|
|
+ public List<Map<String, Object>> getPersonWorkSumInfo(String number, String beginTime, String endTime, Boolean state) {
|
|
|
+ List<Map<String, Object>> list = personWorkMapper.getPersonWorkSumInfo(number, beginTime, endTime, state);
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public JobBooking getPersonWorkInfoById(String number, String id){
|
|
|
- JobBooking e =personWorkMapper.getPersonWorkInfoById( number, id);
|
|
|
+ public JobBooking getPersonWorkInfoById(String number, String id) {
|
|
|
+ JobBooking e = personWorkMapper.getPersonWorkInfoById(number, id);
|
|
|
BigDecimal workingHours = BigDecimal.ZERO;
|
|
|
- for(JobBookingEntry jobEntry : (List<JobBookingEntry>)e.get("entries")){
|
|
|
|
|
|
- workingHours=workingHours.add(new BigDecimal(jobEntry.getWorkingHours()));
|
|
|
+ for (JobBookingEntry jobEntry : (List<JobBookingEntry>) e.get("entries")) {
|
|
|
+
|
|
|
+ workingHours =new BigDecimal(jobEntry.getWorkingHours());
|
|
|
+
|
|
|
}
|
|
|
- e.put("WorkingHours",workingHours.toPlainString());
|
|
|
+ e.put("WorkingHours", workingHours.toPlainString());
|
|
|
return e;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int deleteWork(String number, String id){
|
|
|
- int x =personWorkMapper.deleteWorkEntry(id);
|
|
|
- int i =personWorkMapper.deleteWork(id);
|
|
|
+ public int deleteWork(String number, String id) {
|
|
|
+ int x = personWorkMapper.deleteWorkEntry(id);
|
|
|
+ int i = personWorkMapper.deleteWork(id);
|
|
|
return i;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int submitWork(String number, String id){
|
|
|
- OSFWSClient client = new OSFWSClient();
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- map.put("billId",id);// 单据id
|
|
|
- map.put("status","1");// 单据id
|
|
|
- String str = client.proceedOSF(url,serviceName,map);
|
|
|
- if(StrUtil.isNotBlank(str)){
|
|
|
- JSONObject j = JSONUtil.parseObj(str);
|
|
|
- String code = j.getStr("code");
|
|
|
- if("200".equals(code)){
|
|
|
- return 1;
|
|
|
+ public int submitWork(String number, String id, SHRClient shrClient) {
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("billId", id);// 单据id
|
|
|
+ map.put("status", "1");// 单据id
|
|
|
+ try {
|
|
|
+ Response response = shrClient.executeServiceByLongConnection(url, serviceName, map);
|
|
|
+ String str = (String) response.getData();
|
|
|
+ if (StrUtil.isNotBlank(str)) {
|
|
|
+ if (JSONUtil.isTypeJSON(str)) {
|
|
|
+ JSONObject j = JSONUtil.parseObj(str);
|
|
|
+ String code = j.getStr("code");
|
|
|
+ if ("200".equals(code)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int revocaWork(String number, String id){
|
|
|
- OSFWSClient client = new OSFWSClient();
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- map.put("billId",id);// 单据id
|
|
|
- map.put("status","2");// 单据id
|
|
|
- String str = client.proceedOSF(url,serviceName,map);
|
|
|
- if(StrUtil.isNotBlank(str)){
|
|
|
+ public int submitWork(String number, String id) {
|
|
|
+ SHRClient shrClient = null;
|
|
|
+ int result =0;
|
|
|
+ try {
|
|
|
+ shrClient = new SHRClient(url, number);
|
|
|
+ result= this.submitWork(number, id, shrClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ } finally {
|
|
|
try {
|
|
|
- if(JSONUtil.isTypeJSON(str)) {
|
|
|
+ if (null != shrClient)
|
|
|
+ shrClient.logout(url, shrClient.getGlobalToken(), shrClient.getGlobalHttpClient());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public int revocaWork(String number, String id, SHRClient shrClient) {
|
|
|
+
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("billId", id);// 单据id
|
|
|
+ map.put("status", "2");// 单据id
|
|
|
+ try {
|
|
|
+ Response response = shrClient.executeServiceByLongConnection(url, serviceName, map);
|
|
|
+ String str = (String) response.getData();
|
|
|
+ if (StrUtil.isNotBlank(str)) {
|
|
|
+ if (JSONUtil.isTypeJSON(str)) {
|
|
|
JSONObject j = JSONUtil.parseObj(str);
|
|
|
String code = j.getStr("code");
|
|
|
if ("200".equals(code)) {
|
|
|
return 1;
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return 0;
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public int revocaWork(String number, String id) {
|
|
|
+ SHRClient shrClient = null;
|
|
|
+ int result=0;
|
|
|
+ try {
|
|
|
+ shrClient = new SHRClient(url, number);
|
|
|
+ result= this.revocaWork(number, id, shrClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ if (null != shrClient)
|
|
|
+ shrClient.logout(url, shrClient.getGlobalToken(), shrClient.getGlobalHttpClient());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> deleteWorkToMap(String number, String id){
|
|
|
- int x =personWorkMapper.deleteWorkEntry(id);
|
|
|
- int i =personWorkMapper.deleteWork(id);
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- map.put("code",(i>0?1:0));
|
|
|
- map.put("work",i);
|
|
|
- map.put("workEntry",x);
|
|
|
+ public Map<String, Object> deleteWorkToMap(String number, String id) {
|
|
|
+ int x = personWorkMapper.deleteWorkEntry(id);
|
|
|
+ int i = personWorkMapper.deleteWork(id);
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("code", (i > 0 ? 1 : 0));
|
|
|
+ map.put("work", i);
|
|
|
+ map.put("workEntry", x);
|
|
|
return map;
|
|
|
}
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> submitWorkToMap(String number, String id){
|
|
|
- OSFWSClient client = new OSFWSClient();
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- map.put("billId",id);// 单据id
|
|
|
- map.put("status","1");// 单据id
|
|
|
- String str = client.proceedOSF(url,serviceName,map);
|
|
|
- map.put("code",0);
|
|
|
- if(StrUtil.isNotBlank(str)){
|
|
|
- if(JSONUtil.isTypeJSON(str)) {
|
|
|
- JSONObject j = JSONUtil.parseObj(str);
|
|
|
- String code = j.getStr("code");
|
|
|
- if ("200".equals(code)) {
|
|
|
- map.put("code", 1);
|
|
|
+ public Map<String, Object> submitWorkToMap(String number, String id, SHRClient shrClient) {
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("billId", id);// 单据id
|
|
|
+ map.put("status", "1");// 单据id
|
|
|
+ try {
|
|
|
+ Response response = shrClient.executeServiceByLongConnection(url, serviceName, map);
|
|
|
+ String str = (String) response.getData();
|
|
|
+ map.put("code", 0);
|
|
|
+ if (StrUtil.isNotBlank(str)) {
|
|
|
+ if (JSONUtil.isTypeJSON(str)) {
|
|
|
+ JSONObject j = JSONUtil.parseObj(str);
|
|
|
+ String code = j.getStr("code");
|
|
|
+ if ("200".equals(code)) {
|
|
|
+ map.put("code", 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("msg", str);
|
|
|
}
|
|
|
- }else {
|
|
|
- map.put("msg", str);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> revocaWorkToMap(String number, String id){
|
|
|
- OSFWSClient client = new OSFWSClient();
|
|
|
- Map<String,Object> map = Maps.newHashMap();
|
|
|
- map.put("billId",id);// 单据id
|
|
|
- map.put("status","2");// 单据id
|
|
|
- String str = client.proceedOSF(url,serviceName,map);
|
|
|
- map.put("code",0);
|
|
|
- if(StrUtil.isNotBlank(str)) {
|
|
|
- if (JSONUtil.isTypeJSON(str)) {
|
|
|
- JSONObject j = JSONUtil.parseObj(str);
|
|
|
- String code = j.getStr("code");
|
|
|
- if ("200".equals(code)) {
|
|
|
- map.put("code", 1);
|
|
|
+ public Map<String, Object> submitWorkToMap(String number, String id) {
|
|
|
+ Map<String, Object> result=null;
|
|
|
+ SHRClient shrClient = null;
|
|
|
+ try {
|
|
|
+ shrClient = new SHRClient(url, number);
|
|
|
+ result= this.submitWorkToMap(number, id, shrClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ if (null != shrClient)
|
|
|
+ shrClient.logout(url, shrClient.getGlobalToken(), shrClient.getGlobalHttpClient());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Object> revocaWorkToMap(String number, String id, SHRClient shrClient) {
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+ map.put("billId", id);// 单据id
|
|
|
+ map.put("status", "2");// 单据id
|
|
|
+ try {
|
|
|
+ Response response = shrClient.executeServiceByLongConnection(url, serviceName, map);
|
|
|
+ String str = (String) response.getData();
|
|
|
+ map.put("code", 0);
|
|
|
+ if (StrUtil.isNotBlank(str)) {
|
|
|
+ if (JSONUtil.isTypeJSON(str)) {
|
|
|
+ JSONObject j = JSONUtil.parseObj(str);
|
|
|
+ String code = j.getStr("code");
|
|
|
+ if ("200".equals(code)) {
|
|
|
+ map.put("code", 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("msg", str);
|
|
|
}
|
|
|
- }else {
|
|
|
- map.put("msg", str);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Object> revocaWorkToMap(String number, String id) {
|
|
|
+ Map<String, Object> result=null;
|
|
|
+ SHRClient shrClient = null;
|
|
|
+ try {
|
|
|
+ shrClient = new SHRClient(url, number);
|
|
|
+ result= this.revocaWorkToMap(number, id, shrClient);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ if (null != shrClient)
|
|
|
+ shrClient.logout(url, shrClient.getGlobalToken(), shrClient.getGlobalHttpClient());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|