智慧營區(qū)車輛識別管理系統(tǒng)軟件源碼
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;
/**
* 車牌識別系統(tǒng) 業(yè)務(wù)層處理
*
* @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;
// }
/**
* 導(dǎo)入車輛數(shù)據(jù)
*
* @param vehicleList 內(nèi)部人員數(shù)據(jù)列表
* @param isUpdateSupport 是否更新支持,如果已存在,則進行更新數(shù)據(jù)
* @param operName 操作內(nèi)部人員
* @return 結(jié)果
*/
@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("導(dǎo)入車輛數(shù)據(jù)不能為空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
// String password = configService.selectConfigByKey("sys.user.initPassword");
System.out.println("車輛表導(dǎo)入");
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() + " 導(dǎo)入成功");
}
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() + " 導(dǎo)入失?。?quot;;
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,導(dǎo)入失??!共 " + failureNum + " 條數(shù)據(jù)格式不正確,錯誤如下:");
throw new CustomException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,數(shù)據(jù)已全部導(dǎo)入成功!共 " + successNum + " 條,數(shù)據(jù)如下:");
}
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);
}
}
- 上一篇:巡更棒系統(tǒng)的發(fā)展情況及怎么提高檢驗巡更質(zhì)量和巡檢效率? 2021/3/24
- 下一篇:智慧營區(qū)車輛管理系統(tǒng)車輛信息模塊 2021/3/22