添加供应商入驻流程

This commit is contained in:
yangjun 2026-02-27 13:42:49 +08:00
parent 7d482fa9fd
commit 481ced58bb
15 changed files with 895 additions and 157 deletions

View File

@ -21,9 +21,11 @@ public interface ISuppliersApi {
SuppliersApplyEntity editSuppliers(SuppliersApplyEntity suppliersApplyEntity);
SuppliersApplyEntity getSupInfoByOpenId(String openId, String orgCode,String id);
SuppliersApplyEntity getSupInfoByOpenId(String openId,String id);
IPage<SuppliersOrgAllEntity> getSuppliersAuditLog(Integer pageNo, Integer pageSize, String openId);
boolean nameDuplicateChecked(SuppliersApplyEntity suppliersApplyEntity);
SuppliersApplyEntity getSuppliersApplyInfo(String openId);
}

View File

@ -10,6 +10,9 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nu.dto.SuppliersInfoMQDto;
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;
@ -28,6 +31,7 @@ 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;
@ -74,6 +78,19 @@ public class NuBizSuppliersApplyController extends JeecgController<NuBizSupplier
IPage<NuBizSuppliersApply> pageList = nuBizSuppliersApplyService.page(page, queryWrapper);
return Result.OK(pageList);
}
@ApiOperation(value="供应商入驻申请-分页列表查询", notes="供应商入驻申请-分页列表查询")
@GetMapping(value = "/listPage")
public Result<IPage<NuBizSuppliersApply>> listPage(NuBizSuppliersApply nuBizSuppliersApply,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<NuBizSuppliersApply> queryWrapper = QueryGenerator.initQueryWrapper(nuBizSuppliersApply, req.getParameterMap());
Page<NuBizSuppliersApply> page = new Page<NuBizSuppliersApply>(pageNo, pageSize);
IPage<NuBizSuppliersApply> pageList = nuBizSuppliersApplyService.listPage(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
@ -98,9 +115,11 @@ public class NuBizSuppliersApplyController extends JeecgController<NuBizSupplier
*/
@AutoLog(value = "供应商信息-编辑")
@ApiOperation(value="供应商信息-编辑", notes="供应商信息-编辑")
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_apply:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody NuBizSuppliersApply nuBizSuppliersApply) {
if(StringUtils.equals("3",nuBizSuppliersApply.getApplyStatus())){
nuBizSuppliersApply.setIzRejected("N");
}
nuBizSuppliersApplyService.updateById(nuBizSuppliersApply);
return Result.OK("编辑成功!");
}
@ -177,4 +196,45 @@ public class NuBizSuppliersApplyController extends JeecgController<NuBizSupplier
return super.importExcel(request, response, NuBizSuppliersApply.class);
}
/**
* 变更审核
*
* @param nuConfigSuppliersApply
* @return
*/
@AutoLog(value = "供应商入驻申请-变更审核")
@ApiOperation(value="供应商入驻申请-变更审核", notes="供应商入驻申请-变更审核")
@RequestMapping(value = "/audit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> audit(@RequestBody NuBizSuppliersApply nuConfigSuppliersApply) {
String orgCode = nuBizSuppliersApplyService.audit(nuConfigSuppliersApply);
return Result.OK("审核成功!");
}
@AutoLog(value = "供应商入驻申请-变更审核")
@ApiOperation(value="供应商入驻申请-变更审核", notes="供应商入驻申请-变更审核")
@RequestMapping(value = "/bgAudit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> bgAudit(@RequestBody NuBizSuppliersApply nuConfigSuppliersApply) {
String orgCode = nuBizSuppliersApplyService.bgAudit(nuConfigSuppliersApply);
return Result.OK("审核成功!");
}
/**
* 获取变更信息
*
* @param suppliersApply
* @return
*/
@ApiOperation(value = "供应商信息变更申请-获取变更信息", notes = "供应商信息变更申请-获取变更信息")
@PostMapping(value = "/getModifyInfo")
public Result<List<Map<String, Object>>> getModifyInfo(@RequestBody NuBizSuppliersApply suppliersApply) {
return Result.OK(nuBizSuppliersApplyService.getModifyInfo(suppliersApply));
}
@ApiOperation(value = "供应商变更历史比对信息", notes = "供应商变更历史比对信息")
@PostMapping(value = "/getModifyHistoryInfo")
public Result<List<Map<String, Object>>> getModifyHistoryInfo(@RequestBody NuBizSuppliersApply suppliersApply) {
return Result.OK(nuBizSuppliersApplyService.getModifyHistoryInfo(suppliersApply));
}
}

View File

