Commit 77dea08c authored by litengwei's avatar litengwei

安装告知代码优化

parent 1990e510
......@@ -31,7 +31,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @param noticeDto 安装告知
* @param op 操作类型
*/
JgInstallationNoticeDto updateInstallationNotice(JgInstallationNoticeDto noticeDto, String op);
JgInstallationNoticeDto updateInstallationNotice(String submitType, JgInstallationNoticeDto noticeDto, String op);
/**
* 分页查询
......
......@@ -19,6 +19,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -59,12 +60,16 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知")
public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody Map<String, Object> model, @RequestParam("op") String op) {
public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestParam String submitType, @RequestBody Map<String, Object> model, @RequestParam(value = "op", required = false) String op) {
JgInstallationNoticeDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("installationInfo")), JgInstallationNoticeDto.class, true);
if (Objects.isNull(installationInfo)) {
throw new IllegalArgumentException("参数installationInfo不能为空");
}
return ResponseHelper.buildResponse(iJgInstallationNoticeService.updateInstallationNotice(installationInfo, op));
Object o = ((LinkedHashMap<?, ?>) model.get("installationInfo")).get("proxyStatementAttachment");
Object o1 = ((LinkedHashMap<?, ?>) model.get("installationInfo")).get("installContractAttachment");
installationInfo.setProxyStatementAttachmentList((List<Map<String, Object>>) o);
installationInfo.setInstallContractAttachmentList((List<Map<String, Object>>) o1);
return ResponseHelper.buildResponse(iJgInstallationNoticeService.updateInstallationNotice(submitType,installationInfo, op));
}
/**
......
......@@ -44,6 +44,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.io.File;
......@@ -134,7 +135,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
installationInfo.put("county", notice.getCounty() + "_" + notice.getCountyName());
installationInfo.put("useUnitCreditCode", notice.getUseUnitCreditCode() + "_" + notice.getUseUnitName());
installationInfo.put("receiveOrgCreditCode", notice.getReceiveOrgCreditCode() + "_" + notice.getReceiveOrgName());
if(!ValidationUtil.isEmpty(notice.getInspectUnitId()) && ValidationUtil.isEmpty(notice.getInspectUnitName())) {
installationInfo.put("inspectUnitId", notice.getInspectUnitId() + "_" + notice.getInspectUnitName());
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport",
......@@ -164,14 +167,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
* @param noticeDto 安装告知
*/
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgInstallationNoticeDto updateInstallationNotice(JgInstallationNoticeDto noticeDto, String op) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(op)) {
public JgInstallationNoticeDto updateInstallationNotice(String submitType, JgInstallationNoticeDto noticeDto, String op) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
AjaxResult ajaxResult;
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
......@@ -209,7 +213,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} catch (Exception e) {
log.error("提交失败:{}", e);
}
} else {
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean);
}
return noticeDto;
}
......@@ -477,8 +485,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private void convertField(JgInstallationNoticeDto model) {
// 处理图片
if(!ValidationUtil.isEmpty(model.getProxyStatementAttachmentList())) {
model.setProxyStatementAttachment(JSON.toJSONString(model.getProxyStatementAttachmentList()));
}
if(!ValidationUtil.isEmpty(model.getInstallContractAttachmentList())) {
model.setInstallContractAttachment(JSON.toJSONString(model.getInstallContractAttachmentList()));
}
// 分割省市区字段
String province = model.getProvince();
......
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