去掉没用的字段

This commit is contained in:
yangjun 2026-05-08 13:49:45 +08:00
parent 4b54f4b6d9
commit 097bc54e52
9 changed files with 36 additions and 881 deletions

View File

@ -3,6 +3,7 @@ package com.nu.modules.cgd.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.dto.CgdBeanDto;
import com.nu.modules.cgd.entity.NuInvoicingCgdMain;
import com.baomidou.mybatisplus.extension.service.IService;
@ -19,4 +20,6 @@ public interface INuInvoicingCgdMainService extends IService<NuInvoicingCgdMain>
void auditInfo(NuInvoicingCgdMain nuInvoicingCgdMain);
IPage<NuInvoicingCgdMain> calcList(Page<NuInvoicingCgdMain> page, QueryWrapper<NuInvoicingCgdMain> queryWrapper);
void cgdQueren(CgdBeanDto cgdBeanDto);
}

View File

@ -155,6 +155,32 @@ public class NuInvoicingCgdMainServiceImpl extends ServiceImpl<NuInvoicingCgdMai
return result;
}
@Override
public void cgdQueren(CgdBeanDto cgdBeanDto) {
List<CgdMainDto> list = cgdBeanDto.getList();
for (CgdMainDto cgdMainDto : list) {
List<CgdInfoDto> cgdInfoList = cgdMainDto.getCgdInfoList();
BigDecimal totalPrice = new BigDecimal(0);
for (CgdInfoDto cgdInfoDto : cgdInfoList) {
NuInvoicingCgdInfo cgdInfo = new NuInvoicingCgdInfo();
cgdInfo.setId(cgdInfoDto.getId());
cgdInfo.setArrivalPrice(cgdInfoDto.getArrivalPrice());
BigDecimal sl = new BigDecimal(cgdInfoDto.getPurchaseQuantity());
BigDecimal dj = cgdInfoDto.getArrivalPrice();
BigDecimal wlzj = sl.multiply(dj);
cgdInfo.setXjSupPrice(wlzj);
cgdInfoMapper.updateById(cgdInfo);
totalPrice = totalPrice.add(wlzj);
}
//修改采购单总价
NuInvoicingCgdMain cgdMain = new NuInvoicingCgdMain();
cgdMain.setIzGysConfirmed(cgdMainDto.getIzGysConfirmed());
cgdMain.setId(cgdMainDto.getId());
cgdMain.setArrivalTotlaPrice(totalPrice);
cgdMainMapper.updateById(cgdMain);
}
}
//--------------------------------------------------pad 接口-------------------------------------------------
@Override

View File