@ -0,0 +1,180 @@
package com.nu.modules.bizSuppliers.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 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.bizSuppliers.entity.NuBizSuppliersInfo;
import com.nu.modules.bizSuppliers.service.INuBizSuppliersInfoService;
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.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: 2026-02-26
* @Version: V1.0
*/
@Api(tags="供应商信息")
@RestController
@RequestMapping("/bizSuppliers/nuBizSuppliersInfo")
@Slf4j
public class NuBizSuppliersInfoController extends JeecgController<NuBizSuppliersInfo, INuBizSuppliersInfoService> {
@Autowired
private INuBizSuppliersInfoService nuBizSuppliersInfoService;
/**
* 分页列表查询
*
* @param nuBizSuppliersInfo
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "供应商信息-分页列表查询")
@ApiOperation(value="供应商信息-分页列表查询", notes="供应商信息-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<NuBizSuppliersInfo>> queryPageList(NuBizSuppliersInfo nuBizSuppliersInfo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<NuBizSuppliersInfo> queryWrapper = QueryGenerator.initQueryWrapper(nuBizSuppliersInfo, req.getParameterMap());
Page<NuBizSuppliersInfo> page = new Page<NuBizSuppliersInfo>(pageNo, pageSize);
IPage<NuBizSuppliersInfo> pageList = nuBizSuppliersInfoService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param nuBizSuppliersInfo
* @return
*/
@AutoLog(value = "供应商信息-添加")
@ApiOperation(value="供应商信息-添加", notes="供应商信息-添加")
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody NuBizSuppliersInfo nuBizSuppliersInfo) {
nuBizSuppliersInfoService.save(nuBizSuppliersInfo);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param nuBizSuppliersInfo
* @return
*/
@AutoLog(value = "供应商信息-编辑")
@ApiOperation(value="供应商信息-编辑", notes="供应商信息-编辑")
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody NuBizSuppliersInfo nuBizSuppliersInfo) {
nuBizSuppliersInfoService.updateById(nuBizSuppliersInfo);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "供应商信息-通过id删除")
@ApiOperation(value="供应商信息-通过id删除", notes="供应商信息-通过id删除")
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
nuBizSuppliersInfoService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "供应商信息-批量删除")
@ApiOperation(value="供应商信息-批量删除", notes="供应商信息-批量删除")
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.nuBizSuppliersInfoService.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<NuBizSuppliersInfo> queryById(@RequestParam(name="id",required=true) String id) {
NuBizSuppliersInfo nuBizSuppliersInfo = nuBizSuppliersInfoService.getById(id);
if(nuBizSuppliersInfo==null) {
return Result.error("未找到对应数据");
}
return Result.OK(nuBizSuppliersInfo);
}
/**
* 导出excel
*
* @param request
* @param nuBizSuppliersInfo
*/
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, NuBizSuppliersInfo nuBizSuppliersInfo) {
return super.exportXls(request, nuBizSuppliersInfo, NuBizSuppliersInfo.class, "供应商信息");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("bizSuppliers:nu_biz_suppliers_info:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, NuBizSuppliersInfo.class);
}
}

View File

@ -4,10 +4,8 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
@ -45,6 +43,7 @@ public class NuBizSuppliersApply implements Serializable {
/**供应商性质 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)
@ -61,6 +60,7 @@ public class NuBizSuppliersApply implements Serializable {
/**供应状态 1正常供应 2暂停供应*/
@Excel(name = "供应状态 1正常供应 2暂停供应", width = 15)
@ApiModelProperty(value = "供应状态 1正常供应 2暂停供应")
@Dict(dicCode = "supply_state")
private java.lang.String supplyState;
/**开户行*/
@Excel(name = "开户行", width = 15)
@ -114,4 +114,14 @@ public class NuBizSuppliersApply implements Serializable {
@Excel(name = "是否被拒 Y被拒绝申请审核驳回 N除了申请被驳回以外的所有情况", width = 15)
@ApiModelProperty(value = "是否被拒 Y被拒绝申请审核驳回 N除了申请被驳回以外的所有情况")
private java.lang.String izRejected;
private String applyContent;
private String applyStatus;
private String optType;
private String suppliersId;
private String izHistory;
@TableField(exist = false)
private String status;
}

View File

@ -0,0 +1,104 @@
package com.nu.modules.bizSuppliers.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
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: 供应商信息
* @Author: jeecg-boot
* @Date: 2026-02-26
* @Version: V1.0
*/
@Data
@TableName("nu_biz_suppliers_info")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_biz_suppliers_info对象", description="供应商信息")
public class NuBizSuppliersInfo 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, dicCode = "suppliers_nature")
@Dict(dicCode = "suppliers_nature")
@ApiModelProperty(value = "供应商性质 1代理商 2批发商 3制造商")
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, dicCode = "supply_status")
@Dict(dicCode = "supply_status")
@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;
/**openId*/
@Excel(name = "openId", width = 15)
@ApiModelProperty(value = "openId")
private java.lang.String openId;
/**资质照片*/
@Excel(name = "资质照片", width = 15)
@ApiModelProperty(value = "资质照片")
private java.lang.String imgPath;
/**是否删除 0未删除 1删除*/
@Excel(name = "是否删除 0未删除 1删除", width = 15)
@ApiModelProperty(value = "是否删除 0未删除 1删除")
@TableLogic
private java.lang.String delFlag;
/**创建人*/
@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 updateBy;
/**更新日期*/
@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 updateTime;
}

