材料车辆修改

This commit is contained in:
pengjie 2024-05-06 15:10:48 +08:00
parent 75cabd3e20
commit fd12d565dd
3 changed files with 36 additions and 10 deletions

View File

@ -4,11 +4,15 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.car.entity.CarInfo;
import com.zhgd.xmgl.modules.car.service.ICarInfoService;
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
@ -45,6 +49,12 @@ public class CarInfoController {
@Autowired
private ICarInfoService carInfoService;
@Autowired
private ISystemUserService systemUserService;
@Autowired
private IWorkerInfoService workerInfoService;
/**
* 分页列表查询
* @return
@ -85,7 +95,7 @@ public class CarInfoController {
@PostMapping(value = "/save")
public Result<CarInfo> save(@RequestBody Map<String, Object> map) {
Object alarmPushWorkerId = map.get("alarmPushWorkerId");
Object enterpriseId = map.get("enterpriseId");
String userId = map.get("enterpriseId").toString();
Object driverWorkerName = map.get("driverWorkerName");
List<String> carType = (List<String>) map.get("carType");
List<String> driverWorkerId = (List<String>) map.get("driverWorkerId");
@ -102,12 +112,9 @@ public class CarInfoController {
List<String> alarmPushWorkerIds = (List<String>) alarmPushWorkerId;
carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString());
}
if (enterpriseId != null) {
List<String> enterpriseIds = (List<String>) enterpriseId;
String string = enterpriseIds.get(0).toString();
if (StringUtils.isNotBlank(string)) {
carInfo.setEnterpriseId(Long.valueOf(string));
}
if (userId != null) {
Long workerId = systemUserService.getOne(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getUserId, userId)).getWorkerId();
carInfo.setEnterpriseId(workerInfoService.getById(workerId).getEnterpriseId());
}
carInfo.setCarModuleType(carModuleType);
Integer entryAndExitPermit = MapUtils.getString(map, "entryAndExitPermit").equals("单次") ? 0 : 1;

View File

@ -6,10 +6,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise;
import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.service.IEnterpriseInfoService;
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
import com.zhgd.xmgl.modules.xz.entity.XzMaterialDetail;
import com.zhgd.xmgl.util.PageUtil;
import io.swagger.annotations.Api;
@ -67,6 +70,12 @@ public class XzMaterialController {
@Autowired
private IXzMaterialService xzMaterialService;
@Autowired
private ISystemUserService systemUserService;
@Autowired
private IWorkerInfoService workerInfoService;
@Autowired
private IEnterpriseInfoService enterpriseInfoService;
@ -164,11 +173,14 @@ public class XzMaterialController {
@PostMapping(value = "/save")
public Result<Object> save(@RequestBody JSONObject obj) {
log.info("添加材料信息" + JSON.toJSONString(obj));
List<String> enterpriseIds = (List<String>) obj.get("enterpriseId");
String userId = obj.get("enterpriseId").toString();
Integer type = Integer.parseInt(obj.get("type").toString());
XzMaterial xzMaterial = new XzMaterial();
xzMaterial.setType(type);
String [] param = {"name", "model", "specifications", "unit", "num", "remark"};
List<XzMaterialDetail> list = new ArrayList<>();
XzMaterial exist = xzMaterialService.getOne(Wrappers.<XzMaterial>lambdaQuery()
.eq(XzMaterial::getType, type)
.like(XzMaterial::getName, DateUtil.today())
.orderByDesc(XzMaterial::getCreateTime).last("limit 1"));
if (exist == null) {
@ -200,8 +212,9 @@ public class XzMaterialController {
}
}
xzMaterial.setProjectSn(obj.getString("projectSn"));
if (enterpriseIds != null && enterpriseIds.size() > 0) {
xzMaterial.setEnterpriseId(enterpriseIds.get(0));
if (userId != null ) {
Long workerId = systemUserService.getOne(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getUserId, userId)).getWorkerId();
xzMaterial.setEnterpriseId(workerInfoService.getById(workerId).getEnterpriseId().toString());
}
xzMaterial.setXzMaterialList(list);
xzMaterial.setCreateTime(new Date());

View File

@ -45,6 +45,12 @@ public class XzMaterial implements Serializable {
@Excel(name = "批次数量", width = 15)
@ApiModelProperty(value = "批次数量")
private Integer num;
/**
* 进出场标识(1入场2出厂;)
*/
@Excel(name = "进出场标识(1入场2出厂;)", width = 15)
@ApiModelProperty(value = "进出场标识(1入场2出厂;)")
private Integer type;
/**
* 入场时间
*/