@ -1,253 +0,0 @@
package com.nu.modules.configSuppliersApply.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nu.dto.SuppliersInfoMQDto;
import com.nu.modules.configSuppliersInfo.entity.ConfigSuppliersInfo;
import com.nu.modules.configSuppliersInfo.service.IConfigSuppliersInfoService;
import com.nu.utils.DictUtils;
import com.nu.utils.RabbitMQUtil;
import io.netty.util.internal.StringUtil;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply;
import com.nu.modules.configSuppliersApply.service.INuConfigSuppliersApplyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: 供应商入驻申请
* @Author: jeecg-boot
* @Date: 2025-12-23
* @Version: V1.0
*/
@Api(tags="供应商入驻申请")
@RestController
@RequestMapping("/configSuppliersApply/nuConfigSuppliersApply")
@Slf4j
public class NuConfigSuppliersApplyController extends JeecgController<NuConfigSuppliersApply, INuConfigSuppliersApplyService> {
@Autowired
private INuConfigSuppliersApplyService nuConfigSuppliersApplyService;
@Autowired
private IConfigSuppliersInfoService configSuppliersInfoService;
@Autowired
private RabbitMQUtil rabbitMQUtil;
@Autowired
private DictUtils dictUtils;
/**
* 分页列表查询
*
* @param nuConfigSuppliersApply
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "供应商入驻申请-分页列表查询")
@ApiOperation(value="供应商入驻申请-分页列表查询", notes="供应商入驻申请-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<NuConfigSuppliersApply>> queryPageList(NuConfigSuppliersApply nuConfigSuppliersApply,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<NuConfigSuppliersApply> queryWrapper = QueryGenerator.initQueryWrapper(nuConfigSuppliersApply, req.getParameterMap());
Page<NuConfigSuppliersApply> page = new Page<NuConfigSuppliersApply>(pageNo, pageSize);
IPage<NuConfigSuppliersApply> pageList = nuConfigSuppliersApplyService.page(page, queryWrapper);
return Result.OK(pageList);
}
@ApiOperation(value="供应商入驻申请-分页列表查询", notes="供应商入驻申请-分页列表查询")
@GetMapping(value = "/listPage")
public Result<IPage<NuConfigSuppliersApply>> listPage(NuConfigSuppliersApply nuConfigSuppliersApply,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<NuConfigSuppliersApply> queryWrapper = QueryGenerator.initQueryWrapper(nuConfigSuppliersApply, req.getParameterMap());
Page<NuConfigSuppliersApply> page = new Page<NuConfigSuppliersApply>(pageNo, pageSize);
IPage<NuConfigSuppliersApply> pageList = nuConfigSuppliersApplyService.listPage(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param nuConfigSuppliersApply
* @return
*/
@AutoLog(value = "供应商入驻申请-添加")
@ApiOperation(value="供应商入驻申请-添加", notes="供应商入驻申请-添加")
@RequiresPermissions("configSuppliersApply:供应商入驻申请:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody NuConfigSuppliersApply nuConfigSuppliersApply) {
nuConfigSuppliersApplyService.save(nuConfigSuppliersApply);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param nuConfigSuppliersApply
* @return
*/
@AutoLog(value = "供应商入驻申请-编辑")
@ApiOperation(value="供应商入驻申请-编辑", notes="供应商入驻申请-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody NuConfigSuppliersApply nuConfigSuppliersApply) {
nuConfigSuppliersApplyService.updateById(nuConfigSuppliersApply);
SuppliersInfoMQDto suppliersInfoMQDto = new SuppliersInfoMQDto();
BeanUtils.copyProperties(nuConfigSuppliersApply, suppliersInfoMQDto);
rabbitMQUtil.sendToExchange("nu.suppliers.suppliersApplyStatus", "nu.suppliers.suppliersApplyStatus", suppliersInfoMQDto);
if(StringUtils.equals("2",nuConfigSuppliersApply.getApplyStatus())){
ConfigSuppliersInfo configSuppliersInfo = new ConfigSuppliersInfo();
BeanUtils.copyProperties(nuConfigSuppliersApply, configSuppliersInfo);
configSuppliersInfo.setId(nuConfigSuppliersApply.getSuppliersId());
configSuppliersInfoService.save(configSuppliersInfo);
}
return Result.OK("审核成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "供应商入驻申请-通过id删除")
@ApiOperation(value="供应商入驻申请-通过id删除", notes="供应商入驻申请-通过id删除")
@RequiresPermissions("configSuppliersApply:供应商入驻申请:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
nuConfigSuppliersApplyService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "供应商入驻申请-批量删除")
@ApiOperation(value="供应商入驻申请-批量删除", notes="供应商入驻申请-批量删除")
@RequiresPermissions("configSuppliersApply:供应商入驻申请:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.nuConfigSuppliersApplyService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "供应商入驻申请-通过id查询")
@ApiOperation(value="供应商入驻申请-通过id查询", notes="供应商入驻申请-通过id查询")
@GetMapping(value = "/queryById")
public Result<NuConfigSuppliersApply> queryById(@RequestParam(name="id",required=true) String id) {
NuConfigSuppliersApply nuConfigSuppliersApply = nuConfigSuppliersApplyService.getById(id);
if(nuConfigSuppliersApply==null) {
return Result.error("未找到对应数据");
}
return Result.OK(nuConfigSuppliersApply);
}
/**
* 导出excel
*
* @param request
* @param nuConfigSuppliersApply
*/
@RequiresPermissions("configSuppliersApply:供应商入驻申请:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, NuConfigSuppliersApply nuConfigSuppliersApply) {
return super.exportXls(request, nuConfigSuppliersApply, NuConfigSuppliersApply.class, "供应商入驻申请");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("configSuppliersApply:供应商入驻申请:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, NuConfigSuppliersApply.class);
}
/**
* 获取变更信息
*
* @param suppliersApply
* @return
*/
@ApiOperation(value = "供应商信息变更申请-获取变更信息", notes = "供应商信息变更申请-获取变更信息")
@PostMapping(value = "/getModifyInfo")
public Result<List<Map<String, Object>>> getModifyInfo(@RequestBody NuConfigSuppliersApply suppliersApply) {
return Result.OK(nuConfigSuppliersApplyService.getModifyInfo(suppliersApply));
}
@ApiOperation(value = "供应商变更历史比对信息", notes = "供应商变更历史比对信息")
@PostMapping(value = "/getModifyHistoryInfo")
public Result<List<Map<String, Object>>> getModifyHistoryInfo(@RequestBody NuConfigSuppliersApply suppliersApply) {
return Result.OK(nuConfigSuppliersApplyService.getModifyHistoryInfo(suppliersApply));
}
/**
* 变更审核
*
* @param nuConfigSuppliersApply
* @return
*/
@AutoLog(value = "供应商入驻申请-变更审核")
@ApiOperation(value="供应商入驻申请-变更审核", notes="供应商入驻申请-变更审核")
@RequestMapping(value = "/audit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> audit(@RequestBody NuConfigSuppliersApply nuConfigSuppliersApply) {
String orgCode = nuConfigSuppliersApplyService.audit(nuConfigSuppliersApply);
SuppliersInfoMQDto suppliersInfoMQDto = new SuppliersInfoMQDto();
BeanUtils.copyProperties(nuConfigSuppliersApply, suppliersInfoMQDto);
String text = dictUtils.translateDictText("suppliers_nature",nuConfigSuppliersApply.getSuppliersNature());
suppliersInfoMQDto.setSuppliersNature(text);
suppliersInfoMQDto.setSysOrgCode(orgCode);
rabbitMQUtil.sendToExchange("nu.suppliers.updateAuditResult", "nu.suppliers.updateAuditResult", suppliersInfoMQDto);
return Result.OK("审核成功!");
}
}

View File

@ -1,117 +0,0 @@
package com.nu.modules.configSuppliersApply.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: nu_config_suppliers_apply
* @Author: jeecg-boot
* @Date: 2025-12-23
* @Version: V1.0
*/
@Data
@TableName("nu_config_suppliers_apply")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_config_suppliers_apply对象", description="nu_config_suppliers_apply")
public class NuConfigSuppliersApply implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**供应商名称*/
@Excel(name = "供应商名称", width = 15)
@ApiModelProperty(value = "供应商名称")
private java.lang.String suppliersName;
/**供应商性质 1代理商 2批发商 3制造商*/
@Excel(name = "供应商性质 1代理商 2批发商 3制造商", width = 15)
@ApiModelProperty(value = "供应商性质 1代理商 2批发商 3制造商")
@Dict(dicCode = "suppliers_nature")
private java.lang.String suppliersNature;
/**供应商地址*/
@Excel(name = "供应商地址", width = 15)
@ApiModelProperty(value = "供应商地址")
private java.lang.String suppliersAddress;
/**负责人*/
@Excel(name = "负责人", width = 15)
@ApiModelProperty(value = "负责人")
private java.lang.String personInCharge;
/**联系电话*/
@Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话")
private java.lang.String contactNumber;
/**供应状态 1正常供应 2暂停供应*/
@Excel(name = "供应状态 1正常供应 2暂停供应", width = 15)
@ApiModelProperty(value = "供应状态 1正常供应 2暂停供应")
private java.lang.String supplyState;
/**开户行*/
@Excel(name = "开户行", width = 15)
@ApiModelProperty(value = "开户行")
private java.lang.String openingBank;
/**开户行账号*/
@Excel(name = "开户行账号", width = 15)
@ApiModelProperty(value = "开户行账号")
private java.lang.String openingBankNo;
/**微信账号*/
@Excel(name = "微信账号", width = 15)
@ApiModelProperty(value = "微信账号")
private java.lang.String wechartId;
/**资质照片*/
@Excel(name = "资质照片", width = 15)
@ApiModelProperty(value = "资质照片")
private java.lang.String imgPath;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**审核状态*/
@Excel(name = "审核状态", width = 15)
@ApiModelProperty(value = "审核状态")
private java.lang.String applyStatus;
/**审核备注*/
@Excel(name = "审核备注", width = 15)
@ApiModelProperty(value = "审核备注")
private java.lang.String applyContent;
private java.lang.String applyId;
private String suppliersId;
private java.lang.String sourceType;
/**是否历史数据 Y历史 N当前数据*/
@Excel(name = "是否历史数据 Y历史 N当前数据", width = 15)
@ApiModelProperty(value = "是否历史数据 Y历史 N当前数据")
private java.lang.String izHistory;
/**审核机构 */
@Excel(name = "审核机构", width = 15)
@ApiModelProperty(value = "审核机构")
private String applyOrg;
// 操作类型 入驻/变更
private String optType;
/**变更审核结果*/
@TableField(exist = false)
private java.lang.String status;
}

View File

@ -1,23 +0,0 @@
package com.nu.modules.configSuppliersApply.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: nu_config_suppliers_apply
* @Author: jeecg-boot
* @Date: 2025-12-23
* @Version: V1.0
*/
public interface NuConfigSuppliersApplyMapper extends BaseMapper<NuConfigSuppliersApply> {
IPage<NuConfigSuppliersApply> listPage(Page<NuConfigSuppliersApply> page, @Param(Constants.WRAPPER) QueryWrapper<NuConfigSuppliersApply> queryWrapper);
}

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.configSuppliersApply.mapper.NuConfigSuppliersApplyMapper">
<select id="listPage" resultType="com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply">
SELECT sup.* FROM (
SELECT
IFNULL(b.id, a.id) AS id,
a.suppliers_name,
a.suppliers_nature,
a.suppliers_address,
a.person_in_charge,
a.contact_number,
a.supply_state,
a.opening_bank,
a.opening_bank_no,
a.wechart_id,
a.img_path,
a.create_by,
a.create_time,
a.sys_org_code,
a.source_type,
'1' AS type,
ifnull(b.apply_status,'2') as apply_status,
a.id AS suppliers_id,
IFNULL(b.id, a.id) as apply_id,
b.apply_content as apply_content
FROM nu_config_suppliers_info a
LEFT JOIN nu_config_suppliers_apply b ON a.id = b.suppliers_id AND b.iz_history = 'N'
WHERE a.del_flag = '0' AND a.iz_enabled = 'Y'
UNION ALL
SELECT
b.id AS id,
b.suppliers_name,
b.suppliers_nature,
b.suppliers_address,
b.person_in_charge,
b.contact_number,
b.supply_state,
b.opening_bank,
b.opening_bank_no,
b.wechart_id,
b.img_path,
b.create_by,
b.create_time,
b.sys_org_code,
b.source_type,
'2' AS type,
b.apply_status AS apply_status,
b.suppliers_id AS suppliers_id,
b.apply_id,
b.apply_content
FROM nu_config_suppliers_apply b
WHERE b.suppliers_id NOT IN (SELECT id FROM nu_config_suppliers_info)
AND b.opt_type = '入驻'
AND b.iz_history = 'N'
) sup
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -1,30 +0,0 @@
package com.nu.modules.configSuppliersApply.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.dto.CgdBeanDto;
import com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: nu_config_suppliers_apply
* @Author: jeecg-boot
* @Date: 2025-12-23
* @Version: V1.0
*/
public interface INuConfigSuppliersApplyService extends IService<NuConfigSuppliersApply> {
List<Map<String, Object>> getModifyInfo(NuConfigSuppliersApply suppliersApply);
String audit(NuConfigSuppliersApply nuConfigSuppliersApply);
IPage<NuConfigSuppliersApply> listPage(Page<NuConfigSuppliersApply> page, QueryWrapper<NuConfigSuppliersApply> queryWrapper);
List<Map<String, Object>> getModifyHistoryInfo(NuConfigSuppliersApply suppliersApply);
void cgdQueren(CgdBeanDto cgdBeanDto);
}

View File

@ -1,279 +0,0 @@
package com.nu.modules.configSuppliersApply.service.impl;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.dto.CgdBeanDto;
import com.nu.dto.CgdInfoDto;
import com.nu.dto.CgdMainDto;
import com.nu.modules.cgd.entity.NuInvoicingCgdInfo;
import com.nu.modules.cgd.entity.NuInvoicingCgdMain;
import com.nu.modules.cgd.mapper.NuInvoicingCgdInfoMapper;
import com.nu.modules.cgd.mapper.NuInvoicingCgdMainMapper;
import com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply;
import com.nu.modules.configSuppliersApply.mapper.NuConfigSuppliersApplyMapper;
import com.nu.modules.configSuppliersApply.service.INuConfigSuppliersApplyService;
import com.nu.modules.configSuppliersInfo.entity.ConfigSuppliersInfo;
import com.nu.modules.configSuppliersInfo.service.IConfigSuppliersInfoService;
import com.nu.utils.DictUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description: nu_config_suppliers_apply
* @Author: jeecg-boot
* @Date: 2025-12-23
* @Version: V1.0
*/
@Service
public class NuConfigSuppliersApplyServiceImpl extends ServiceImpl<NuConfigSuppliersApplyMapper, NuConfigSuppliersApply> implements INuConfigSuppliersApplyService {
@Autowired
private IConfigSuppliersInfoService suppliersInfoService;
@Autowired
private DictUtils dictUtils;
@Autowired
private NuInvoicingCgdMainMapper cgdMainMapper;
@Autowired
private NuInvoicingCgdInfoMapper cgdInfoMapper;
@Override
public List<Map<String, Object>> getModifyInfo(NuConfigSuppliersApply suppliersApply) {
// 1. 查询变更后数据
NuConfigSuppliersApply modifyData = baseMapper.selectById(suppliersApply.getId());
// 2. 查询当前使用中数据
QueryWrapper<ConfigSuppliersInfo> usingQW = new QueryWrapper<>();
usingQW.eq("id", modifyData.getSuppliersId());
ConfigSuppliersInfo usingData = suppliersInfoService.getOne(usingQW);
// 3. 准备结果列表
List<Map<String, Object>> result = new ArrayList<>();
// 4. 获取 ConfigSuppliersInfo 所有字段用于遍历
Field[] infoFields = ConfigSuppliersInfo.class.getDeclaredFields();
// 5. 遍历每个字段从两个对象中分别取值比较
for (Field usingField : infoFields) {
try {
String fieldName = usingField.getName();
// 跳过序列化ID @TableField(exist = false) 的字段
if ("serialVersionUID".equals(fieldName)) {
continue;
}
TableField tableField = usingField.getAnnotation(TableField.class);
if (tableField != null && !tableField.exist()) {
continue;
}
// 设置可访问
usingField.setAccessible(true);
// 获取 ElderInfo 中对应的字段必须同名
Field modifyField = null;
try {
modifyField = NuConfigSuppliersApply.class.getDeclaredField(fieldName);
modifyField.setAccessible(true);
} catch (NoSuchFieldException e) {
// 如果员工信息表中没有这个字段跳过
continue;
}
// 获取两个对象中该字段的值
Object modifyValue = modifyField.get(modifyData);
Object usingValue = usingField.get(usingData);
// 处理日期类型
if (usingField.getType() == Date.class) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
modifyValue = modifyValue != null ? sdf.format((Date) modifyValue) : null;
usingValue = usingValue != null ? sdf.format((Date) usingValue) : null;
}
if(StringUtils.equals(fieldName,"suppliersNature")){
usingValue = usingValue != null ? dictUtils.translateDictValue("suppliers_nature", usingValue.toString()) : null;
modifyValue = modifyValue != null ? dictUtils.translateDictValue("suppliers_nature", modifyValue.toString()) : null;
}
// 创建结果项
Map<String, Object> fieldMap = new HashMap<>();
fieldMap.put("id", IdUtil.simpleUUID());
fieldMap.put("d1", fieldName); // 字段名
fieldMap.put("d2", usingValue); // 原始值
fieldMap.put("d3", modifyValue); // 修改值
fieldMap.put("d4", Objects.equals(usingValue, modifyValue) ? "相同" : "不同"); // 比较结果
result.add(fieldMap);
} catch (IllegalAccessException e) {
// 忽略访问失败或字段不存在的情况
continue;
}
}
return result;
}
@Override
public String audit(NuConfigSuppliersApply nuConfigSuppliersApply) {
//变更后数据
NuConfigSuppliersApply one = baseMapper.selectById(nuConfigSuppliersApply.getId());
//变更审核通过
NuConfigSuppliersApply apply = new NuConfigSuppliersApply();
apply.setId(nuConfigSuppliersApply.getId());
if ("modifyPass".equals(nuConfigSuppliersApply.getStatus())) {
//修改apply状态
apply.setApplyStatus("2");
//修改info表
ConfigSuppliersInfo info = new ConfigSuppliersInfo();
info.setId(one.getSuppliersId());
info.setSuppliersName(one.getSuppliersName());//供应商名称
info.setSuppliersNature(one.getSuppliersNature());//供应商性质
info.setSuppliersAddress(one.getSuppliersAddress());//供应商地址
info.setPersonInCharge(one.getPersonInCharge());//负责人
info.setContactNumber(one.getContactNumber());//联系电话
info.setOpeningBank(one.getOpeningBank());//开户行
info.setOpeningBankNo(one.getOpeningBankNo());//开户行账号
info.setImgPath(one.getImgPath());//资质照片
suppliersInfoService.updateById(info);
}
//变更审核未通过
if ("modifyFail".equals(nuConfigSuppliersApply.getStatus())) {
//修改apply本身状态即可
apply.setApplyStatus("5");
apply.setApplyContent(nuConfigSuppliersApply.getApplyContent());
}
baseMapper.updateById(apply);
return one.getSysOrgCode();
}
@Override
public IPage<NuConfigSuppliersApply> listPage(Page<NuConfigSuppliersApply> page, QueryWrapper<NuConfigSuppliersApply> queryWrapper) {
return baseMapper.listPage(page, queryWrapper);
}
@Override
public List<Map<String, Object>> getModifyHistoryInfo(NuConfigSuppliersApply suppliersApply) {
// 1. 查询变更后数据
NuConfigSuppliersApply modifyData = baseMapper.selectById(suppliersApply.getId());
// 2. 查询当前使用中数据
QueryWrapper<NuConfigSuppliersApply> usingQW = new QueryWrapper<>();
usingQW.eq("suppliers_id", modifyData.getSuppliersId());
usingQW.eq("apply_status", "2");
usingQW.lt("create_time", modifyData.getCreateTime());
usingQW.last("limit 1");
NuConfigSuppliersApply usingData = baseMapper.selectOne(usingQW);
if(usingData == null || usingData.getId() == null){
usingData = modifyData;
}
// 3. 准备结果列表
List<Map<String, Object>> result = new ArrayList<>();
// 4. 获取 ConfigSuppliersInfo 所有字段用于遍历
Field[] infoFields = NuConfigSuppliersApply.class.getDeclaredFields();
// 5. 遍历每个字段从两个对象中分别取值比较
for (Field usingField : infoFields) {
try {
String fieldName = usingField.getName();
// 跳过序列化ID @TableField(exist = false) 的字段
if ("serialVersionUID".equals(fieldName)) {
continue;
}
TableField tableField = usingField.getAnnotation(TableField.class);
if (tableField != null && !tableField.exist()) {
continue;
}
// 设置可访问
usingField.setAccessible(true);
// 获取 ElderInfo 中对应的字段必须同名
Field modifyField = null;
try {
modifyField = NuConfigSuppliersApply.class.getDeclaredField(fieldName);
modifyField.setAccessible(true);
} catch (NoSuchFieldException e) {
// 如果员工信息表中没有这个字段跳过
continue;
}
// 获取两个对象中该字段的值
Object modifyValue = modifyField.get(modifyData);
Object usingValue = usingField.get(usingData);
// 处理日期类型
if (usingField.getType() == Date.class) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
modifyValue = modifyValue != null ? sdf.format((Date) modifyValue) : null;
usingValue = usingValue != null ? sdf.format((Date) usingValue) : null;
}
if(StringUtils.equals(fieldName,"suppliersNature")){
usingValue = usingValue != null ? dictUtils.translateDictValue("suppliers_nature", usingValue.toString()) : null;
modifyValue = modifyValue != null ? dictUtils.translateDictValue("suppliers_nature", modifyValue.toString()) : null;
}
// 创建结果项
Map<String, Object> fieldMap = new HashMap<>();
fieldMap.put("id", IdUtil.simpleUUID());
fieldMap.put("d1", fieldName); // 字段名
fieldMap.put("d2", usingValue); // 原始值
fieldMap.put("d3", modifyValue); // 修改值
fieldMap.put("d4", Objects.equals(usingValue, modifyValue) ? "相同" : "不同"); // 比较结果
result.add(fieldMap);
} catch (IllegalAccessException e) {
// 忽略访问失败或字段不存在的情况
continue;
}
}
return result;
}
@Override
public void cgdQueren(CgdBeanDto cgdBeanDto) {
List<CgdMainDto> list = cgdBeanDto.getList();
for (CgdMainDto cgdMainDto : list) {
List<CgdInfoDto> cgdInfoList = cgdMainDto.getCgdInfoList();
BigDecimal totalPrice = new BigDecimal(0);
for (CgdInfoDto cgdInfoDto : cgdInfoList) {
NuInvoicingCgdInfo cgdInfo = new NuInvoicingCgdInfo();
cgdInfo.setId(cgdInfoDto.getId());
cgdInfo.setArrivalPrice(cgdInfoDto.getArrivalPrice());
BigDecimal sl = new BigDecimal(cgdInfoDto.getPurchaseQuantity());
BigDecimal dj = cgdInfoDto.getArrivalPrice();
BigDecimal wlzj = sl.multiply(dj);
cgdInfo.setXjSupPrice(wlzj);
cgdInfoMapper.updateById(cgdInfo);
totalPrice = totalPrice.add(wlzj);
}
//修改采购单总价
NuInvoicingCgdMain cgdMain = new NuInvoicingCgdMain();
cgdMain.setIzGysConfirmed(cgdMainDto.getIzGysConfirmed());
cgdMain.setId(cgdMainDto.getId());
cgdMain.setArrivalTotlaPrice(totalPrice);
cgdMainMapper.updateById(cgdMain);
}
}
}

View File

@ -1,14 +1,12 @@
package com.nu.mq.suppliers.listener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.nu.dto.CgdBeanDto;
import com.nu.dto.SuppliersInfoMQDto;
import com.nu.dto.SuppliersMaterialInfoDto;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersMaterialInfo;
import com.nu.modules.bizSuppliers.service.IBizSuppliersMaterialInfoService;
import com.nu.modules.configSuppliersApply.entity.NuConfigSuppliersApply;
import com.nu.modules.configSuppliersApply.service.INuConfigSuppliersApplyService;
import com.nu.modules.cgd.service.INuInvoicingCgdMainService;
import com.nu.modules.configSuppliersInfo.entity.ConfigSuppliersInfo;
import com.nu.modules.configSuppliersInfo.service.IConfigSuppliersInfoService;
import lombok.extern.slf4j.Slf4j;
@ -22,105 +20,16 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class SuppliersMQListener {
@Autowired
private INuConfigSuppliersApplyService nuConfigSuppliersApplyService;
@Autowired
private IConfigSuppliersInfoService configSuppliersInfoService;
@Autowired
private IBizSuppliersMaterialInfoService bizSuppliersMaterialInfoService;
@Autowired
private IConfigSuppliersInfoService suppliersInfoService;
@Autowired
private INuInvoicingCgdMainService cgdMainService;
/**
* 供应商-供应商申请合作
*/
@AutoLog(value = "供应商-供应商申请合作")
@RabbitListener(
bindings = @QueueBinding(
value = @Queue(name = "#{suppliersDQNP.getQueueName()}"),
exchange = @Exchange(name = "nu.suppliers.applyStatus", type = ExchangeTypes.DIRECT),
key = "#{suppliersDQNP.getKeyName()}"
),
errorHandler = "suppliersMQExceptionHandler"
)
public void applyStatus(SuppliersInfoMQDto suppliersInfoMQDto) {
try {
QueryWrapper<NuConfigSuppliersApply> qw = new QueryWrapper<>();
qw.eq("suppliers_id", suppliersInfoMQDto.getSuppliersId());
NuConfigSuppliersApply upData = new NuConfigSuppliersApply();
upData.setIzHistory("Y");
nuConfigSuppliersApplyService.update(upData, qw);
NuConfigSuppliersApply configSuppliersApply = new NuConfigSuppliersApply();
BeanUtils.copyProperties(suppliersInfoMQDto, configSuppliersApply);
configSuppliersApply.setApplyOrg(configSuppliersApply.getSysOrgCode());
configSuppliersApply.setIzHistory("N");
nuConfigSuppliersApplyService.save(configSuppliersApply);
System.out.println("保存成功");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 供应商-供应商申请合作
*/
@AutoLog(value = "供应商-供应商修改信息")
@RabbitListener(
bindings = @QueueBinding(
value = @Queue(name = "#{suppliersDQNP.getEditSuppliersApply()}"),
exchange = @Exchange(name = "nu.suppliers.editSuppliersApply", type = ExchangeTypes.DIRECT),
key = "#{suppliersDQNP.getEditSuppApply()}"
),
errorHandler = "suppliersMQExceptionHandler"
)
public void editSuppliersApply(SuppliersInfoMQDto suppliersInfoMQDto) {
try {
//置为历史
NuConfigSuppliersApply applyUpdateData = new NuConfigSuppliersApply();
applyUpdateData.setIzHistory("Y");
UpdateWrapper<NuConfigSuppliersApply> uw = new UpdateWrapper<>();
uw.eq("suppliers_id", suppliersInfoMQDto.getSuppliersId());
nuConfigSuppliersApplyService.update(applyUpdateData, uw);
//插入信息变更审核数据
NuConfigSuppliersApply applyData = new NuConfigSuppliersApply();
applyData.setSuppliersName(suppliersInfoMQDto.getSuppliersName());
applyData.setSuppliersNature(suppliersInfoMQDto.getSuppliersNature());
applyData.setSuppliersAddress(suppliersInfoMQDto.getSuppliersAddress());
applyData.setPersonInCharge(suppliersInfoMQDto.getPersonInCharge());
applyData.setContactNumber(suppliersInfoMQDto.getContactNumber());
applyData.setSupplyState(suppliersInfoMQDto.getSupplyState());
applyData.setOpeningBank(suppliersInfoMQDto.getOpeningBank());
applyData.setOpeningBankNo(suppliersInfoMQDto.getOpeningBankNo());
applyData.setWechartId(suppliersInfoMQDto.getWechartId());
applyData.setImgPath(suppliersInfoMQDto.getImgPath());
applyData.setSysOrgCode(suppliersInfoMQDto.getSysOrgCode());
applyData.setApplyStatus("4");
applyData.setApplyId(suppliersInfoMQDto.getApplyId());
applyData.setSuppliersId(suppliersInfoMQDto.getSuppliersId());
applyData.setSourceType(suppliersInfoMQDto.getSourceType());
applyData.setIzHistory("N");
applyData.setApplyOrg(suppliersInfoMQDto.getApplyOrg());
applyData.setOptType(suppliersInfoMQDto.getOptType());
nuConfigSuppliersApplyService.save(applyData);
// ConfigSuppliersInfo param = configSuppliersInfoService.getById(suppliersInfoMQDto.getSuppliersId());
// BeanUtils.copyProperties(suppliersInfoMQDto, param);
// param.setId(suppliersInfoMQDto.getSuppliersId());
// configSuppliersInfoService.updateById(param);
//
// System.out.println("保存成功");
} catch (Exception e) {
e.printStackTrace();
}
}
@AutoLog(value = "供应商-信息变更通过")
@RabbitListener(
@ -143,24 +52,7 @@ public class SuppliersMQListener {
configSuppliersInfo.setOpeningBank(suppliersInfoMQDto.getOpeningBank());//开户行
configSuppliersInfo.setOpeningBankNo(suppliersInfoMQDto.getOpeningBankNo());//开户行账号
configSuppliersInfo.setImgPath(suppliersInfoMQDto.getImgPath());//资质照片
configSuppliersInfoService.updateById(configSuppliersInfo);
QueryWrapper<NuConfigSuppliersApply> applyQW = new QueryWrapper<>();
applyQW.eq("suppliers_id", suppliersInfoMQDto.getSuppliersId());
applyQW.eq("iz_history", "N");
NuConfigSuppliersApply applyOne = nuConfigSuppliersApplyService.getOne(applyQW);
//供应商变更信息时如果本机构处于入驻申请 需要把信息变为最新的
if (applyOne != null && "1".equals(applyOne.getApplyStatus())) {
applyOne.setSuppliersName(suppliersInfoMQDto.getSuppliersName());//供应商名称
applyOne.setSuppliersNature(suppliersInfoMQDto.getSuppliersNature());//供应商性质
applyOne.setSuppliersAddress(suppliersInfoMQDto.getSuppliersAddress());//供应商地址
applyOne.setPersonInCharge(suppliersInfoMQDto.getPersonInCharge());//负责人
applyOne.setContactNumber(suppliersInfoMQDto.getContactNumber());//联系电话
applyOne.setOpeningBank(suppliersInfoMQDto.getOpeningBank());//开户行
applyOne.setOpeningBankNo(suppliersInfoMQDto.getOpeningBankNo());//开户行账号
applyOne.setImgPath(suppliersInfoMQDto.getImgPath());//资质照片
nuConfigSuppliersApplyService.updateById(applyOne);
}
suppliersInfoService.updateById(configSuppliersInfo);
System.out.println("保存成功");
} catch (Exception e) {
e.printStackTrace();
@ -168,8 +60,6 @@ public class SuppliersMQListener {
}
/**
* 供应商-供应商申请合作
*/
@ -223,7 +113,7 @@ public class SuppliersMQListener {
)
public void cgdQueren(CgdBeanDto cgdBeanDto) {
try {
nuConfigSuppliersApplyService.cgdQueren(cgdBeanDto);
cgdMainService.cgdQueren(cgdBeanDto);
System.out.println("保存成功");
} catch (Exception e) {