View File

@ -2,7 +2,10 @@ package com.nu.modules.bizSuppliers.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 com.nu.entity.SuppliersOrgAllEntity;
import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity;
import org.apache.ibatis.annotations.Param;
@ -22,4 +25,6 @@ public interface NuBizSuppliersApplyMapper extends BaseMapper<NuBizSuppliersAppl
IPage<SuppliersOrgAllEntity> getApplySuppliersOrgInfo(IPage<SuppliersOrgAllEntity> page,@Param("orgCode") String orgCode,@Param("title") String title,@Param("openId") String openId);
IPage<SuppliersOrgAllEntity> getSuppliersAuditLog(IPage<SuppliersOrgAllEntity> page,@Param("openId") String openId);
IPage<NuBizSuppliersApply> listPage(Page<NuBizSuppliersApply> page, @Param(Constants.WRAPPER) QueryWrapper<NuBizSuppliersApply> queryWrapper);
}

View File

@ -0,0 +1,17 @@
package com.nu.modules.bizSuppliers.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2026-02-26
* @Version: V1.0
*/
public interface NuBizSuppliersInfoMapper extends BaseMapper<NuBizSuppliersInfo> {
}

View File

@ -72,4 +72,56 @@
and s.open_id = #{openId}
order by s.create_time desc
</select>
<select id="listPage" resultType="com.nu.modules.bizSuppliers.entity.NuBizSuppliersApply">
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.img_path,
a.create_by,
a.create_time,
'1' AS type,
ifnull(b.apply_status,'2') as apply_status,
a.id AS suppliers_id,
b.apply_content as apply_content,
a.open_id
FROM nu_biz_suppliers_info a
LEFT JOIN nu_biz_suppliers_apply b ON a.id = b.suppliers_id AND b.iz_history = 'N'
WHERE a.del_flag = '0'
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.img_path,
b.create_by,
b.create_time,
'2' AS type,
b.apply_status AS apply_status,
b.suppliers_id AS suppliers_id,
b.apply_content,
b.open_id
FROM nu_biz_suppliers_apply b
WHERE b.suppliers_id NOT IN (SELECT id FROM nu_biz_suppliers_info)
AND b.opt_type = '入驻'
AND b.iz_history = 'N'
) sup
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -0,0 +1,5 @@
<?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.bizSuppliers.mapper.NuBizSuppliersInfoMapper">
</mapper>

View File

@ -1,8 +1,14 @@
package com.nu.modules.bizSuppliers.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.modules.bizSuppliers.entity.NuBizSuppliersApply;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
@ -11,4 +17,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface INuBizSuppliersApplyService extends IService<NuBizSuppliersApply> {
IPage<NuBizSuppliersApply> listPage(Page<NuBizSuppliersApply> page, QueryWrapper<NuBizSuppliersApply> queryWrapper);
String audit(NuBizSuppliersApply nuConfigSuppliersApply);
List<Map<String, Object>> getModifyHistoryInfo(NuBizSuppliersApply suppliersApply);
List<Map<String, Object>> getModifyInfo(NuBizSuppliersApply suppliersApply);
String bgAudit(NuBizSuppliersApply nuConfigSuppliersApply);
}

View File

@ -0,0 +1,14 @@
package com.nu.modules.bizSuppliers.service;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2026-02-26
* @Version: V1.0
*/
public interface INuBizSuppliersInfoService extends IService<NuBizSuppliersInfo> {
}

View File

