Compare commits
No commits in common. "ba62225a498586f4f59c2517e522776aa79dd171" and "b64e1b681921a8995f0d9e871d944a3cd752b3a3" have entirely different histories.
ba62225a49
...
b64e1b6819
@ -6,19 +6,24 @@ import com.xkrs.dao.FirePointPreciseDao;
|
|||||||
import com.xkrs.dao.StreetDao;
|
import com.xkrs.dao.StreetDao;
|
||||||
import com.xkrs.dao.SysUserDao;
|
import com.xkrs.dao.SysUserDao;
|
||||||
import com.xkrs.helper.FirePointSubscribeManager;
|
import com.xkrs.helper.FirePointSubscribeManager;
|
||||||
|
import com.xkrs.model.bean.VipTimeRangeBean;
|
||||||
|
import com.xkrs.model.entity.SysUserEntity;
|
||||||
import com.xkrs.model.qo.AllFirePointQo;
|
import com.xkrs.model.qo.AllFirePointQo;
|
||||||
import com.xkrs.service.DispatchFirePointService;
|
import com.xkrs.service.DispatchFirePointService;
|
||||||
import com.xkrs.service.impl.FirePointServiceImpl;
|
import com.xkrs.service.impl.FirePointServiceImpl;
|
||||||
|
import com.xkrs.utilsnew.JsonUtils;
|
||||||
|
import com.xkrs.utilsold.DateTimeUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
@ -44,37 +49,41 @@ public class DispatchFirePointController {
|
|||||||
@GetMapping("/debug")
|
@GetMapping("/debug")
|
||||||
public String debug() {
|
public String debug() {
|
||||||
|
|
||||||
// System.out.println("开始更新用户VIP时间范围");
|
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 < 462; i++) {
|
List<SysUserEntity> sysUserEntityList = sysUserDao.findAll();
|
||||||
firePointOrdinaryDao.updateProCityCode(i * 5000L, (i + 1) * 5000L);
|
for (SysUserEntity sysUserEntity : sysUserEntityList) {
|
||||||
firePointOrdinaryDao.updateProCityName(i * 5000L, (i + 1) * 5000L);
|
String addTime = sysUserEntity.getAddTime();
|
||||||
System.out.println(i + "/" + 462);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("开始更新省编码市编码");
|
||||||
|
firePointOrdinaryDao.updateProCityCode();
|
||||||
|
System.out.println("开始更新省名市名");
|
||||||
|
firePointOrdinaryDao.updateProCityName();
|
||||||
|
|
||||||
|
// for (int i = 0; i < 30; i++) {
|
||||||
|
// firePointOrdinaryDao.updateProCityCodeById((long) i);
|
||||||
|
// firePointOrdinaryDao.updateProCityNameById((long) i);
|
||||||
|
// }
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKKKK", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKKKK", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,19 +6,24 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface FirePointOrdinaryDao extends JpaRepository<FirePointOrdinaryEntity, Long>, JpaSpecificationExecutor<FirePointOrdinaryEntity> {
|
public interface FirePointOrdinaryDao extends JpaRepository<FirePointOrdinaryEntity, Long>, JpaSpecificationExecutor<FirePointOrdinaryEntity> {
|
||||||
|
|
||||||
@Query(value = "UPDATE fire_point_ordinary SET pro_code = concat(left(county_code, 2), '0000'), city_code = concat(left(county_code, 4), '00') WHERE id BETWEEN ?1 AND ?2", nativeQuery = true)
|
@Query(value = "UPDATE fire_point_ordinary SET pro_code = concat(left(county_code, 2), '0000'), city_code = concat(left(county_code, 4), '00')", nativeQuery = true)
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Transactional(rollbackFor = Exception.class)
|
void updateProCityCode();
|
||||||
void updateProCityCode(Long startId, Long endId);
|
|
||||||
|
|
||||||
@Query(value = "UPDATE fire_point_ordinary AS f SET pro_name = (SELECT s.pro_name AS proname FROM street AS s WHERE s.pro_code = f.pro_code LIMIT 1), city_name = (SELECT s.city_name AS cityname FROM street AS s WHERE s.city_code = f.city_code LIMIT 1) WHERE id BETWEEN ?1 AND ?2", nativeQuery = true)
|
@Query(value = "UPDATE fire_point_ordinary AS f SET pro_name = (SELECT s.pro_name AS proname FROM street AS s WHERE s.pro_code = f.pro_code LIMIT 1), city_name = (SELECT s.city_name AS cityname FROM street AS s WHERE s.city_code = f.city_code LIMIT 1)", nativeQuery = true)
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Transactional(rollbackFor = Exception.class)
|
void updateProCityName();
|
||||||
void updateProCityName(Long startId, Long endId);
|
|
||||||
|
@Query(value = "UPDATE fire_point_ordinary SET pro_code = concat(left(county_code, 2), '0000'), city_code = concat(left(county_code, 4), '00') WHERE id = ?1", nativeQuery = true)
|
||||||
|
@Modifying(clearAutomatically = true)
|
||||||
|
void updateProCityCodeById(Long id);
|
||||||
|
|
||||||
|
@Query(value = "UPDATE fire_point_ordinary AS f SET pro_name = (SELECT s.pro_name AS proname FROM street AS s WHERE s.pro_code = f.pro_code LIMIT 1), city_name = (SELECT s.city_name AS cityname FROM street AS s WHERE s.city_code = f.city_code LIMIT 1) WHERE id = ?1", nativeQuery = true)
|
||||||
|
@Modifying(clearAutomatically = true)
|
||||||
|
void updateProCityNameById(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
server.port = 6801
|
server.port = 6802
|
||||||
|
|
||||||
## 数据源配置
|
## 数据源配置
|
||||||
spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/straw_fire_point
|
spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/straw_fire_point_debug
|
||||||
spring.datasource.userName = straw_manager
|
spring.datasource.userName = straw_manager
|
||||||
spring.datasource.password = straw123
|
spring.datasource.password = straw123
|
||||||
spring.datasource.driverClassName = org.postgresql.Driver
|
spring.datasource.driverClassName = org.postgresql.Driver
|
||||||
|
Loading…
x
Reference in New Issue
Block a user