Commit 0fcb3aa0 by 翁国栋

8小时后台,单人替换

parent 18a4d8f3
......@@ -15,6 +15,7 @@ import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.dto.insure.InsureUserDto;
import cn.timer.api.dto.insure.PlansDto;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.dto.spmk.User;
import cn.timer.api.utils.*;
import com.alibaba.druid.util.Base64;
import com.aliyun.oss.common.utils.StringUtils;
......@@ -985,6 +986,110 @@ public class InsureContorll {
return ResultUtil.data(selectUserList, "导入成功");
}
@PostMapping(value = "/importUserClient")
@ApiOperation(value = "导入用户--8小时后台", httpMethod = "POST", notes = "导入用户")
public Result<Object> importUserClient(@CurrentUser UserBean userBean, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById();
if (company == null) {
return ResultUtil.error("该企业不存在");
}
if (file.getSize() <= 0) {
return ResultUtil.error("请上传文件");
}
List<YgglMainEmp> yg = Lists.newArrayList();
List<YgglMainEmp> selectUserList=Lists.newArrayList();
List<YgglMainEmp> allList=Lists.newArrayList();
try {
XSSFWorkbook xw = new XSSFWorkbook(file.getInputStream());
XSSFSheet sheetAt = xw.getSheetAt(0);
//默认第一行为标题行,i = 0
XSSFRow titleRow = sheetAt.getRow(0);
YgglMainEmp y;
// 循环获取每一行数据
for (int i = 1; i < sheetAt.getPhysicalNumberOfRows(); i++) {
XSSFRow row = sheetAt.getRow(i);
y = YgglMainEmp.builder().build();
y.setOrgCode(userBean.getOrgCode());
// 读取每一格内容
for (int index = 0; index < row.getPhysicalNumberOfCells(); index++) {
XSSFCell titleCell = titleRow.getCell(index);
XSSFCell cell = row.getCell(index);
cell.setCellType(CellType.STRING);
if (cell.getStringCellValue().equals("")) {
continue;
}
switch (ExcelUtils.getString(titleCell)) {
case "姓名(必填)":
y.setName(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
break;
case "手机号":
y.setPhone(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
break;
// case "性别":
// y.setSex(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
// break;
// case "证件类型":
// y.setZjType(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
// break;
case "证件号(必填)":
String idNo = Optional.ofNullable(ExcelUtils.getString(cell)).orElse("");
if (Strings.isNullOrEmpty(idNo) && idNo.length() != 18) {
return ResultUtil.error(y.getName() + "身份证格式不正确");
}
if (!idNo.matches("^(\\d{6})(\\d{4})(\\d{2})(\\d{2})(\\d{3})([0-9]|X)$")) {
return ResultUtil.error(y.getName() + "身份证格式不正确");
}
try {
y.setBirthday(dtf.parse(idNo.substring(6, 14)));
} catch (ParseException e) {
e.printStackTrace();
}
y.setZjNum(idNo);
break;
// case "工作性质":
// y.setJobType(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
// break;
// case "试用期":
// y.setSyq(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
// break;
// case "入职日期":
// y.setRzTime(Optional.ofNullable(ExcelUtils.getString(cell)).orElse(""));
// break;
default:
break;
}
}
if (StringUtils.isNullOrEmpty(y.getName()) || StringUtils.isNullOrEmpty(y.getZjNum())) {
continue;
}
yg.add(y);
}
List<YgglMainEmp> userList = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
List<String> idNumList = userList.stream().map(YgglMainEmp::getZjNum).collect(Collectors.toList());
List<YgglMainEmp> newList = yg.stream().filter(v -> !idNumList.contains(v.getZjNum())).collect(Collectors.toList());
if (newList.size() > 0) {
newList.forEach(u -> u.insert());
}
allList=ygglMainEmpMapper.selectListByIZjNum(yg.stream().map(YgglMainEmp::getZjNum).toArray(String[]::new),company.getId());
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());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
} catch (IOException e) {
e.printStackTrace();
}
List<String> message =allList.stream().filter(s->s.getIsInsure()==1).map(YgglMainEmp::getName).collect(Collectors.toList());
if(message.size()>0){
return ResultUtil.data(selectUserList, JSONObject.toJSONString(message)+"已投过保");
}
return ResultUtil.data(selectUserList, "导入成功");
}
@PostMapping(value = "/importPolicy")
@ApiOperation(value = "导入保单--运营后台", httpMethod = "POST", notes = "导入用户")
public Result<Object> importPolicy(@RequestParam("file") MultipartFile file, @RequestParam("productId") String productId) {
......
......@@ -5,6 +5,7 @@
*/
package cn.timer.api.controller.yggl;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -2079,7 +2080,7 @@ public class YgglController {
@PostMapping(value = "/addLzyy")
@ApiOperation(value = "离职原因", httpMethod = "POST", notes = "离职原因")
public Result<Object> getUserList(@CurrentUser UserBean userBean,@RequestBody YgglEmpLzyy data) {
public Result<Object> addLzyy(@CurrentUser UserBean userBean,@RequestBody YgglEmpLzyy data) {
if(StringUtils.isEmpty(data.getValue())){
return ResultUtil.error("请输入离职原因");
}
......
......@@ -9,6 +9,7 @@ import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
......@@ -26,4 +27,6 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
List<PolicyDto> policyTotalList();
List<InsureUserDto> selectPlansListByorgCode(@Param("orgCode")Integer id);
List<InsurePolicy> selectPolicyListByStatus(@Param("date") Date date);
}
......@@ -25,6 +25,7 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> {
List<InsureUser> selectListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListByIds(@Param("array")String[] ids);
List<InsureUserDto> selectPlansListById(@Param("policyId")String id);
int updateInsure(@Param("array")Integer[] ids);
......
......@@ -347,4 +347,10 @@
iu.benefit_basic_plan,
iu.benefit_occupation_category
</select>
<select id="selectPolicyListByStatus" resultType="cn.timer.api.bean.insure.InsurePolicy">
select * from insure_policy
where status = 1 and
policy_date_end <![CDATA[ < ]]> #{date}
</select>
</mapper>
......@@ -378,4 +378,15 @@
group by benefit_basic_plan, benefit_occupation_category
</select>
<update id="updateInsure">
UPDATE insure_user
<set>
status = 2,
insure_status=2
</set>
WHERE policy_id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>
......@@ -251,6 +251,7 @@
<!-- 查询员工信息 搜索 分页 -->
<select id="queryEmpMessage" resultType="cn.timer.api.dto.yggl.YgQueryDto">
SELECT
a.id id,
a.name empName,
a.emp_num empNum,
b.name deptName,
......
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