Commit 57f14343 authored by wanghao's avatar wanghao

1 液化石油气-安检记录 外部接口开发。

parent 527db5f1
...@@ -5,13 +5,12 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,13 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.mapper.TEnterpriseInfoMapper; import com.zehong.system.mapper.TEnterpriseInfoMapper;
import com.zehong.system.service.*; import com.zehong.system.service.*;
import com.zehong.web.controller.tool.DESEncoder; import com.zehong.web.controller.tool.DESEncoder;
import org.apache.commons.fileupload.MultipartStream;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -40,7 +39,7 @@ public class lpgGasController { ...@@ -40,7 +39,7 @@ public class lpgGasController {
/** /**
* 气瓶档案 * 气瓶档案
*/ */
@Autowired @Resource
private ITLpgGasBottleFilesService tLpgGasBottleFilesService; private ITLpgGasBottleFilesService tLpgGasBottleFilesService;
/** /**
...@@ -58,7 +57,20 @@ public class lpgGasController { ...@@ -58,7 +57,20 @@ public class lpgGasController {
@Resource @Resource
private ITLpgVehicleInfoService lpgVehicleInfoService; private ITLpgVehicleInfoService lpgVehicleInfoService;
@Autowired /**
* 安检记录
*/
@Resource
private ITLpgSafeCheckRecordService lpgSafeCheckRecordService;
/**
* 燃气用户
*/
@Resource
private ITYehuaqiUserService tYehuaqiUserService;
@Resource
DecryptService decryptService; DecryptService decryptService;
@Resource @Resource
...@@ -141,7 +153,7 @@ public class lpgGasController { ...@@ -141,7 +153,7 @@ public class lpgGasController {
// 生产日期 // 生产日期
String makeDate = jsonObject.getString("makeDate") == null ? "" : jsonObject.getString("makeDate"); String makeDate = jsonObject.getString("makeDate") == null ? "" : jsonObject.getString("makeDate");
if(StringUtils.isNotBlank(makeDate) && !isValidDate(sdf,makeDate)) { if(makeDate.length()>0 && !isValidDate(sdf,makeDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"生产日期不符合要求!!!", encryption.getQybm()); "生产日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -150,7 +162,7 @@ public class lpgGasController { ...@@ -150,7 +162,7 @@ public class lpgGasController {
} }
// 上检日期 // 上检日期
String pchkDate = jsonObject.getString("pchkDate") == null ? "" : jsonObject.getString("pchkDate"); String pchkDate = jsonObject.getString("pchkDate") == null ? "" : jsonObject.getString("pchkDate");
if(StringUtils.isNotBlank(pchkDate) && !isValidDate(sdf,pchkDate)) { if(pchkDate.length() > 0 && !isValidDate(sdf,pchkDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"上检日期不符合要求!!!", encryption.getQybm()); "上检日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -159,7 +171,7 @@ public class lpgGasController { ...@@ -159,7 +171,7 @@ public class lpgGasController {
} }
// 下检日期 // 下检日期
String nchkDate = jsonObject.getString("nchkDate") == null ? "" : jsonObject.getString("nchkDate"); String nchkDate = jsonObject.getString("nchkDate") == null ? "" : jsonObject.getString("nchkDate");
if(StringUtils.isNotBlank(nchkDate) && !isValidDate(sdf,nchkDate)) { if(nchkDate.length() > 0 && !isValidDate(sdf,nchkDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"下检日期不符合要求!!!", encryption.getQybm()); "下检日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -168,7 +180,7 @@ public class lpgGasController { ...@@ -168,7 +180,7 @@ public class lpgGasController {
} }
// 生产日期 // 生产日期
String productDate = jsonObject.getString("productDate") == null ? "" : jsonObject.getString("productDate"); String productDate = jsonObject.getString("productDate") == null ? "" : jsonObject.getString("productDate");
if(StringUtils.isNotBlank(productDate) && !isValidDate(sdf,productDate)) { if(productDate.length() > 0 && !isValidDate(sdf,productDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"生产日期不符合要求!!!", encryption.getQybm()); "生产日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -177,7 +189,7 @@ public class lpgGasController { ...@@ -177,7 +189,7 @@ public class lpgGasController {
} }
// 报废日期 // 报废日期
String discardDate = jsonObject.getString("discardDate") == null ? "" : jsonObject.getString("discardDate"); String discardDate = jsonObject.getString("discardDate") == null ? "" : jsonObject.getString("discardDate");
if(StringUtils.isNotBlank(discardDate) && !isValidDate(sdf,discardDate)) { if(discardDate.length()>0 && !isValidDate(sdf,discardDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"报废日期不符合要求!!!", encryption.getQybm()); "报废日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -186,7 +198,7 @@ public class lpgGasController { ...@@ -186,7 +198,7 @@ public class lpgGasController {
} }
// 安全评价日期 // 安全评价日期
String safeJudgeDate = jsonObject.getString("safeJudgeDate") == null ? "" : jsonObject.getString("safeJudgeDate"); String safeJudgeDate = jsonObject.getString("safeJudgeDate") == null ? "" : jsonObject.getString("safeJudgeDate");
if(StringUtils.isNotBlank(safeJudgeDate) && !isValidDate(sdf,safeJudgeDate)) { if(safeJudgeDate.length() > 0 && !isValidDate(sdf,safeJudgeDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgGasBottleFiles", jsonObject.toJSONString(),
"安全评价日期不符合要求!!!", encryption.getQybm()); "安全评价日期不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -254,7 +266,7 @@ public class lpgGasController { ...@@ -254,7 +266,7 @@ public class lpgGasController {
// 压力 // 压力
String pressure = jsonObject.getString("pressure") == null ? "" : jsonObject.getString("pressure"); String pressure = jsonObject.getString("pressure") == null ? "" : jsonObject.getString("pressure");
BigDecimal pressureBigDecimal = BigDecimal.ZERO; BigDecimal pressureBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(pressure)) { if (pressure.length() > 0) {
try { try {
pressureBigDecimal = new BigDecimal(pressure); pressureBigDecimal = new BigDecimal(pressure);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -269,7 +281,7 @@ public class lpgGasController { ...@@ -269,7 +281,7 @@ public class lpgGasController {
// 体积 // 体积
String volume = jsonObject.getString("volume") == null ? "" : jsonObject.getString("volume"); String volume = jsonObject.getString("volume") == null ? "" : jsonObject.getString("volume");
BigDecimal volumeBigDecimal = BigDecimal.ZERO; BigDecimal volumeBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(volume)) { if (volume.length() > 0) {
try { try {
volumeBigDecimal = new BigDecimal(volume); volumeBigDecimal = new BigDecimal(volume);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -304,7 +316,7 @@ public class lpgGasController { ...@@ -304,7 +316,7 @@ public class lpgGasController {
// 公称压力Mpa // 公称压力Mpa
String gpressure = jsonObject.getString("gpressure") == null ? "" : jsonObject.getString("gpressure"); String gpressure = jsonObject.getString("gpressure") == null ? "" : jsonObject.getString("gpressure");
BigDecimal gpressureBigDecimal = BigDecimal.ZERO; BigDecimal gpressureBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(gpressure)) { if (gpressure.length() > 0) {
try { try {
gpressureBigDecimal = new BigDecimal(gpressure); gpressureBigDecimal = new BigDecimal(gpressure);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -319,7 +331,7 @@ public class lpgGasController { ...@@ -319,7 +331,7 @@ public class lpgGasController {
// 水试验压力Mpa // 水试验压力Mpa
String wpressure = jsonObject.getString("wpressure") == null ? "" : jsonObject.getString("wpressure"); String wpressure = jsonObject.getString("wpressure") == null ? "" : jsonObject.getString("wpressure");
BigDecimal wpressureBigDecimal = BigDecimal.ZERO; BigDecimal wpressureBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(wpressure)) { if (wpressure.length() > 0) {
try { try {
wpressureBigDecimal = new BigDecimal(wpressure); wpressureBigDecimal = new BigDecimal(wpressure);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -334,7 +346,7 @@ public class lpgGasController { ...@@ -334,7 +346,7 @@ public class lpgGasController {
// 标准重量KG // 标准重量KG
String selfWeight = jsonObject.getString("selfWeight") == null ? "" : jsonObject.getString("selfWeight"); String selfWeight = jsonObject.getString("selfWeight") == null ? "" : jsonObject.getString("selfWeight");
BigDecimal selfWeightBigDecimal = BigDecimal.ZERO; BigDecimal selfWeightBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(selfWeight)) { if (selfWeight.length() > 0) {
try { try {
selfWeightBigDecimal = new BigDecimal(selfWeight); selfWeightBigDecimal = new BigDecimal(selfWeight);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -348,7 +360,7 @@ public class lpgGasController { ...@@ -348,7 +360,7 @@ public class lpgGasController {
// 壁厚mm // 壁厚mm
String thickness = jsonObject.getString("thickness") == null ? "" : jsonObject.getString("thickness"); String thickness = jsonObject.getString("thickness") == null ? "" : jsonObject.getString("thickness");
BigDecimal thicknessBigDecimal = BigDecimal.ZERO; BigDecimal thicknessBigDecimal = BigDecimal.ZERO;
if (StringUtils.isNotBlank(thickness)) { if (thickness.length() > 0) {
try { try {
thicknessBigDecimal = new BigDecimal(thickness); thicknessBigDecimal = new BigDecimal(thickness);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -406,7 +418,7 @@ public class lpgGasController { ...@@ -406,7 +418,7 @@ public class lpgGasController {
// 已检验次数 // 已检验次数
String inspectedTimes = jsonObject.getString("inspectedTimes") == null ? "" : jsonObject.getString("inspectedTimes"); String inspectedTimes = jsonObject.getString("inspectedTimes") == null ? "" : jsonObject.getString("inspectedTimes");
long inspectedTimesl = 0L; long inspectedTimesl = 0L;
if (StringUtils.isNotBlank(inspectedTimes)) { if (inspectedTimes.length() > 0) {
try { try {
inspectedTimesl = Long.parseLong(inspectedTimes); inspectedTimesl = Long.parseLong(inspectedTimes);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
...@@ -479,34 +491,34 @@ public class lpgGasController { ...@@ -479,34 +491,34 @@ public class lpgGasController {
// 钢瓶交付文件照片 // 钢瓶交付文件照片
String payImage = jsonObject.getString("payImage") == null ? "" : jsonObject.getString("payImage"); String payImage = jsonObject.getString("payImage") == null ? "" : jsonObject.getString("payImage");
if(StringUtils.isNotBlank(payImage) && isBase64Image(payImage)) { if(payImage.length() > 0 && isBase64Image(payImage)) {
lpgGasBottleFiles1.setPayImage(payImage); lpgGasBottleFiles1.setPayImage(payImage);
} }
// 检验质量证明书照片 // 检验质量证明书照片
String batchImage = jsonObject.getString("batchImage") == null ? "" : jsonObject.getString("batchImage"); String batchImage = jsonObject.getString("batchImage") == null ? "" : jsonObject.getString("batchImage");
if (StringUtils.isNotBlank(batchImage) && isBase64Image(batchImage)) { if (batchImage.length() > 0 && isBase64Image(batchImage)) {
lpgGasBottleFiles1.setBatchImage(batchImage); lpgGasBottleFiles1.setBatchImage(batchImage);
} }
// 制造监督检验证书照片 // 制造监督检验证书照片
String deviceImage = jsonObject.getString("deviceImage") == null ? "" : jsonObject.getString("deviceImage"); String deviceImage = jsonObject.getString("deviceImage") == null ? "" : jsonObject.getString("deviceImage");
if (StringUtils.isNotBlank(deviceImage) && isBase64Image(deviceImage)) { if (deviceImage.length() > 0 && isBase64Image(deviceImage)) {
lpgGasBottleFiles1.setDeviceImage(deviceImage); lpgGasBottleFiles1.setDeviceImage(deviceImage);
} }
// 检验报告照片 // 检验报告照片
String checkImage = jsonObject.getString("checkImage") == null ? "" : jsonObject.getString("checkImage"); String checkImage = jsonObject.getString("checkImage") == null ? "" : jsonObject.getString("checkImage");
if (StringUtils.isNotBlank(checkImage) && isBase64Image(checkImage)) { if (checkImage.length() > 0 && isBase64Image(checkImage)) {
lpgGasBottleFiles1.setCheckImage(checkImage); lpgGasBottleFiles1.setCheckImage(checkImage);
} }
// 钢瓶信息照片 // 钢瓶信息照片
String botImage = jsonObject.getString("botImage") == null ? "" : jsonObject.getString("botImage"); String botImage = jsonObject.getString("botImage") == null ? "" : jsonObject.getString("botImage");
if (StringUtils.isNotBlank(botImage) && isBase64Image(botImage)) { if (botImage.length() > 0 && isBase64Image(botImage)) {
lpgGasBottleFiles1.setBotImage(botImage); lpgGasBottleFiles1.setBotImage(botImage);
} }
...@@ -742,7 +754,7 @@ public class lpgGasController { ...@@ -742,7 +754,7 @@ public class lpgGasController {
} }
// 充装记录编号 // 充装记录编号
String gzId = jsonObject.getString("gzId") == null ? "" : jsonObject.getString("gzId"); String gzId = jsonObject.getString("gzId");
if (StringUtils.isBlank(gzId)) { if (StringUtils.isBlank(gzId)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(),
"充装记录编号不许为空!!!", encryption.getQybm()); "充装记录编号不许为空!!!", encryption.getQybm());
...@@ -766,7 +778,7 @@ public class lpgGasController { ...@@ -766,7 +778,7 @@ public class lpgGasController {
// 充装开始时间 // 充装开始时间
String fillStatrTime = jsonObject.getString("fillStatrTime") == null ? "" : jsonObject.getString("fillStatrTime"); String fillStatrTime = jsonObject.getString("fillStatrTime") == null ? "" : jsonObject.getString("fillStatrTime");
if(StringUtils.isNotBlank(fillStatrTime) && !isValidDate(sdf,fillStatrTime)) { if(fillStatrTime.length() > 0 && !isValidDate(sdf,fillStatrTime)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(),
"充装开始时间不符合要求!!!", encryption.getQybm()); "充装开始时间不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -775,7 +787,7 @@ public class lpgGasController { ...@@ -775,7 +787,7 @@ public class lpgGasController {
} }
// 充装结束时间 // 充装结束时间
String fillEndTime = jsonObject.getString("fillEndTime") == null ? "" : jsonObject.getString("fillEndTime"); String fillEndTime = jsonObject.getString("fillEndTime") == null ? "" : jsonObject.getString("fillEndTime");
if(StringUtils.isNotBlank(fillEndTime) && !isValidDate(sdf,fillEndTime)) { if(fillEndTime.length() > 0 && !isValidDate(sdf,fillEndTime)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(), lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgAirChargeFiles", jsonObject.toJSONString(),
"充装结束时间不符合要求!!!", encryption.getQybm()); "充装结束时间不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord); lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
...@@ -826,7 +838,7 @@ public class lpgGasController { ...@@ -826,7 +838,7 @@ public class lpgGasController {
// 设定净重 // 设定净重
String setWeight = jsonObject.getString("setWeight") == null ? "" : jsonObject.getString("setWeight"); String setWeight = jsonObject.getString("setWeight") == null ? "" : jsonObject.getString("setWeight");
if (StringUtils.isNotBlank(setWeight)) { if (setWeight.length() > 0) {
try { try {
new BigDecimal(setWeight); new BigDecimal(setWeight);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -840,7 +852,7 @@ public class lpgGasController { ...@@ -840,7 +852,7 @@ public class lpgGasController {
// 实际净重 // 实际净重
String wtNet = jsonObject.getString("wtNet") == null ? "" : jsonObject.getString("wtNet"); String wtNet = jsonObject.getString("wtNet") == null ? "" : jsonObject.getString("wtNet");
if (StringUtils.isNotBlank(wtNet)) { if (wtNet.length() > 0) {
try { try {
new BigDecimal(wtNet); new BigDecimal(wtNet);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -854,7 +866,7 @@ public class lpgGasController { ...@@ -854,7 +866,7 @@ public class lpgGasController {
// 设定瓶重 // 设定瓶重
String setBottleWeight = jsonObject.getString("setBottleWeight") == null ? "" : jsonObject.getString("setBottleWeight"); String setBottleWeight = jsonObject.getString("setBottleWeight") == null ? "" : jsonObject.getString("setBottleWeight");
if (StringUtils.isNotBlank(setBottleWeight)) { if (setBottleWeight.length() > 0) {
try { try {
new BigDecimal(setBottleWeight); new BigDecimal(setBottleWeight);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -868,7 +880,7 @@ public class lpgGasController { ...@@ -868,7 +880,7 @@ public class lpgGasController {
// 实际瓶重 // 实际瓶重
String bottleWeight = jsonObject.getString("bottleWeight") == null ? "" : jsonObject.getString("bottleWeight"); String bottleWeight = jsonObject.getString("bottleWeight") == null ? "" : jsonObject.getString("bottleWeight");
if (StringUtils.isNotBlank(bottleWeight)) { if (bottleWeight.length() > 0) {
try { try {
new BigDecimal(bottleWeight); new BigDecimal(bottleWeight);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -882,7 +894,7 @@ public class lpgGasController { ...@@ -882,7 +894,7 @@ public class lpgGasController {
// 实际总重 // 实际总重
String wtGross = jsonObject.getString("wtGross") == null ? "" : jsonObject.getString("wtGross"); String wtGross = jsonObject.getString("wtGross") == null ? "" : jsonObject.getString("wtGross");
if (StringUtils.isNotBlank(wtGross)) { if (wtGross.length() > 0) {
try { try {
new BigDecimal(wtGross); new BigDecimal(wtGross);
}catch (NumberFormatException e) { }catch (NumberFormatException e) {
...@@ -1284,6 +1296,477 @@ public class lpgGasController { ...@@ -1284,6 +1296,477 @@ public class lpgGasController {
return AjaxResult.success(sb.toString()); return AjaxResult.success(sb.toString());
} }
/**
* 创建 安检记录接口
* @return r
*/
@PostMapping("/createLpgSafeCheckRecord")
public AjaxResult createLpgSafeCheckRecord(@RequestBody Encryption encryption) {
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
if (selectkey == null) {
return AjaxResult.error("企业编码不存在!!!");
}
DESEncoder desEncoder = new DESEncoder();
String data = encryption.getData();
String decrypt = desEncoder.decrypt(data, selectkey.getSecretKey());
TEnterpriseInfo tEnterpriseInfo = tEnterpriseInfoMapper.selectTEnterpriseInfoById(selectkey.getEnterpriseId());
if (tEnterpriseInfo == null) {
return AjaxResult.error("监管平台配置企业信息不存在!!!");
}
int successNum = 0;
int errorNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
JSONArray jsonArray = JSON.parseArray(decrypt);
String js = JSONObject.toJSONString(jsonArray, SerializerFeature.WriteClassName);
List<JSONObject> list = JSONObject.parseArray(js, JSONObject.class);
if (list.size() > 500) {
return AjaxResult.error("每次最多处理500条数据");
}
List<TLpgSafeCheckRecord> lpgSafeCheckRecords = new ArrayList<>();
// 液化气表里面有的userOwnId
List<TLpgSafeCheckRecord> yehuaqiLpgSafeCheckRecords = new ArrayList<>();
TLpgSafeCheckRecord lpgSafeCheckRecord;
String dateFormat = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
// 接口保存记录
List<TLpgThirdPartyDockingInterfaceRecord> lpgThirdPartyDockingInterfaceRecords = new ArrayList<>();
TLpgThirdPartyDockingInterfaceRecord lpgThirdPartyDockingInterfaceRecord;
for (int i = 0; i < list.size(); i++) {
lpgSafeCheckRecord = new TLpgSafeCheckRecord();
JSONObject jsonObject = list.get(i);
// 用户自有编号 可以为空
String userOwnId = jsonObject.getString("userOwnId") == null ? "" : jsonObject.getString("userOwnId");
if(userOwnId.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用户自有编号不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 储备站 可以为空
String stationName = jsonObject.getString("stationName") == null ? "" : jsonObject.getString("stationName");
if (stationName.length() > 64) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"储备站不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户名可以为空
String gasUser = jsonObject.getString("gasUser") == null ? "" : jsonObject.getString("gasUser");
if (gasUser.length() > 64) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用户名不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 联系电话 可以为空
String telNum = jsonObject.getString("telNum") == null ? "" : jsonObject.getString("telNum");
if (telNum.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"联系电话不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户地址 可以为空
String gasUserAddress = jsonObject.getString("gasUserAddress") == null ? "" : jsonObject.getString("gasUserAddress");
if (gasUserAddress.length() > 50) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用户地址 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户类型 可以为空
String gasUserType = jsonObject.getString("gasUserType") == null ? "" : jsonObject.getString("gasUserType");
if (gasUserType.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用户类型不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用户类型 可以为空
if(gasUserType.length()> 0 && !"0".equals(gasUserType) && !"1".equals(gasUserType)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用户类型不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 安检时间 可以为空
String safeCheckDate = jsonObject.getString("safeCheckDate") == null ? "" : jsonObject.getString("safeCheckDate");
if (safeCheckDate.length() > 0 && !isValidDate(sdf,safeCheckDate)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"安检时间不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 安检人 可以为空
String safeCheckPerson = jsonObject.getString("safeCheckPerson") == null ? "" : jsonObject.getString("safeCheckPerson");
if(safeCheckPerson.length() > 20) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"安检人不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 气瓶数量 可以为空
String bottleNum = jsonObject.getString("bottleNum") == null ? "" : jsonObject.getString("bottleNum");
int bottleNumInt = 0;
if(bottleNum.length() > 0) {
try {
bottleNumInt = Integer.parseInt(bottleNum);
} catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"气瓶数量不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
// 入户状态 可以为空
String checkInStatus = jsonObject.getString("checkInStatus") == null ? "" : jsonObject.getString("checkInStatus");
if(checkInStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"入户状态不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (checkInStatus.length() > 0 && !"0".equals(checkInStatus) && !"1".equals(checkInStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"入户状态不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 燃气灶具检查情况 可以为空
String stoveCheckStatus = jsonObject.getString("stoveCheckStatus") == null ? "" : jsonObject.getString("stoveCheckStatus");
if(stoveCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"燃气灶具检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (stoveCheckStatus.length() > 0 && !"0".equals(stoveCheckStatus) && !"1".equals(stoveCheckStatus) && !"2".equals(stoveCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"燃气灶具检查情况 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 连接软管检查情况 可以为空
String hoseCheckStatus = jsonObject.getString("hoseCheckStatus") == null ? "" : jsonObject.getString("hoseCheckStatus");
if(hoseCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"连接软管检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (hoseCheckStatus.length() > 0 && !"0".equals(hoseCheckStatus) && !"1".equals(hoseCheckStatus)
&& !"2".equals(hoseCheckStatus)&& !"3".equals(hoseCheckStatus)&& !"4".equals(hoseCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"连接软管检查情况 不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 减压阀检查情况: 可以为空
String valveCheckStatus = jsonObject.getString("valveCheckStatus") == null ? "" : jsonObject.getString("valveCheckStatus");
if(valveCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"减压阀检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (valveCheckStatus.length() > 0 && !"0".equals(valveCheckStatus) && !"1".equals(valveCheckStatus) && !"2".equals(valveCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"减压阀检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 液化气钢瓶检查情况 可以为空
String bottleCheckStatus = jsonObject.getString("bottleCheckStatus") == null ? "" : jsonObject.getString("bottleCheckStatus");
if(bottleCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"液化气钢瓶检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (bottleCheckStatus.length() > 0 && !"0".equals(bottleCheckStatus) && !"1".equals(bottleCheckStatus)
&& !"2".equals(bottleCheckStatus)&& !"3".equals(bottleCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"液化气钢瓶检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 报警器加电磁切断阀检查情况 可以为空
String alarmCheckStatus = jsonObject.getString("alarmCheckStatus") == null ? "" : jsonObject.getString("alarmCheckStatus");
if(alarmCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"报警器加电磁切断阀检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (alarmCheckStatus.length() > 0 && !"0".equals(alarmCheckStatus) && !"1".equals(alarmCheckStatus)
&& !"2".equals(alarmCheckStatus)&& !"3".equals(alarmCheckStatus)&& !"4".equals(alarmCheckStatus)
&& !"5".equals(alarmCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"报警器加电磁切断阀检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 用气场所检查情况 可以为空
String placeCheckStatus = jsonObject.getString("placeCheckStatus") == null ? "" : jsonObject.getString("placeCheckStatus");
if(placeCheckStatus.length() > 2) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用气场所检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
if (placeCheckStatus.length() > 0 && !"0".equals(placeCheckStatus) && !"1".equals(placeCheckStatus)
&& !"2".equals(placeCheckStatus)&& !"3".equals(placeCheckStatus)&& !"4".equals(placeCheckStatus)
&& !"5".equals(placeCheckStatus)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", jsonObject.toJSONString(),
"用气场所检查情况不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
lpgSafeCheckRecord.setUserOwnId(userOwnId);
lpgSafeCheckRecord.setStationName(stationName);
lpgSafeCheckRecord.setGasUser(gasUser);
lpgSafeCheckRecord.setTelNum(telNum);
lpgSafeCheckRecord.setGasUserAddress(gasUserAddress);
lpgSafeCheckRecord.setGasUserType(gasUserType);
lpgSafeCheckRecord.setSafeCheckDate(DateUtils.parseDate(safeCheckDate));
lpgSafeCheckRecord.setSafeCheckPerson(safeCheckPerson);
lpgSafeCheckRecord.setBottleNum(bottleNumInt);
lpgSafeCheckRecord.setCheckInStatus(checkInStatus);
lpgSafeCheckRecord.setStoveCheckStatus(stoveCheckStatus);
lpgSafeCheckRecord.setHoseCheckStatus(hoseCheckStatus);
lpgSafeCheckRecord.setValveCheckStatus(valveCheckStatus);
lpgSafeCheckRecord.setBottleCheckStatus(bottleCheckStatus);
lpgSafeCheckRecord.setAlarmCheckStatus(alarmCheckStatus);
lpgSafeCheckRecord.setPlaceCheckStatus(placeCheckStatus);
// 六张照片
// 燃气灶具检查情况照片 可以为空
String stoveCheckPic = jsonObject.getString("stoveCheckPic") == null ? "" : jsonObject.getString("stoveCheckPic");
if(stoveCheckPic.length() > 0 && !isBase64Image(stoveCheckPic)) {
lpgSafeCheckRecord.setStoveCheckPic(stoveCheckPic);
}
// 连接软管检查情况照片 可以为空
String hoseCheckPic = jsonObject.getString("hoseCheckPic") == null ? "" : jsonObject.getString("hoseCheckPic");
if(hoseCheckPic.length() > 0 && !isBase64Image(hoseCheckPic)) {
lpgSafeCheckRecord.setHoseCheckPic(hoseCheckPic);
}
// 减压阀检查情况 可以为空
String valveCheckPic = jsonObject.getString("valveCheckPic") == null ? "" : jsonObject.getString("valveCheckPic");
if(valveCheckPic.length() > 0 && !isBase64Image(valveCheckPic)) {
lpgSafeCheckRecord.setValveCheckPic(valveCheckPic);
}
// 液化气钢瓶检查情况 可以为空
String bottleCheckPic = jsonObject.getString("bottleCheckPic") == null ? "" : jsonObject.getString("bottleCheckPic");
if(bottleCheckPic.length() > 0 && !isBase64Image(bottleCheckPic)) {
lpgSafeCheckRecord.setBottleCheckPic(bottleCheckPic);
}
// 报警器加电磁切断阀检查情况照片 可以为空
String alarmCheckPic = jsonObject.getString("alarmCheckPic") == null ? "" : jsonObject.getString("alarmCheckPic");
if(alarmCheckPic.length() > 0 && !isBase64Image(alarmCheckPic)) {
lpgSafeCheckRecord.setAlarmCheckPic(alarmCheckPic);
}
// 用气场所检查情况照片 可以为空
String placeCheckPic = jsonObject.getString("placeCheckPic") == null ? "" : jsonObject.getString("placeCheckPic");
if(placeCheckPic.length() > 0 && !isBase64Image(placeCheckPic)) {
lpgSafeCheckRecord.setPlaceCheckPic(placeCheckPic);
}
lpgSafeCheckRecords.add(lpgSafeCheckRecord);
}
if (lpgSafeCheckRecords.size() > 0) {
// 集合里面如果有 userOwnId 则 去燃气用户表里面查下 看看有没有该用户
List<TLpgSafeCheckRecord> collect = lpgSafeCheckRecords.stream().filter(item -> StringUtils.isNotBlank(item.getUserOwnId())).collect(Collectors.toList());
// userOwnId 不为空的数据
if (collect.size() > 0) {
// 处理没有 userownid的数据,直接插入
List<TLpgSafeCheckRecord> collect2 = lpgSafeCheckRecords.stream().filter(item -> StringUtils.isBlank(item.getUserOwnId())).collect(Collectors.toList());
if (collect2.size() > 0) {
successNum += collect2.size();
lpgSafeCheckRecordService.insertBatchContainPic(collect2);
for (TLpgSafeCheckRecord safeCheckRecord : collect2) {
safeCheckRecord.setPlaceCheckPic("");
safeCheckRecord.setValveCheckPic("");
safeCheckRecord.setBottleCheckPic("");
safeCheckRecord.setAlarmCheckPic("");
safeCheckRecord.setHoseCheckPic("");
safeCheckRecord.setStoveCheckPic("");
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgSafeCheckRecord", safeCheckRecord.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
}
// 处理有 userOwnId的 看看 燃气用户表下有没有数据
List<String> collect1 = collect.stream().map(TLpgSafeCheckRecord::getUserOwnId).collect(Collectors.toList());
List<TYehuaqiUser> yehuaqiUsers = tYehuaqiUserService.queryByUserOwnIdsAndEnterpriseId(collect1, tEnterpriseInfo.getEnterpriseId());
if (yehuaqiUsers.size() > 0) {
Map<String, List<TYehuaqiUser>> collect3 = yehuaqiUsers.stream().collect(Collectors.groupingBy(TYehuaqiUser::getUserOwnId));
for (TLpgSafeCheckRecord tLpgSafeCheckRecord : collect) {
List<TYehuaqiUser> yehuaqiUsers1 = collect3.get(tLpgSafeCheckRecord.getUserOwnId());
if (yehuaqiUsers1.size() > 0) {
successNum ++;
tLpgSafeCheckRecord.setPlaceCheckPic("");
tLpgSafeCheckRecord.setValveCheckPic("");
tLpgSafeCheckRecord.setBottleCheckPic("");
tLpgSafeCheckRecord.setAlarmCheckPic("");
tLpgSafeCheckRecord.setHoseCheckPic("");
tLpgSafeCheckRecord.setStoveCheckPic("");
tLpgSafeCheckRecord.setUserId(yehuaqiUsers1.get(0).getUserId());
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgSafeCheckRecord", tLpgSafeCheckRecord.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
yehuaqiLpgSafeCheckRecords.add(tLpgSafeCheckRecord);
} else {
errorNum++;
tLpgSafeCheckRecord.setPlaceCheckPic("");
tLpgSafeCheckRecord.setValveCheckPic("");
tLpgSafeCheckRecord.setBottleCheckPic("");
tLpgSafeCheckRecord.setAlarmCheckPic("");
tLpgSafeCheckRecord.setHoseCheckPic("");
tLpgSafeCheckRecord.setStoveCheckPic("");
String sb = "燃气用户userOwnId为:" + tLpgSafeCheckRecord.getUserOwnId() + "的用户在监管平台不存在";
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", tLpgSafeCheckRecord.toString(),
sb, encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
}
} else {
errorNum += collect.size();
for (TLpgSafeCheckRecord safeCheckRecord : collect) {
safeCheckRecord.setPlaceCheckPic("");
safeCheckRecord.setValveCheckPic("");
safeCheckRecord.setBottleCheckPic("");
safeCheckRecord.setAlarmCheckPic("");
safeCheckRecord.setHoseCheckPic("");
safeCheckRecord.setStoveCheckPic("");
String sb = "燃气用户userOwnId为:" + safeCheckRecord.getUserOwnId() + "的用户在监管平台不存在";
lpgThirdPartyDockingInterfaceRecord = errorRecord("createLpgSafeCheckRecord", safeCheckRecord.toString(),
sb, encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
}
// userOwnId 都为空的数据
} else {
lpgSafeCheckRecordService.insertBatchContainPic(lpgSafeCheckRecords);
for (TLpgSafeCheckRecord safeCheckRecord : lpgSafeCheckRecords) {
safeCheckRecord.setPlaceCheckPic("");
safeCheckRecord.setValveCheckPic("");
safeCheckRecord.setBottleCheckPic("");
safeCheckRecord.setAlarmCheckPic("");
safeCheckRecord.setHoseCheckPic("");
safeCheckRecord.setStoveCheckPic("");
lpgThirdPartyDockingInterfaceRecord = successRecord("createLpgSafeCheckRecord", safeCheckRecord.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
successNum += lpgSafeCheckRecords.size();
}
}
if(yehuaqiLpgSafeCheckRecords.size() > 0) {
lpgSafeCheckRecordService.insertBatchContainPic(yehuaqiLpgSafeCheckRecords);
}
// 接口记录直接插入
if (lpgThirdPartyDockingInterfaceRecords.size() > 0) {
lpgThirdPartyDockingInterfaceRecordService.insertBatch(lpgThirdPartyDockingInterfaceRecords);
}
}
StringBuilder sb = new StringBuilder();
if (errorNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条");
return AjaxResult.success(sb.toString());
}
sb.append("成功:").append(successNum).append("条");
return AjaxResult.success(sb.toString());
}
/** /**
* 封装一个 失败的接口对象 * 封装一个 失败的接口对象
* @return r * @return r
......
...@@ -3,6 +3,7 @@ package com.zehong.web.controller.tool; ...@@ -3,6 +3,7 @@ package com.zehong.web.controller.tool;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zehong.common.utils.StringUtils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
...@@ -158,15 +159,65 @@ public class DESEncoder { ...@@ -158,15 +159,65 @@ public class DESEncoder {
// System.out.println(DESEncoder.encrypt(skcs1,"23546324")); // System.out.println(DESEncoder.encrypt(skcs1,"23546324"));
String lpggasdata = "[\n" + String lpggasdata = "[\n" +
"{\"onState\":\"1\",\"vehicleLimt\":\"车辆限乘01\",\"vehicleLoad\":\"车辆载重01\",\"carNum\":\"SE123\",\"vehicleCode\":\"代码01\",\"brandModel\":\"品牌型号01\",\"vehicleInspect\":\"车辆检查信息01\",\"vehicleUser\":\"使用人01\",\"carNumber\":\"车辆编号01\",\"phone\":\"888888888\",\"personLiable\":\"责任人88888888\",\"stationName\":\"储备站88888888\",\"vehicleSize\":\"车辆大小01\",\"vehicleType\":\"车辆类型01\",\"remarks\":\"备注01\"},\n" + " {\n" +
"{\"onState\":\"0\",\"vehicleLimt\":\"车辆限乘02\",\"vehicleLoad\":\"车辆载重02\",\"carNum\":\"SE456\",\"vehicleCode\":\"代码02\",\"brandModel\":\"品牌型号02\",\"vehicleInspect\":\"车辆检查信息02\",\"vehicleUser\":\"使用人02\",\"carNumber\":\"车辆编号02\",\"phone\":\"联系电话02\",\"personLiable\":\"责任人02\",\"stationName\":\"储备站02\",\"vehicleSize\":\"车辆大小02\",\"vehicleType\":\"车辆类型02\",\"remarks\":\"备注02\"}\n" + " \"userOwnId\": \"1\",\n" +
"{\"onState\":\"1\",\"vehicleLimt\":\"车辆限乘01\",\"vehicleLoad\":\"车辆载重01\",\"carNum\":\"SE123\",\"vehicleCode\":\"代码01\",\"brandModel\":\"品牌型号01\",\"vehicleInspect\":\"车辆检查信息01\",\"vehicleUser\":\"使用人01\",\"carNumber\":\"车辆编号01\",\"phone\":\"888888888\",\"personLiable\":\"责任人88888888\",\"stationName\":\"储备站88888888\",\"vehicleSize\":\"车辆大小01\",\"vehicleType\":\"车辆类型01\",\"remarks\":\"备注01\"},\n" + " \"stationName\": \"储备站01-接口来的-01\",\n" +
"]"; " \"gasUser\": \"用户名01-接口来的-01\",\n" +
" \"telNum\": \"电话01-接口来的-01\",\n" +
" \"gasUserAddress\": \"用户地址01-接口来的-01\",\n" +
" \"gasUserType\": \"0\",\n" +
" \"safeCheckDate\": \"2024-12-16\",\n" +
" \"safeCheckPerson\": \"安检人-接口来的-01\",\n" +
" \"bottleNum\": \"15\",\n" +
" \"checkInStatus\": \"0\",\n" +
" \"stoveCheckStatus\": \"0\",\n" +
" \"hoseCheckStatus\": \"0\",\n" +
" \"valveCheckStatus\": \"0\",\n" +
" \"bottleCheckStatus\": \"0\",\n" +
" \"alarmCheckStatus\": \"0\",\n" +
" \"placeCheckStatus\": \"0\",\n" +
"\n" +
" \"stoveCheckPic\": \"0\",\n" +
" \"hoseCheckPic\": \"0\",\n" +
" \"valveCheckPic\": \"0\",\n" +
" \"bottleCheckPic\": \"0\",\n" +
" \"alarmCheckPic\": \"0\",\n" +
" \"placeCheckPic\": \"0\",\n" +
" },\n" +
" {\n" +
" \"userOwnId\": \"2\",\n" +
" \"stationName\": \"储备站01-接口来的-01\",\n" +
" \"gasUser\": \"用户名01-接口来的-01\",\n" +
" \"telNum\": \"电话01-接口来的-01\",\n" +
" \"gasUserAddress\": \"用户地址01-接口来的-01\",\n" +
" \"gasUserType\": \"用户类型-接口来的-01\",\n" +
" \"safeCheckDate\": \"2024-12-16\",\n" +
" \"safeCheckPerson\": \"安检人-接口来的-01\",\n" +
" \"bottleNum\": \"设定净重-接口来的-01\",\n" +
" \"checkInStatus\": \"入户状态01-接口来的-01\",\n" +
" \"stoveCheckStatus\": \"0\",\n" +
" \"hoseCheckStatus\": \"0\",\n" +
" \"valveCheckStatus\": \"0\",\n" +
" \"bottleCheckStatus\": \"0\",\n" +
" \"alarmCheckStatus\": \"0\",\n" +
" \"placeCheckStatus\": \"0\",\n" +
"\n" +
" \"stoveCheckPic\": \"0\",\n" +
" \"hoseCheckPic\": \"0\",\n" +
" \"valveCheckPic\": \"0\",\n" +
" \"bottleCheckPic\": \"0\",\n" +
" \"alarmCheckPic\": \"0\",\n" +
" \"placeCheckPic\": \"0\",\n" +
" }\n" +
"]\n" +
"\n";
JSONArray objects = JSON.parseArray(lpggasdata); JSONArray objects = JSON.parseArray(lpggasdata);
System.out.println(objects); System.out.println(objects);
System.out.println(DESEncoder.encrypt(objects.toString(),"GCQYTRQ00001")); System.out.println(DESEncoder.encrypt(objects.toString(),"GCQYTRQ00001"));
} }
} }
...@@ -119,6 +119,12 @@ public class TLpgSafeCheckRecord extends BaseEntity ...@@ -119,6 +119,12 @@ public class TLpgSafeCheckRecord extends BaseEntity
private Long userId; private Long userId;
/**
* 用户自有编号 接收第三方数据时暂时使用
*/
private String userOwnId;
public void setSafeCheckId(Long safeCheckId) public void setSafeCheckId(Long safeCheckId)
{ {
this.safeCheckId = safeCheckId; this.safeCheckId = safeCheckId;
...@@ -353,6 +359,14 @@ public class TLpgSafeCheckRecord extends BaseEntity ...@@ -353,6 +359,14 @@ public class TLpgSafeCheckRecord extends BaseEntity
this.userId = userId; this.userId = userId;
} }
public String getUserOwnId() {
return userOwnId;
}
public void setUserOwnId(String userOwnId) {
this.userOwnId = userOwnId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -43,6 +43,13 @@ public interface TLpgSafeCheckRecordMapper ...@@ -43,6 +43,13 @@ public interface TLpgSafeCheckRecordMapper
* @return r * @return r
*/ */
public int insertBatch(@Param("list") List<TLpgSafeCheckRecord> list); public int insertBatch(@Param("list") List<TLpgSafeCheckRecord> list);
/**
* 批量插入 包含图片
* @param list list
* @return r
*/
public int insertBatchContainPic(@Param("list") List<TLpgSafeCheckRecord> list);
/** /**
* 修改液化石油安检记录 * 修改液化石油安检记录
* *
......
...@@ -84,6 +84,14 @@ public interface TYehuaqiUserMapper ...@@ -84,6 +84,14 @@ public interface TYehuaqiUserMapper
*/ */
public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser); public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser);
/**
* 根据userOwnIds 和 enterpriseId 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
public List<TYehuaqiUser> queryByUserOwnIdsAndEnterpriseId(@Param("userOwnIds") List<String> userOwnIds,@Param("enterpriseId") String enterpriseId);
public List<TYehuaqiUser> queryErrorDetectorUserList(String depId); public List<TYehuaqiUser> queryErrorDetectorUserList(String depId);
/** /**
* 修改燃气用户 * 修改燃气用户
......
...@@ -39,6 +39,13 @@ public interface ITLpgSafeCheckRecordService ...@@ -39,6 +39,13 @@ public interface ITLpgSafeCheckRecordService
*/ */
public int insertTLpgSafeCheckRecord(TLpgSafeCheckRecord tLpgSafeCheckRecord); public int insertTLpgSafeCheckRecord(TLpgSafeCheckRecord tLpgSafeCheckRecord);
/**
* 批量插入
* @param tLpgSafeCheckRecords t
* @return r
*/
public int insertBatchContainPic(List<TLpgSafeCheckRecord> tLpgSafeCheckRecords);
/** /**
* 修改液化石油安检记录 * 修改液化石油安检记录
* *
......
...@@ -57,6 +57,14 @@ public interface ITYehuaqiUserService ...@@ -57,6 +57,14 @@ public interface ITYehuaqiUserService
*/ */
public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser); public List<TYehuaqiUser> selectForExportTYehuaqiUserList(TYehuaqiUser tDetectorUser);
/**
* 根据用户自有id 集合 和 企业id 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
public List<TYehuaqiUser> queryByUserOwnIdsAndEnterpriseId(List<String> userOwnIds,String enterpriseId);
/** /**
* 查询导入的错误数据 * 查询导入的错误数据
* @return r * @return r
......
...@@ -70,6 +70,16 @@ public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordServi ...@@ -70,6 +70,16 @@ public class TLpgSafeCheckRecordServiceImpl implements ITLpgSafeCheckRecordServi
return tLpgSafeCheckRecordMapper.insertTLpgSafeCheckRecord(tLpgSafeCheckRecord); return tLpgSafeCheckRecordMapper.insertTLpgSafeCheckRecord(tLpgSafeCheckRecord);
} }
/**
* 批量插入
* @param tLpgSafeCheckRecords t
* @return r
*/
@Override
public int insertBatchContainPic(List<TLpgSafeCheckRecord> tLpgSafeCheckRecords) {
return tLpgSafeCheckRecordMapper.insertBatchContainPic(tLpgSafeCheckRecords);
}
/** /**
* 修改液化石油安检记录 * 修改液化石油安检记录
* *
......
...@@ -208,6 +208,17 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService ...@@ -208,6 +208,17 @@ public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
return tYehuaqiUserMapper.selectForExportTYehuaqiUserList(yehuaqiUser); return tYehuaqiUserMapper.selectForExportTYehuaqiUserList(yehuaqiUser);
} }
/**
* 根据userOwnIds 和 enterpriseId 查询数据
* @param userOwnIds u
* @param enterpriseId e
* @return r
*/
@Override
public List<TYehuaqiUser> queryByUserOwnIdsAndEnterpriseId(List<String> userOwnIds, String enterpriseId) {
return tYehuaqiUserMapper.queryByUserOwnIdsAndEnterpriseId(userOwnIds,enterpriseId);
}
/** /**
* 处理解析好的 自定义模版的导入的数据 多sheet * 处理解析好的 自定义模版的导入的数据 多sheet
* @param gasUserExportVos d 燃气用户数据 * @param gasUserExportVos d 燃气用户数据
......
...@@ -105,7 +105,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -105,7 +105,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertBatch" parameterType="list"> <insert id="insertBatch" parameterType="list">
insert into t_lpg_safe_check_record (station_name, user_id,gas_user_type,gas_user_address,tel_num,safe_check_date, insert into t_lpg_safe_check_record (station_name, user_id,gas_user_type,gas_user_address,tel_num,safe_check_date,
safe_check_person,bottle_num,check_in_status,stove_check_status,hose_check_status,valve_check_status,bottle_check_status, safe_check_person,bottle_num,check_in_status,stove_check_status,hose_check_status,valve_check_status,bottle_check_status,
alarm_check_status,place_check_status) alarm_check_status,place_check_status)
...@@ -119,6 +118,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -119,6 +118,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</foreach> </foreach>
</insert> </insert>
<insert id="insertBatchContainPic" parameterType="list">
insert into t_lpg_safe_check_record (station_name, user_id,gas_user_type,gas_user_address,tel_num,safe_check_date,
safe_check_person,bottle_num,check_in_status,stove_check_status,hose_check_status,valve_check_status,bottle_check_status,
alarm_check_status,place_check_status,stove_check_pic,hose_check_pic,valve_check_pic,bottle_check_pic,alarm_check_pic,place_check_pic)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.stationName,jdbcType=VARCHAR}, #{item.userId}, #{item.gasUserType,jdbcType=VARCHAR},
#{item.gasUserAddress,jdbcType=VARCHAR}, #{item.telNum,jdbcType=VARCHAR}, #{item.safeCheckDate},
#{item.safeCheckPerson},#{item.bottleNum},#{item.checkInStatus},#{item.stoveCheckStatus},
#{item.hoseCheckStatus},#{item.valveCheckStatus},#{item.bottleCheckStatus},#{item.alarmCheckStatus},
#{item.placeCheckStatus},#{item.stoveCheckPic},#{item.hoseCheckPic},#{item.valveCheckPic},#{item.bottleCheckPic},
#{item.alarmCheckPic},#{item.placeCheckPic}
)
</foreach>
</insert>
<insert id="insertTLpgSafeCheckRecord" parameterType="TLpgSafeCheckRecord" useGeneratedKeys="true" keyProperty="safeCheckId"> <insert id="insertTLpgSafeCheckRecord" parameterType="TLpgSafeCheckRecord" useGeneratedKeys="true" keyProperty="safeCheckId">
insert into t_lpg_safe_check_record insert into t_lpg_safe_check_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
...@@ -133,6 +133,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -133,6 +133,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="queryByUserOwnIdsAndEnterpriseId" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/>
where beyond_enterprise_id = #{enterpriseId} and user_own_id in
<foreach collection="userOwnIds" close=")" separator="," open="(" item="item" index="i">
#{item}
</foreach>
</select>
<select id="selectForExportTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserExportResult"> <select id="selectForExportTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserExportResult">
select a.user_id, select a.user_id,
......
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