|
|
@@ -15,6 +15,7 @@ import com.goafanti.common.utils.excel.NewExcelUtil;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import com.goafanti.core.websocket.SystemWebSocketHandler;
|
|
|
import com.goafanti.customer.bo.*;
|
|
|
import com.goafanti.customer.service.CustomerService;
|
|
|
import com.goafanti.order.bo.TOrderNewBo;
|
|
|
@@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.socket.TextMessage;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
@@ -98,7 +100,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
private TOrderLogMapper tOrderLogMapper;
|
|
|
@Resource
|
|
|
private PublicExamineMapper publicExamineMapper;
|
|
|
+ @Resource
|
|
|
+ private PublicReleaseLogMapper publicReleaseLogMapper;
|
|
|
+ @Resource
|
|
|
+ private PublicReleaseMapper publicReleaseMapper;
|
|
|
+ @Autowired
|
|
|
+ private SystemWebSocketHandler systemWebSocketHandler;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AsyncUtils asyncUtils;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1288,7 +1298,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
|
|
|
addUserTransferLog(uid, aid,oldAid, type, null, now, uList);
|
|
|
//转交客户后公出审核人也切换
|
|
|
- publicExamineMapper.updateAidByAid(oldAid,aid);
|
|
|
+ transferUser(uList,aid,uid);
|
|
|
}
|
|
|
if (isUs) {
|
|
|
if (AFTConstants.USER_RECEIVE == operatorType) {
|
|
|
@@ -1302,6 +1312,45 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
return errors;
|
|
|
}
|
|
|
|
|
|
+ private void transferUser(List<String> uList, String aid, String uid) {
|
|
|
+ if(uList.isEmpty())uList.add(uid);
|
|
|
+ //先查出所有在其他审核的公出
|
|
|
+ List<PublicReleaseTransferUserBo> list=publicExamineMapper.selectByuList(uList);
|
|
|
+ Admin admin = adminMapper.selectByPrimaryKey(aid);
|
|
|
+ for (PublicReleaseTransferUserBo e : list) {
|
|
|
+ PublicExamine pe=new PublicExamine();
|
|
|
+ pe.setPrid(e.getId());
|
|
|
+ if (e.getAid().equals(aid)){
|
|
|
+ //再查比对和发起者一致的全部走入下一个审核流程
|
|
|
+ PublicReleaseLog log = new PublicReleaseLog(e.getId(), TokenManager.getAdminId(), 2, "转交客户到发起公出审核人,自动审核通过。", new Date());
|
|
|
+ publicReleaseLogMapper.insertSelective(log);
|
|
|
+ PublicRelease pr=new PublicRelease();
|
|
|
+ pr.setId(e.getId());
|
|
|
+ pr.setPublicType(0);
|
|
|
+ publicReleaseMapper.updateByPrimaryKeySelective(pr);
|
|
|
+ Admin sendAdmin=adminMapper.selectByPrimaryKey(admin.getReviewer());
|
|
|
+ systemWebSocketHandler.sendMessageToUser(sendAdmin.getId(), new TextMessage("unread"));
|
|
|
+ StringBuffer content=new StringBuffer().append("[").append(e.getUserNames()).append("]公司的外出申请已发起,请尽快审核。");
|
|
|
+ Notice n =new Notice();
|
|
|
+ n.setId(UUID.randomUUID().toString());
|
|
|
+ n.setAid(sendAdmin.getId());
|
|
|
+ n.setNoticeType(NoticeStatus.PUBLIC_RELEASE_START.getCode());
|
|
|
+ n.setContent(content.toString());
|
|
|
+ n.setReaded(0);//未读
|
|
|
+ asyncUtils.addNotice(n);
|
|
|
+ pe.setAid(sendAdmin.getId());
|
|
|
+ pe.setAname(sendAdmin.getName());
|
|
|
+ pe.setCreateTime(new Date());
|
|
|
+ }else {
|
|
|
+ //与发起者不一致的就需要修改审核人员
|
|
|
+
|
|
|
+ pe.setAid(aid);
|
|
|
+ pe.setAname(admin.getName());
|
|
|
+ }
|
|
|
+ publicExamineMapper.updateByPridSelective(pe);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void updateOrderHandOver(String uid, String aid, String oldAid) {
|
|
|
List<TOrderNewBo> list = tOrderNewMapper.selectByuidandAid(uid, oldAid);
|
|
|
for (TOrderNewBo bo : list) {
|