Commit 0d7c3c47 authored by hezhen's avatar hezhen

code重复同步数据

parent 7c23a0fe
...@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.ace.cache.annotation.Cache; import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear; import com.ace.cache.annotation.CacheClear;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -393,4 +394,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -393,4 +394,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
pageDataVO.setTotalCount(dataVO.getTotalCount()); pageDataVO.setTotalCount(dataVO.getTotalCount());
return pageDataVO; return pageDataVO;
} }
public List<JSONObject> getList(){
return mapper.getList();
}
} }
...@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.biz; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.biz;
import com.ace.cache.annotation.CacheClear; import com.ace.cache.annotation.CacheClear;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil; import com.github.wxiaoqi.security.common.util.RandomUtil;
...@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -124,6 +126,36 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> { ...@@ -124,6 +126,36 @@ public class CompanyBaseBiz extends BaseBiz<CompanyBaseMapper, CompanyBase> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//临时数据同步5(添加车辆)
public ObjectRestResponse synchro5(){
List<JSONObject> list= branchCompanyBiz.getList();
Integer number=10000;
if (list.size()>0){
for (JSONObject obj:list){
Integer code= obj.getInteger("code");
if (code==null||code==0){
continue;
}
Example example=new Example(Vehicle.class);
example.createCriteria().andEqualTo("code",code);
List<Vehicle> vehicles=vehicleBiz.selectByExample(example);
int num=0;
for (Vehicle vehicle:vehicles){
num++;
if (num==1){
continue;
}
number++;
vehicle.setCode(number);
vehicleBiz.updateSelectiveById(vehicle);
}
}
}
return ObjectRestResponse.succ();
}
public String getNumberPlate(int number){ public String getNumberPlate(int number){
String str=number+""; String str=number+"";
......
package com.xxfc.platform.vehicle.mapper; package com.xxfc.platform.vehicle.mapper;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO; import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -17,4 +19,8 @@ public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdLi ...@@ -17,4 +19,8 @@ public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdLi
List<Integer> findCompanyIdsByAreaId(@Param("areaId") Integer areaId); List<Integer> findCompanyIdsByAreaId(@Param("areaId") Integer areaId);
List<BranchCompanyListDTO > findBranchCompanys(@Param("provinceCode") Integer provinceCode,@Param("cityCode") Integer cityCode); List<BranchCompanyListDTO > findBranchCompanys(@Param("provinceCode") Integer provinceCode,@Param("cityCode") Integer cityCode);
@Select("SELECT `code`,count(id) cd FROM `vehicle` WHERE is_del=0 and number_plate LIKE '%测试%' GROUP BY code HAVING cd>=2")
List<JSONObject> getList();
} }
\ No newline at end of file
...@@ -33,8 +33,8 @@ public class CompanyController extends BaseController<CompanyBaseBiz> { ...@@ -33,8 +33,8 @@ public class CompanyController extends BaseController<CompanyBaseBiz> {
@ApiOperation("同步股权3") @ApiOperation("同步股权3")
@PostMapping("synchro3") @PostMapping("synchro3")
public ObjectRestResponse<String> synchro3() { public ObjectRestResponse synchro3() {
return baseBiz.synchro3(); return baseBiz.synchro5();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment