100 lines
3.8 KiB
Java
100 lines
3.8 KiB
Java
package com.xkrs.controller;
|
|
|
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
|
import com.xkrs.dao.FirePointOrdinaryDao;
|
|
import com.xkrs.dao.StreetDao;
|
|
import com.xkrs.dao.SysUserDao;
|
|
import com.xkrs.fireseason.FireSeasonConfigService;
|
|
import com.xkrs.model.qo.AllFirePointQo;
|
|
import com.xkrs.model.qo.UpdateFirePointQo;
|
|
import com.xkrs.service.DispatchFirePointService;
|
|
import com.xkrs.service.impl.FirePointServiceImpl;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.Locale;
|
|
|
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
|
|
|
@RestController
|
|
public class DispatchFirePointController {
|
|
|
|
public static Logger log = LoggerFactory.getLogger(FirePointServiceImpl.class);
|
|
@Resource
|
|
private SysUserDao sysUserDao;
|
|
@Resource
|
|
private DispatchFirePointService firePointService;
|
|
@Resource
|
|
private FireSeasonConfigService fireSeasonConfigService;
|
|
@Resource
|
|
private FirePointOrdinaryDao firePointOrdinaryDao;
|
|
@Resource
|
|
private StreetDao streetDao;
|
|
private final Locale locale = LocaleContextHolder.getLocale();
|
|
|
|
@GetMapping("/debug")
|
|
public String debug() {
|
|
|
|
// System.out.println("开始更新用户VIP时间范围");
|
|
//
|
|
// List<SysUserEntity> sysUserEntityList = sysUserDao.findAll();
|
|
// for (SysUserEntity sysUserEntity : sysUserEntityList) {
|
|
// String addTime = sysUserEntity.getAddTime();
|
|
// String vipTimeRangeJson = sysUserEntity.getVipTimeRangeJson();
|
|
// if (!DateTimeUtil.isValidDateTime(addTime)) {
|
|
// return sysUserEntity.getUserName();
|
|
// }
|
|
// if (!DateTimeUtil.isValidDateTime(vipTimeRangeJson)) {
|
|
// return sysUserEntity.getUserName();
|
|
// }
|
|
// VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItemBean = new VipTimeRangeBean.VipTimeRangeItemBean();
|
|
// vipTimeRangeItemBean.setStartTime(addTime);
|
|
// vipTimeRangeItemBean.setEndTime(vipTimeRangeJson);
|
|
// List<VipTimeRangeBean.VipTimeRangeItemBean> list = new ArrayList<>();
|
|
// list.add(vipTimeRangeItemBean);
|
|
// VipTimeRangeBean vipTimeRangeBean = new VipTimeRangeBean();
|
|
// vipTimeRangeBean.setList(list);
|
|
// String serialize = JsonUtils.<VipTimeRangeBean>serialize(vipTimeRangeBean);
|
|
// System.out.println("serialize = " + serialize);
|
|
// sysUserEntity.setVipTimeRangeJson(serialize);
|
|
// sysUserDao.save(sysUserEntity);
|
|
// }
|
|
|
|
// for (int i = 0; i < 10000; i++) {
|
|
// firePointOrdinaryDao.updateProCityCode(i * 310L, (i + 1) * 310L);
|
|
// firePointOrdinaryDao.updateProCityName(i * 310L, (i + 1) * 310L);
|
|
// System.out.println(i + "/" + 10000);
|
|
// }
|
|
|
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKKKK", locale);
|
|
}
|
|
|
|
@GetMapping("/autoSync")
|
|
public String autoSync() {
|
|
return fireSeasonConfigService.updateFireSeasonConfig();
|
|
}
|
|
|
|
/**
|
|
* 推送火点到秸秆系统
|
|
*/
|
|
@PostMapping("/insertFirePoint")
|
|
public String insertFirePoint(@RequestBody AllFirePointQo firePointQo) {
|
|
return firePointService.insertFirePoint(firePointQo);
|
|
}
|
|
|
|
/**
|
|
* 更新火点状态
|
|
*/
|
|
@PostMapping("/updateFirePoint")
|
|
public String updateFirePoint(@RequestBody UpdateFirePointQo updateFirePointQo) {
|
|
return firePointService.updateFirePoint(updateFirePointQo);
|
|
}
|
|
|
|
}
|