@ -1,22 +1,28 @@
package com.nu.modules.bizSuppliers.service.impl;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.nu.dto.SuppliersInfoMQDto;
import com.nu.entity.EmployeesAdvisoryInfoEntity;
import com.nu.entity.SuppliersApplyEntity;
import com.nu.entity.SuppliersOrgAllEntity;
import com.nu.entity.SuppliersOrgEntity;
import com.nu.entity.*;
import com.nu.enums.WxClientType;
import com.nu.modules.EmployeesInfo.api.IEmployeesAdvisioryInfoApi;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersApply;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersInfo;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersOrg;
import com.nu.modules.bizSuppliers.mapper.NuBizSuppliersApplyMapper;
import com.nu.modules.bizSuppliers.mapper.NuBizSuppliersInfoMapper;
import com.nu.modules.bizSuppliers.mapper.NuBizSuppliersOrgMapper;
import com.nu.modules.bizSuppliers.service.INuBizSuppliersApplyService;
import com.nu.modules.bizSuppliers.service.INuBizSuppliersOrgService;
import com.nu.modules.suppliers.ISuppliersApi;
import com.nu.modules.wxnotice.IWxNoticeApi;
import com.nu.utils.DictUtils;
import com.nu.utils.RabbitMQUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@ -26,7 +32,9 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description: 供应商信息
@ -44,32 +52,37 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
private IEmployeesAdvisioryInfoApi employeesAdvisioryInfoApi;
@Autowired
private INuBizSuppliersOrgService suppliersOrgService;
@Autowired
private NuBizSuppliersInfoMapper nuBizSuppliersInfoMapper;
@Autowired
private IWxNoticeApi wxNoticeApi;
@Autowired
private RabbitMQUtil rabbitMQUtil;
@Autowired
private DictUtils dictUtils;
@Override
public SuppliersApplyEntity addSuppliers(SuppliersApplyEntity suppliersApplyEntity) {
// QueryWrapper<NuBizSuppliersApply> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("open_id", suppliersApplyEntity.getOpenId());
// List<NuBizSuppliersApply> list = baseMapper.selectList(queryWrapper);
// if (list.size() > 0) {
// BeanUtils.copyProperties(list.get(0), suppliersApplyEntity);
// return suppliersApplyEntity;
// }
NuBizSuppliersApply nuBizSuppliersApply = new NuBizSuppliersApply();
if (StringUtils.isNotBlank(suppliersApplyEntity.getId())) {
//上次申请被拒绝
BeanUtils.copyProperties(suppliersApplyEntity, nuBizSuppliersApply);
nuBizSuppliersApply.setIzRejected("N");
baseMapper.updateById(nuBizSuppliersApply);
} else {
//第一次申请
BeanUtils.copyProperties(suppliersApplyEntity, nuBizSuppliersApply);
nuBizSuppliersApply.setIzRejected("N");
baseMapper.insert(nuBizSuppliersApply);
}
//修改原来的数据都改为历史数据
UpdateWrapper<NuBizSuppliersApply> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("open_id", suppliersApplyEntity.getOpenId());
updateWrapper.eq("iz_history","N");
NuBizSuppliersApply nuBizSuppliersApply1 = new NuBizSuppliersApply();
nuBizSuppliersApply1.setIzHistory("Y");
baseMapper.update(nuBizSuppliersApply1, updateWrapper);
NuBizSuppliersApply nuBizSuppliersApply = new NuBizSuppliersApply();
//第一次申请
BeanUtils.copyProperties(suppliersApplyEntity, nuBizSuppliersApply);
nuBizSuppliersApply.setIzRejected("N");
nuBizSuppliersApply.setIzHistory("N");
nuBizSuppliersApply.setOptType("入驻");
nuBizSuppliersApply.setApplyStatus("1");
nuBizSuppliersApply.setSuppliersId(nuBizSuppliersApply.getId());
nuBizSuppliersApply.setCreateTime(new Date());
baseMapper.insert(nuBizSuppliersApply);
//修改此用户信息咨询表iz_gys是否供应商置为Y
EmployeesAdvisoryInfoEntity edEntity = new EmployeesAdvisoryInfoEntity();
@ -83,6 +96,38 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
return suppliersApplyEntity;
}
@Override
public SuppliersApplyEntity editSuppliers(SuppliersApplyEntity suppliersApplyEntity) {
//先把管理平台中间表变更为历史状态
UpdateWrapper<NuBizSuppliersApply> uw = new UpdateWrapper<>();
uw.eq("suppliers_id", suppliersApplyEntity.getSuppliersId());
uw.eq("iz_history","N");
NuBizSuppliersApply soDto = new NuBizSuppliersApply();
soDto.setIzHistory("Y");
soDto.setUpdateTime(new Date());
baseMapper.update(soDto, uw);
//插入新的数据
NuBizSuppliersApply addDto = new NuBizSuppliersApply();
addDto.setOpenId(suppliersApplyEntity.getOpenId());
addDto.setSuppliersId(suppliersApplyEntity.getSuppliersId());
addDto.setApplyStatus("4");//变更申请
addDto.setIzHistory("N");
addDto.setOptType("变更");
addDto.setSuppliersName(suppliersApplyEntity.getSuppliersName());
addDto.setSuppliersNature(suppliersApplyEntity.getSuppliersNature());
addDto.setSuppliersAddress(suppliersApplyEntity.getSuppliersAddress());
addDto.setPersonInCharge(suppliersApplyEntity.getPersonInCharge());
addDto.setContactNumber(suppliersApplyEntity.getContactNumber());
addDto.setOpeningBank(suppliersApplyEntity.getOpeningBank());
addDto.setOpeningBankNo(suppliersApplyEntity.getOpeningBankNo());
addDto.setImgPath(suppliersApplyEntity.getImgPath());
baseMapper.insert(addDto);
return null;
}
@Override
public IPage<SuppliersOrgAllEntity> getSuppliersOrgInfo(Integer pageNo, Integer pageSize, String orgCode, String title, String openId) {
IPage<SuppliersOrgAllEntity> page = new Page<>(pageNo, pageSize);
@ -162,127 +207,20 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
return list;
}
@Override
public SuppliersApplyEntity editSuppliers(SuppliersApplyEntity suppliersApplyEntity) {
//先把管理平台中间表变更为历史状态
UpdateWrapper<NuBizSuppliersOrg> uw = new UpdateWrapper<>();
uw.eq("suppliers_id", suppliersApplyEntity.getId());
uw.eq("org_code", suppliersApplyEntity.getOrgCode());
NuBizSuppliersOrg soDto = new NuBizSuppliersOrg();
soDto.setIzHistory("Y");
suppliersOrgService.update(soDto, uw);
//插入新的数据
NuBizSuppliersOrg addDto = new NuBizSuppliersOrg();
addDto.setOpenId(suppliersApplyEntity.getOpenId());
addDto.setSuppliersId(suppliersApplyEntity.getId());
addDto.setOrgCode(suppliersApplyEntity.getOrgCode());
addDto.setStatus("4");//变更申请
addDto.setApplyOrg(suppliersApplyEntity.getOrgCode());
addDto.setIzHistory("N");
addDto.setSuppliersName(suppliersApplyEntity.getSuppliersName());
addDto.setSuppliersNature(suppliersApplyEntity.getSuppliersNature());
addDto.setSuppliersAddress(suppliersApplyEntity.getSuppliersAddress());
addDto.setPersonInCharge(suppliersApplyEntity.getPersonInCharge());
addDto.setContactNumber(suppliersApplyEntity.getContactNumber());
addDto.setOpeningBank(suppliersApplyEntity.getOpeningBank());
addDto.setOpeningBankNo(suppliersApplyEntity.getOpeningBankNo());
addDto.setImgPath(suppliersApplyEntity.getImgPath());
suppliersOrgService.save(addDto);
//通知业务平台去审核
SuppliersInfoMQDto suppliersInfoMQDto = new SuppliersInfoMQDto();
suppliersInfoMQDto.setSuppliersName(suppliersApplyEntity.getSuppliersName());
suppliersInfoMQDto.setSuppliersNature(suppliersApplyEntity.getSuppliersNature());
suppliersInfoMQDto.setSuppliersAddress(suppliersApplyEntity.getSuppliersAddress());
suppliersInfoMQDto.setPersonInCharge(suppliersApplyEntity.getPersonInCharge());
suppliersInfoMQDto.setContactNumber(suppliersApplyEntity.getContactNumber());
suppliersInfoMQDto.setSupplyState(suppliersApplyEntity.getSupplyState());
suppliersInfoMQDto.setOpeningBank(suppliersApplyEntity.getOpeningBank());
suppliersInfoMQDto.setOpeningBankNo(suppliersApplyEntity.getOpeningBankNo());
suppliersInfoMQDto.setImgPath(suppliersApplyEntity.getImgPath());
suppliersInfoMQDto.setSysOrgCode(suppliersApplyEntity.getOrgCode());
suppliersInfoMQDto.setSuppliersId(suppliersApplyEntity.getId());
suppliersInfoMQDto.setApplyId(addDto.getId());
suppliersInfoMQDto.setOptType("变更");
rabbitMQUtil.sendToExchange("nu.suppliers.editSuppliersApply", suppliersApplyEntity.getOrgCode() + ".suppliers.editSuppliersApply", suppliersInfoMQDto);
// rabbitMQUtil.sendToExchange("nu.suppliers.editSuppliersApply", suppliersApplyEntity.getApplyOrg() + ".suppliers.editSuppliersApply", suppliersInfoMQDto);
return null;
// baseMapper.updateById(nuBizSuppliersApply);
// QueryWrapper<NuBizSuppliersOrg> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("status", "2");
// queryWrapper.eq("iz_history", "N");
// List<NuBizSuppliersOrg> list = nuBizSuppliersOrgMapper.selectList(queryWrapper);
// for (NuBizSuppliersOrg nuBizSuppliersOrg : list) {
// //todo 修改对应机构的供应商数据
// SuppliersInfoMQDto suppliersInfoMQDto = new SuppliersInfoMQDto();
// suppliersInfoMQDto.setSuppliersName(nuBizSuppliersApply.getSuppliersName());
// suppliersInfoMQDto.setSuppliersNature(nuBizSuppliersApply.getSuppliersNature());
// suppliersInfoMQDto.setSuppliersAddress(nuBizSuppliersApply.getSuppliersAddress());
// suppliersInfoMQDto.setPersonInCharge(nuBizSuppliersApply.getPersonInCharge());
// suppliersInfoMQDto.setContactNumber(nuBizSuppliersApply.getContactNumber());
// suppliersInfoMQDto.setSupplyState(nuBizSuppliersApply.getSupplyState());
// suppliersInfoMQDto.setOpeningBank(nuBizSuppliersApply.getOpeningBank());
// suppliersInfoMQDto.setOpeningBankNo(nuBizSuppliersApply.getOpeningBankNo());
// suppliersInfoMQDto.setImgPath(nuBizSuppliersApply.getImgPath());
//// suppliersInfoMQDto.setApplyStatus("1");
// suppliersInfoMQDto.setSysOrgCode(nuBizSuppliersOrg.getOrgCode());
// suppliersInfoMQDto.setSuppliersId(nuBizSuppliersApply.getId());
// rabbitMQUtil.sendToExchange("nu.suppliers.editSuppliersApply", nuBizSuppliersOrg.getOrgCode() + ".suppliers.editSuppliersApply", suppliersInfoMQDto);
// }
//
//
// BeanUtils.copyProperties(nuBizSuppliersApply, suppliersApplyEntity);
// return suppliersApplyEntity;
}
@Override
public SuppliersApplyEntity getSupInfoByOpenId(String openId, String orgCode,String id) {
public SuppliersApplyEntity getSupInfoByOpenId(String openId,String id) {
QueryWrapper<NuBizSuppliersApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("open_id", openId);
queryWrapper.orderByDesc("create_time");
if(StringUtils.isNotBlank(id) && !StringUtils.equals("null",id)){
queryWrapper.eq("suppliers_id",id);
}
List<NuBizSuppliersApply> list = baseMapper.selectList(queryWrapper);
if (list.size() > 0) {
SuppliersApplyEntity suppliersApplyEntity = new SuppliersApplyEntity();
BeanUtils.copyProperties(list.get(0), suppliersApplyEntity);
QueryWrapper<NuBizSuppliersOrg> qw = new QueryWrapper<>();
qw.eq("suppliers_id", list.get(0).getId());
qw.eq("iz_history", "N");
// qw.eq("org_code", orgCode);
List<NuBizSuppliersOrg> soList = suppliersOrgService.list(qw);
System.out.println("id-------------------------------------------------------"+id);
if(StringUtils.isNotEmpty(id) && !StringUtils.equals("undefined",id)){
NuBizSuppliersOrg NuBizSuppliersOrgA = suppliersOrgService.getById(id);
suppliersApplyEntity = new SuppliersApplyEntity();
suppliersApplyEntity.setSuppliersName(NuBizSuppliersOrgA.getSuppliersName());
suppliersApplyEntity.setSuppliersNature(NuBizSuppliersOrgA.getSuppliersNature());
suppliersApplyEntity.setSuppliersAddress(NuBizSuppliersOrgA.getSuppliersAddress());
suppliersApplyEntity.setPersonInCharge(NuBizSuppliersOrgA.getPersonInCharge());
suppliersApplyEntity.setContactNumber(NuBizSuppliersOrgA.getContactNumber());
suppliersApplyEntity.setOpeningBank(NuBizSuppliersOrgA.getOpeningBank());
suppliersApplyEntity.setOpeningBankNo(NuBizSuppliersOrgA.getOpeningBankNo());
suppliersApplyEntity.setImgPath(NuBizSuppliersOrgA.getImgPath());
suppliersApplyEntity.setSuppliersStatus(NuBizSuppliersOrgA.getStatus());
suppliersApplyEntity.setAuditContent(NuBizSuppliersOrgA.getAuditContent());
if("4".equals(NuBizSuppliersOrgA.getStatus())){
suppliersApplyEntity.setIzModify(true);
}
}else if (!CollectionUtils.isEmpty(soList)) {
for (int i = 0; i < soList.size(); i++) {
NuBizSuppliersOrg so = soList.get(i);
if (so.getOrgCode().equals(orgCode)) {
suppliersApplyEntity.setSuppliersStatus(so.getStatus());
suppliersApplyEntity.setAuditContent(so.getAuditContent());
suppliersApplyEntity.setOrgCode(orgCode);
}
if("4".equals(so.getStatus())){
suppliersApplyEntity.setIzModify(true);
}
}
}
return suppliersApplyEntity;
}
@ -303,6 +241,7 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
if (StringUtils.isNotBlank(suppliersApplyEntity.getId())) {
queryWrapper.ne("id", suppliersApplyEntity.getId());
}
queryWrapper.ne("open_id", suppliersApplyEntity.getOpenId());
queryWrapper.eq("suppliers_name", suppliersApplyEntity.getSuppliersName());
queryWrapper.eq("iz_rejected", "N");//不包含已拒绝供应商
List<NuBizSuppliersApply> nuBizSuppliersApplies = baseMapper.selectList(queryWrapper);
@ -313,4 +252,318 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl<NuBizSuppliersAp
}
}
@Override
public SuppliersApplyEntity getSuppliersApplyInfo(String openId) {
QueryWrapper<NuBizSuppliersApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("open_id", openId);
queryWrapper.eq("iz_history", "N");
queryWrapper.orderByDesc("create_time");
queryWrapper.last("limit 1");
NuBizSuppliersApply nuBizSuppliersApply = baseMapper.selectOne(queryWrapper);
if (nuBizSuppliersApply == null) {
return null;
}
SuppliersApplyEntity suppliersApplyEntity = new SuppliersApplyEntity();
BeanUtils.copyProperties(nuBizSuppliersApply, suppliersApplyEntity);
return suppliersApplyEntity;
}
@Override
public IPage<NuBizSuppliersApply> listPage(Page<NuBizSuppliersApply> page, QueryWrapper<NuBizSuppliersApply> queryWrapper) {
return baseMapper.listPage(page, queryWrapper);
}
@Override
public String audit(NuBizSuppliersApply nuBizSuppliersApply) {
//变更后数据
NuBizSuppliersApply one = baseMapper.selectById(nuBizSuppliersApply.getId());
//变更审核通过
NuBizSuppliersApply apply = new NuBizSuppliersApply();
apply.setId(nuBizSuppliersApply.getId());
if ("modifyPass".equals(nuBizSuppliersApply.getStatus())) {
//修改apply状态
apply.setApplyStatus("2");
//修改info表
NuBizSuppliersInfo info = new NuBizSuppliersInfo();
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());//资质照片
nuBizSuppliersInfoMapper.insert(info);
apply.setSuppliersId(info.getId());
}
//变更审核未通过
if ("modifyFail".equals(nuBizSuppliersApply.getStatus())) {
//修改apply本身状态即可
apply.setApplyStatus("3");
apply.setApplyContent(nuBizSuppliersApply.getApplyContent());
}
baseMapper.updateById(apply);
String content1 = "";
String content2 = "";
//审核通过
if (StringUtils.equals("modifyPass", nuBizSuppliersApply.getStatus())) {
content1 = "您好,您提交的供应商入驻申请已通过审核,欢迎加入护理单元大家庭,期待携手同行!";
content2 = "审核通过";
} else if (StringUtils.equals("modifyFail", nuBizSuppliersApply.getStatus())) {
content1 = "您好,您提交的供应商入驻申请审核暂未通过,期待您的再次申请。";
content2 = "审核驳回";
}
NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity();
nuWxNotice.setOpenId(one.getOpenId());
nuWxNotice.setIzRead("N");
nuWxNotice.setTitle("入驻机构审批");
nuWxNotice.setContent(content1);
nuWxNotice.setType("suppliers_status");
Map<String, Object> extend = Maps.newHashMap();
extend.put("suppliersId", nuBizSuppliersApply.getSuppliersId());
nuWxNotice.setExtend(JSONObject.toJSONString(extend));
nuWxNotice.setClientType(WxClientType.SUPPLIERS.getCode());
wxNoticeApi.addNotice(nuWxNotice);
WxNoticeEntity wxNotice = new WxNoticeEntity();
wxNotice.setPageRoute("pages/supplierindex/index");
wxNotice.setThing2("供应商入驻审核");
wxNotice.setPhrase1(content2);
wxNotice.setLogMainInfo("供应商入驻审核");
wxNoticeApi.sendWechartMessage_SHENHE(wxNotice, nuWxNotice);
return one.getSysOrgCode();
}
@Override
public List<Map<String, Object>> getModifyHistoryInfo(NuBizSuppliersApply suppliersApply) {
// 1. 查询变更后数据
NuBizSuppliersApply modifyData = baseMapper.selectById(suppliersApply.getId());
// 2. 查询当前使用中数据
QueryWrapper<NuBizSuppliersApply> usingQW = new QueryWrapper<>();
usingQW.eq("suppliers_id", modifyData.getSuppliersId());
usingQW.eq("apply_status", "2");
usingQW.lt("create_time", modifyData.getCreateTime());
usingQW.last("limit 1");
NuBizSuppliersApply usingData = baseMapper.selectOne(usingQW);
if(usingData == null || usingData.getId() == null){
usingData = modifyData;
}
// 3. 准备结果列表
List<Map<String, Object>> result = new ArrayList<>();
// 4. 获取 ConfigSuppliersInfo 所有字段用于遍历
Field[] infoFields = NuBizSuppliersApply.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 = NuBizSuppliersApply.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 List<Map<String, Object>> getModifyInfo(NuBizSuppliersApply suppliersApply) {
// 1. 查询变更后数据
NuBizSuppliersApply modifyData = baseMapper.selectById(suppliersApply.getId());
// 2. 查询当前使用中数据
QueryWrapper<NuBizSuppliersInfo> usingQW = new QueryWrapper<>();
usingQW.eq("id", modifyData.getSuppliersId());
NuBizSuppliersInfo usingData = nuBizSuppliersInfoMapper.selectOne(usingQW);
// 3. 准备结果列表
List<Map<String, Object>> result = new ArrayList<>();
// 4. 获取 ConfigSuppliersInfo 所有字段用于遍历
Field[] infoFields = NuBizSuppliersInfo.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 = NuBizSuppliersApply.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 bgAudit(NuBizSuppliersApply nuBizSuppliersApply) {
//变更后数据
NuBizSuppliersApply one = baseMapper.selectById(nuBizSuppliersApply.getId());
//变更审核通过
NuBizSuppliersApply apply = new NuBizSuppliersApply();
apply.setId(nuBizSuppliersApply.getId());
if ("modifyPass".equals(nuBizSuppliersApply.getStatus())) {
//修改apply状态
apply.setApplyStatus("2");
//修改info表
NuBizSuppliersInfo info = new NuBizSuppliersInfo();
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());//资质照片
nuBizSuppliersInfoMapper.updateById(info);
}
//变更审核未通过
if ("modifyFail".equals(nuBizSuppliersApply.getStatus())) {
//修改apply本身状态即可
apply.setApplyStatus("5");
apply.setApplyContent(nuBizSuppliersApply.getApplyContent());
}
baseMapper.updateById(apply);
String content1 = "";
String content2 = "";
// QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("org_code", nuBizSuppliersOrg.getOrgCode());
// SysDepart dto = sysDepartService.getOne(queryWrapper);
//审核通过
if (StringUtils.equals("modifyPass", nuBizSuppliersApply.getStatus())) {
content1 = "您好,您提交的信息变更已通过";
content2 = "审核通过";
} else if (StringUtils.equals("modifyFail", nuBizSuppliersApply.getStatus())) {
content1 = "您好,您提交的信息变更未通过,驳回原因:"+nuBizSuppliersApply.getApplyContent();
content2 = "审核未通过";
}
NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity();
nuWxNotice.setOpenId(one.getOpenId());
nuWxNotice.setIzRead("N");
nuWxNotice.setTitle("供应商信息变更审核");
nuWxNotice.setContent(content1);
nuWxNotice.setType("suppliers_ausit_status");
Map<String, Object> extend = Maps.newHashMap();
extend.put("suppliersId", nuBizSuppliersApply.getSuppliersId());
nuWxNotice.setExtend(JSONObject.toJSONString(extend));
nuWxNotice.setClientType(WxClientType.SUPPLIERS.getCode());
wxNoticeApi.addNotice(nuWxNotice);
WxNoticeEntity wxNotice = new WxNoticeEntity();
wxNotice.setPageRoute("pages/supplierindex/index");
wxNotice.setThing2("供应商变更审核");
wxNotice.setPhrase1(content2);
wxNotice.setLogMainInfo("供应商变更审核");
wxNoticeApi.sendWechartMessage_SHENHE(wxNotice, nuWxNotice);
return one.getSysOrgCode();
}
}

