|
|
@@ -78,17 +78,24 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
// in.setAssistAidName(getAssistAidName(in.getAssistAid()));
|
|
|
in.setMainName(my.getName());
|
|
|
}
|
|
|
+ Map checkOrderNo = checkOrderNoDuration(in);
|
|
|
+ boolean isValid = (boolean) checkOrderNo.get("code");
|
|
|
+ if (isValid){
|
|
|
+ in.setTechStartProcess(0);
|
|
|
+ }else {
|
|
|
+ in.setTechStartProcess(1);
|
|
|
+ }
|
|
|
publicReleaseMapper.insertSelective(in);
|
|
|
List<PublicReleaseDetails> prdList=new ArrayList<>();
|
|
|
List<User> users=new ArrayList<>();
|
|
|
- StringBuffer str =new StringBuffer();
|
|
|
+ StringBuilder str =new StringBuilder();
|
|
|
if (in.getUids()!=null){
|
|
|
List<String> split = Arrays.asList(in.getUids().split(","));
|
|
|
int userCount=split.size();
|
|
|
Double duration = in.getDuration();
|
|
|
//计算平均
|
|
|
double d = durationSum(duration, userCount);
|
|
|
- Integer index=1;
|
|
|
+ int index=1;
|
|
|
//获取非已企业公出需要的审核人员
|
|
|
for (String s : split) {
|
|
|
PublicReleaseDetails prd=new PublicReleaseDetails();
|
|
|
@@ -130,8 +137,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
String userNames=str.substring(0,str.length()-1);
|
|
|
in.setUserNames(userNames);
|
|
|
addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
|
|
|
- Map<String, Object> map=addPublicReleaseLog(my, in,userNames,date,users);
|
|
|
- return map;
|
|
|
+ return (Map<String, Object>) addPublicReleaseLog(my, in,userNames,date,users,checkOrderNo);
|
|
|
}
|
|
|
|
|
|
private void addPublicExamine(Integer id, String aid) {
|
|
|
@@ -175,53 +181,78 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
* @param nickname 客户名称
|
|
|
* @param date 时间
|
|
|
*/
|
|
|
- private Map<String, Object> addPublicReleaseLog(AdminListBo my,PublicRelease in,String nickname,Date date,List<User> users) {
|
|
|
- //获取公出审核人
|
|
|
- Admin a=adminMapper.selectByPrimaryKey(my.getReviewer());
|
|
|
- String str="["+my.getName()+"]发起["+nickname+"]的外出申请,请及时审核。";
|
|
|
- //默认上级审核
|
|
|
- AtomicReference<Integer> status= new AtomicReference<>(1);
|
|
|
- String formatDate = DateUtils.formatDate(in.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
|
|
|
- Map<String, Object>map=new HashMap<String, Object>();
|
|
|
- //不是业务员
|
|
|
- if (in.getType()==0){
|
|
|
- if (my.getPublicPurview()==0){
|
|
|
- users.forEach(u->{
|
|
|
- if (!u.getAid().equals(my.getId())){
|
|
|
- StringBuffer str2=new StringBuffer();
|
|
|
- str2=str2.append(my.getName()).append("(需审核),准备公出您的企业");
|
|
|
- str2=str2.append("[").append(u.getNickname()).append("]!!!。");
|
|
|
- sendEmailAndNoticeAndSoucket(u.getAid(),3,str2.toString());
|
|
|
- Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
|
|
|
- if (in.getType()==0){
|
|
|
- //不是自己的企业则需要审核并设置非自己客户待审核
|
|
|
- addPublicExamine(in.getId(), admin);
|
|
|
- if(in.getPublicType()==null|| in.getPublicType()==0)in.setPublicType(1);
|
|
|
+ private Map<String, Object> addPublicReleaseLog(AdminListBo my,PublicRelease in,String nickname,Date date,List<User> users,
|
|
|
+ Map<String,Object> checkOrderNo) {
|
|
|
+ Map<String, Object>map=new HashMap<String, Object>();
|
|
|
+ //无需订单负责人审核
|
|
|
+ if (in.getTechStartProcess()==0){
|
|
|
+ //获取公出审核人
|
|
|
+ Admin a=adminMapper.selectByPrimaryKey(my.getReviewer());
|
|
|
+ String str="["+my.getName()+"]发起["+nickname+"]的外出申请,请及时审核。";
|
|
|
+ //默认上级审核
|
|
|
+ AtomicReference<Integer> status= new AtomicReference<>(1);
|
|
|
+ String formatDate = DateUtils.formatDate(in.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
|
|
|
+ //不是业务员
|
|
|
+ if (in.getType()==0){
|
|
|
+ if (my.getPublicPurview()==0){
|
|
|
+ users.forEach(u->{
|
|
|
+ if (!u.getAid().equals(my.getId())){
|
|
|
+ StringBuffer str2=new StringBuffer();
|
|
|
+ str2=str2.append(my.getName()).append("(需审核),准备公出您的企业");
|
|
|
+ str2=str2.append("[").append(u.getNickname()).append("]!!!。");
|
|
|
+ sendEmailAndNoticeAndSoucket(u.getAid(),3,str2.toString());
|
|
|
+ Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
|
|
|
+ if (in.getType()==0){
|
|
|
+ //不是自己的企业则需要审核并设置非自己客户待审核
|
|
|
+ addPublicExamine(in.getId(), admin);
|
|
|
+ if(in.getPublicType()==null|| in.getPublicType()==0)in.setPublicType(1);
|
|
|
+ }
|
|
|
+ pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
|
|
|
+ status.set(0);
|
|
|
}
|
|
|
- pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
|
|
|
- status.set(0);
|
|
|
- }
|
|
|
- });
|
|
|
- }else {
|
|
|
- users.forEach(u->{
|
|
|
- if (!u.getAid().equals(my.getId())){
|
|
|
- StringBuffer str2=new StringBuffer();
|
|
|
- str2=str2.append(my.getName()).append("计划公出您的企业").append(u.getNickname())
|
|
|
- .append(",").append(formatDate).append("【小程序端广播提示】");
|
|
|
- sendNoticeAndSoucket(u.getAid(),3,str2.toString());
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ users.forEach(u->{
|
|
|
+ if (!u.getAid().equals(my.getId())){
|
|
|
+ StringBuffer str2=new StringBuffer();
|
|
|
+ str2=str2.append(my.getName()).append("计划公出您的企业").append(u.getNickname())
|
|
|
+ .append(",").append(formatDate).append("【小程序端广播提示】");
|
|
|
+ sendNoticeAndSoucket(u.getAid(),3,str2.toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (status.get()==1){
|
|
|
+ pushNoticeAndSoucketAndEmail(my, in, date, a, str, map);
|
|
|
}
|
|
|
- }
|
|
|
- if (status.get()==1){
|
|
|
- pushNoticeAndSoucketAndEmail(my, in, date, a, str, map);
|
|
|
- }
|
|
|
publicReleaseMapper.updateByPrimaryKeySelective(in);
|
|
|
- map.put("data", publicReleaseMapper.selectDtails(in.getId()));
|
|
|
+ }else {
|
|
|
+ TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(in.getOrderNo());
|
|
|
+ String salesmanId = tOrderNew.getSalesmanId();
|
|
|
+ Admin a = adminMapper.selectByPrimaryKey(salesmanId);
|
|
|
+ CheckOrderNoOut data = (CheckOrderNoOut) checkOrderNo.get("data");
|
|
|
+ String format = getString(my, data);
|
|
|
+ pushNoticeAndSoucketAndEmail(my, in, date, a, format, map);
|
|
|
+ }
|
|
|
+ map.put("data", publicReleaseMapper.selectDtails(in.getId()));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ private String getString(AdminListBo my, CheckOrderNoOut data) {
|
|
|
+ String amountName="";
|
|
|
+ if (data.getAmountType()==0)amountName="低于1万";
|
|
|
+ if (data.getAmountType()==1)amountName="在1~3万";
|
|
|
+ if (data.getAmountType()==2)amountName="在3~5万";
|
|
|
+ if (data.getAmountType()==3)amountName="在5~10万";
|
|
|
+ String format = String.format("%s准备公出%s(%s)," +
|
|
|
+ "总计公出:%s人,%s次,%s时。本合同%s,本次公出申请,已超出%s小时。超出公出时长,将计入您的第三方成本," +
|
|
|
+ "从奖金计算基数中扣除!请确认是否同意本次公出?", my.getName(), data.getUserName(), data.getContractNo(),
|
|
|
+ data.getPeopleCount(), data.getTimesCount(), data.getDurationCount().stripTrailingZeros(), amountName,
|
|
|
+ data.getDurationMax());
|
|
|
+ return format;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param my 发送人信息
|
|
|
@@ -346,9 +377,20 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
publicExamineMapper.updateByPridSelective(pe);
|
|
|
}
|
|
|
AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
|
|
|
-
|
|
|
+ Map checkOrderNo=new HashMap();
|
|
|
+ if (in.getType()==1){
|
|
|
+ checkOrderNo = checkOrderNoDuration(in);
|
|
|
+ boolean isValid = (boolean) checkOrderNo.get("code");
|
|
|
+ if (isValid){
|
|
|
+ in.setTechStartProcess(0);
|
|
|
+ }else {
|
|
|
+ in.setTechStartProcess(1);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ in.setTechStartProcess(0);
|
|
|
+ }
|
|
|
//重新发起
|
|
|
- addPublicReleaseLog(my,in,in.getUserNames(),date,uses);
|
|
|
+ addPublicReleaseLog(my,in,in.getUserNames(),date,uses,checkOrderNo);
|
|
|
}else {
|
|
|
List<PublicRelease> list = publicReleaseMapper.selectByMainId(in.getId(),3,null);
|
|
|
List<PublicRelease> list2 = publicReleaseMapper.selectByMainId(in.getId(),4,null);
|