|
|
@@ -33,15 +33,12 @@ import com.lc.ibps.cloud.entity.APIRequest;
|
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
import com.lc.ibps.cloud.utils.RequestUtil;
|
|
|
-import com.lc.ibps.form.data.persistence.entity.DataTemplatePo;
|
|
|
-import com.lc.ibps.form.data.persistence.entity.DatasetPo;
|
|
|
import com.lc.ibps.form.data.repository.DataTemplateRepository;
|
|
|
import com.lc.ibps.form.data.repository.DatasetRepository;
|
|
|
import com.lc.ibps.office.api.IBpmReceivedService;
|
|
|
import com.lc.ibps.org.api.IPartyEmployeeService;
|
|
|
import com.lc.ibps.org.api.IPartyEntityService;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyEntityPo;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
|
|
|
import com.lc.ibps.org.party.persistence.vo.ExceptRelationVo;
|
|
|
import com.lc.ibps.org.vo.IdKeyVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -53,6 +50,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
import static java.util.Comparator.comparing;
|
|
|
@@ -143,21 +141,8 @@ public class BpmReceivedProvider extends GenericProvider implements IBpmReceived
|
|
|
bpmTaskRepository.buildInternal(list);
|
|
|
bpmTaskRepository.removeBuildInternal();
|
|
|
}
|
|
|
- // 返回数据集合添加部门ID字段值
|
|
|
- List<Map<String,Object>> deptList = (List<Map<String, Object>>) commonDao.query(" select id_,name_ from ibps_party_org where status_ = 'actived' ");
|
|
|
- if (BeanUtils.isNotEmpty(list)){
|
|
|
- for (BpmTaskPo bpmTaskPo : list) {
|
|
|
- for (Map<String, Object> deptMap : deptList) {
|
|
|
- if (StringUtil.isNotEmpty(bpmTaskPo.getStartDept())){
|
|
|
- if (bpmTaskPo.getStartDept().equals(deptMap.get("name_"))) {
|
|
|
- bpmTaskPo.setStartDeptId(deptMap.get("id_").toString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 按照创建时间降序排序
|
|
|
- list.sort(comparing(BpmTaskPo::getCreateTime).reversed());
|
|
|
+ this.getExpired(list);
|
|
|
+
|
|
|
APIPageList<BpmTaskPo> apiPageList = this.getAPIPageList(list);
|
|
|
result.setData(apiPageList);
|
|
|
} catch(Exception e) {
|
|
|
@@ -165,6 +150,77 @@ public class BpmReceivedProvider extends GenericProvider implements IBpmReceived
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ private void getExpired(List<BpmTaskPo> list){
|
|
|
+ if (BeanUtils.isNotEmpty(list)){
|
|
|
+ for (BpmTaskPo bpmTaskPo : list) {
|
|
|
+ String subject = bpmTaskPo.getSubject();
|
|
|
+ String[] parts = subject.split("#");
|
|
|
+ System.out.println("bpmTaskPo.getCreateTime() = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(bpmTaskPo.getCreateTime()));
|
|
|
+ for (String part : parts) {
|
|
|
+ if (part.contains("\"timeLimit\"")) {
|
|
|
+ ifExpired(part , "timeLimit" , bpmTaskPo);
|
|
|
+ } else if (part.contains("\"loseDate\"")) {
|
|
|
+ ifExpired(part , "loseDate" , bpmTaskPo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按照创建时间降序排序
|
|
|
+ list.sort(comparing(BpmTaskPo::getCreateTime).reversed());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ifExpired(String part,String flag,BpmTaskPo bpmTaskPo){
|
|
|
+ if ("timeLimit".equals(flag)){
|
|
|
+ try{
|
|
|
+ String timeObj = part.split(",")[0];
|
|
|
+ String timeLimit = timeObj.substring(timeObj.indexOf(":")+1).replace("\"", "");
|
|
|
+ int day = Integer.parseInt(timeLimit);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(bpmTaskPo.getCreateTime());
|
|
|
+ calendar.add(Calendar.DATE, day);
|
|
|
+ Date currentDate = new Date();
|
|
|
+ if (calendar.getTime().compareTo(currentDate) > 0) {
|
|
|
+ // 判断是否即将超时(创建时间和当前时间的间隔小于等于一天)
|
|
|
+ long timeDifference = currentDate.getTime() - bpmTaskPo.getCreateTime().getTime();
|
|
|
+ long oneDayInMillis = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
|
|
+ if (timeDifference >= (day - 1) * oneDayInMillis) {
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.ABOUT_TO_TIME_OUT);
|
|
|
+ } else {
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.NOT_TIME_OUT);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.TIME_OUT);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.NOT_TIME_OUT);
|
|
|
+ logger.warn("timeLimit天数转换异常,bpmTaskPo.getId()={}",bpmTaskPo.getId());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ try{
|
|
|
+ String timeObj = part.split(",")[0];
|
|
|
+ String loseDate = timeObj.substring(timeObj.indexOf(":")+1).replace("\"", "");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date deadline = sdf.parse(loseDate);
|
|
|
+ Date currentTime = new Date();
|
|
|
+ // 如果当前时间在截止日期之后,则已超时
|
|
|
+ if (currentTime.after(deadline)) {
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.TIME_OUT);
|
|
|
+ }else if ((deadline.getTime() - currentTime.getTime()) <= (24 * 60 * 60 * 1000)) {
|
|
|
+ // 如果当前时间和截止日期相差小于等于一天,则设置为即将超时
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.ABOUT_TO_TIME_OUT);
|
|
|
+ }else {
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.NOT_TIME_OUT);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ bpmTaskPo.setExpired(BpmTaskPo.NOT_TIME_OUT);
|
|
|
+ logger.warn("loseDate日期时间转换异常,bpmTaskPo.getId()={}",bpmTaskPo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "我的待办列表-栏目", notes = "我的待办列表")
|
|
|
@Override
|
|
|
@@ -545,6 +601,8 @@ public class BpmReceivedProvider extends GenericProvider implements IBpmReceived
|
|
|
bpmTaskRepository.buildInternal(list);
|
|
|
bpmTaskRepository.removeBuildInternal();
|
|
|
}
|
|
|
+
|
|
|
+ this.getExpired(list);
|
|
|
|
|
|
StopWatchUtil.stopAndStartNewLocal(localId, step, "pending build page list");
|
|
|
APIPageList<BpmTaskPo> apiPageList = this.getAPIPageList(list);
|