40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
|
|
package com.nationalelectric.greenH5;
|
||
|
|
|
||
|
|
import java.util.Collection;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
import org.springframework.util.CollectionUtils;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson.JSON;
|
||
|
|
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
|
||
|
|
import com.sgcc.uap.persistence.IHibernateDao;
|
||
|
|
|
||
|
|
//@Component
|
||
|
|
public class ExportFoodImageTimer {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private IHibernateDao hibernateDao;
|
||
|
|
@Autowired
|
||
|
|
private BaseServiceImpl baseService;
|
||
|
|
// @Scheduled(cron="0 0/1 * * * ?")
|
||
|
|
public void task(){
|
||
|
|
// System.out.println("qmh------------->执行器");
|
||
|
|
//
|
||
|
|
List<Map<String,Object>> menuList1 = hibernateDao.queryForListWithSql("select id,picture_data as pic_id,img_status from GREEN_FOODS_KINDS where img_status=2");
|
||
|
|
if(CollectionUtils.isEmpty(menuList1)){
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
for (Map<String, Object> map : menuList1) {
|
||
|
|
String pic_id=(String)map.get("pic_id");
|
||
|
|
Long id =(Long)map.get("id");
|
||
|
|
baseService.saveFoodImage(id, pic_id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|