Authored by mingdan.ge

cps批量拒绝申请

... ... @@ -25,6 +25,7 @@ import com.yoho.unions.server.service.IUnionShareService;
import com.yoho.unions.utils.DateUtils;
import com.yoho.unions.utils.ImagesHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.SetUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -331,19 +332,53 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
@Override
public int refuseApply(IdOrIdsBo req){
logger.info("refuseApply,req is {}", req);
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
logger.info("refuseApply end,selectByPrimaryKey null,req is {}", req);
return 0;
if (req.getId() != null) {
logger.info("refuseApply,id opt,req is {}", req);
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
logger.info("refuseApply end,selectByPrimaryKey null,req is {}", req);
return 0;
}
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(new HashSet<Integer>(){{add(req.getId());}},1,3, DateUtil.getCurrentTimeSecond());
if (result == 0) {
logger.info("refuseApply,updateStatus null,req is {}", req);
return 0;
}
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
return result;
} else {
//批量拒绝
logger.info("refuseApply,ids opt,req is {}", req);
Set<Integer> idSet =getSetFromIds(req.getIds());
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(idSet,1,3, DateUtil.getCurrentTimeSecond());
if (result == 0) {
logger.info("refuseApply,updateStatus null,req is {}", req);
return 0;
}
logger.info("refuseApply,updateStatus num is {}", result);
List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(idSet);
if (CollectionUtils.isEmpty(unionShareUserApplies)) {
logger.info("refuseApply,selectByIds null,req is {}", req);
return 0;
}
int[] uids = unionShareUserApplies.stream().mapToInt(UnionShareUserApply::getUid).toArray();
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),uids);
return result;
}
UnionShareUserApply updateReq = new UnionShareUserApply();
updateReq.setId(req.getId());
updateReq.setStatus((byte) 3);//状态:1-申请中,2-通过,3-拒绝
updateReq.setCheckTime(DateUtil.getCurrentTimeSecond());
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
return result;
}
private Set<Integer> getSetFromIds(String ids) {
Set<Integer> idSet = Arrays.stream(ids.split(",")).map(s->{
Integer skn = null;
try {
skn = Integer.valueOf(s);
} catch (NumberFormatException e) {
}
return skn;
}).collect(Collectors.toSet());
return idSet;
}
/**
* 通过用户申请
... ... @@ -362,30 +397,20 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
logger.info("agreeApply,selectByPrimaryKey null,req is {}", req);
return 0;
}
UnionShareUserApply updateReq = new UnionShareUserApply();
updateReq.setId(req.getId());
updateReq.setStatus((byte) 2);//状态:1-申请中,2-通过,3-拒绝
updateReq.setCheckTime(DateUtil.getCurrentTimeSecond());
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(new HashSet<Integer>(){{add(req.getId());}},1,2, DateUtil.getCurrentTimeSecond());
if (result > 0) {
// 绑定unionType
relateUnionType(unionShareUserApply.getUid(),updateReq.getId());
relateUnionType(unionShareUserApply.getUid(),req.getId());
}
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
return result;
} else {
//批量通过
logger.info("agreeApply,ids opt,req is {}", req);
//批量操作
Set<Integer> idSet = Arrays.stream(req.getIds().split(",")).map(s->{
Integer skn = null;
try {
skn = Integer.valueOf(s);
} catch (NumberFormatException e) {
}
return skn;
}).collect(Collectors.toSet());
Set<Integer> idSet =getSetFromIds(req.getIds());
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(idSet,1,2, currentTimeSecond);
if (result == 0) {
logger.info("agreeApply,updateStatus null,req is {}", req);
... ... @@ -421,14 +446,13 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
if (null != unionShareUser1) {
logger.info("relateUnionType,uid is {},has unionType,record is {}", uid,unionShareUser1);
//用户已绑定生成unionType
//todo 直接返回成功
//直接返回成功
//是否删除:1-正常,0-删除
if (unionShareUser1.getStatus() == 0) {
//todo 目前没有删除操作,不会存在这个情况
}
if (unionShareUser1.getApplyId() == null || unionShareUser1.getApplyId() == 0) {
}
// if (unionShareUser1.getStatus() == 0) {
//目前没有删除操作,不会存在这个情况
// }
// if (unionShareUser1.getApplyId() == null || unionShareUser1.getApplyId() == 0) {
// }
return;
}
... ... @@ -454,7 +478,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareUser.setCreateTime(DateUtil.getCurrentTimeSecond());
unionShareUser.setUpdateTime(unionShareUser.getCreateTime());
unionShareUser.setApplyId(applyId);
unionShareUserMapper.insertSelective(unionShareUser);
int result = unionShareUserMapper.insertSelective(unionShareUser);
if (result > 0) {
logger.info("relateUnionType,begin to send message,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
//todo 发送联盟用户申请成功短信
}
}
public MktMarketingUrl buildMktMarketingUrl(int uid) {
... ... @@ -994,8 +1022,15 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
private void queryUidActivity() {
List<UnionShareOrdersActivity> activities=unionShareOrdersActivityMapper.selectByDate(DateUtil.getCurrentTimeSecond());
}
//todo 查询可参加的活动
private void getActivity() {
}
//todo 判断是否达标
private boolean canJoin(){
return false;
}
//todo 汇总月统计数据
/**
... ...
... ... @@ -45,6 +45,7 @@
</input>
<a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
<a id="passButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">批量通过</a>
<a id="refuseButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">批量拒绝</a>
<a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a>
</div>
</form>
... ... @@ -217,7 +218,7 @@
function refuse(id) {
var paramObj={};
if(id==null) {
paramObj.idArray = checkedItems;
paramObj.ids = checkedItems.toString();
}else {
paramObj.id = id;
}
... ... @@ -279,6 +280,15 @@
pass(null);
}
});
$("#refuseButton").linkbutton({
onClick : function() {
if (checkedItems.length == 0) {
$.messager.alert('提示','请选择要拒绝的数据');
return;
}
refuse(null);
}
});
$("#exportButton").linkbutton({
onClick : function() {
... ...