|
|
@@ -102,7 +102,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
prd.setMainStatus(1);
|
|
|
}else {
|
|
|
prd.setMainStatus(0);
|
|
|
- if(in.getPublicType()==null||in.getPublicType()==0)in.setPublicType(1);
|
|
|
}
|
|
|
prd.setPrid(in.getId());
|
|
|
prd.setUid(s);
|
|
|
@@ -127,15 +126,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
publicReleaseDetailsMapper.insertBatch(prdList);
|
|
|
}
|
|
|
String userNames=str.substring(0,str.length()-1);
|
|
|
- PublicRelease upName=new PublicRelease();
|
|
|
- upName.setId(in.getId());
|
|
|
- upName.setUserNames(userNames);
|
|
|
- if (in.getPublicType()==1){
|
|
|
- upName.setPublicType(1);
|
|
|
- }
|
|
|
+ in.setUserNames(userNames);
|
|
|
addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
|
|
|
Map<String, Object> map=addPublicReleaseLog(my, in,userNames,date,users);
|
|
|
- publicReleaseMapper.updateByPrimaryKeySelective(upName);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@@ -195,9 +188,11 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
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);
|
|
|
+ if(in.getPublicType()==null|| in.getPublicType()==0)in.setPublicType(1);
|
|
|
+ }
|
|
|
pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
|
|
|
status.set(0);
|
|
|
}
|
|
|
@@ -216,6 +211,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
if (status.get()==1){
|
|
|
pushNoticeAndSoucketAndEmail(my, in, date, a, str, map);
|
|
|
}
|
|
|
+ publicReleaseMapper.updateByPrimaryKeySelective(in);
|
|
|
map.put("data", publicReleaseMapper.selectDtails(in.getId()));
|
|
|
return map;
|
|
|
}
|
|
|
@@ -366,7 +362,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
//先删除,再修改个,再新增,有利于减少计算
|
|
|
deletePRD(split,prList);
|
|
|
publicReleaseDetailsMapper.updateDistrictByPrid(in);
|
|
|
- List<User> users = addPRD(split, prList, use);
|
|
|
+ List<User> users = addPRD(split, prList, use,in);
|
|
|
|
|
|
|
|
|
return users;
|
|
|
@@ -393,10 +389,15 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
* @param prdList 修改前客户集
|
|
|
* @param use 原订单信息
|
|
|
*/
|
|
|
- private List<User> addPRD(List<String> split, List<OutPublicReleaseDetails> prdList, PublicRelease use) {
|
|
|
+ private List<User> addPRD(List<String> split, List<OutPublicReleaseDetails> prdList, PublicRelease use, InputPublicRelease in) {
|
|
|
List<PublicReleaseDetails> addPrdList=new ArrayList<>();
|
|
|
List<User> users=new ArrayList<>();
|
|
|
Integer publicType = use.getPublicType();
|
|
|
+ //计算平均
|
|
|
+ Integer userCount=split.size();
|
|
|
+ Integer index=0;
|
|
|
+ Double duration= in.getDuration();
|
|
|
+ double d = durationSum(duration,userCount );
|
|
|
for (String s : split) {
|
|
|
User u=userMapper.selectByPrimaryKey(s);
|
|
|
users.add(u);
|
|
|
@@ -410,8 +411,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
if (longitude==null)longitude=prd.getLongitude();
|
|
|
if (s.equals(prd.getUid())){
|
|
|
flag=false;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+ //计算下
|
|
|
if (flag){
|
|
|
PublicReleaseDetails prd=new PublicReleaseDetails();
|
|
|
if (u!=null&&u.getShareType()==2){
|
|
|
@@ -432,10 +435,42 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
prd.setLongitude(longitude);
|
|
|
prd.setClockIn(0);
|
|
|
addPrdList.add(prd);
|
|
|
+ //设置时长
|
|
|
+ if (index<userCount){
|
|
|
+ if (in.getDuration()==0){
|
|
|
+ prd.setDuration(in.getDuration());
|
|
|
+ } else {
|
|
|
+ prd.setDuration(d);
|
|
|
+ duration=duration-d;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ prd.setDuration(duration);
|
|
|
+ }
|
|
|
+ index++;
|
|
|
if (!use.getAid().equals(u.getAid())){
|
|
|
addPublicExamine(use.getId(), u.getAid());
|
|
|
if (publicType==1)publicType=1;
|
|
|
}
|
|
|
+ }else {
|
|
|
+ InputPublicRelease inp=new InputPublicRelease();
|
|
|
+ inp.setId(in.getId());
|
|
|
+ inp.setUid(s);
|
|
|
+ PublicReleaseDetails publicReleaseDetails = publicReleaseDetailsMapper.selectBypridAndUid(inp);
|
|
|
+ PublicReleaseDetails newprd =new PublicReleaseDetails();
|
|
|
+ newprd.setId(publicReleaseDetails.getId());
|
|
|
+ //设置时长
|
|
|
+ if (index<userCount){
|
|
|
+ if (in.getDuration()==0){
|
|
|
+ newprd.setDuration(in.getDuration());
|
|
|
+ } else {
|
|
|
+ newprd.setDuration(d);
|
|
|
+ duration=duration-d;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ newprd.setDuration(duration);
|
|
|
+ }
|
|
|
+ publicReleaseDetailsMapper.updateByPrimaryKeySelective(newprd);
|
|
|
+ index++;
|
|
|
}
|
|
|
}
|
|
|
StringBuffer str=new StringBuffer();
|