Commit e917e8d0fce7a3f3d9a560406f9f4af67ec81136
1 parent
b2c710e1
1.更新分公司信息
Showing
1 changed file
with
3 additions
and
3 deletions
src/main/java/com/bsth/handler/personnelUpdateHandler.java
| @@ -291,10 +291,10 @@ public class personnelUpdateHandler { | @@ -291,10 +291,10 @@ public class personnelUpdateHandler { | ||
| 291 | }); | 291 | }); |
| 292 | } | 292 | } |
| 293 | // 根据工号关联更新姓名、公司、工种、身份证号 | 293 | // 根据工号关联更新姓名、公司、工种、身份证号 |
| 294 | - int rows = jdbcTemplate.update("update bsth_c_personnel a inner join bsth_c_employee b on a.job_code = b.job_code1 set a.personnel_name = b.employee_name,a.personnel_type = b.job_type,a.company = b.company_name,a.company_code = b.company_code,a.card = b.id_card,a.branche_company_code = b.branche_company_code,a.branche_company = b.branche_company where a.destroy = 0"); | 294 | + int rows = jdbcTemplate.update("update bsth_c_personnel a inner join bsth_c_employee b on a.job_code = b.job_code1 set a.personnel_name = b.employee_name,a.personnel_type = b.job_type,a.company = b.company_name,a.company_code = b.company_code,a.card = b.id_card,a.branche_company_code = b.branche_company_code,a.branche_company = b.branche_company,a.jd_codeori = b.job_code where a.destroy = 0"); |
| 295 | logger.info(String.format("根据工号关联更新姓名、公司、工种、身份证号,记录数%d",rows)); | 295 | logger.info(String.format("根据工号关联更新姓名、公司、工种、身份证号,记录数%d",rows)); |
| 296 | // 未匹配上工号的数据 用身份证号关联更新工号、姓名、公司、工种 | 296 | // 未匹配上工号的数据 用身份证号关联更新工号、姓名、公司、工种 |
| 297 | - rows = jdbcTemplate.update("update bsth_c_personnel a inner join bsth_c_employee b on a.card = b.id_card set a.job_code = b.job_code1,a.personnel_name = b.employee_name,a.personnel_type = b.job_type,a.company = b.company_name,a.company_code = b.company_code,a.branche_company_code = b.branche_company_code,a.branche_company = b.branche_company where a.destroy = 0 and a.job_code <> b.job_code1"); | 297 | + rows = jdbcTemplate.update("update bsth_c_personnel a inner join bsth_c_employee b on a.card = b.id_card set a.job_code = b.job_code1,a.personnel_name = b.employee_name,a.personnel_type = b.job_type,a.company = b.company_name,a.company_code = b.company_code,a.branche_company_code = b.branche_company_code,a.branche_company = b.branche_company,a.jd_codeori = b.job_code where a.destroy = 0 and a.job_code <> b.job_code1"); |
| 298 | logger.info(String.format("根据身份证号关联更新工号、姓名、公司、工种,记录数%d",rows)); | 298 | logger.info(String.format("根据身份证号关联更新工号、姓名、公司、工种,记录数%d",rows)); |
| 299 | // 可能会出现数据异常情况 如一个是最新的工号无身份证号,一个是老的工号有身份证号,最后更新的结果会造成工号和身份证号重复 | 299 | // 可能会出现数据异常情况 如一个是最新的工号无身份证号,一个是老的工号有身份证号,最后更新的结果会造成工号和身份证号重复 |
| 300 | // 将更早创建的人员信息更新为停用 | 300 | // 将更早创建的人员信息更新为停用 |
| @@ -304,7 +304,7 @@ public class personnelUpdateHandler { | @@ -304,7 +304,7 @@ public class personnelUpdateHandler { | ||
| 304 | rows = jdbcTemplate.update("update bsth_c_personnel a left join bsth_c_employee b on a.job_code = b.job_code1 set a.destroy = 1 where a.destroy = 0 and b.job_code1 is null"); | 304 | rows = jdbcTemplate.update("update bsth_c_personnel a left join bsth_c_employee b on a.job_code = b.job_code1 set a.destroy = 1 where a.destroy = 0 and b.job_code1 is null"); |
| 305 | logger.info(String.format("调度系统未匹配数据标记为停用,记录数%d",rows)); | 305 | logger.info(String.format("调度系统未匹配数据标记为停用,记录数%d",rows)); |
| 306 | // 仍未匹配上的金蝶数据作为新人员 | 306 | // 仍未匹配上的金蝶数据作为新人员 |
| 307 | - rows = jdbcTemplate.update("insert into bsth_c_personnel (job_code,personnel_name,personnel_type,company,company_code,job_codeori,branche_company_code,branche_company) select b.job_code1,b.employee_name,b.job_type,b.company_name,b.company_code,b.job_code2,b.branche_company_code,b.branche_company from bsth_c_employee b left join bsth_c_personnel a on b.job_code1 = a.job_code where a.job_code is null"); | 307 | + rows = jdbcTemplate.update("insert into bsth_c_personnel (job_code,personnel_name,personnel_type,company,company_code,job_codeori,branche_company_code,branche_company,jd_codeori) select b.job_code1,b.employee_name,b.job_type,b.company_name,b.company_code,b.job_code2,b.branche_company_code,b.branche_company,b.job_code from bsth_c_employee b left join bsth_c_personnel a on b.job_code1 = a.job_code where a.job_code is null"); |
| 308 | logger.info(String.format("金蝶未匹配数据插入,记录数%d",rows)); | 308 | logger.info(String.format("金蝶未匹配数据插入,记录数%d",rows)); |
| 309 | // 赋值分公司编码1 不然无法查询 | 309 | // 赋值分公司编码1 不然无法查询 |
| 310 | rows = jdbcTemplate.update("update bsth_c_personnel set branche_company_code = '1' where branche_company_code is null"); | 310 | rows = jdbcTemplate.update("update bsth_c_personnel set branche_company_code = '1' where branche_company_code is null"); |