Commit d3514219 by ilal Committed by chenzg

提交

parent caf5d867
......@@ -1519,95 +1519,105 @@ public class SalaryManagementController {
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getName, file.getEmpname()).eq(YgglMainEmp::getPhone, file.getPhone())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(emp != null) {
//0:定薪 1:调薪
if(file.getSfdx() == 0) {
XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build();
xzdadx.setUserid(emp.getEmpNum());//用户id
xzdadx.setSxrq(file.getSxrq());//生效日期
xzdadx.setAddtime(new Date().getTime());
xzdadx.setRemarks("");
xzdadx.setQyid(userBean.getOrgCode());
xzdadx.setTxzt(0);//0:使用中;1:历史, 2: 未生效
xcglassoxzdadxmapper.xzdadxinsert(xzdadx);
int zdyid = xzdadx.getId();
List<XcglAssoXzdaz> xzdazlist=new ArrayList<XcglAssoXzdaz>();
CustomDto[] cus = file.getCus();
List<XcglAssoXzdazdy> xzs = XcglAssoXzdazdy.builder().build().selectList(new QueryWrapper<XcglAssoXzdazdy>().lambda().eq(XcglAssoXzdazdy::getQyid, userBean.getOrgCode()));
for(XcglAssoXzdazdy xz : xzs) {
XcglAssoXzdaz xzdaz = XcglAssoXzdaz.builder().build();
xzdaz.setXzdazdyid(xz.getId());//薪资档案自定义id
xzdaz.setRsz("0");//输入值
xzdaz.setXzdadxid(zdyid);//薪资档案-定薪id
xzdaz.insert();
}
if(file.getSxrq().length() == 10) {
if(cus.length>0){
for(int p=0;p<cus.length;p++){
XcglAssoXzdaz.builder().build().delete(new QueryWrapper<XcglAssoXzdaz>().lambda().eq(XcglAssoXzdaz::getXzdazdyid, cus[p].getId()).eq(XcglAssoXzdaz::getXzdadxid, zdyid));
XcglAssoXzdaz xzdaz = new XcglAssoXzdaz();
xzdaz.setXzdazdyid(cus[p].getId());//薪资档案自定义id
xzdaz.setRsz(cus[p].getVal());//输入值
//0:定薪 1:调薪
if(file.getSfdx() == 0) {
XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build();
xzdadx.setUserid(emp.getEmpNum());//用户id
xzdadx.setSxrq(file.getSxrq().replace("/", "-"));//生效日期
xzdadx.setAddtime(new Date().getTime());
xzdadx.setRemarks("");
xzdadx.setQyid(userBean.getOrgCode());
xzdadx.setTxzt(0);//0:使用中;1:历史, 2: 未生效
xcglassoxzdadxmapper.xzdadxinsert(xzdadx);
int zdyid = xzdadx.getId();
List<XcglAssoXzdaz> xzdazlist=new ArrayList<XcglAssoXzdaz>();
CustomDto[] cus = file.getCus();
List<XcglAssoXzdazdy> xzs = XcglAssoXzdazdy.builder().build().selectList(new QueryWrapper<XcglAssoXzdazdy>().lambda().eq(XcglAssoXzdazdy::getQyid, userBean.getOrgCode()));
for(XcglAssoXzdazdy xz : xzs) {
XcglAssoXzdaz xzdaz = XcglAssoXzdaz.builder().build();
xzdaz.setXzdazdyid(xz.getId());//薪资档案自定义id
xzdaz.setRsz("0");//输入值
xzdaz.setXzdadxid(zdyid);//薪资档案-定薪id
xzdazlist.add(xzdaz);
xzdaz.insert();
}
}
if(xzdazlist.size()>0){
xcglassoxzdazmapper.insertxcglassoxzdazList(xzdazlist);
}
toinsert++;
}else {
// 当前日期
String curDate = DateUtil.getStringFormat(new Date().getTime());
// 未生效的调薪记录同一天只能有一条
XcglAssoXzdadx tmp = new LambdaQueryChainWrapper<XcglAssoXzdadx>(xcglassoxzdadxmapper)
.eq(XcglAssoXzdadx::getUserid, emp.getEmpNum())
.eq(XcglAssoXzdadx::getTxzt, 2)
.eq(XcglAssoXzdadx::getSxrq, file.getSxrq())
.one();
if (!Objects.isNull(tmp)) {
return ResultUtil.error("调薪成功失败, 已存在生效日期" + file.getSxrq() + "的待生效记录, 请到调薪记录页面查看!");
}
int txzt = 2;
if (DateUtil.getFormat(file.getSxrq()) <= DateUtil.getFormat(curDate)) {
// 生效日期在当天或之前的, 立即生效, 原使用中的记录变成历史记录
XcglAssoXzdadx xzds = new LambdaQueryChainWrapper<XcglAssoXzdadx>(xcglassoxzdadxmapper)
if(cus.length>0){
for(int p=0;p<cus.length;p++){
XcglAssoXzdaz.builder().build().delete(new QueryWrapper<XcglAssoXzdaz>().lambda().eq(XcglAssoXzdaz::getXzdazdyid, cus[p].getId()).eq(XcglAssoXzdaz::getXzdadxid, zdyid));
XcglAssoXzdaz xzdaz = new XcglAssoXzdaz();
xzdaz.setXzdazdyid(cus[p].getId());//薪资档案自定义id
xzdaz.setRsz(cus[p].getVal());//输入值
xzdaz.setXzdadxid(zdyid);//薪资档案-定薪id
xzdazlist.add(xzdaz);
}
}
if(xzdazlist.size()>0){
xcglassoxzdazmapper.insertxcglassoxzdazList(xzdazlist);
}
toinsert++;
}else {
// 当前日期
String curDate = DateUtil.getStringFormat(new Date().getTime());
// 未生效的调薪记录同一天只能有一条
XcglAssoXzdadx tmp = new LambdaQueryChainWrapper<XcglAssoXzdadx>(xcglassoxzdadxmapper)
.eq(XcglAssoXzdadx::getUserid, emp.getEmpNum())
.eq(XcglAssoXzdadx::getTxzt, 0)
.eq(XcglAssoXzdadx::getTxzt, 2)
.eq(XcglAssoXzdadx::getSxrq, file.getSxrq())
.one();
if(xzds != null) {
XcglAssoXzdadx txrz = XcglAssoXzdadx.builder().build();
txrz.setTxzt(1);//0:使用中;1:历史, 2: 未生效
txrz.setId(xzds.getId());
txrz.updateById();
if (!Objects.isNull(tmp)) {
return ResultUtil.error("调薪成功失败, 已存在生效日期" + file.getSxrq() + "的待生效记录, 请到调薪记录页面查看!");
}
txzt = 0;
}
XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build();
xzdadx.setUserid(emp.getEmpNum());//用户id
xzdadx.setSxrq(file.getSxrq());//生效日期
xzdadx.setAddtime(new Date().getTime());
xzdadx.setXgyhid(userBean.getEmpNum());//修改用户id
xzdadx.setRemarks("");
xzdadx.setQyid(userBean.getOrgCode());
xzdadx.setTxzt(txzt);
xcglassoxzdadxmapper.xzdadxinsert(xzdadx);
int zdyid = xzdadx.getId();
List<XcglAssoXzdaz> xzdazlist=new ArrayList<XcglAssoXzdaz>();
CustomDto[] cus = file.getCus();
if(cus.length>0){
for(int p=0;p<cus.length;p++){
XcglAssoXzdaz xzdaz = new XcglAssoXzdaz();
xzdaz.setXzdazdyid(cus[p].getId());//薪资档案自定义id
xzdaz.setRsz(cus[p].getVal());//输入值
xzdaz.setXzdadxid(zdyid);//薪资档案-定薪id
xzdazlist.add(xzdaz);
int txzt = 2;
if (DateUtil.getFormat(file.getSxrq()) <= DateUtil.getFormat(curDate)) {
// 生效日期在当天或之前的, 立即生效, 原使用中的记录变成历史记录
XcglAssoXzdadx xzds = new LambdaQueryChainWrapper<XcglAssoXzdadx>(xcglassoxzdadxmapper)
.eq(XcglAssoXzdadx::getUserid, emp.getEmpNum())
.eq(XcglAssoXzdadx::getTxzt, 0)
.one();
if(xzds != null) {
XcglAssoXzdadx txrz = XcglAssoXzdadx.builder().build();
txrz.setTxzt(1);//0:使用中;1:历史, 2: 未生效
txrz.setId(xzds.getId());
txrz.updateById();
}
txzt = 0;
}
XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build();
xzdadx.setUserid(emp.getEmpNum());//用户id
xzdadx.setSxrq(file.getSxrq());//生效日期
xzdadx.setAddtime(new Date().getTime());
xzdadx.setXgyhid(userBean.getEmpNum());//修改用户id
xzdadx.setRemarks("");
xzdadx.setQyid(userBean.getOrgCode());
xzdadx.setTxzt(txzt);
xcglassoxzdadxmapper.xzdadxinsert(xzdadx);
int zdyid = xzdadx.getId();
List<XcglAssoXzdaz> xzdazlist=new ArrayList<XcglAssoXzdaz>();
CustomDto[] cus = file.getCus();
if(cus.length>0){
for(int p=0;p<cus.length;p++){
XcglAssoXzdaz xzdaz = new XcglAssoXzdaz();
xzdaz.setXzdazdyid(cus[p].getId());//薪资档案自定义id
xzdaz.setRsz(cus[p].getVal());//输入值
xzdaz.setXzdadxid(zdyid);//薪资档案-定薪id
xzdazlist.add(xzdaz);
}
}
if(xzdazlist.size()>0){
xcglassoxzdazmapper.insertxcglassoxzdazList(xzdazlist);
}
toinsert++;
}
if(xzdazlist.size()>0){
xcglassoxzdazmapper.insertxcglassoxzdazList(xzdazlist);
}
toinsert++;
}else {
failure++;
map.put("name", name);
map.put("msg", "日期格式不对(Excel中输入时间处设置为“短日期”即可)");
reasons.add(map);
}
}else {
failure++;
......
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