|
|
@ -23,57 +23,52 @@ import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.CheckLo |
|
|
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.DiscardStandArddict; |
|
|
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.DiscardStandArddict; |
|
|
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository; |
|
|
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository; |
|
|
import com.ciotea.cdcng.front.domain.tool.Tool; |
|
|
import com.ciotea.cdcng.front.domain.tool.Tool; |
|
|
import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; |
|
|
|
|
|
import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; |
|
|
import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; |
|
|
import com.fasterxml.jackson.databind.JavaType; |
|
|
|
|
|
import infrastructure.support.exception.AppException; |
|
|
import infrastructure.support.exception.AppException; |
|
|
import infrastructure.support.validation.Validator; |
|
|
import infrastructure.support.validation.Validator; |
|
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
import java.text.ParseException; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Calendar; |
|
|
import java.util.Calendar; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
|
import org.codehaus.jackson.map.ObjectMapper; |
|
|
|
|
|
import org.codehaus.jackson.map.type.TypeFactory; |
|
|
|
|
|
import org.codehaus.jackson.type.JavaType; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class ChecklogServiceImpl implements ChecklogService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ChecklogServiceImpl |
|
|
|
|
|
implements ChecklogService { |
|
|
@Resource |
|
|
@Resource |
|
|
Repository repository; |
|
|
Repository repository; |
|
|
@Resource |
|
|
@Resource |
|
|
BottleRepository bottleRepository; |
|
|
BottleRepository bottleRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
ChecklogRepository checklogRepository; |
|
|
ChecklogRepository checklogRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
CngCdCarStrategy cngCdCarStrategy; |
|
|
CngCdCarStrategy cngCdCarStrategy; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
MakeQRCodeRepository makeQRCodeRepository; |
|
|
MakeQRCodeRepository makeQRCodeRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
AirBottleRepository airBottleRepository; |
|
|
AirBottleRepository airBottleRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
CngCdCarStrategy carStrategy; |
|
|
CngCdCarStrategy carStrategy; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
CngUserRepository cngUserRepository; |
|
|
CngUserRepository cngUserRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
AuthorityDepartmentRepository authorityDepartmentRepository; |
|
|
AuthorityDepartmentRepository authorityDepartmentRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private LogOperation logOperation; |
|
|
private LogOperation logOperation; |
|
|
|
|
|
|
|
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public CheckLog passCheckLog(String nextCheckDate, String[] bcodes, |
|
|
|
|
|
CheckLog check, CngUser user, AuthorityDepartment dept) { |
|
|
|
|
|
|
|
|
public Map<String, Object> passCheckLog(String nextCheckDate, String[] bcodes, CheckLog check, CngUser user, AuthorityDepartment dept) { |
|
|
|
|
|
Map<String, Object> map = new HashMap(); |
|
|
if (bcodes.length == 0) { |
|
|
if (bcodes.length == 0) { |
|
|
throw new AppException("请选择气瓶"); |
|
|
throw new AppException("请选择气瓶"); |
|
|
} |
|
|
} |
|
|
@ -81,96 +76,100 @@ public class ChecklogServiceImpl implements ChecklogService { |
|
|
v.forProperty("checkCode") |
|
|
v.forProperty("checkCode") |
|
|
.notBlank() |
|
|
.notBlank() |
|
|
.length(1, 20) |
|
|
.length(1, 20) |
|
|
.custom(checklogRepository.getCheckLogByCode(check |
|
|
|
|
|
|
|
|
.custom(this.checklogRepository.getCheckLogByCode(check |
|
|
.getCheckCode()) == null, "定检编号存在"); |
|
|
.getCheckCode()) == null, "定检编号存在"); |
|
|
v.forProperty("checkDetail").notBlank(); |
|
|
v.forProperty("checkDetail").notBlank(); |
|
|
v.forProperty("checker.id").notNull(); |
|
|
v.forProperty("checker.id").notNull(); |
|
|
v.forProperty("verifier.id").notNull(); |
|
|
v.forProperty("verifier.id").notNull(); |
|
|
v.forProperty("approver.id").notNull(); |
|
|
v.forProperty("approver.id").notNull(); |
|
|
v.check(); |
|
|
v.check(); |
|
|
check.setRowState(1); |
|
|
|
|
|
|
|
|
check.setRowState(Integer.valueOf(1)); |
|
|
check.setDateJoined(new Date()); |
|
|
check.setDateJoined(new Date()); |
|
|
check.setDateUpdate(new Date()); |
|
|
check.setDateUpdate(new Date()); |
|
|
check.setRegUserId(user.getId()); |
|
|
check.setRegUserId(user.getId()); |
|
|
check.setAuthorityDepartment(dept); |
|
|
check.setAuthorityDepartment(dept); |
|
|
check.setCheckDate(sdf.format(new Date())); |
|
|
|
|
|
check.setApproverDate(sdf.format(new Date())); |
|
|
|
|
|
check.setVerifyDate(sdf.format(new Date())); |
|
|
|
|
|
|
|
|
check.setCheckDate(this.sdf.format(new Date())); |
|
|
|
|
|
check.setApproverDate(this.sdf.format(new Date())); |
|
|
|
|
|
check.setVerifyDate(this.sdf.format(new Date())); |
|
|
check.setLogState("1"); |
|
|
check.setLogState("1"); |
|
|
CheckLog clog = repository.save(check); |
|
|
|
|
|
|
|
|
CheckLog clog = (CheckLog) this.repository.save(check); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
|
|
|
|
|
|
List<Bottle> bottles = new ArrayList(); |
|
|
for (int i = 0; i < bcodes.length; i++) { |
|
|
for (int i = 0; i < bcodes.length; i++) { |
|
|
if (!StringUtil.isNullOrEmpty(bcodes[i])) { |
|
|
|
|
|
Bottle bottle = repository.get(Bottle.class, new Integer(bcodes[i])); |
|
|
|
|
|
String historyDate = bottle.getNextCheckDate(); |
|
|
|
|
|
// Date d2 = new Date(); |
|
|
|
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{bcodes[i]})) { |
|
|
|
|
|
Bottle bottle = (Bottle) this.repository.get(Bottle.class, new Integer(bcodes[i])); |
|
|
|
|
|
String historyDate = bottle.getNextCheckDate(); |
|
|
|
|
|
|
|
|
Date d2 = Tool.getNowDate(); |
|
|
Date d2 = Tool.getNowDate(); |
|
|
if(StringUtil.isNullOrEmpty(nextCheckDate) && StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) { |
|
|
|
|
|
throw new AppException("请输入下次检验日期"); |
|
|
|
|
|
} |
|
|
|
|
|
if(StringUtil.isNullOrEmpty(nextCheckDate) && !StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) { |
|
|
|
|
|
Date d3 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d3 = sdf.parse(bottle.getNextCheckDate()); |
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) { |
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) { |
|
|
|
|
|
throw new AppException("请输入下次检验日期"); |
|
|
} |
|
|
} |
|
|
if(d3.getTime() < d2.getTime()) { |
|
|
|
|
|
throw new AppException("请确认气瓶编号为"+bottle.getBottCode()+"的下次检验日期"); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) { |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) { |
|
|
|
|
|
Date d3 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d3 = sdf.parse(bottle.getNextCheckDate()); |
|
|
|
|
|
} catch (ParseException localParseException) { |
|
|
|
|
|
} |
|
|
|
|
|
if (d3.getTime() < d2.getTime()) { |
|
|
|
|
|
throw new AppException("请确认气瓶编号为" + bottle.getBottCode() + "的下次检验日期"); |
|
|
|
|
|
} |
|
|
bottle.setNextCheckDate(bottle.getNextCheckDate()); |
|
|
bottle.setNextCheckDate(bottle.getNextCheckDate()); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if(!StringUtil.isNullOrEmpty(nextCheckDate) && StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) { |
|
|
|
|
|
Date d1 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d1 = sdf.parse(nextCheckDate); |
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
} |
|
|
|
|
|
if(d1.getTime() < d2.getTime()) { |
|
|
|
|
|
throw new AppException("请确认下次检验日期输入是否正确,应该大于当前日期"); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) { |
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) { |
|
|
|
|
|
Date d1 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d1 = sdf.parse(nextCheckDate); |
|
|
|
|
|
} catch (ParseException localParseException1) { |
|
|
|
|
|
} |
|
|
|
|
|
if (d1.getTime() < d2.getTime()) { |
|
|
|
|
|
throw new AppException("请确认下次检验日期输入是否正确,应该大于当前日期"); |
|
|
|
|
|
} |
|
|
bottle.setNextCheckDate(nextCheckDate); |
|
|
bottle.setNextCheckDate(nextCheckDate); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(!StringUtil.isNullOrEmpty(nextCheckDate) && !StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) { |
|
|
|
|
|
Date d4 = null; |
|
|
|
|
|
Date d5 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d4 = sdf.parse(bottle.getNextCheckDate()); |
|
|
|
|
|
d5 = sdf.parse(nextCheckDate); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
} |
|
|
|
|
|
// if(d4.getTime() < d2.getTime() || d5.getTime() < d2.getTime()) { |
|
|
|
|
|
// throw new AppException("上次定检气瓶的下次检验日期小于当前日期"); |
|
|
|
|
|
// } |
|
|
|
|
|
if(d4.getTime() > d5.getTime()) { |
|
|
|
|
|
bottle.setNextCheckDate(bottle.getNextCheckDate()); |
|
|
|
|
|
} else { |
|
|
|
|
|
bottle.setNextCheckDate(nextCheckDate); |
|
|
|
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) { |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) { |
|
|
|
|
|
Date d4 = null; |
|
|
|
|
|
Date d5 = null; |
|
|
|
|
|
try { |
|
|
|
|
|
d4 = sdf.parse(bottle.getNextCheckDate()); |
|
|
|
|
|
d5 = sdf.parse(nextCheckDate); |
|
|
|
|
|
} catch (Exception localException) { |
|
|
|
|
|
} |
|
|
|
|
|
if (d4.getTime() > d5.getTime()) { |
|
|
|
|
|
bottle.setNextCheckDate(bottle.getNextCheckDate()); |
|
|
|
|
|
} else { |
|
|
|
|
|
bottle.setNextCheckDate(nextCheckDate); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
repository.save(bottle); |
|
|
|
|
|
logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检时,修改气瓶的下次检验日期"); |
|
|
|
|
|
|
|
|
this.repository.save(bottle); |
|
|
|
|
|
this.logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检时,修改气瓶的下次检验日期"); |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
checklogbott.setBottle(bottle.getId()); |
|
|
checklogbott.setBottle(bottle.getId()); |
|
|
checklogbott.setChecklog(clog.getId()); |
|
|
checklogbott.setChecklog(clog.getId()); |
|
|
if(!StringUtil.isNullOrEmpty(nextCheckDate)) { |
|
|
|
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) { |
|
|
checklogbott.setNextCheckDate(nextCheckDate); |
|
|
checklogbott.setNextCheckDate(nextCheckDate); |
|
|
} |
|
|
} |
|
|
// else { |
|
|
|
|
|
// checklogbott.setNextCheckDate(nextCheckDate); |
|
|
|
|
|
// } |
|
|
|
|
|
CheckLogBott logBott= repository.save(checklogbott); |
|
|
|
|
|
logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联"); |
|
|
|
|
|
|
|
|
CheckLogBott logBott = (CheckLogBott) this.repository.save(checklogbott); |
|
|
|
|
|
this.logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联"); |
|
|
|
|
|
|
|
|
|
|
|
bottles.add(bottle); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息"); |
|
|
|
|
|
return clog; |
|
|
|
|
|
|
|
|
this.logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息"); |
|
|
|
|
|
map.put("clog", clog); |
|
|
|
|
|
map.put("bottles", bottles); |
|
|
|
|
|
return map; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos, |
|
|
|
|
|
CheckLog check, CngUser user, AuthorityDepartment dept) { |
|
|
|
|
|
|
|
|
public CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos, CheckLog check, CngUser user, AuthorityDepartment dept) { |
|
|
if (bcodescraps.length == 0) { |
|
|
if (bcodescraps.length == 0) { |
|
|
throw new AppException("请选择气瓶"); |
|
|
throw new AppException("请选择气瓶"); |
|
|
} |
|
|
} |
|
|
@ -181,7 +180,7 @@ public class ChecklogServiceImpl implements ChecklogService { |
|
|
v.forProperty("checkCode") |
|
|
v.forProperty("checkCode") |
|
|
.notNull() |
|
|
.notNull() |
|
|
.length(1, 20) |
|
|
.length(1, 20) |
|
|
.custom(checklogRepository.getCheckLogByCode(check |
|
|
|
|
|
|
|
|
.custom(this.checklogRepository.getCheckLogByCode(check |
|
|
.getCheckCode()) == null, "定检编号存在"); |
|
|
.getCheckCode()) == null, "定检编号存在"); |
|
|
v.forProperty("checkDetail").notBlank(); |
|
|
v.forProperty("checkDetail").notBlank(); |
|
|
v.forProperty("disCardId.id").notNull(); |
|
|
v.forProperty("disCardId.id").notNull(); |
|
|
@ -190,86 +189,80 @@ public class ChecklogServiceImpl implements ChecklogService { |
|
|
v.forProperty("approver.id").notNull(); |
|
|
v.forProperty("approver.id").notNull(); |
|
|
v.check(); |
|
|
v.check(); |
|
|
|
|
|
|
|
|
check.setRowState(1); |
|
|
|
|
|
|
|
|
check.setRowState(Integer.valueOf(1)); |
|
|
check.setDateJoined(new Date()); |
|
|
check.setDateJoined(new Date()); |
|
|
check.setDateUpdate(new Date()); |
|
|
check.setDateUpdate(new Date()); |
|
|
check.setRegUserId(user.getId()); |
|
|
check.setRegUserId(user.getId()); |
|
|
check.setAuthorityDepartment(dept); |
|
|
check.setAuthorityDepartment(dept); |
|
|
check.setCheckDate(sdf.format(new Date())); |
|
|
|
|
|
check.setApproverDate(sdf.format(new Date())); |
|
|
|
|
|
check.setVerifyDate(sdf.format(new Date())); |
|
|
|
|
|
|
|
|
check.setCheckDate(this.sdf.format(new Date())); |
|
|
|
|
|
check.setApproverDate(this.sdf.format(new Date())); |
|
|
|
|
|
check.setVerifyDate(this.sdf.format(new Date())); |
|
|
check.setLogState("1"); |
|
|
check.setLogState("1"); |
|
|
CheckLog clog = repository.save(check); |
|
|
|
|
|
|
|
|
CheckLog clog = (CheckLog) this.repository.save(check); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
for (int i = 0; i < bcodescraps.length; i++) { |
|
|
for (int i = 0; i < bcodescraps.length; i++) { |
|
|
if (!StringUtil.isNullOrEmpty(bcodescraps[i])) { |
|
|
|
|
|
Bottle bottle = repository.get(Bottle.class, new Integer(bcodescraps[i])); |
|
|
|
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{bcodescraps[i]})) { |
|
|
|
|
|
Bottle bottle = (Bottle) this.repository.get(Bottle.class, new Integer(bcodescraps[i])); |
|
|
if (bottle != null) { |
|
|
if (bottle != null) { |
|
|
bottle.setRowState(2); |
|
|
|
|
|
bottle.setBottState(4); |
|
|
|
|
|
// bottle.setBottCode("4"); //已报废 |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(scrapmemos[i])) { |
|
|
|
|
|
|
|
|
bottle.setRowState(Integer.valueOf(2)); |
|
|
|
|
|
bottle.setBottState(Integer.valueOf(4)); |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{scrapmemos[i]})) { |
|
|
bottle.setMemo(scrapmemos[i]); |
|
|
bottle.setMemo(scrapmemos[i]); |
|
|
} |
|
|
} |
|
|
bottle.setDateUpdate(sdf.format(new Date())); |
|
|
bottle.setDateUpdate(sdf.format(new Date())); |
|
|
repository.save(bottle); |
|
|
|
|
|
logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改状态为报废"); |
|
|
|
|
|
CngCdCar car = repository.get(CngCdCar.class, bottle.getCar().getId()); |
|
|
|
|
|
|
|
|
this.repository.save(bottle); |
|
|
|
|
|
this.logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改状态为报废"); |
|
|
|
|
|
CngCdCar car = (CngCdCar) this.repository.get(CngCdCar.class, bottle.getCar().getId()); |
|
|
if (car != null) { |
|
|
if (car != null) { |
|
|
if(car.getBottleNum() > 0) { |
|
|
|
|
|
car.setBottleNum(car.getBottleNum() - 1); |
|
|
|
|
|
|
|
|
if (car.getBottleNum().intValue() > 0) { |
|
|
|
|
|
car.setBottleNum(Integer.valueOf(car.getBottleNum().intValue() - 1)); |
|
|
} |
|
|
} |
|
|
if (car.getRfidNum() > 0) { |
|
|
|
|
|
car.setRfidNum(car.getRfidNum() - 1); |
|
|
|
|
|
|
|
|
if (car.getRfidNum().intValue() > 0) { |
|
|
|
|
|
car.setRfidNum(Integer.valueOf(car.getRfidNum().intValue() - 1)); |
|
|
} |
|
|
} |
|
|
repository.save(car); |
|
|
|
|
|
logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改气瓶数量、电子标签数量"); |
|
|
|
|
|
|
|
|
this.repository.save(car); |
|
|
|
|
|
this.logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改气瓶数量、电子标签数量"); |
|
|
} |
|
|
} |
|
|
List<RfidTag> listrfid = checklogRepository.getRfidTagBybottle(bottle.getId()); |
|
|
|
|
|
if(listrfid.size() > 0) { |
|
|
|
|
|
|
|
|
List<RfidTag> listrfid = this.checklogRepository.getRfidTagBybottle(bottle.getId()); |
|
|
|
|
|
if (listrfid.size() > 0) { |
|
|
for (RfidTag rfidtag : listrfid) { |
|
|
for (RfidTag rfidtag : listrfid) { |
|
|
if (rfidtag != null) { |
|
|
if (rfidtag != null) { |
|
|
rfidtag.setIsvaild("2"); |
|
|
rfidtag.setIsvaild("2"); |
|
|
rfidtag.setDateUpdate(sdf.format(new Date())); |
|
|
rfidtag.setDateUpdate(sdf.format(new Date())); |
|
|
repository.save(rfidtag); |
|
|
|
|
|
logOperation.saveCngcdRfidtagLog(rfidtag, user.getUsername(), Operations.DELETE, "定检管理中气瓶报废,删除电子标签信息"); |
|
|
|
|
|
|
|
|
this.repository.save(rfidtag); |
|
|
|
|
|
this.logOperation.saveCngcdRfidtagLog(rfidtag, user.getUsername(), Operations.DELETE, "定检管理中气瓶报废,删除电子标签信息"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
checklogbott.setBottle(bottle.getId()); |
|
|
checklogbott.setBottle(bottle.getId()); |
|
|
checklogbott.setChecklog(clog.getId()); |
|
|
checklogbott.setChecklog(clog.getId()); |
|
|
CheckLogBott logBott = repository.save(checklogbott); |
|
|
|
|
|
logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联"); |
|
|
|
|
|
|
|
|
CheckLogBott logBott = (CheckLogBott) this.repository.save(checklogbott); |
|
|
|
|
|
this.logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息"); |
|
|
|
|
|
|
|
|
this.logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息"); |
|
|
return clog; |
|
|
return clog; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public CngCdCar updateCar(CngCdCar bean, CngUser user, |
|
|
|
|
|
AuthorityDepartment dept) { |
|
|
|
|
|
CngCdCar car = cngCdCarStrategy.findById(bean.getId()); |
|
|
|
|
|
|
|
|
public CngCdCar updateCar(CngCdCar bean, CngUser user, AuthorityDepartment dept) { |
|
|
|
|
|
CngCdCar car = this.cngCdCarStrategy.findById(bean.getId()); |
|
|
Validator v = new Validator(bean); |
|
|
Validator v = new Validator(bean); |
|
|
|
|
|
|
|
|
if(/*(bean.getCarState()==2 && bean.getRefitState()==2) ||*/ "".equals(bean.getPlatenum())){ |
|
|
|
|
|
|
|
|
if ("".equals(bean.getPlatenum())) { |
|
|
v.forProperty("platenum").notBlank().length(1, 10).isVehicle(); |
|
|
v.forProperty("platenum").notBlank().length(1, 10).isVehicle(); |
|
|
}else{ |
|
|
|
|
|
v.forProperty("platenum").notBlank().length(1, 10).isVehicle().custom(cngCdCarStrategy.findByPlateNumAndPcolor(1,bean.getPlatenum(),bean.getPcolor(),bean.getId()).size()==0, "车牌号已存在"); |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
v.forProperty("platenum").notBlank().length(1, 10).isVehicle().custom(this.cngCdCarStrategy.findByPlateNumAndPcolor(Integer.valueOf(1), bean.getPlatenum(), bean.getPcolor(), bean.getId()).size() == 0, "������������"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
v.forProperty("vin").notBlank().isLength(17).isSpecialCharacters().hasNoChineseWord().custom(cngCdCarStrategy.findByVinUp(1,bean.getVin(),bean.getId()).size()==0, "车架号已被使用"); |
|
|
|
|
|
if(bean.getMadeDate()!=null && bean.getNextCheckDate()!=null && bean.getMadeDate().length()>0 && bean.getNextCheckDate().length()>0){ |
|
|
|
|
|
v.forProperty("nextCheckDate").custom(bean.getNextCheckDate().compareTo(bean.getMadeDate())>0, "下次年审日期必须大于出厂日期!"); |
|
|
|
|
|
|
|
|
v.forProperty("vin").notBlank().isLength(17).isSpecialCharacters().hasNoChineseWord().custom(this.cngCdCarStrategy.findByVinUp(Integer.valueOf(1), bean.getVin(), bean.getId()).size() == 0, "��������������"); |
|
|
|
|
|
if ((bean.getMadeDate() != null) && (bean.getNextCheckDate() != null) && (bean.getMadeDate().length() > 0) && (bean.getNextCheckDate().length() > 0)) { |
|
|
|
|
|
v.forProperty("nextCheckDate").custom(bean.getNextCheckDate().compareTo(bean.getMadeDate()) > 0, "下次年审日期必须大于出厂日期"); |
|
|
} |
|
|
} |
|
|
v.forProperty("carTypeDict.id").notNull(); |
|
|
v.forProperty("carTypeDict.id").notNull(); |
|
|
v.forProperty("areaDict.id").notNull(); |
|
|
v.forProperty("areaDict.id").notNull(); |
|
|
v.forProperty("pcolor").notNull(); |
|
|
v.forProperty("pcolor").notNull(); |
|
|
v.forProperty("memo").maxLength(200);// 备注 |
|
|
|
|
|
v.forProperty("engineid").notBlank().length(6, 20);//.isNOSpecialCharacters().hasNoChineseWord() |
|
|
|
|
|
|
|
|
v.forProperty("memo").maxLength(200); |
|
|
|
|
|
v.forProperty("engineid").notBlank().length(6, 20); |
|
|
v.forProperty("isorig").notNull(); |
|
|
v.forProperty("isorig").notNull(); |
|
|
ModelDict modeldict = bean.getModelDict(); |
|
|
ModelDict modeldict = bean.getModelDict(); |
|
|
v.forProperty("modelDict").custom(modeldict != null, "请选择车辆厂牌"); |
|
|
v.forProperty("modelDict").custom(modeldict != null, "请选择车辆厂牌"); |
|
|
@ -280,15 +273,15 @@ public class ChecklogServiceImpl implements ChecklogService { |
|
|
v.forProperty("fromDept").notBlank().length(1, 50); |
|
|
v.forProperty("fromDept").notBlank().length(1, 50); |
|
|
String isorigtype = bean.getIsorigtype(); |
|
|
String isorigtype = bean.getIsorigtype(); |
|
|
String isorig = bean.getIsorig(); |
|
|
String isorig = bean.getIsorig(); |
|
|
if(isorig.equals("2") && isorigtype.equals("1")) { |
|
|
|
|
|
v.forProperty("isorigtype").custom(checklogRepository.findCheckDept(bean.getVin(), dept), "请确认此处过户的检验单位是否跟上次检验单位一致"); |
|
|
|
|
|
|
|
|
if ((isorig.equals("2")) && (isorigtype.equals("1"))) { |
|
|
|
|
|
v.forProperty("isorigtype").custom(this.checklogRepository.findCheckDept(bean.getVin(), dept), "请确认此处过户的检验单位是否跟上次检验单位一致"); |
|
|
} |
|
|
} |
|
|
if (bean.getOwner() != null) { |
|
|
if (bean.getOwner() != null) { |
|
|
v.forProperty("owner.name").notNull().length(1, 25); |
|
|
v.forProperty("owner.name").notNull().length(1, 25); |
|
|
if("0".equals(bean.getOwnerType())){ |
|
|
|
|
|
|
|
|
if ("0".equals(bean.getOwnerType())) { |
|
|
v.forProperty("owner.idcard").notBlank().isIdCard2().maxLength(20); |
|
|
v.forProperty("owner.idcard").notBlank().isIdCard2().maxLength(20); |
|
|
} |
|
|
} |
|
|
if("1".equals(bean.getOwnerType())){ |
|
|
|
|
|
|
|
|
if ("1".equals(bean.getOwnerType())) { |
|
|
v.forProperty("owner.idcard").notBlank().isOrganizationCode().maxLength(20); |
|
|
v.forProperty("owner.idcard").notBlank().isOrganizationCode().maxLength(20); |
|
|
} |
|
|
} |
|
|
v.forProperty("owner.mobile").notBlank().length(1, 12).isPhoneInChina(); |
|
|
v.forProperty("owner.mobile").notBlank().length(1, 12).isPhoneInChina(); |
|
|
@ -303,210 +296,164 @@ public class ChecklogServiceImpl implements ChecklogService { |
|
|
bean.setNextMaintDate(car.getNextMaintDate()); |
|
|
bean.setNextMaintDate(car.getNextMaintDate()); |
|
|
bean.setRegDept(car.getRegDept()); |
|
|
bean.setRegDept(car.getRegDept()); |
|
|
bean.setRegUser(car.getRegUser()); |
|
|
bean.setRegUser(car.getRegUser()); |
|
|
|
|
|
|
|
|
//lg |
|
|
|
|
|
if(StringUtil.isNullOrEmpty(bean.getNextCheckDate())){ |
|
|
|
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{bean.getNextCheckDate()})) { |
|
|
bean.setNextCheckDate(null); |
|
|
bean.setNextCheckDate(null); |
|
|
} |
|
|
} |
|
|
if(StringUtil.isNullOrEmpty(bean.getMadeDate())){ |
|
|
|
|
|
|
|
|
if (StringUtil.isNullOrEmpty(new String[]{bean.getMadeDate()})) { |
|
|
bean.setMadeDate(null); |
|
|
bean.setMadeDate(null); |
|
|
} |
|
|
} |
|
|
CngCdCar cngCdCar = repository.save(bean); |
|
|
|
|
|
logOperation.saveCngcdCarLog(cngCdCar, user.getUsername(), Operations.UPDATE, "定检管理,修改车辆信息"); |
|
|
|
|
|
|
|
|
CngCdCar cngCdCar = (CngCdCar) this.repository.save(bean); |
|
|
|
|
|
this.logOperation.saveCngcdCarLog(cngCdCar, user.getUsername(), Operations.UPDATE, "定检管理,修改车辆信息"); |
|
|
return cngCdCar; |
|
|
return cngCdCar; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Bottle addBottle(Bottle bottle, CngUser user, |
|
|
|
|
|
AuthorityDepartment dept) { |
|
|
|
|
|
CngCdCar car = repository.get(CngCdCar.class, bottle.getCar().getId()); |
|
|
|
|
|
|
|
|
public Bottle addBottle(Bottle bottle, CngUser user, AuthorityDepartment dept) { |
|
|
|
|
|
CngCdCar car = (CngCdCar) this.repository.get(CngCdCar.class, bottle.getCar().getId()); |
|
|
Validator v = new Validator(bottle); |
|
|
Validator v = new Validator(bottle); |
|
|
// 气瓶编号唯一性验证 |
|
|
|
|
|
if (bottle.getBottCode().length() > 0) { |
|
|
|
|
|
v.forProperty("bottCode") |
|
|
|
|
|
.notBlank() |
|
|
|
|
|
.isNOSpecialCharacters() |
|
|
|
|
|
.hasNoChineseWord() |
|
|
|
|
|
.length(1, 20) |
|
|
|
|
|
.custom(airBottleRepository.findByBottCodeAndMadeVender(1, bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");// 气瓶编号 |
|
|
|
|
|
|
|
|
if (!bottle.getBottCode().isEmpty()) { |
|
|
|
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20).custom(this.airBottleRepository.findByBottCodeAndMadeVender(Integer.valueOf(1), bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用"); |
|
|
} else { |
|
|
} else { |
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord() |
|
|
|
|
|
.length(1, 20); |
|
|
|
|
|
|
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20); |
|
|
} |
|
|
} |
|
|
v.forProperty("bottType.id").notNull();// 气瓶类型 |
|
|
|
|
|
v.forProperty("madeVenderd.id").notNull();// 气瓶生产厂家 |
|
|
|
|
|
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);// 气瓶材质 |
|
|
|
|
|
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();// 气瓶重量 |
|
|
|
|
|
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();// 公称工作压力 |
|
|
|
|
|
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();// 水压试验压力 |
|
|
|
|
|
v.forProperty("madeDate").notBlank().isDate();// 生产日期 |
|
|
|
|
|
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0,"安装日期必须大于出厂日期!");// 安装日期 |
|
|
|
|
|
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期 |
|
|
|
|
|
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号 |
|
|
|
|
|
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积 |
|
|
|
|
|
|
|
|
v.forProperty("bottType.id").notNull(); |
|
|
|
|
|
v.forProperty("madeVenderd.id").notNull(); |
|
|
|
|
|
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20); |
|
|
|
|
|
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("madeDate").notBlank().isDate(); |
|
|
|
|
|
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0, "安装日期必须大于出厂日期"); |
|
|
|
|
|
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!"); |
|
|
|
|
|
v.forProperty("bottModel").hasNoChineseWord().maxLength(30); |
|
|
|
|
|
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0.0D, 2000.0D); |
|
|
v.check(); |
|
|
v.check(); |
|
|
if(user != null) { |
|
|
|
|
|
|
|
|
if (user != null) { |
|
|
bottle.setRegUser(user.getId()); |
|
|
bottle.setRegUser(user.getId()); |
|
|
} |
|
|
} |
|
|
if(dept != null) { |
|
|
|
|
|
|
|
|
if (dept != null) { |
|
|
bottle.setRegDept(dept); |
|
|
bottle.setRegDept(dept); |
|
|
} |
|
|
} |
|
|
bottle.setRowState(1); |
|
|
bottle.setRowState(1); |
|
|
bottle.setBottState(1); |
|
|
bottle.setBottState(1); |
|
|
bottle.setDateJoined(sdf.format(new Date())); |
|
|
|
|
|
bottle.setDateUpdate(sdf.format(new Date())); |
|
|
|
|
|
|
|
|
bottle.setDateJoined(this.sdf.format(new Date())); |
|
|
|
|
|
bottle.setDateUpdate(this.sdf.format(new Date())); |
|
|
car.setBottleNum(car.getBottleNum() + 1); |
|
|
car.setBottleNum(car.getBottleNum() + 1); |
|
|
repository.save(car); |
|
|
|
|
|
Bottle bott = repository.save(bottle); |
|
|
|
|
|
logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "修改气瓶数量"); |
|
|
|
|
|
logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.INSERT, ""); |
|
|
|
|
|
|
|
|
this.repository.save(car); |
|
|
|
|
|
Bottle bott = (Bottle) this.repository.save(bottle); |
|
|
|
|
|
if (user != null) { |
|
|
|
|
|
this.logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "修改气瓶数量"); |
|
|
|
|
|
} |
|
|
|
|
|
if (user != null) { |
|
|
|
|
|
this.logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.INSERT, ""); |
|
|
|
|
|
} |
|
|
return bott; |
|
|
return bott; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Bottle updateBottle(Bottle bottle, CngUser user, |
|
|
|
|
|
AuthorityDepartment dept) { |
|
|
|
|
|
|
|
|
public Bottle updateBottle(Bottle bottle, CngUser user, AuthorityDepartment dept) { |
|
|
Validator v = new Validator(bottle); |
|
|
Validator v = new Validator(bottle); |
|
|
// 气瓶编号唯一性验证 |
|
|
|
|
|
if (bottle.getBottCode().length() > 0) { |
|
|
|
|
|
v.forProperty("bottCode") |
|
|
|
|
|
.notBlank() |
|
|
|
|
|
.isNOSpecialCharacters() |
|
|
|
|
|
.hasNoChineseWord() |
|
|
|
|
|
.length(1, 20) |
|
|
|
|
|
.custom(airBottleRepository.findByBottCodeAndMadeVender(bottle.getId(), 1, bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");// 气瓶编号 |
|
|
|
|
|
|
|
|
if (!bottle.getBottCode().isEmpty()) { |
|
|
|
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20).custom(this.airBottleRepository.findByBottCodeAndMadeVender(bottle.getId(), Integer.valueOf(1), bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用"); |
|
|
} else { |
|
|
} else { |
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord() |
|
|
|
|
|
.length(1, 20); |
|
|
|
|
|
|
|
|
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20); |
|
|
} |
|
|
} |
|
|
v.forProperty("bottType.id").notNull();// 气瓶类型 |
|
|
|
|
|
v.forProperty("madeVenderd.id").notNull();// 气瓶生产厂家 |
|
|
|
|
|
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);// 气瓶材质 |
|
|
|
|
|
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();// 气瓶重量 |
|
|
|
|
|
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();// 公称工作压力 |
|
|
|
|
|
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();// 水压试验压力 |
|
|
|
|
|
v.forProperty("madeDate").notBlank().isDate();// 生产日期 |
|
|
|
|
|
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0,"安装日期必须大于出厂日期!");// 安装日期 |
|
|
|
|
|
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期 |
|
|
|
|
|
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号 |
|
|
|
|
|
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积 |
|
|
|
|
|
|
|
|
v.forProperty("bottType.id").notNull(); |
|
|
|
|
|
v.forProperty("madeVenderd.id").notNull(); |
|
|
|
|
|
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20); |
|
|
|
|
|
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum(); |
|
|
|
|
|
v.forProperty("madeDate").notBlank().isDate(); |
|
|
|
|
|
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0, "安装日期必须大于出厂日期!"); |
|
|
|
|
|
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!"); |
|
|
|
|
|
v.forProperty("bottModel").hasNoChineseWord().maxLength(30); |
|
|
|
|
|
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0.0D, 2000.0D); |
|
|
v.check(); |
|
|
v.check(); |
|
|
if(user != null) { |
|
|
|
|
|
|
|
|
if (user != null) { |
|
|
bottle.setTouchDeptId(user.getId()); |
|
|
bottle.setTouchDeptId(user.getId()); |
|
|
} |
|
|
} |
|
|
if(dept != null) { |
|
|
|
|
|
|
|
|
if (dept != null) { |
|
|
bottle.setTouchDeptId(dept.getId()); |
|
|
bottle.setTouchDeptId(dept.getId()); |
|
|
} |
|
|
} |
|
|
bottle.setRowState(1); |
|
|
|
|
|
bottle.setBottState(1); |
|
|
|
|
|
bottle.setDateUpdate(sdf.format(new Date())); |
|
|
|
|
|
Bottle bott = repository.save(bottle); |
|
|
|
|
|
logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.UPDATE, ""); |
|
|
|
|
|
|
|
|
bottle.setRowState(Integer.valueOf(1)); |
|
|
|
|
|
bottle.setBottState(Integer.valueOf(1)); |
|
|
|
|
|
bottle.setDateUpdate(this.sdf.format(new Date())); |
|
|
|
|
|
Bottle bott = (Bottle) this.repository.save(bottle); |
|
|
|
|
|
this.logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.UPDATE, ""); |
|
|
return bott; |
|
|
return bott; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean printChecklog(Integer checkid, AuthorityDepartment dept, |
|
|
|
|
|
CngUser user) { |
|
|
|
|
|
CheckLog log = repository.get(CheckLog.class, checkid); |
|
|
|
|
|
|
|
|
public boolean printChecklog(Integer checkid, AuthorityDepartment dept, CngUser user) { |
|
|
|
|
|
CheckLog log = (CheckLog) this.repository.get(CheckLog.class, checkid); |
|
|
log.setTouchDeptId(dept.getId()); |
|
|
log.setTouchDeptId(dept.getId()); |
|
|
log.setTouchUserId(user.getId()); |
|
|
log.setTouchUserId(user.getId()); |
|
|
log.setLogState("0"); |
|
|
log.setLogState("0"); |
|
|
repository.save(log); |
|
|
|
|
|
logOperation.saveCngcdCheckLog(log, user.getUsername(), Operations.UPDATE, "修改打印状态"); |
|
|
|
|
|
|
|
|
this.repository.save(log); |
|
|
|
|
|
this.logOperation.saveCngcdCheckLog(log, user.getUsername(), Operations.UPDATE, "修改打印状态"); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public String syncLogs(String bottleCode) { |
|
|
public String syncLogs(String bottleCode) { |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
String result = "1"; |
|
|
String result = "1"; |
|
|
String date = ""; |
|
|
String date = ""; |
|
|
CheckLogSync syncTemp = checklogRepository.getById(1); |
|
|
|
|
|
if(syncTemp == null){ |
|
|
|
|
|
|
|
|
CheckLogSync syncTemp = this.checklogRepository.getById(Integer.valueOf(1)); |
|
|
|
|
|
if (syncTemp == null) { |
|
|
date = "2012-01-01 00:00:00"; |
|
|
date = "2012-01-01 00:00:00"; |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
Calendar tempDate = Calendar.getInstance(); |
|
|
Calendar tempDate = Calendar.getInstance(); |
|
|
tempDate.setTime(syncTemp.getSyncTime()); |
|
|
tempDate.setTime(syncTemp.getSyncTime()); |
|
|
tempDate.add(Calendar.HOUR_OF_DAY, -1); |
|
|
|
|
|
|
|
|
tempDate.add(11, -1); |
|
|
date = sdf.format(tempDate.getTime()); |
|
|
date = sdf.format(tempDate.getTime()); |
|
|
} |
|
|
} |
|
|
//test |
|
|
|
|
|
// List<CheckLog> testList = new ArrayList<CheckLog>(); |
|
|
|
|
|
// CheckLog testLog = new CheckLog(); |
|
|
|
|
|
// testLog.setSid("1"); |
|
|
|
|
|
// testLog.setDateJoined(new Date()); |
|
|
|
|
|
// testLog.setPlateNum("川AL946学"); |
|
|
|
|
|
// testLog.setVin("LFV2A1BS3E4582212"); |
|
|
|
|
|
// testLog.setBottleCodes("BB2015009138"); |
|
|
|
|
|
// testLog.setCheckCode("QP222222"); |
|
|
|
|
|
// testLog.setIspass("1"); |
|
|
|
|
|
// testLog.setCheckDetail("合格"); |
|
|
|
|
|
// testLog.setCheckName("郭展飞"); |
|
|
|
|
|
// testLog.setCheckDate("2015-10-31 00:00:00"); |
|
|
|
|
|
// testLog.setVerifyName("袁媛"); |
|
|
|
|
|
// testLog.setVerifyDate("2015-11-01 00:00:00"); |
|
|
|
|
|
// testLog.setApprovName("阴昊"); |
|
|
|
|
|
// testLog.setApproverDate("2015-11-02 00:00:00"); |
|
|
|
|
|
// testLog.setLogState("0"); |
|
|
|
|
|
// testList.add(testLog); |
|
|
|
|
|
|
|
|
|
|
|
// 发送 GET 请求 |
|
|
|
|
|
String str = HttpRequest.sendGet( |
|
|
String str = HttpRequest.sendGet( |
|
|
"http://www.chengducng.com/cdcng/special-service/getCheckLogs", |
|
|
"http://www.chengducng.com/cdcng/special-service/getCheckLogs", |
|
|
"date="+date); |
|
|
|
|
|
// 发送 POST 请求 |
|
|
|
|
|
// String sr= HttpRequest.sendPost("http://192.168.1.104:8081/cdcng-front/special-service/getBottleDetails", |
|
|
|
|
|
// "bottleCode=00223085"); |
|
|
|
|
|
|
|
|
"date=" + date); |
|
|
|
|
|
|
|
|
ObjectMapper m = new ObjectMapper(); |
|
|
ObjectMapper m = new ObjectMapper(); |
|
|
try { |
|
|
try { |
|
|
// String str = m.writeValueAsString(testList); |
|
|
|
|
|
JavaType type = m.getTypeFactory().constructParametricType( |
|
|
JavaType type = m.getTypeFactory().constructParametricType( |
|
|
ArrayList.class, CheckLog.class); |
|
|
|
|
|
List<CheckLog> list = m.readValue(str, type); |
|
|
|
|
|
for(CheckLog log : list){ |
|
|
|
|
|
CheckLog tempLog = checklogRepository.findCheckLogBySId(log.getSid()); |
|
|
|
|
|
if(tempLog == null){ |
|
|
|
|
|
CngCdCar car = carStrategy.findCar(log.getPlateNum(), log.getVin()); |
|
|
|
|
|
CngUser checkUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getCheckName()).getId()); |
|
|
|
|
|
CngUser verifiUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getVerifyName()).getId()); |
|
|
|
|
|
CngUser approvUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getApprovName()).getId()); |
|
|
|
|
|
String bottles[] = log.getBottleCodes().split(","); |
|
|
|
|
|
log.setRowState(1); |
|
|
|
|
|
|
|
|
ArrayList.class, new Class[]{CheckLog.class}); |
|
|
|
|
|
List<CheckLog> list = (List) m.readValue(str, type); |
|
|
|
|
|
for (CheckLog log : list) { |
|
|
|
|
|
CheckLog tempLog = this.checklogRepository.findCheckLogBySId(log.getSid()); |
|
|
|
|
|
if (tempLog == null) { |
|
|
|
|
|
CngCdCar car = this.carStrategy.findCar(log.getPlateNum(), log.getVin()); |
|
|
|
|
|
CngUser checkUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getCheckName()).getId()); |
|
|
|
|
|
CngUser verifiUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getVerifyName()).getId()); |
|
|
|
|
|
CngUser approvUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getApprovName()).getId()); |
|
|
|
|
|
String[] bottles = log.getBottleCodes().split(","); |
|
|
|
|
|
log.setRowState(Integer.valueOf(1)); |
|
|
log.setCar(car); |
|
|
log.setCar(car); |
|
|
log.setChecker(checkUser); |
|
|
log.setChecker(checkUser); |
|
|
log.setVerifier(verifiUser); |
|
|
log.setVerifier(verifiUser); |
|
|
log.setApprover(approvUser); |
|
|
log.setApprover(approvUser); |
|
|
log.setDateUpdate(log.getDateJoined()); |
|
|
log.setDateUpdate(log.getDateJoined()); |
|
|
log.setAuthorityDepartment(repository.get(AuthorityDepartment.class, 55)); |
|
|
|
|
|
if(!StringUtil.isNullOrEmpty(log.getDisCard())){ |
|
|
|
|
|
log.setDisCardId(repository.get(DiscardStandArddict.class, Integer.parseInt(log.getDisCard()))); |
|
|
|
|
|
|
|
|
log.setAuthorityDepartment((AuthorityDepartment) this.repository.get(AuthorityDepartment.class, Integer.valueOf(55))); |
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(new String[]{log.getDisCard()})) { |
|
|
|
|
|
log.setDisCardId((DiscardStandArddict) this.repository.get(DiscardStandArddict.class, Integer.valueOf(Integer.parseInt(log.getDisCard())))); |
|
|
} |
|
|
} |
|
|
CheckLog saveLog = repository.save(log); |
|
|
|
|
|
for(int i = 0 ;i < bottles.length; i ++){ |
|
|
|
|
|
|
|
|
CheckLog saveLog = (CheckLog) this.repository.save(log); |
|
|
|
|
|
for (int i = 0; i < bottles.length; i++) { |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
CheckLogBott checklogbott = new CheckLogBott(); |
|
|
List<Bottle> bott = bottleRepository.findBottleByCode(bottles[i]); |
|
|
|
|
|
checklogbott.setBottle(bott.get(0).getId()); |
|
|
|
|
|
|
|
|
List<Bottle> bott = this.bottleRepository.findBottleByCode(bottles[i]); |
|
|
|
|
|
checklogbott.setBottle(((Bottle) bott.get(0)).getId()); |
|
|
checklogbott.setChecklog(saveLog.getId()); |
|
|
checklogbott.setChecklog(saveLog.getId()); |
|
|
repository.save(checklogbott); |
|
|
|
|
|
|
|
|
this.repository.save(checklogbott); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
CheckLogSync sync = new CheckLogSync(); |
|
|
CheckLogSync sync = new CheckLogSync(); |
|
|
sync.setDateJoined(new Date()); |
|
|
sync.setDateJoined(new Date()); |
|
|
sync.setSyncTime(new Date()); |
|
|
sync.setSyncTime(new Date()); |
|
|
sync.setId(1); |
|
|
|
|
|
repository.save(sync); |
|
|
|
|
|
|
|
|
sync.setId(Integer.valueOf(1)); |
|
|
|
|
|
this.repository.save(sync); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
result = "0"; |
|
|
result = "0"; |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void delBottle(String bottleCode) { |
|
|
public void delBottle(String bottleCode) { |
|
|
List<Bottle> list = bottleRepository.findBottleByCode(bottleCode); |
|
|
|
|
|
|
|
|
List<Bottle> list = this.bottleRepository.findBottleByCode(bottleCode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |