Commit 0947b05c by MMF

MMF 2026-04-15 调度专家修改

parent eb397dab
......@@ -2,14 +2,17 @@ package com.qianhe.zqbf.controller;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.exception.BusinessException;
import com.qianhe.zqbf.domain.ZqbfXmzBfxm;
import com.qianhe.zqbf.domain.ZqbfXmzBfzj;
import com.qianhe.zqbf.domain.ZqczXmzBfjlQuery;
import com.qianhe.zqbf.domain.ZqczXmzDdzj;
import com.qianhe.zqbf.service.ZqczXmzDdzjService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
......@@ -30,4 +33,20 @@ public class ZqczXmzDdzjController extends BaseController {
return error(e.getMessage());
}
}
/**
* 新增
*/
@PostMapping
public AjaxResult batchAdd(@RequestBody List<ZqbfXmzBfzj> xmzBfzjList) {
try {
return toAjax(xmzDdzjService.batchAdd(xmzBfzjList));
} catch (BusinessException e) {
log.warn("最强帮扶-调度专家-新增失败:" + e.getMessage());
return warn(e.getMessage());
} catch (Exception e) {
log.error(e.getMessage());
return error(e.getMessage());
}
}
}
......@@ -19,6 +19,15 @@ public class ZqbfXmzBfzj implements Serializable {
* 专家ID
*/
private Long zjid;
private Long ddzj;
/**
* 需求ID
*/
private Long xqid;
/**
* 负责人
*/
private String fzr;
/**
* 绑定系统用户
*/
......
......@@ -18,6 +18,14 @@ public class ZqczXmzDdzj implements Serializable {
*/
private Long ddid;
/**
* 单位ID
*/
private Long dwid;
/**
* 单位名称
*/
private String dwmc;
/**
* 需求ID
*/
private Long xqid;
......@@ -26,11 +34,21 @@ public class ZqczXmzDdzj implements Serializable {
*/
private Long ddzj;
/**
* 负责人 1=是 2=否
* 专家名称
*/
private String zjmc;
/**
* 联系方式
*/
private String sjh;
/**
* 负责人 1=是 2=否
*/
private String fzr;
public ZqczXmzDdzj(ZqbfXmzBfzj zqbfXmzBfzj){
this.xqid = zqbfXmzBfzj.getXqid();
this.ddzj = zqbfXmzBfzj.getZjid() != null ? zqbfXmzBfzj.getZjid() : zqbfXmzBfzj.getDdzj();
this.fzr = zqbfXmzBfzj.getFzr();
}
}
package com.qianhe.zqbf.service;
import com.qianhe.zqbf.domain.ZqbfXmzBfzj;
import com.qianhe.zqbf.domain.ZqczXmzDdzj;
import java.util.List;
......@@ -9,4 +10,6 @@ public interface ZqczXmzDdzjService {
* 条件查询
*/
List<ZqczXmzDdzj> list(ZqczXmzDdzj zqczXmzDdzj);
int batchAdd(List<ZqbfXmzBfzj> xmzBfzjList);
}
package com.qianhe.zqbf.service.impl;
import com.qianhe.common.exception.BusinessException;
import com.qianhe.zqbf.domain.ZqbfXmzBfzj;
import com.qianhe.zqbf.domain.ZqczXmzDdzj;
import com.qianhe.zqbf.mapper.ZqczXmzDdzjMapper;
import com.qianhe.zqbf.service.ZqczXmzDdzjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@Service
public class ZqczXmzDdzjServiceImpl implements ZqczXmzDdzjService {
......@@ -21,4 +26,26 @@ public class ZqczXmzDdzjServiceImpl implements ZqczXmzDdzjService {
List<ZqczXmzDdzj> dataList = ddzjMapper.list(zqczXmzDdzj);
return dataList;
}
@Transactional
@Override
public int batchAdd(List<ZqbfXmzBfzj> xmzBfzjList) {
if (Optional.ofNullable(xmzBfzjList).orElse(Collections.emptyList()).isEmpty()) {
return 0;
}
Long xqid = xmzBfzjList.get(0).getXqid();
ddzjMapper.delete(xqid);
List<ZqczXmzDdzj> dataList = new ArrayList<>();
int count = 0;
for (ZqbfXmzBfzj zqbfXmzBfzj : xmzBfzjList) {
if ("1".equals(zqbfXmzBfzj.getFzr())) count += 1;
dataList.add(new ZqczXmzDdzj(zqbfXmzBfzj));
}
if (count != 1) {
throw new BusinessException("必须指定一个负责人");
}
ddzjMapper.batchAdd(dataList);
return 1;
}
}
......@@ -6,21 +6,29 @@
<!-- 返回实体 -->
<resultMap id="ZqczXmzDdzjResult" type="ZqczXmzDdzj">
<result property="ddid" column="ddid"/>
<result property="dwid" column="dwid"/>
<result property="dwmc" column="dwmc"/>
<result property="xqid" column="xqid"/>
<result property="ddzj" column="ddzj"/>
<result property="zjmc" column="zjmc"/>
<result property="sjh" column="sjh"/>
<result property="fzr" column="fzr"/>
</resultMap>
<!-- 通用查询 -->
<sql id="selectCommon">
SELECT
ddzj.ddid,
bfzj.dwid,
CONCAT( dept.dept_name, dept.create_by ) AS dwmc,
ddzj.xqid,
ddzj.ddzj,
bfzj.zjmc,
bfzj.sjh,
ddzj.fzr
FROM
zqcz_xmz_ddzj ddzj LEFT JOIN zqbf_xmz_bfzj bfzj ON ddzj.ddzj=bfzj.zjid
zqcz_xmz_ddzj ddzj
LEFT JOIN zqbf_xmz_bfzj bfzj ON ddzj.ddzj = bfzj.zjid
LEFT JOIN sys_dept dept ON bfzj.dwid = dept.dept_id
</sql>
<!-- 条件查询 -->
<select id="list" parameterType="ZqczXmzDdzj" resultMap="ZqczXmzDdzjResult">
......
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