新购模块代码修改

This commit is contained in:
dingjie 2023-12-22 19:14:59 +08:00
parent 2700fceceb
commit a18aff4d23
21 changed files with 312 additions and 80 deletions

View File

@ -83,11 +83,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHouseList" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort,concat,phone
from ma_house_info
<where>
where del_flag = '0'
<if test="houseName != null and houseName != ''">
AND house_name like concat('%', #{houseName}, '%')
</if>
</where>
</select>
<select id="selectHouseById" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">

View File

@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND type_id = #{typeId}
</if>
</where>
order by m.id desc
</select>

View File

@ -7,6 +7,7 @@ import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService;
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import com.bonus.sgzb.material.vo.MaInputVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -65,13 +66,24 @@ public class PurchaseMacodeInfoController extends BaseController
return success(purchaseMacodeInfoService.selectPurchaseMacodeInfo(purchaseMacodeInfo));
}
/**
* 获取新购验收编号管理详细信息
*/
@ApiOperation(value = "新购入库清单明细")
@GetMapping(value = "/putinDetails")
public TableDataInfo putinDetails(PurchaseMacodeInfo purchaseMacodeInfo)
{
startPage();
return getDataTable(purchaseMacodeInfoService.selectPutinDetails(purchaseMacodeInfo));
}
/**
* 新增新购验收编号管理
*/
@ApiOperation(value = "新增新购验收编号管理")
@PostMapping
public AjaxResult add(@RequestBody List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
return toAjax(purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList));
return purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList);
}
/**
@ -104,8 +116,8 @@ public class PurchaseMacodeInfoController extends BaseController
*/
@ApiOperation(value = "修改编码管理的入库状态")
@PutMapping("/manageStatus")
public AjaxResult modifyManageStatus(@RequestBody MaInputRecord maInputRecord) throws Exception {
return toAjax(purchaseMacodeInfoService.modifyManageStatus(maInputRecord));
public AjaxResult modifyManageStatus(@RequestBody MaInputVO maInputVO) throws Exception {
return toAjax(purchaseMacodeInfoService.modifyManageStatus(maInputVO));
}
/**

View File

@ -20,39 +20,37 @@ public class MaInputRecord extends BaseEntity
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@ApiModelProperty(value = "主键id")
private Long id;
/** 任务ID */
@Excel(name = "任务ID")
@ApiModelProperty(value = "任务ID")
private Long taskId;
/** 类型ID */
@Excel(name = "类型ID")
@ApiModelProperty(value = "类型ID")
private Long typeId;
/** 机具ID */
@Excel(name = "机具ID")
@ApiModelProperty(value = "机具ID")
private Long maId;
/** 入库类型(1新购入库2退料入库3修试后入库) */
@Excel(name = "入库类型(1新购入库2退料入库3修试后入库)")
@ApiModelProperty(value = "入库类型(1新购入库2退料入库3修试后入库)")
private String inputType;
/** 入库数量 */
@Excel(name = "入库数量")
@ApiModelProperty(value = "入库数量")
private BigDecimal inputNum;
/** 状态0删除1正常 */
@Excel(name = "状态", readConverterExp = "0=删除1正常")
@ApiModelProperty(value = "状态 0=删除1正常")
private String status;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
@ApiModelProperty("验收的编码id")
private List<Long> maCodeInfoIdList;
@ApiModelProperty(value = "验收结论")
private String checkResult;
@ -134,13 +132,6 @@ public class MaInputRecord extends BaseEntity
return companyId;
}
public List<Long> getMaCodeInfoIdList() {
return maCodeInfoIdList;
}
public void setMaCodeInfoIdList(List<Long> maCodeInfoIdList) {
this.maCodeInfoIdList = maCodeInfoIdList;
}
public String getCheckResult() {
return checkResult;

View File

@ -98,6 +98,12 @@ public class PurchaseCheckDetails extends BaseEntity
@ApiModelProperty(value = "规格型号")
private String specificationType;
@ApiModelProperty(value = "规格型号")
private String typeName;
@ApiModelProperty(value = "单位")
private String unitName;
@ApiModelProperty(value = "机具类型名称")
private String machineTypeName;
@ -302,6 +308,22 @@ public class PurchaseCheckDetails extends BaseEntity
this.bindNum = bindNum;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -102,6 +102,13 @@ public class PurchaseMacodeInfo extends BaseEntity
@ApiModelProperty(value = "出厂日期")
private Date productionTime;
/** 到货日期 */
@ApiModelProperty(value = "到货日期")
private String arrivalTime;
@ApiModelProperty(value = "0,正常 1, 重复数据")
private int statusFlag;
public Long getId() {
return id;
}
@ -278,6 +285,22 @@ public class PurchaseMacodeInfo extends BaseEntity
this.assetsCode = assetsCode;
}
public String getArrivalTime() {
return arrivalTime;
}
public void setArrivalTime(String arrivalTime) {
this.arrivalTime = arrivalTime;
}
public int getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(int statusFlag) {
this.statusFlag = statusFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -4,6 +4,7 @@ import com.bonus.sgzb.material.domain.PurchaseCheckDetails;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@ -71,4 +72,10 @@ public interface PurchaseCheckDetailsMapper {
int deleteCheckDetailsByTaskId(Long taskId);
int updateByTaskIdTypeId(PurchaseCheckDetails purchaseCheckDetails);
int updateBindByTaskIdTypeId(PurchaseCheckDetails purchaseCheckDetails);
BigDecimal selectInputNUmByTypeId(@Param("taskId") Long taskId, @Param("typeId") Long typeId);
Integer selectBindNUmByTypeId(@Param("typeId") Long typeId, @Param("taskId") Long taskId);
}

View File

@ -96,4 +96,10 @@ public interface PurchaseMacodeInfoMapper {
int deleteMaMachineInfoByMaCode(String maCode);
List<PurchaseMacodeInfo> selectPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo);
List<PurchaseMacodeInfo> selectPutinDetails(PurchaseMacodeInfo purchaseMacodeInfo);
int selectMaCode(String maCode);
int updateMacodeByType(PurchaseMacodeInfo purchaseMacodeInfo);
}

