Commit 4350eccd authored by tianyiming's avatar tianyiming

维修告知编辑接口修改

parent 303bb239
......@@ -33,7 +33,7 @@ public interface IJgMaintainNoticeService extends IService<JgMaintainNotice> {
* @param noticeDto 维修告知
* @param op 操作类型
*/
JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op);
JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op, ReginParams reginParams);
/**
* 分页查询
......
......@@ -11,7 +11,6 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgMaintainNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jdk.nashorn.api.scripting.JSObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -70,7 +69,8 @@ public class JgMaintainNoticeController extends BaseController {
Object o1 = ((LinkedHashMap<?, ?>) model.get(TABLE_PAGE_ID)).get("powerOfAttorneyList");
maintainInfo.setConstructionContractList((List<Map<String, Object>>) o);
maintainInfo.setPowerOfAttorneyList((List<Map<String, Object>>) o1);
return ResponseHelper.buildResponse(iJgMaintainNoticeService.updateMaintainNotice(submitType, maintainInfo, op));
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(iJgMaintainNoticeService.updateMaintainNotice(submitType, maintainInfo, op,reginParams));
}
/**
......
......@@ -285,7 +285,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Override
@SuppressWarnings({"rawtypes", "Duplicates"})
@Transactional
public JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op) {
public JgMaintainNoticeDto updateMaintainNotice(String submitType, JgMaintainNoticeDto noticeDto, String op, ReginParams reginParams) {
try {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
......@@ -293,6 +293,18 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
// 字段转换
this.convertField(noticeDto);
// 获取告知设备列表
List<Map<String, Object>> deviceList = noticeDto.getDeviceList();
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备");
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
}
JgMaintainNotice notice = jgMaintainNoticeMapper.selectById(noticeDto.getSequenceNbr());
this.checkRepeatUsed(submitType, notice);
// submitType=1为流程提交否则仅为保存业务数据
......@@ -395,6 +407,20 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
BeanUtils.copyProperties(noticeDto, bean);
jgMaintainNoticeMapper.updateById(bean);
}
LambdaQueryWrapper<JgMaintainNoticeEq> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, noticeDto.getSequenceNbr());
jgMaintainNoticeEqMapper.delete(lambdaQueryWrapper);
List<JgMaintainNoticeEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> {
JgMaintainNoticeEq jgRelationEquip = new JgMaintainNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(noticeDto.getSequenceNbr().toString());
jgRelationEquip.setEquCode(ObjectUtils.isEmpty(obj.get("EQU_CODE"))?null:String.valueOf(obj.get("EQU_CODE")));
jgRelationEquip.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));
jgRelationEquip.setEquCategoryCode(String.valueOf(obj.get("EQU_CATEGORY_CODE")));
equipList.add(jgRelationEquip);
});
jgMaintainNoticeEqMapper.insertBatchSomeColumn(equipList);
return noticeDto;
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
......
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