|
@ -23,18 +23,52 @@ public class SignEndJob implements Job {
|
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
|
try {
|
|
|
System.out.println("sign end job start");
|
|
|
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
|
|
|
Calendar today = Calendar.getInstance();
|
|
|
today.add(Calendar.DATE, -1);
|
|
|
String date = DateUtil.dateToStrShort(today.getTime());
|
|
|
String start = date + " 00:00:00";
|
|
|
String end = date + " 23:59:59";
|
|
|
String sql = "update wlyy_sign_family set status = -4,apply_unsign_date =SYSDATE() where end >= ? and end <= ? and status > 0";
|
|
|
String sqlT = "update wlyy_doctor_team set del = '0' where del = '1' and code in (select team_code from wlyy_sign_family where end >= ? and end <= ? and status > 0)";
|
|
|
String sqlTm = "update wlyy_doctor_team_member set del = '0' where del = '1' and team in (select team_code from wlyy_sign_family where end >= ? and end <= ? and status > 0)";
|
|
|
int sucessT = jdbcTemplate.update(sqlT, start, end);
|
|
|
int sucessTm = jdbcTemplate.update(sqlTm, start, end);
|
|
|
int sucess = jdbcTemplate.update(sql, start, end);
|
|
|
// SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
|
|
|
// Calendar today = Calendar.getInstance();
|
|
|
// today.add(Calendar.DATE, -1);
|
|
|
// String date = DateUtil.dateToStrShort(today.getTime());
|
|
|
// String start = date + " 00:00:00";
|
|
|
// String end = date + " 23:59:59";
|
|
|
// String sql = "update wlyy_sign_family set status = -4,apply_unsign_date =SYSDATE() where end >= ? and end <= ? and status > 0";
|
|
|
// String sqlT = "update wlyy_doctor_team set del = '0' where del = '1' and code in (select team_code from wlyy_sign_family where end >= ? and end <= ? and status > 0)";
|
|
|
// String sqlTm = "update wlyy_doctor_team_member set del = '0' where del = '1' and team in (select team_code from wlyy_sign_family where end >= ? and end <= ? and status > 0)";
|
|
|
// int sucessT = jdbcTemplate.update(sqlT, start, end);
|
|
|
// int sucessTm = jdbcTemplate.update(sqlTm, start, end);
|
|
|
// int sucess = jdbcTemplate.update(sql, start, end);
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int year = cal.get(Calendar.YEAR)-1;
|
|
|
int month = cal.get(Calendar.MONTH)+1;
|
|
|
if(month >=7){
|
|
|
//设置已过期
|
|
|
String sql = "UPDATE wlyy_sign_family t SET t.status = -4 WHERE t.status>=0 AND t.sign_year='"+year+"' AND t.expenses_status='1'";
|
|
|
//数据迁移
|
|
|
String sql2 ="INSERT INTO wlyy_sign_family(" +
|
|
|
"code,lw_code,type,patient,openid,name,idcard,ssc," +
|
|
|
"mobile,emer_mobile,hospital,hospital_name,doctor," +
|
|
|
"doctor_name,begin,end,images,group_code,status,reason," +
|
|
|
"czrq,team_code,sign_type,apply_date,release_speak," +
|
|
|
"doctor_health_name,doctor_health,family_code,patient_apply_date," +
|
|
|
"expenses,expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
|
|
|
"sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date,expenses_type," +
|
|
|
"sign_year,medical_insurance_num,agent_doctor_code,agent_doctor_name," +
|
|
|
"agent_doctor_level,admin_team_code,expenses_time) " +
|
|
|
"SELECT code,lw_code,type,patient,openid,name,idcard,ssc," +
|
|
|
"mobile,emer_mobile,hospital,hospital_name,doctor,doctor_name," +
|
|
|
"begin,end,images,group_code,status,reason,czrq,team_code," +
|
|
|
"sign_type,apply_date,release_speak,doctor_health_name," +
|
|
|
"doctor_health,family_code,patient_apply_date,expenses," +
|
|
|
"expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
|
|
|
"sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date," +
|
|
|
"expenses_type,sign_year,medical_insurance_num,agent_doctor_code," +
|
|
|
"agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time " +
|
|
|
"FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
|
|
|
//更改迁移状态
|
|
|
String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
|
|
|
jdbcTemplate.execute(sql);
|
|
|
jdbcTemplate.execute(sql2);
|
|
|
jdbcTemplate.execute(sql3);
|
|
|
}
|
|
|
|
|
|
System.out.println("sign end job end");
|
|
|
} catch (Exception e) {
|