智慧营区车辆识别管理系统软件源码
package com.yucheng.project.factory.service.impl;
import com.yucheng.common.constant.UserConstants;
import com.yucheng.common.exception.CustomException;
import com.yucheng.common.utils.IdUtils;
import com.yucheng.common.utils.SecurityUtils;
import com.yucheng.common.utils.StringUtils;
import com.yucheng.framework.aspectj.lang.annotation.DataScope;
import com.yucheng.project.campsys.domain.CampSysPIORec;
import com.yucheng.project.campsys.domain.CampSysPerson;
import com.yucheng.project.campsys.mapper.CampSysPersonMapper;
import com.yucheng.project.campsys.service.ICampSysPersonService;
import com.yucheng.project.factory.domain.FactoryVehicle;
import com.yucheng.project.factory.mapper.FactoryVehicleMapper;
import com.yucheng.project.factory.service.IFactoryVehicleService;
import com.yucheng.project.system.domain.SysUser;
import com.yucheng.project.system.service.ISysConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 车牌识别系统 业务层处理
*
* @author yucheng
*/
@Service
public class FactoryVehicleServiceImpl implements IFactoryVehicleService
{
private static final Logger log = LoggerFactory.getLogger(FactoryVehicleServiceImpl.class);
@Autowired
private FactoryVehicleMapper factoryVehicleMapper;
@Override
public List<FactoryVehicle> selectVehicleList(FactoryVehicle factoryVehicle) {
return factoryVehicleMapper.selectVehicleList(factoryVehicle);
}
@Override
public FactoryVehicle selectVehicleByUserName(String workerName) {
return factoryVehicleMapper.selectVehicleByUserName(workerName);
}
@Override
public FactoryVehicle selectVehicleById(Long vehicleId) {
return factoryVehicleMapper.selectVehicleById(vehicleId);
}
@Override
public int insertVehicle(FactoryVehicle factoryVehicle) {
return factoryVehicleMapper.insertVehicle(factoryVehicle);
}
@Override
public int updateVehicle(FactoryVehicle factoryVehicle) {
return factoryVehicleMapper.updateVehicle(factoryVehicle);
}
@Override
public int deleteVehicleById(Long vehicleId) {
return factoryVehicleMapper.deleteVehicleById(vehicleId);
}
@Override
public int deleteVehicleByIds(Long[] vehicleIds) {
return factoryVehicleMapper.deleteVehicleByIds(vehicleIds);
}
// @Override
// public String importVehicle(List<FactoryVehicle> vehicleList, Boolean isUpdateSupport, String operName) {
// // TODO Auto-generated method stub
// return null;
// }
/**
* 导入车辆数据
*
* @param vehicleList 内部人员数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作内部人员
* @return 结果
*/
@Override
public String importVehicle(List<FactoryVehicle> vehicleList, Boolean isUpdateSupport, SysUser user )
{ String operName=user.getUserName();
if (StringUtils.isNull(vehicleList) || vehicleList.size() == 0)
{
throw new CustomException("导入车辆数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
// String password = configService.selectConfigByKey("sys.user.initPassword");
System.out.println("车辆表导入");
for (FactoryVehicle vehicle : vehicleList)
{ System.out.println("车辆表:"+vehicle.toString());
try
{
// 验证是否存在这个人员车辆
vehicle.setOrgId(user.getOrgId());
//FactoryVehicle u = factoryVehicleMapper.selectVehicleByUserName(vehicle.getWorkerName());
FactoryVehicle u = factoryVehicleMapper.selectVehicleByPlate(vehicle.getPlate());
if (StringUtils.isNull(u))
{
System.out.println("车辆表:"+vehicle.toString());
vehicle.setCreateBy(operName);
this.insertVehicle(vehicle);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + vehicle.getPlate() + " 导入成功");
}
else if (isUpdateSupport)
{
vehicle.setUpdateBy(operName);
this.updateVehicle(vehicle);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + vehicle.getPlate() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、账号 " + vehicle.getPlate() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + vehicle.getPlate() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new CustomException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public FactoryVehicle selectVehicleByPlate(String plate) {
// TODO Auto-generated method stub
return null;
}
@Override
public FactoryVehicle selectVehicleByWorkerNo(String workerNO) {
return factoryVehicleMapper.selectVehicleByWorkerNo(workerNO);
}
}
- 上一篇:巡更棒系统的发展情况及怎么提高检验巡更质量和巡检效率? 2021/3/24
- 下一篇:智慧营区车辆管理系统车辆信息模块 2021/3/22