Commit cbf66e2c by ilal

提交

parent 517cda10
......@@ -7,7 +7,9 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
......@@ -25,6 +27,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.sbgjj.SbgjjAdminCbry;
......@@ -59,6 +63,7 @@ import cn.timer.api.dto.sbgjj.SocialfundDto;
import cn.timer.api.dto.sbgjj.StopimmediatelyDto;
import cn.timer.api.dto.sbgjj.VerifyInsuredDto;
import cn.timer.api.dto.sbgjj.VerifyInsuredDtoListDto;
import cn.timer.api.dto.xcgl.ImportDescriptionDto;
import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
......@@ -1521,25 +1526,57 @@ public class SocialSecurityFundController {
@ApiOperationSupport(order = 40)
public Result<Object> Verifytheinsured(@CurrentUser UserBean userBean,@RequestBody VerifyInsuredDtoListDto verinlist) {
int toinsert = 0;//新增
int toupdate = 0;//更新
int failure = 0;//失败
List<Map<String, String>> reasons = Lists.newArrayList();
List<YgglMainEmp> ygs = new ArrayList<YgglMainEmp>();
VerifyInsuredDto[] verin = verinlist.getVerin();
if(verin.length>0){
for(int n=0;n<verin.length;n++){
YgglMainEmp yg = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getName, verin[n].getEmpname()).eq(YgglMainEmp::getPhone, verin[n].getPhone())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(yg != null) {
YgglMainEmp ygl = YgglMainEmp.builder().build();
ygl.setName(yg.getName());
ygl.setEmpNum(yg.getEmpNum());
ygs.add(ygl);
Map<String, String> map = Maps.newHashMap();
String name = verin[n].getEmpname();
try {
YgglMainEmp yg = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getName, verin[n].getEmpname()).eq(YgglMainEmp::getPhone, verin[n].getPhone())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(yg != null) {
YgglMainEmp ygl = YgglMainEmp.builder().build();
ygl.setName(yg.getName());
ygl.setEmpNum(yg.getEmpNum());
ygs.add(ygl);
toinsert++;
}else {
failure++;
map.put("name", name);
map.put("msg", "该员工不存在");
reasons.add(map);
}
} catch (Exception e) {
failure++;
map.put("name", name);
map.put("msg", StringUtils.isBlank(e.getMessage()) ? "必填数据出现空值" : e.getMessage());
reasons.add(map);
}
}
}
return ResultUtil.data(ygs, "成功");
ImportDescriptionDto imds = new ImportDescriptionDto();
imds.setSuccess(toinsert + toupdate);//成功
imds.setToinsert(toinsert);
imds.setToupdate(toupdate);//更新
imds.setFailure(failure);//失败
imds.setReasons(reasons);
// return ResultUtil.data(ygs, "成功");
return ResultUtil.datas(ygs, imds, "成功");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment