Commit 24097fa3 authored by 韩桐桐's avatar 韩桐桐

fix(jg):三环数据认领改动

parent 7318ca55
...@@ -16,7 +16,7 @@ public interface IShCarService { ...@@ -16,7 +16,7 @@ public interface IShCarService {
Page<ShCarDto> queryForShCarPage(Page<ShCarDto> page, ShCarDto dto); Page<ShCarDto> queryForShCarPage(Page<ShCarDto> page, ShCarDto dto);
Boolean claim(Map<String, Object> paramMap); Boolean claim(String claimOneself,Map<String, Object> paramMap);
ShCar searchForSanHan(Map<?, ?> map); ShCar searchForSanHan(Map<?, ?> map);
} }
...@@ -113,6 +113,15 @@ public class ShCarEquVo { ...@@ -113,6 +113,15 @@ public class ShCarEquVo {
private String produceUnitName; private String produceUnitName;
private String equList;
private String equCategory;
private String equDefine;
/**
* 是否车用气瓶
*/
private String whetherVehicleCylinder;
public ShCarEquVo(ShCarEqu shCarEqu) { public ShCarEquVo(ShCarEqu shCarEqu) {
this.setSequenceNbr(shCarEqu.getSequenceNbr()); this.setSequenceNbr(shCarEqu.getSequenceNbr());
......
...@@ -17,6 +17,7 @@ import org.typroject.tyboot.component.event.RestEventTrigger; ...@@ -17,6 +17,7 @@ import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -124,10 +125,12 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController { ...@@ -124,10 +125,12 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController {
public ResponseModel<Page<JgUseRegistrationManageDto>> getUseRegistrationCodeData( public ResponseModel<Page<JgUseRegistrationManageDto>> getUseRegistrationCodeData(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size,
@RequestParam(value = "useUnitCreditCode") String useUnitCreditCode, @RequestParam(value = "useUnitCreditCode", required = false) String useUnitCreditCode,
@RequestParam(value = "whetherVehicleCylinder") String whetherVehicleCylinder, @RequestParam(value = "whetherVehicleCylinder") String whetherVehicleCylinder,
@RequestParam(value = "certificateStatus") String certificateStatus, @RequestParam(value = "certificateStatus") String certificateStatus,
@RequestParam(value = "useRegistrationCode", required = false) String useRegistrationCode) { @RequestParam(value = "useRegistrationCode", required = false) String useRegistrationCode) {
if (ValidationUtil.isEmpty(useUnitCreditCode))
throw new BadRequest("请先选择原使用单位");
JgUseRegistrationManageDto dto = new JgUseRegistrationManageDto(); JgUseRegistrationManageDto dto = new JgUseRegistrationManageDto();
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>(); Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current); page.setCurrent(current);
......
...@@ -206,7 +206,8 @@ public class ShCarController extends BaseController { ...@@ -206,7 +206,8 @@ public class ShCarController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "认领三环系统数据", notes = "认领三环系统数据") @ApiOperation(httpMethod = "POST", value = "认领三环系统数据", notes = "认领三环系统数据")
@PostMapping(value = "/claim") @PostMapping(value = "/claim")
public ResponseModel<Boolean> claim(@RequestBody Map<String, Object> paramMap) { public ResponseModel<Boolean> claim(@RequestParam(value = "claimOneself",defaultValue = "true")String claimOneself,
return ResponseHelper.buildResponse(shCarServiceImpl.claim(paramMap)); @RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(shCarServiceImpl.claim(claimOneself,paramMap));
} }
} }
...@@ -19,6 +19,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -19,6 +19,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -120,8 +121,9 @@ public class ShCarEquController extends BaseController { ...@@ -120,8 +121,9 @@ public class ShCarEquController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "汽车详细信息列表", notes = "汽车详细信息列表") @ApiOperation(httpMethod = "GET",value = "汽车详细信息列表", notes = "汽车详细信息列表")
@GetMapping(value = "/selectByCarId") @GetMapping(value = "/selectByCarId")
public ResponseModel<CarAndEquVo> selectByCarId(@RequestParam String carId) { public ResponseModel<Map<String,Object>> selectByCarId(@RequestParam(value = "carId") String carId,
@RequestParam(value = "claimOneself") String claimOneself) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryByCarId(carId,reginParams)); return ResponseHelper.buildResponse(shCarEquServiceImpl.queryByCarId(carId,claimOneself,reginParams));
} }
} }
...@@ -788,6 +788,11 @@ public class CommonServiceImpl implements ICommonService { ...@@ -788,6 +788,11 @@ public class CommonServiceImpl implements ICommonService {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSTALLATION_UNIT").getResult(); List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSTALLATION_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList)); result.forEach(x -> convertAndAddToUnitList(x, unitList));
} }
// 使用单位追加 三环认领的(业主可能未注册系统,别人帮忙认领的,帮忙认领后会保存一份原使用单位的数据到字典)
if ("使用单位".equals(type)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_USE_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
List<Map<String, Object>> unitListByType = commonMapper.getUnitListByType(type); List<Map<String, Object>> unitListByType = commonMapper.getUnitListByType(type);
unitList.addAll(unitListByType); unitList.addAll(unitListByType);
return unitList; return unitList;
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto; import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
...@@ -13,11 +15,14 @@ import com.yeejoin.amos.boot.module.jg.api.vo.ShCarEquVo; ...@@ -13,11 +15,14 @@ import com.yeejoin.amos.boot.module.jg.api.vo.ShCarEquVo;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -49,7 +54,8 @@ public class ShCarEquServiceImpl extends BaseService<ShCarEqu, ShCarEqu, ShCarEq ...@@ -49,7 +54,8 @@ public class ShCarEquServiceImpl extends BaseService<ShCarEqu, ShCarEqu, ShCarEq
return this.queryForList("", false); return this.queryForList("", false);
} }
public CarAndEquVo queryByCarId(String carId, ReginParams reginParams) { public Map<String,Object> queryByCarId(String carId,String claimOneself, ReginParams reginParams) {
Map<String,Object> result = new HashMap<String,Object>();
// 根据carId获取Car // 根据carId获取Car
LambdaQueryWrapper<ShCar> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ShCar> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ShCar::getSequenceNbr, carId); queryWrapper1.eq(ShCar::getSequenceNbr, carId);
...@@ -60,33 +66,97 @@ public class ShCarEquServiceImpl extends BaseService<ShCarEqu, ShCarEqu, ShCarEq ...@@ -60,33 +66,97 @@ public class ShCarEquServiceImpl extends BaseService<ShCarEqu, ShCarEqu, ShCarEq
String companyType = reginParams.getCompany().getCompanyType(); String companyType = reginParams.getCompany().getCompanyType();
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
shCarDto.setCompanyType(companyType); shCarDto.setCompanyType(companyType);
shCarDto.setUseUnitName(reginParams.getCompany().getCompanyName());
shCarDto.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode());
String[] code = reginParams.getCompany().getCompanyCode().split("_"); String[] code = reginParams.getCompany().getCompanyCode().split("_");
String useUnitCode = code.length > 1 ? code[1] : code[0]; String useUnitCode = code.length > 1 ? code[1] : code[0];
if ("true".equals(claimOneself)){//认领自己的
shCarDto.setUseUnitName(reginParams.getCompany().getCompanyName());
shCarDto.setUseUnitCreditCode(reginParams.getCompany().getCompanyCode());
if ("个人主体".equals(companyType)) { if ("个人主体".equals(companyType)) {
shCarDto.setUseUnitAddress((String) commonService.getEnterpriseInfo(useUnitCode).get("address")); shCarDto.setUseUnitAddress((String) commonService.getEnterpriseInfo(useUnitCode).get("address"));
} else { } else {
shCarDto.setUseUnitAddress(reginParams.getCompany().getAddress()); shCarDto.setUseUnitAddress(reginParams.getCompany().getAddress());
} }
}
if ("false".equals(claimOneself)){//帮别人认领 取 原三环数据填充表单
shCarDto.setUseUnitName(shCar.getOwner());
shCarDto.setUseUnitCreditCode(shCar.getOwner());
shCarDto.setUseUnitAddress(shCar.getAddress());
}
shCarDto.setSafetyManagerId("个人主体".equals(companyType) ? userModel.getRealName() : null); shCarDto.setSafetyManagerId("个人主体".equals(companyType) ? userModel.getRealName() : null);
shCarDto.setPhone("个人主体".equals(companyType) ? userModel.getMobile() : null); shCarDto.setPhone("个人主体".equals(companyType) ? userModel.getMobile() : null);
if (!ValidationUtil.isEmpty(shCarDto.getVehicleAttribute())){
switch (shCarDto.getVehicleAttribute()) {
case "A":
shCarDto.setVehicleAttribute("PRIVATE_CAR");
break;
case "B":
shCarDto.setVehicleAttribute("BUS");
break;
case "H":
shCarDto.setVehicleAttribute("SERVICE_VEHICLE");
break;
case "P":
shCarDto.setVehicleAttribute("SERVICE_CAR");
break;
case "V":
shCarDto.setVehicleAttribute("MINIVAN");
break;
case "X":
shCarDto.setVehicleAttribute("OTHER");
break;
case "T":
shCarDto.setVehicleAttribute("TAXI");
break;
case "J":
shCarDto.setVehicleAttribute("TRAINING_CAR");
break;
default:
shCarDto.setVehicleAttribute("OTHER");
}
}
if("原车".equals(shCarDto.getCylinderInstallationMethod())){
shCarDto.setCylinderInstallationMethod("ORIGINAL_CAR");
}else if("加装".equals(shCarDto.getCylinderInstallationMethod())){
shCarDto.setCylinderInstallationMethod("RELOADING");
}
// 根据carId获取设备列表 // 根据carId获取设备列表
LambdaQueryWrapper<ShCarEqu> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ShCarEqu> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShCarEqu::getCarId, carId); queryWrapper.eq(ShCarEqu::getCarId, carId);
List<ShCarEqu> list = this.list(queryWrapper); List<ShCarEqu> list = this.list(queryWrapper);
// 将设备列表转换为前端可识别bean // 将设备列表转换为前端可识别bean
List<ShCarEquVo> collect = list.stream() List<ShCarEquVo> collect = list.stream().map(shCarEqu -> {
.map(shCarEqu -> {
ShCarEquVo shCarEquVo = new ShCarEquVo(shCarEqu); ShCarEquVo shCarEquVo = new ShCarEquVo(shCarEqu);
shCarEquVo.setUseInnerCode(shCarDto.getCarNumber()); shCarEquVo.setWhetherVehicleCylinder("1");
shCarEquVo.setEquType(shCarEqu.getSequenceCode()); shCarEquVo.setEquList("2000");
shCarEquVo.setEquCategory("2300");
shCarEquVo.setEquDefine("23T0");
return shCarEquVo; return shCarEquVo;
}) }).collect(Collectors.toList());
.collect(Collectors.toList());
// 封装返回VO // 封装返回VO
return new CarAndEquVo(shCarDto, collect); HashMap<String ,Object> hashMap = JSONObject.parseObject(JSON.toJSONString(shCarDto), HashMap.class);
hashMap.put("equList", collect);
result.put("completeDataSanHuan", hashMap);
// 帮别人认领 + 单位变更给自己
if ("false".equals(claimOneself)){
HashMap<String, Object> gasCylinderChangeObj = new HashMap<>();
if ("个人主体".equals(companyType)) {
String[] companyName = reginParams.getCompany().getCompanyName().split("_");
String newUseUnitCreditCodeStr = companyName.length > 1 ? companyName[1] : companyName[0];
gasCylinderChangeObj.put("newUseUnitCreditCode", newUseUnitCreditCodeStr);// 使用单位
gasCylinderChangeObj.put("address",commonService.getEnterpriseInfo(useUnitCode).get("address"));
gasCylinderChangeObj.put("companyType", "person");
} else {
gasCylinderChangeObj.put("newUseUnitCreditCode", reginParams.getCompany().getCompanyName());// 使用单位
gasCylinderChangeObj.put("address",commonService.getEnterpriseInfo(reginParams.getCompany().getCompanyCode()).get("address"));
gasCylinderChangeObj.put("companyType", "company");
}
gasCylinderChangeObj.put("useRegistrationCode",shCarDto.getUseRegistrationCode());
gasCylinderChangeObj.put("carNumber",shCarDto.getCarNumber());
result.put("gasCylinderChange",gasCylinderChangeObj);
}
return result;
} }
......
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