View File

@ -0,0 +1,19 @@
package com.nu.modules.bizSuppliers.service.impl;
import com.nu.modules.bizSuppliers.entity.NuBizSuppliersInfo;
import com.nu.modules.bizSuppliers.mapper.NuBizSuppliersInfoMapper;
import com.nu.modules.bizSuppliers.service.INuBizSuppliersInfoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2026-02-26
* @Version: V1.0
*/
@Service
public class NuBizSuppliersInfoServiceImpl extends ServiceImpl<NuBizSuppliersInfoMapper, NuBizSuppliersInfo> implements INuBizSuppliersInfoService {
}

View File

@ -14,6 +14,7 @@ import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -33,6 +34,10 @@ public class SuppliersApi {
*/
@PostMapping(value = "/addSuppliers")
public Result<Object> addSuppliers(@RequestBody SuppliersApplyEntity suppliersApplyEntity) {
suppliersApplyEntity.setId(null);
suppliersApplyEntity.setApplyContent(null);
suppliersApplyEntity.setCreateBy(null);
suppliersApplyEntity.setCreateTime(new Date());
if (suppliersApi.nameDuplicateChecked(suppliersApplyEntity)) {
return Result.error("供应商名称重复");
}
@ -81,20 +86,7 @@ public class SuppliersApi {
return Result.OK(result);
}
/**
* 供应商入驻机构
*
* @param suppliersOrgEntity
* @return
*/
@PostMapping(value = "/applySupOrg")
public Result<Object> applySupOrg(@RequestBody SuppliersOrgEntity suppliersOrgEntity) {
if(StringUtils.isEmpty(suppliersOrgEntity.getOrgCode())){
return Result.error("请选择入驻机构");
}
suppliersApi.applySupOrg(suppliersOrgEntity);
return Result.OK(suppliersOrgEntity);
}
/**
@ -130,8 +122,8 @@ public class SuppliersApi {
*/
@GetMapping(value = "/getSupInfoByOpenId")
public Result<SuppliersApplyEntity> getSupInfoByOpenId(
@RequestParam(value = "openId") String openId, @RequestParam(value = "orgCode") String orgCode, @RequestParam(value = "id",required = false) String id) {
SuppliersApplyEntity result = suppliersApi.getSupInfoByOpenId(openId, orgCode,id);
@RequestParam(value = "openId") String openId, @RequestParam(value = "id",required = false) String id) {
SuppliersApplyEntity result = suppliersApi.getSupInfoByOpenId(openId,id);
return Result.OK(result);
}
@ -145,4 +137,11 @@ public class SuppliersApi {
return Result.OK(result);
}
@GetMapping(value = "/getSuppliersApplyInfo")
public Result<SuppliersApplyEntity> getSuppliersApplyInfo(@RequestParam(value = "openId") String openId) {
SuppliersApplyEntity result = suppliersApi.getSuppliersApplyInfo(openId);
return Result.OK(result);
}
}

View File

@ -75,4 +75,7 @@ public class SuppliersApplyEntity implements Serializable {
private String orgCode;
public Boolean izModify;
private String applyContent;
private String applyStatus;
private String suppliersId;
}