View File

@ -1,9 +1,11 @@
package com.bonus.sgzb.material.service;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import com.bonus.sgzb.material.vo.MaInputVO;
import java.util.List;
@ -37,7 +39,7 @@ public interface IPurchaseMacodeInfoService
* @param purchaseMacodeInfoList 新购验收编号管理purchase_macode_info
* @return 结果
*/
public int insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception;
public AjaxResult insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception;
/**
* 修改新购验收编号管理purchase_macode_info
@ -67,9 +69,12 @@ public interface IPurchaseMacodeInfoService
int deletePurchaseMacodeInfoById(Long id);
int modifyManageStatus(MaInputRecord maInputRecord);
int modifyManageStatus(MaInputVO maInputVO);
int deletePurchaseMacodeInfoByMaCode(String maCode);
List<PurchaseMacodeInfo> selectPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo);
List<PurchaseMacodeInfo> selectPutinDetails(PurchaseMacodeInfo purchaseMacodeInfo);
}

View File

@ -89,7 +89,7 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
// macodeInfoService.insertPurchaseMacodeInfo(macodeInfo);
// }
} else if ("不通过".equals(purchaseCheckDetails.getCheckResult())) {
purchaseCheckDetails.setStatus(0);
purchaseCheckDetails.setStatus(3);
} else {
purchaseCheckDetails.setStatus(2);
}

View File

@ -11,6 +11,8 @@ import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.BmQrcodeInfo;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseCheckDetails;
@ -19,6 +21,7 @@ import com.bonus.sgzb.material.mapper.*;
import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import com.bonus.sgzb.material.vo.MaInputVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,7 +49,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
private PurchaseCheckDetailsMapper checkDetailsMapper;
/**
* 查询新购验收编号管理
*
@ -76,10 +78,27 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
* @return 结果
*/
@Override
public int insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
@Transactional
public AjaxResult insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
boolean b = true;
for (PurchaseMacodeInfo purchaseMacodeInfo : purchaseMacodeInfoList) {
int i = purchaseMacodeInfoMapper.selectMaCode(purchaseMacodeInfo.getMaCode());
if (i > 0) {
purchaseMacodeInfo.setStatusFlag(1);
b = false;
} else {
purchaseMacodeInfo.setStatusFlag(0);
}
}
if (!b) {
return AjaxResult.success(purchaseMacodeInfoList);
}
PurchaseCheckDetails purchaseCheckDetails = new PurchaseCheckDetails();
for (PurchaseMacodeInfo purchaseMacodeInfo : purchaseMacodeInfoList) {
Long typeId = purchaseMacodeInfo.getTypeId();
String maCode = purchaseMacodeInfo.getMaCode();
purchaseCheckDetails.setTypeId(typeId);
purchaseCheckDetails.setTaskId(purchaseMacodeInfo.getTaskId());
if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId);
@ -96,6 +115,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
}
maMachine.setMaCode(maCode);
maMachine.setCreateTime(new Date());
maMachine.setCreateBy(SecurityUtils.getUsername());
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
}
String qrCode = purchaseMacodeInfo.getQrCode();
@ -112,8 +132,12 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
}
return 1;
Integer bindNum = checkDetailsMapper.selectBindNUmByTypeId(purchaseCheckDetails.getTypeId(), purchaseCheckDetails.getTaskId());
// 添加绑定数量
purchaseCheckDetails.setBindNum(bindNum + purchaseMacodeInfoList.size());
purchaseCheckDetails.setUpdateTime(new Date());
checkDetailsMapper.updateBindByTaskIdTypeId(purchaseCheckDetails);
return AjaxResult.success();
}
@ -125,10 +149,12 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
*/
@Override
public int updatePurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
for (PurchaseMacodeInfo purchaseMacodeInfo : purchaseMacodeInfoList) {
Long typeId = purchaseMacodeInfo.getTypeId();
String maCode = purchaseMacodeInfo.getMaCode();
if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId);
@ -160,6 +186,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
purchaseMacodeInfo.setUpdateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.updatePurchaseMacodeInfo(purchaseMacodeInfo);
}
return 1;
}
@ -208,7 +235,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
for (int i = 0; i < equipmentNumberVO.getCount(); i++) {
int i1 = count + i;
// 编码规则
String codingRule = "NXJJ" + typeCode + format + specsCode;
String codingRule = "NSJJ" + specsCode + format + typeCode;
String codeNum = "";
String code = format;
String code1 = format;
@ -241,6 +268,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 删除机具编码
*
* @param id 机具编码id
* @return 结果
*/
@ -251,52 +279,59 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 修改编码管理的入库状态
* @param maInputRecord 入库信息
*
* @param maInputVO 入库信息
* @return 结果
*/
@Override
public int modifyManageStatus(MaInputRecord maInputRecord) {
Long taskId = maInputRecord.getTaskId();
public int modifyManageStatus(MaInputVO maInputVO) {
Long taskId = maInputVO.getTaskId();
List<MaInputRecord> inputRecordList = maInputVO.getInputRecordList();
for (MaInputRecord maInputRecord : inputRecordList) {
Long typeId = maInputRecord.getTypeId();
String checkResult = maInputRecord.getCheckResult();
List<Long> maCodeInfoIdList = maInputRecord.getMaCodeInfoIdList();
// 修改编码管理的入库状态
for (Long maCodeInfoId : maCodeInfoIdList) {
MaType maType = purchaseMacodeInfoMapper.selectTypeByTypeId(typeId);
// 库存添加
maType.setNum(String.valueOf(maInputRecord.getInputNum().add(new BigDecimal(Integer.parseInt(maType.getNum())))));
purchaseMacodeInfoMapper.updateTypeByTypeId(maType);
// 修改机具入库状态
MaMachine maMachine = new MaMachine();
maMachine.setMaId(maInputRecord.getMaId());
maMachine.setMaCode(maInputRecord.getMaCode());
maMachine.setMaStatus("15");
maMachine.setMaStatus("1".equals(checkResult) ? "15":"14");
purchaseMacodeInfoMapper.updateMaMachine(maMachine);
// 修改验收任务详细表入库数量
if ("1".equals(checkResult)) {
// 修改编码管理的入库状态
MaType maType = purchaseMacodeInfoMapper.selectTypeByTypeId(typeId);
// 库存添加
maType.setNum(String.valueOf(maInputRecord.getInputNum().add(new BigDecimal(Integer.parseInt(maType.getNum())))));
purchaseMacodeInfoMapper.updateTypeByTypeId(maType);
BigDecimal inputNum = checkDetailsMapper.selectInputNUmByTypeId(taskId, typeId);
PurchaseCheckDetails purchaseCheckDetails = new PurchaseCheckDetails();
purchaseCheckDetails.setTaskId(taskId);
purchaseCheckDetails.setTypeId(typeId);
purchaseCheckDetails.setInputNum(maInputRecord.getInputNum());
purchaseCheckDetails.setInputNum(inputNum.add(maInputRecord.getInputNum()));
purchaseCheckDetails.setStatus(4);
checkDetailsMapper.updateByTaskIdTypeId(purchaseCheckDetails);
}
// 修改编码管理表入库状态
PurchaseMacodeInfo purchaseMacodeInfo = new PurchaseMacodeInfo();
purchaseMacodeInfo.setId(maCodeInfoId);
purchaseMacodeInfo.setTaskId(taskId);
purchaseMacodeInfo.setStatus("通过".equals(checkResult) ? "54":"55");
purchaseMacodeInfoMapper.updatePurchaseMacodeInfo(purchaseMacodeInfo);
purchaseMacodeInfo.setTypeId(typeId);
purchaseMacodeInfo.setStatus("1".equals(checkResult) ? "1" : "0");
purchaseMacodeInfoMapper.updateMacodeByType(purchaseMacodeInfo);
// 新增入库记录
purchaseMacodeInfoMapper.insertMaInputRecord(maInputRecord);
}
// 当全部为已入库的时候任务改为入库状态
Integer count = purchaseMacodeInfoMapper.selectMacodeInfoStatusByTaskId(taskId);
if (count <= 0) {
TmTask task = new TmTask();
task.setTaskId(taskId);
task.setTaskStatus(54);
task.setTaskStatus(28);
taskMapper.updateTmTask(task);
}
@ -305,6 +340,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 根据机具编码删除编码
*
* @param maCode 机具编码
* @return 结果
*/
@ -317,6 +353,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 根据类型id和任务id查询编码详情
*
* @param purchaseMacodeInfo
* @return 结果
*/
@ -325,4 +362,15 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
return purchaseMacodeInfoMapper.selectPurchaseMacodeInfo(purchaseMacodeInfo);
}
/**
* 获取入库清单明细
*
* @param purchaseMacodeInfo 查询条件
* @return 结果
*/
@Override
public List<PurchaseMacodeInfo> selectPutinDetails(PurchaseMacodeInfo purchaseMacodeInfo) {
return purchaseMacodeInfoMapper.selectPutinDetails(purchaseMacodeInfo);
}
}

View File

@ -0,0 +1,25 @@
package com.bonus.sgzb.material.vo;
import com.bonus.sgzb.material.domain.MaInputRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class MaInputVO {
/** 任务ID */
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "验收结论")
private String checkResult;
/**
* 入库记录
*/
private List<MaInputRecord> inputRecordList;
}

View File

@ -35,7 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select pcd.id,pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_num, pcd.check_num, pcd.check_result,
pcd.supplier_id, pcd.status, msi.supplier, pcd.create_by, pcd.production_time, pcd.create_time, pcd.check_url_name,
pcd.check_url, pcd.file_name, pcd.file_url,pcd.update_by, pcd.update_time, pcd.remark, pcd.company_id,
mt1.type_name machineTypeName,mt.type_name specificationType, mt.manage_type manageType, tk.code
mt1.type_name machineTypeName,mt.type_name specificationType, mt.manage_type manageType, tk.code ,mt.type_name typeName,
mt.unit_name unitName
from purchase_check_details pcd
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
@ -196,6 +197,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckDetailsStatus" resultType="int">
select count(*) from purchase_check_details where task_id = #{taskId} and status != 1
</select>
<select id="selectInputNUmByTypeId" resultType="java.math.BigDecimal">
select IFNULL(input_num,0) from purchase_check_details where task_id = #{taskId} and type_id = #{typeId}
</select>
<select id="selectBindNUmByTypeId" resultType="java.lang.Integer">
select IFNULL(bind_num, 0) from purchase_check_details where task_id = #{taskId} and type_id = #{typeId}
</select>
<delete id="deleteCheckDetailsByTaskId">
delete from purchase_check_details where task_id = #{taskId}
@ -204,4 +211,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateByTaskIdTypeId">
update purchase_check_details set check_num = #{checkNum} where task_id = #{taskId} and type_id = #{typeId}
</update>
<update id="updateCheckDetails">
update purchase_check_details set status = '0' where task_id = #{taskId}
</update>
<update id="updateBindByTaskIdTypeId">
update purchase_check_details set bind_num = #{bindNum} where task_id = #{taskId} and type_id = #{typeId}
</update>
</mapper>

View File

@ -154,5 +154,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
<if test="companyId != null "> and pci.company_id = #{companyId}</if>
order by pci.id desc
</select>
</mapper>

View File

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
select distinct pcd.task_id, pcd.type_id, pmi.qr_code, pmi.fix_code, pmi.code_type, pmi.status,
pmi.remark, pmi.company_id, mt.type_name specificationType,
pmi.remark, pmi.company_id, mt.type_name specificationType, pt.arrival_time arrivalTime,
mt1.type_name typeName, pcd.check_num checkNum, pcd.purchase_num purchaseNum ,
IFNULL(pcd.bind_num,0) bindNum, mt.code typeCode,mt.model_code specsCode,pt.purchase_time purchaseTime
from purchase_check_details pcd
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join purchase_macode_info pmi on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
left join purchase_check_info pt on pcd.task_id = pt.task_id
where pcd.task_id = #{taskId}
and mt.manage_type = '0'
<if test="typeId != null "> and pmi.type_id = #{typeId}</if>
<if test="keyWord != null and keyWord != ''">(mt.type_name like concat('%',#{keyWord},'%') or mt1.type_name like concat('%',#{keyWord})</if>
<if test="typeName != null and typeName != ''"> and mt1.type_name = #{typeName}</if>
@ -200,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<select id="selectMacodeInfoStatusByTaskId" resultType="java.lang.Integer">
select count(*) from purchase_macode_info where task_id = #{taskId} and status != '54'
select count(*) from purchase_macode_info where task_id = #{taskId} and status != '1'
</select>
<insert id="insertMaInputRecord" parameterType="com.bonus.sgzb.material.domain.MaInputRecord" useGeneratedKeys="true" keyProperty="id">
@ -256,6 +257,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productionTime != null">pcd.production_time = #{productionTime}</if>
</select>
<select id="selectPutinDetails" resultType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo">
select pcd.production_time productionTime,mt.type_name specificationType, mt1.type_name typeName, pmi.ma_code maCode,
mm.assets_code assetsCode ,pmi.fix_code fixCode,pcd.type_id typeId,pcd.task_id taskId, mt.code specsCode,mt1.code typeCode,
if(pmi.ma_code is null, if(pcd.status != 4, 0 , pcd.status), pmi.status) status,
if(pmi.ma_code is not null,1,pcd.check_num) checkNum
from purchase_check_details pcd
left join purchase_macode_info pmi on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
left join ma_machine mm on pmi.ma_code = mm.ma_code
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where pcd.task_id = #{taskId}
</select>
<select id="selectMaCode" resultType="java.lang.Integer">
select count(ma_id) from ma_machine where ma_code = #{maCode}
</select>
<update id="updateTypeByTypeId">
update ma_type set num = #{num} where type_id = #{typeId}
@ -264,4 +280,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateMaMachine">
update ma_machine set ma_status = #{maStatus} where ma_id = #{maId}
</update>
<update id="updateMacodeByType">
update purchase_macode_info set status = #{status} where task_id = #{taskId} and type_id = #{typeId}
</update>
</mapper>

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.system.controller;
import java.util.List;
import com.bonus.sgzb.system.api.domain.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,9 +54,9 @@ public class PurchaseNoticePersonController extends BaseController
@ApiOperation(value ="新增新购短信通知人员")
@Log(title = "新购短信通知人员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PurchaseNoticePerson purchaseNoticePerson)
public AjaxResult add(@RequestBody List<PurchaseNoticePerson> purchaseNoticePersonList)
{
return toAjax(purchaseNoticePersonService.insertPurchaseNoticePerson(purchaseNoticePerson));
return toAjax(purchaseNoticePersonService.insertPurchaseNoticePersonList(purchaseNoticePersonList));
}
/**
@ -63,9 +64,20 @@ public class PurchaseNoticePersonController extends BaseController
*/
@RequiresPermissions("删除新购短信通知人员")
@Log(title = "删除新购短信通知人员", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
@DeleteMapping("/{userId}")
public AjaxResult remove(@PathVariable Long userId)
{
return toAjax(purchaseNoticePersonService.deletePurchaseNoticePersonById(id));
return toAjax(purchaseNoticePersonService.deletePurchaseNoticePersonById(userId));
}
/**
* 通知人员添加查询接口
* @param sysUser
* @return
*/
@GetMapping("/notification")
public AjaxResult notification(SysUser sysUser) {
return success(purchaseNoticePersonService.getUserByRoleList(sysUser));
}
}

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.system.mapper;
import java.util.List;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.domain.PurchaseNoticePerson;
import org.apache.ibatis.annotations.Mapper;
@ -48,10 +50,10 @@ public interface PurchaseNoticePersonMapper
/**
* 删除新购短信通知人员purchase_notice_person
*
* @param id 新购短信通知人员purchase_notice_person主键
* @param userId 新购短信通知人员purchase_notice_person主键
* @return 结果
*/
public int deletePurchaseNoticePersonById(Long id);
public int deletePurchaseNoticePersonById(Long userId);
/**
* 批量删除新购短信通知人员purchase_notice_person
@ -60,4 +62,6 @@ public interface PurchaseNoticePersonMapper
* @return 结果
*/
public int deletePurchaseNoticePersonByIds(Long[] ids);
List<PurchaseNoticePerson> getUserByRoleList(SysUser sysUser);
}

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.system.service;
import java.util.List;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.domain.PurchaseNoticePerson;
/**
@ -54,8 +56,13 @@ public interface IPurchaseNoticePersonService
/**
* 删除新购短信通知人员purchase_notice_person信息
*
* @param id 新购短信通知人员purchase_notice_person主键
* @param userId 新购短信通知人员purchase_notice_person主键
* @return 结果
*/
public int deletePurchaseNoticePersonById(Long id);
public int deletePurchaseNoticePersonById(Long userId);
List<PurchaseNoticePerson> getUserByRoleList(SysUser sysUser);
int insertPurchaseNoticePersonList(List<PurchaseNoticePerson> purchaseNoticePersonList);
}

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.system.service.impl;
import java.util.List;
import com.bonus.sgzb.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.sgzb.system.mapper.PurchaseNoticePersonMapper;
@ -84,12 +86,35 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
/**
* 删除新购短信通知人员purchase_notice_person信息
*
* @param id 新购短信通知人员purchase_notice_person主键
* @param userId 新购短信通知人员purchase_notice_person主键
* @return 结果
*/
@Override
public int deletePurchaseNoticePersonById(Long id)
public int deletePurchaseNoticePersonById(Long userId)
{
return purchaseNoticePersonMapper.deletePurchaseNoticePersonById(id);
return purchaseNoticePersonMapper.deletePurchaseNoticePersonById(userId);
}
/**
* 查询添加人员
* @param sysUser
* @return
*/
@Override
public List<PurchaseNoticePerson> getUserByRoleList(SysUser sysUser) {
return purchaseNoticePersonMapper.getUserByRoleList(sysUser);
}
/**
* 批量添加人员
* @param purchaseNoticePersonList
* @return
*/
@Override
public int insertPurchaseNoticePersonList(List<PurchaseNoticePerson> purchaseNoticePersonList) {
for (PurchaseNoticePerson purchaseNoticePerson : purchaseNoticePersonList) {
insertPurchaseNoticePerson(purchaseNoticePerson);
}
return 1;
}
}

View File

@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_dept d on u.dept_id = d.dept_id
left join sys_dept d1 on d.parent_id = d1.dept_id
left join sys_dept d2 on d1.parent_id = d2.dept_id
where r.role_id = #{roleId} and u.status = '0'
where u.status = '0'
</select>
@ -32,17 +32,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPurchaseNoticePersonVo"/>
where id = #{id}
</select>
<select id="getUserByRoleList" resultType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
select u.user_id userId, u.dept_id deptId, u.nick_name nickName, u.user_name userName, u.avatar, u.phonenumber telphone,
concat(d2.dept_name,'/',d1.dept_name,'/',d.dept_name) deptName,r.role_name roleName
from sys_user u
left join sys_user_role sur on u.user_id = sur.user_id
left join sys_role r on sur.role_id = r.role_id
left join sys_dept d on u.dept_id = d.dept_id
left join sys_dept d1 on d.parent_id = d1.dept_id
left join sys_dept d2 on d1.parent_id = d2.dept_id
where u.status = '0' and u.del_flag = '0' and u.user_id not in (select user_id from purchase_notice_person)
</select>
<insert id="insertPurchaseNoticePerson" parameterType="com.bonus.sgzb.system.domain.PurchaseNoticePerson">
insert into purchase_notice_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="telphone != null">telphone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="telphone != null">#{telphone},</if>
@ -60,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deletePurchaseNoticePersonById" parameterType="Long">
delete from purchase_notice_person where id = #{id}
delete from purchase_notice_person where user_id = #{userId}
</delete>
<delete id="deletePurchaseNoticePersonByIds" parameterType="String">

View File

@ -229,6 +229,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.remark
from sys_user u
left join sys_user_role sur on u.user_id = sur.user_id
where u.status = '0' and u.del_flag = '0' and sur.role_id = #{roleId}
where u.status = '0' and u.del_flag = '0'
<if test="roleId != null" >
and sur.role_id = #{roleId}
</if>
</select>
</mapper>