|
@@ -5,13 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qdport.entity.PolicyFile;
|
|
import com.qdport.entity.PolicyFile;
|
|
|
|
|
+import com.qdport.entity.PolicyTodo;
|
|
|
import com.qdport.enums.QDPortEnum;
|
|
import com.qdport.enums.QDPortEnum;
|
|
|
|
|
+import com.qdport.mapper.PolicyTodoMapper;
|
|
|
|
|
+import com.qdport.modules.system.entity.SysUser;
|
|
|
|
|
+import com.qdport.modules.system.service.TSysUserService;
|
|
|
import com.qdport.query.QueryWrapperBuilder;
|
|
import com.qdport.query.QueryWrapperBuilder;
|
|
|
import com.qdport.service.PolicyFileService;
|
|
import com.qdport.service.PolicyFileService;
|
|
|
import com.qdport.service.PolicyFlowNoService;
|
|
import com.qdport.service.PolicyFlowNoService;
|
|
|
import com.qdport.util.StringUtil;
|
|
import com.qdport.util.StringUtil;
|
|
|
import com.qdport.vo.PolicyFileVO;
|
|
import com.qdport.vo.PolicyFileVO;
|
|
|
import com.qdport.vo.PolicyShareVO;
|
|
import com.qdport.vo.PolicyShareVO;
|
|
|
|
|
+import com.qdport.workflow.process.model.WfProcess;
|
|
|
|
|
+import com.qdport.workflow.process.service.IWfProcessService;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import com.qdport.entity.PolicyStrive;
|
|
import com.qdport.entity.PolicyStrive;
|
|
|
import com.qdport.query.PolicyStriveQuery;
|
|
import com.qdport.query.PolicyStriveQuery;
|
|
@@ -21,6 +27,7 @@ import com.qdport.service.PolicyStriveService;
|
|
|
import com.qdport.wrapper.PolicyStriveWrapper;
|
|
import com.qdport.wrapper.PolicyStriveWrapper;
|
|
|
import com.qdport.core.tool.utils.Func;
|
|
import com.qdport.core.tool.utils.Func;
|
|
|
import com.qdport.core.tool.utils.BeanUtil;
|
|
import com.qdport.core.tool.utils.BeanUtil;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -29,6 +36,7 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 政策争取
|
|
* 政策争取
|
|
@@ -42,6 +50,14 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
|
|
|
private PolicyFlowNoService policyFlowNoService;
|
|
private PolicyFlowNoService policyFlowNoService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private PolicyFileService policyFileService;
|
|
private PolicyFileService policyFileService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IWfProcessService processService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private PolicyTodoMapper policyTodoMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TSysUserService sysUserService;
|
|
|
|
|
+ @Value("${processDefKey.policyStrive}")
|
|
|
|
|
+ private String processDefKey;
|
|
|
private final static BigDecimal decimal_50w = new BigDecimal(500000);
|
|
private final static BigDecimal decimal_50w = new BigDecimal(500000);
|
|
|
private final static BigDecimal decimal_200w = new BigDecimal(2000000);
|
|
private final static BigDecimal decimal_200w = new BigDecimal(2000000);
|
|
|
private final static BigDecimal decimal_500w = new BigDecimal(5000000);
|
|
private final static BigDecimal decimal_500w = new BigDecimal(5000000);
|
|
@@ -69,10 +85,19 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
|
|
|
private QueryWrapper<PolicyStrive> getWrapper(PolicyStriveQuery query) {
|
|
private QueryWrapper<PolicyStrive> getWrapper(PolicyStriveQuery query) {
|
|
|
QueryWrapper<PolicyStrive> wrapper = QueryWrapperBuilder.buildQueryWrapper(query, PolicyStrive.class);
|
|
QueryWrapper<PolicyStrive> wrapper = QueryWrapperBuilder.buildQueryWrapper(query, PolicyStrive.class);
|
|
|
wrapper.orderByDesc("CREATE_TIME");
|
|
wrapper.orderByDesc("CREATE_TIME");
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtil.isNotEmpty(query.getDeptId())) {
|
|
|
|
|
+ QueryWrapper<SysUser> userWrapper = new QueryWrapper<>();
|
|
|
|
|
+ userWrapper.eq("dept_id", query.getDeptId());
|
|
|
|
|
+ List<SysUser> userList = sysUserService.list(userWrapper);
|
|
|
|
|
+ List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
|
|
|
|
|
+ wrapper.in("create_id", userIdList);
|
|
|
|
|
+ }
|
|
|
return wrapper;
|
|
return wrapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void save(PolicyStriveVO vo) {
|
|
public void save(PolicyStriveVO vo) {
|
|
|
String flowNo = policyFlowNoService.getFlowNo(QDPortEnum.FLOWNO_TYPE_STRIVE.getValue());
|
|
String flowNo = policyFlowNoService.getFlowNo(QDPortEnum.FLOWNO_TYPE_STRIVE.getValue());
|
|
|
vo.setCreateTime(new Date());
|
|
vo.setCreateTime(new Date());
|
|
@@ -98,6 +123,7 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void update(PolicyStriveVO vo) {
|
|
public void update(PolicyStriveVO vo) {
|
|
|
vo.setUpdateTime(new Date());
|
|
vo.setUpdateTime(new Date());
|
|
|
PolicyStrive entity = BeanUtil.copy(vo, PolicyStrive.class);
|
|
PolicyStrive entity = BeanUtil.copy(vo, PolicyStrive.class);
|
|
@@ -118,6 +144,7 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void updateById(PolicyStriveVO vo) {
|
|
public void updateById(PolicyStriveVO vo) {
|
|
|
vo.setUpdateTime(new Date());
|
|
vo.setUpdateTime(new Date());
|
|
|
updateRewardData(vo);
|
|
updateRewardData(vo);
|
|
@@ -131,6 +158,105 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
|
|
|
removeByIds(idList);
|
|
removeByIds(idList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void saveApprove(PolicyStriveVO vo) {
|
|
|
|
|
+ JSONObject body = new JSONObject();
|
|
|
|
|
+ String processInstanceId = processService.startProcessInstanceByKey(processDefKey, vo.getId(), body);
|
|
|
|
|
+ String processTaskId = processService.getTaskIdByProcessInstanceId(processInstanceId);
|
|
|
|
|
+
|
|
|
|
|
+ vo.setProcessInstanceId(processInstanceId);
|
|
|
|
|
+ vo.setProcessTaskId(processTaskId);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtil.isEmpty(vo.getId())) {
|
|
|
|
|
+ vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_APPROVE.getValue());
|
|
|
|
|
+ save(vo);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_APPROVE.getValue());
|
|
|
|
|
+ update(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void approve(PolicyStriveVO vo) {
|
|
|
|
|
+ PolicyStrive strive = baseMapper.selectById(vo.getId());
|
|
|
|
|
+ vo.setProcessInstanceId(strive.getProcessInstanceId());
|
|
|
|
|
+ vo.setProcessTaskId(strive.getProcessTaskId());
|
|
|
|
|
+
|
|
|
|
|
+ WfProcess process = new WfProcess();
|
|
|
|
|
+ process.setTaskId(vo.getProcessTaskId());
|
|
|
|
|
+ process.setProcessDefinitionId(vo.getProcessDefinitionId());
|
|
|
|
|
+ process.setProcessInstanceId(vo.getProcessInstanceId());
|
|
|
|
|
+ process.setPass(true);
|
|
|
|
|
+ process.setComment("同意");
|
|
|
|
|
+ processService.completeTask(process);
|
|
|
|
|
+
|
|
|
|
|
+ String processTaskId = processService.getTaskIdByProcessInstanceId(vo.getProcessInstanceId());
|
|
|
|
|
+ vo.setProcessTaskId(processTaskId);
|
|
|
|
|
+
|
|
|
|
|
+ vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_DONE.getValue());
|
|
|
|
|
+ vo.setUpdateTime(new Date());
|
|
|
|
|
+ updateById(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void refuse(PolicyStriveVO vo) {
|
|
|
|
|
+ PolicyStrive strive = baseMapper.selectById(vo.getId());
|
|
|
|
|
+ vo.setProcessDefinitionId(strive.getProcessDefinitionId());
|
|
|
|
|
+ vo.setProcessTaskId(strive.getProcessTaskId());
|
|
|
|
|
+
|
|
|
|
|
+ WfProcess process = new WfProcess();
|
|
|
|
|
+ process.setTaskId(vo.getProcessTaskId());
|
|
|
|
|
+ process.setProcessDefinitionId(vo.getProcessDefinitionId());
|
|
|
|
|
+ process.setProcessInstanceId(vo.getProcessInstanceId());
|
|
|
|
|
+ process.setPass(false);
|
|
|
|
|
+ process.setComment(vo.getComment());
|
|
|
|
|
+ processService.completeTask(process);
|
|
|
|
|
+
|
|
|
|
|
+ String processTaskId = processService.getTaskIdByProcessInstanceId(vo.getProcessInstanceId());
|
|
|
|
|
+ vo.setProcessTaskId(processTaskId);
|
|
|
|
|
+
|
|
|
|
|
+ vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_INACTIVE.getValue());
|
|
|
|
|
+ vo.setUpdateTime(new Date());
|
|
|
|
|
+ updateById(vo);
|
|
|
|
|
+
|
|
|
|
|
+ QueryWrapper<PolicyTodo> todoQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ todoQueryWrapper.eq("REF_ID", vo.getId());
|
|
|
|
|
+ todoQueryWrapper.eq("REF_TYPE", QDPortEnum.POLICY_TODO_REFTYPE_POLICY_STRIVE.getValue());
|
|
|
|
|
+ todoQueryWrapper.eq("TODO_TYPE", QDPortEnum.POLICY_TODO_TYPE_APPROVE.getValue());
|
|
|
|
|
+ todoQueryWrapper.eq("STATUS", QDPortEnum.POLICY_TODO_STATUS_ACTIVE.getValue());
|
|
|
|
|
+ PolicyTodo todo = new PolicyTodo();
|
|
|
|
|
+ todo.setStatus(QDPortEnum.POLICY_TODO_STATUS_DONE.getValue());
|
|
|
|
|
+ policyTodoMapper.update(todo, todoQueryWrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void withdraw(PolicyStriveVO vo) {
|
|
|
|
|
+ PolicyStrive strive = baseMapper.selectById(vo.getId());
|
|
|
|
|
+ vo.setProcessTaskId(strive.getProcessTaskId());
|
|
|
|
|
+
|
|
|
|
|
+ WfProcess process = new WfProcess();
|
|
|
|
|
+ process.setTaskId(vo.getProcessTaskId());
|
|
|
|
|
+ process.setWithdrawType("wf_withdraw_end");
|
|
|
|
|
+ processService.terminateProcess(process);
|
|
|
|
|
+
|
|
|
|
|
+ vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_ACTIVE.getValue());
|
|
|
|
|
+ vo.setUpdateTime(new Date());
|
|
|
|
|
+ updateById(vo);
|
|
|
|
|
+
|
|
|
|
|
+ QueryWrapper<PolicyTodo> todoQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ todoQueryWrapper.eq("REF_ID", vo.getId());
|
|
|
|
|
+ todoQueryWrapper.eq("REF_TYPE", QDPortEnum.POLICY_TODO_REFTYPE_POLICY_STRIVE.getValue());
|
|
|
|
|
+ todoQueryWrapper.eq("TODO_TYPE", QDPortEnum.POLICY_TODO_TYPE_APPROVE.getValue());
|
|
|
|
|
+ todoQueryWrapper.eq("STATUS", QDPortEnum.POLICY_TODO_STATUS_ACTIVE.getValue());
|
|
|
|
|
+ PolicyTodo todo = new PolicyTodo();
|
|
|
|
|
+ todo.setStatus(QDPortEnum.POLICY_TODO_STATUS_CANCEL.getValue());
|
|
|
|
|
+ policyTodoMapper.update(todo, todoQueryWrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void updateRewardData(PolicyStriveVO vo) {
|
|
private void updateRewardData(PolicyStriveVO vo) {
|
|
|
Integer rewardType = vo.getRewardType();
|
|
Integer rewardType = vo.getRewardType();
|
|
|
Integer isLand = vo.getIsLand();
|
|
Integer isLand = vo.getIsLand();
|