|
|
|
@ -43,276 +43,275 @@ import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 业务层实现
|
|
|
|
|
*/
|
|
|
|
|
* 业务层实现
|
|
|
|
|
*/
|
|
|
|
|
@Service("taskchildPictureService")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class TaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchildPictureMybatisDao, OcrTaskchildPicture> implements IFormCustomService<OcrTaskchildPicture> {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OcrTaskchildPictureService ocrTaskchildPictureService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserTokenService userTokenService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private XiaoyaoConfig xiaoyaoConfig;
|
|
|
|
|
@Autowired
|
|
|
|
|
private FtperrorService ftperrorService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CategoryService categoryService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserService userService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SeqManageService seqManageService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CandidateuserService candidateuserService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFlowFormMessageService iFlowFormMessageService;
|
|
|
|
|
@Override
|
|
|
|
|
public String saveForm(HttpServletRequest request) {
|
|
|
|
|
OcrTaskchildPicture model = null;
|
|
|
|
|
try {
|
|
|
|
|
model = RequestBaseUtil.reflects(request,OcrTaskchildPicture.class);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(null != model && null == model.getId()){
|
|
|
|
|
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
model.setCreateuser(userToken.getLoginname());
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName,ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
model.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置流程编号
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
|
map.put("systemcode",SystemConstantsOa.OA_BUSSINRSS_NO_FIX);
|
|
|
|
|
Category category = categoryService.getById(model.getCategoryid());
|
|
|
|
|
if(null != category){
|
|
|
|
|
map.put("categoryformtype",category.getFormtype());
|
|
|
|
|
}
|
|
|
|
|
List<Distionary> distionaryList = candidateuserService.selectList(userToken.getLoginname());
|
|
|
|
|
if(null != distionaryList && !distionaryList.isEmpty()){
|
|
|
|
|
map.put("deptcodeno",distionaryList.get(0).getCodeno());
|
|
|
|
|
}
|
|
|
|
|
map.put("number","6");
|
|
|
|
|
|
|
|
|
|
model.setBuessinessno(seqManageService.getSeqNextNo(map));
|
|
|
|
|
model.setCreatedate(System.currentTimeMillis());
|
|
|
|
|
this.save(model);
|
|
|
|
|
return model.getId().toString();
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName,ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
model.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setUpdatetime(System.currentTimeMillis());
|
|
|
|
|
this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
return model.getId().toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String editForm(HttpServletRequest request, String fromid) {
|
|
|
|
|
if(StringUtils.isBlank(fromid)){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
OcrTaskchildPicture modelOld = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if(null == modelOld){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
OcrTaskchildPicture modelNew = null;
|
|
|
|
|
try {
|
|
|
|
|
modelNew = RequestBaseUtil.reflects(request,OcrTaskchildPicture.class);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(null != modelNew){
|
|
|
|
|
modelNew.setId(modelNew.getId());
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName,ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
modelNew.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modelNew.setUpdatetime(System.currentTimeMillis());
|
|
|
|
|
modelNew.setUpdateuser(userToken.getUserid());
|
|
|
|
|
this.ocrTaskchildPictureService.updateById(modelNew);
|
|
|
|
|
return modelNew.getId().toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean delForm(String formid) {
|
|
|
|
|
if(StringUtils.isNotBlank(formid)){
|
|
|
|
|
return this.ocrTaskchildPictureService.removeById(formid) ;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateForm(String fromid, String deploymentid, String processdefinitionid, String assignee, String taskId, String processInstanceId,String tasknme) {
|
|
|
|
|
if(StringUtils.isNotBlank(fromid) && StringUtils.isNotBlank(deploymentid) && StringUtils.isNotBlank(processdefinitionid)){
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
model .setProcessinstanceid(processInstanceId);
|
|
|
|
|
model.setProcessdefinitionid(processdefinitionid);
|
|
|
|
|
model.setDeploymentid(deploymentid);
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
model.setTaskname(tasknme);
|
|
|
|
|
model.setStates(SystemConstantsOa.OA_STATUS_TYPE_ING);
|
|
|
|
|
//查询审批人姓名
|
|
|
|
|
String[] assignees = assignee.split(",");
|
|
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
|
|
for(String tempAssign:assignees){
|
|
|
|
|
User user = userService.findByLoginname(tempAssign);
|
|
|
|
|
if(StringUtils.isNotBlank(stringBuffer.toString())){
|
|
|
|
|
stringBuffer.append("," + user.getUsername());
|
|
|
|
|
}else {
|
|
|
|
|
stringBuffer.append(user.getUsername());
|
|
|
|
|
}
|
|
|
|
|
//发送消息
|
|
|
|
|
//iFlowFormMessageService.sendMsg(user.getLoginname(),model.getUsername() + SystemMessage.SYS_OA_TYPE_LEAVE + SystemMessage.SYS_OA_TO_DO,taskId,processInstanceId,fromid, CacheQyweixinConstants.OA_DISTIONARY_TYPE_MSG_SHENPI,model.getCategoryid().toString());
|
|
|
|
|
}
|
|
|
|
|
model.setAssigneename(stringBuffer.toString());
|
|
|
|
|
|
|
|
|
|
return this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean editStatesForm(String fromid, int states, String assignee) {
|
|
|
|
|
//TODO 后期修改图片的状态
|
|
|
|
|
if(StringUtils.isNotBlank(fromid)){
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if(StringUtils.isNotBlank(assignee)){
|
|
|
|
|
User user1 = userService.findByLoginname(assignee);
|
|
|
|
|
model.setAssigneename(user1.getUsername());
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果状态为拒绝,监听程序不改变当前状态
|
|
|
|
|
if(model.getStates().intValue() != SystemConstantsOa.OA_STATUS_TYPE_REFUSE){
|
|
|
|
|
//判断是否为撤回
|
|
|
|
|
if(states == SystemConstantsOa.OA_STATUS_TYPE_CANCLE){
|
|
|
|
|
model.setProcessinstanceid("");
|
|
|
|
|
model.setDeploymentid("");
|
|
|
|
|
model.setProcessdefinitionid("");
|
|
|
|
|
model.setAssigneename("");
|
|
|
|
|
model.setAssignee("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setStates(states);
|
|
|
|
|
return this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean endForm(String fromid, int states, String assignee, String processInstanceId,String tasknme) {
|
|
|
|
|
//TODO 后期修改图片的状态
|
|
|
|
|
if(StringUtils.isNotBlank(fromid)){
|
|
|
|
|
OcrTaskchildPicture model = this.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if(StringUtils.isNotBlank(assignee)){
|
|
|
|
|
User user1 = userService.findByLoginname(assignee);
|
|
|
|
|
model.setAssigneename(user1.getUsername());
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
}
|
|
|
|
|
model.setTaskname(tasknme);
|
|
|
|
|
//iFlowFormMessageService.sendMsg(model.getCreateuser(),SystemMessage.SYS_OA_TYPE_LEAVE + SystemMessage.SYS_OA_TO_CLOSE,null,processInstanceId,fromid,CacheQyweixinConstants.OA_DISTIONARY_TYPE_MSG_SHENPI_PASS,model.getCategoryid().toString());
|
|
|
|
|
//如果状态为拒绝,监听程序不改变当前状态
|
|
|
|
|
if(model.getStates().intValue() != SystemConstantsOa.OA_STATUS_TYPE_REFUSE){
|
|
|
|
|
model.setStates(states);
|
|
|
|
|
return this.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public FlowModelVO getForm(String fromid) {
|
|
|
|
|
if(StringUtils.isNotBlank(fromid)){
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
|
|
|
|
|
//查询审批人
|
|
|
|
|
if(null != model){
|
|
|
|
|
return model.getFlowModelVO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
public class TaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchildPictureMybatisDao, OcrTaskchildPicture> implements IFormCustomService<OcrTaskchildPicture> {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OcrTaskchildPictureService ocrTaskchildPictureService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserTokenService userTokenService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private XiaoyaoConfig xiaoyaoConfig;
|
|
|
|
|
@Autowired
|
|
|
|
|
private FtperrorService ftperrorService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CategoryService categoryService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserService userService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SeqManageService seqManageService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CandidateuserService candidateuserService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFlowFormMessageService iFlowFormMessageService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String saveForm(HttpServletRequest request) {
|
|
|
|
|
OcrTaskchildPicture model = null;
|
|
|
|
|
try {
|
|
|
|
|
model = RequestBaseUtil.reflects(request, OcrTaskchildPicture.class);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null != model && null == model.getId()) {
|
|
|
|
|
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
model.setCreateuser(userToken.getLoginname());
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName, ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
model.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置流程编号
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("systemcode", SystemConstantsOa.OA_BUSSINRSS_NO_FIX);
|
|
|
|
|
Category category = categoryService.getById(model.getCategoryid());
|
|
|
|
|
if (null != category) {
|
|
|
|
|
map.put("categoryformtype", category.getFormtype());
|
|
|
|
|
}
|
|
|
|
|
List<Distionary> distionaryList = candidateuserService.selectList(userToken.getLoginname());
|
|
|
|
|
if (null != distionaryList && !distionaryList.isEmpty()) {
|
|
|
|
|
map.put("deptcodeno", distionaryList.get(0).getCodeno());
|
|
|
|
|
}
|
|
|
|
|
map.put("number", "6");
|
|
|
|
|
|
|
|
|
|
model.setBuessinessno(seqManageService.getSeqNextNo(map));
|
|
|
|
|
model.setCreatedate(System.currentTimeMillis());
|
|
|
|
|
this.save(model);
|
|
|
|
|
return model.getId().toString();
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName, ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
model.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setUpdatetime(System.currentTimeMillis());
|
|
|
|
|
this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
return model.getId().toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String editForm(HttpServletRequest request, String fromid) {
|
|
|
|
|
if (StringUtils.isBlank(fromid)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
OcrTaskchildPicture modelOld = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if (null == modelOld) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
OcrTaskchildPicture modelNew = null;
|
|
|
|
|
try {
|
|
|
|
|
modelNew = RequestBaseUtil.reflects(request, OcrTaskchildPicture.class);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null != modelNew) {
|
|
|
|
|
modelNew.setId(modelNew.getId());
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = WebUtils
|
|
|
|
|
.getNativeRequest(request, MultipartHttpServletRequest.class);
|
|
|
|
|
MultipartFile multipartfile = multipartRequest.getFile("fileannex");
|
|
|
|
|
|
|
|
|
|
//上传附件
|
|
|
|
|
if (null != multipartfile && !multipartfile.isEmpty()) {
|
|
|
|
|
String filepat = SystemConstantsOa.OA_FILE_PATH;
|
|
|
|
|
|
|
|
|
|
//获得文件后缀
|
|
|
|
|
String fileType = FilenameUtils.getExtension(multipartfile.getOriginalFilename());
|
|
|
|
|
|
|
|
|
|
//重新命名
|
|
|
|
|
String fileName = System.currentTimeMillis() + "_c." + fileType;
|
|
|
|
|
|
|
|
|
|
ResultVo rs = UploadSpringUtil.springUpload(multipartfile, xiaoyaoConfig, filepat, fileName, ftperrorService);
|
|
|
|
|
if (null != rs) {
|
|
|
|
|
if (rs.getCode().equals(ResultVo.SUCCESS)) {
|
|
|
|
|
modelNew.setFileannex(rs.getOtherMessage().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modelNew.setUpdatetime(System.currentTimeMillis());
|
|
|
|
|
modelNew.setUpdateuser(userToken.getUserid());
|
|
|
|
|
this.ocrTaskchildPictureService.updateById(modelNew);
|
|
|
|
|
return modelNew.getId().toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean delForm(String formid) {
|
|
|
|
|
if (StringUtils.isNotBlank(formid)) {
|
|
|
|
|
return this.ocrTaskchildPictureService.removeById(formid);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateForm(String fromid, String deploymentid, String processdefinitionid, String assignee, String taskId, String processInstanceId, String tasknme) {
|
|
|
|
|
if (StringUtils.isNotBlank(fromid) && StringUtils.isNotBlank(deploymentid) && StringUtils.isNotBlank(processdefinitionid)) {
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
model.setProcessinstanceid(processInstanceId);
|
|
|
|
|
model.setProcessdefinitionid(processdefinitionid);
|
|
|
|
|
model.setDeploymentid(deploymentid);
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
model.setTaskname(tasknme);
|
|
|
|
|
model.setStates(SystemConstantsOa.OA_STATUS_TYPE_ING);
|
|
|
|
|
//查询审批人姓名
|
|
|
|
|
String[] assignees = assignee.split(",");
|
|
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
|
|
for (String tempAssign : assignees) {
|
|
|
|
|
User user = userService.findByLoginname(tempAssign);
|
|
|
|
|
if (StringUtils.isNotBlank(stringBuffer.toString())) {
|
|
|
|
|
stringBuffer.append("," + user.getUsername());
|
|
|
|
|
} else {
|
|
|
|
|
stringBuffer.append(user.getUsername());
|
|
|
|
|
}
|
|
|
|
|
//发送消息
|
|
|
|
|
//iFlowFormMessageService.sendMsg(user.getLoginname(),model.getUsername() + SystemMessage.SYS_OA_TYPE_LEAVE + SystemMessage.SYS_OA_TO_DO,taskId,processInstanceId,fromid, CacheQyweixinConstants.OA_DISTIONARY_TYPE_MSG_SHENPI,model.getCategoryid().toString());
|
|
|
|
|
}
|
|
|
|
|
model.setAssigneename(stringBuffer.toString());
|
|
|
|
|
|
|
|
|
|
return this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean editStatesForm(String fromid, int states, String assignee) {
|
|
|
|
|
//TODO 后期修改图片的状态
|
|
|
|
|
if (StringUtils.isNotBlank(fromid)) {
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if (StringUtils.isNotBlank(assignee)) {
|
|
|
|
|
User user1 = userService.findByLoginname(assignee);
|
|
|
|
|
model.setAssigneename(user1.getUsername());
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果状态为拒绝,监听程序不改变当前状态
|
|
|
|
|
if (model.getStates().intValue() != SystemConstantsOa.OA_STATUS_TYPE_REFUSE) {
|
|
|
|
|
//判断是否为撤回
|
|
|
|
|
if (states == SystemConstantsOa.OA_STATUS_TYPE_CANCLE) {
|
|
|
|
|
model.setProcessinstanceid("");
|
|
|
|
|
model.setDeploymentid("");
|
|
|
|
|
model.setProcessdefinitionid("");
|
|
|
|
|
model.setAssigneename("");
|
|
|
|
|
model.setAssignee("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setStates(states);
|
|
|
|
|
return this.ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean endForm(String fromid, int states, String assignee, String processInstanceId, String tasknme) {
|
|
|
|
|
//TODO 后期修改图片的状态
|
|
|
|
|
if (StringUtils.isNotBlank(fromid)) {
|
|
|
|
|
OcrTaskchildPicture model = this.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
if (StringUtils.isNotBlank(assignee)) {
|
|
|
|
|
User user1 = userService.findByLoginname(assignee);
|
|
|
|
|
model.setAssigneename(user1.getUsername());
|
|
|
|
|
model.setAssignee(assignee);
|
|
|
|
|
}
|
|
|
|
|
model.setTaskname(tasknme);
|
|
|
|
|
//iFlowFormMessageService.sendMsg(model.getCreateuser(),SystemMessage.SYS_OA_TYPE_LEAVE + SystemMessage.SYS_OA_TO_CLOSE,null,processInstanceId,fromid,CacheQyweixinConstants.OA_DISTIONARY_TYPE_MSG_SHENPI_PASS,model.getCategoryid().toString());
|
|
|
|
|
//如果状态为拒绝,监听程序不改变当前状态
|
|
|
|
|
model.setStates(states);
|
|
|
|
|
return this.updateById(model);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public FlowModelVO getForm(String fromid) {
|
|
|
|
|
if (StringUtils.isNotBlank(fromid)) {
|
|
|
|
|
OcrTaskchildPicture model = this.ocrTaskchildPictureService.selectDtoById(Long.parseLong(fromid));
|
|
|
|
|
|
|
|
|
|
//查询审批人
|
|
|
|
|
if (null != model) {
|
|
|
|
|
return model.getFlowModelVO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|