Commit d35a96de by 翁国栋

8小时后台--

增员替换已投保bug
parent 12265316
...@@ -61,6 +61,7 @@ import java.time.format.DateTimeFormatter; ...@@ -61,6 +61,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -796,7 +797,7 @@ public class InsureContorll { ...@@ -796,7 +797,7 @@ public class InsureContorll {
@PostMapping(value = "/importUser") @PostMapping(value = "/importUser")
@ApiOperation(value = "12.导入用户--运营后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "12.导入用户--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<Object> importUser(@RequestParam("orgCode") String orgCode, @RequestParam("file") MultipartFile file) { public Result<Object> importUser(@RequestParam("orgCode") String orgCode,@RequestParam("policyId") Integer policyId, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(orgCode)).build().selectById(); QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(orgCode)).build().selectById();
if (company == null) { if (company == null) {
...@@ -889,15 +890,25 @@ public class InsureContorll { ...@@ -889,15 +890,25 @@ public class InsureContorll {
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(String.valueOf(System.currentTimeMillis())).pw(Md5.md5(pwd)).regTime(new Date()).orgId(company.getId()).username(u.getName()).sts(CommonEnum.U_STS_ON.getType()).build(); QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(String.valueOf(System.currentTimeMillis())).pw(Md5.md5(pwd)).regTime(new Date()).orgId(company.getId()).username(u.getName()).sts(CommonEnum.U_STS_ON.getType()).build();
qyzxEmpLogin.insert(); qyzxEmpLogin.insert();
u.setEmpNum(qyzxEmpLogin.getId()); u.setEmpNum(qyzxEmpLogin.getId());
u.insert();
}); });
} }
allList = ygglMainEmpMapper.selectListByIZjNum(yg.stream().map(YgglMainEmp::getZjNum).toArray(String[]::new), company.getId()); allList = ygglMainEmpMapper.selectListByIZjNum(yg.stream().map(YgglMainEmp::getZjNum).toArray(String[]::new), company.getId());
selectUserList = allList.stream().filter(s -> s.getIsInsure() == 0).collect(Collectors.toList()); // selectUserList = allList.stream().filter(s -> s.getIsInsure() == 0).collect(Collectors.toList());
//假期规则初始化 //假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode)); List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode));
/*投保前验证人员当月是否已投保*/
InsurePolicy policy = InsurePolicy.builder().id(policyId).build().selectById();
List<InsureUser> insureUserList = insureUserMapper.selectListByIds(allList.stream().map(YgglMainEmp::getId).map(String::valueOf).toArray(String[]::new), null, new SimpleDateFormat("yyyy-MM").format(policy.getPolicyDateStart()));
if (insureUserList.size() > 0) {
String name = "";
for (InsureUser insureUser : insureUserList) {
name+=insureUser.getInsuredEContact()+',';
}
return ResultUtil.error("被保人"+name+"当月已投保");
}
} catch (IOException e) { } catch (IOException e) {
log.error("一键校验异常:", e); log.error("一键校验异常:", e);
throw new CustomException("一键校验异常"); throw new CustomException("一键校验异常");
...@@ -913,17 +924,18 @@ public class InsureContorll { ...@@ -913,17 +924,18 @@ public class InsureContorll {
} }
} }
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
if (message.size() > 0) { // List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
return ResultUtil.data(selectUserList, JSONObject.toJSONString(message) + "已投过保"); // if (message.size() > 0) {
} // return ResultUtil.data(selectUserList, JSONObject.toJSONString(message) + "已投过保");
// }
return ResultUtil.data(selectUserList, "导入成功"); return ResultUtil.data(selectUserList, "导入成功");
} }
@PostMapping(value = "/importUserClient") @PostMapping(value = "/importUserClient")
@ApiOperation(value = "13.导入用户--8小时后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "13.导入用户--8小时后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<Object> importUserClient(@CurrentUser UserBean userBean, @RequestParam("file") MultipartFile file) { public Result<Object> importUserClient(@CurrentUser UserBean userBean,@RequestParam("policyId")Integer policyId, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById(); QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById();
if (company == null) { if (company == null) {
...@@ -1015,11 +1027,21 @@ public class InsureContorll { ...@@ -1015,11 +1027,21 @@ public class InsureContorll {
newList.forEach(u -> u.insert()); newList.forEach(u -> u.insert());
} }
allList = ygglMainEmpMapper.selectListByIZjNum(yg.stream().map(YgglMainEmp::getZjNum).toArray(String[]::new), company.getId()); allList = ygglMainEmpMapper.selectListByIZjNum(yg.stream().map(YgglMainEmp::getZjNum).toArray(String[]::new), company.getId());
selectUserList = allList.stream().filter(s -> s.getIsInsure() == 0).collect(Collectors.toList()); // selectUserList = allList.stream().filter(s -> s.getIsInsure() == 0).collect(Collectors.toList());
//假期规则初始化 //假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode())); List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
/*投保前验证人员当月是否已投保*/
InsurePolicy policy = InsurePolicy.builder().id(policyId).build().selectById();
List<InsureUser> insureUserList = insureUserMapper.selectListByIds(allList.stream().map(YgglMainEmp::getId).map(String::valueOf).toArray(String[]::new), null, new SimpleDateFormat("yyyy-MM").format(policy.getPolicyDateStart()));
if (insureUserList.size() > 0) {
String name = "";
for (InsureUser insureUser : insureUserList) {
name+=insureUser.getInsuredEContact()+',';
}
return ResultUtil.error("被保人"+name+"当月已投保");
}
} catch (IOException e) { } catch (IOException e) {
log.error("导入用户:", e); log.error("导入用户:", e);
throw new CustomException("导入用户"); throw new CustomException("导入用户");
...@@ -1032,10 +1054,11 @@ public class InsureContorll { ...@@ -1032,10 +1054,11 @@ public class InsureContorll {
} }
} }
} }
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList()); //
if (message.size() > 0) { // List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
return ResultUtil.data(selectUserList, JSONObject.toJSONString(message) + "已投过保"); // if (message.size() > 0) {
} // return ResultUtil.data(selectUserList, JSONObject.toJSONString(message) + "已投过保");
// }
return ResultUtil.data(selectUserList, "导入成功"); return ResultUtil.data(selectUserList, "导入成功");
} }
...@@ -1196,9 +1219,9 @@ public class InsureContorll { ...@@ -1196,9 +1219,9 @@ public class InsureContorll {
policy.setUpdateTime(new Date()); policy.setUpdateTime(new Date());
policy.insert(); policy.insert();
} else { } else {
policy = oldPolicy;
oldPolicy.setPolicyFile(policy.getPolicyFile()); oldPolicy.setPolicyFile(policy.getPolicyFile());
policy.setUpdateTime(new Date()); policy.setUpdateTime(new Date());
policy = oldPolicy;
policy.updateById(); policy.updateById();
} }
Result<String> ossUrl = ossService.upload(policy.getId(), "policy", file); Result<String> ossUrl = ossService.upload(policy.getId(), "policy", file);
...@@ -1271,7 +1294,7 @@ public class InsureContorll { ...@@ -1271,7 +1294,7 @@ public class InsureContorll {
}finally { }finally {
if(xw!=null){ if(xw!=null){
try { try {
xw.close(); xw.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
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