Browse Source

[fix]销售模块客户基础资料,增加查询语句

dev
zhangsiqi 5 months ago
parent
commit
89ce321450
  1. 55
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java
  3. 1
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  5. 21
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

55
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -1,5 +1,6 @@
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.util.MapUtils;
@ -139,39 +140,31 @@ public class SysCustomerController extends BaseController
SysCustomerVo sysCustomer1 = new SysCustomerVo(); SysCustomerVo sysCustomer1 = new SysCustomerVo();
sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName()); sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName());
sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser()); sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser());
List<SysCustomerVo> sysCustomerList = sysCustomerService.selectSysCustomerList(sysCustomer1); SysCustomerVo sysCustomerVo2 = sysCustomerService.selectSysCustomerByCustomer(sysCustomer1);
int index = sysCustomerList.size(); if(ObjectUtil.isNotEmpty(sysCustomerVo2)){
if (index >= 1){
SysCustomer sysCustomer2 = sysCustomerList.get(0);
return AjaxResult.error("该客户已被其他业务员添加,"+" 客户名称 :" + return AjaxResult.error("该客户已被其他业务员添加,"+" 客户名称 :" +
sysCustomer2.getEnterpriseName() + sysCustomerVo2.getEnterpriseName() +
"事业部 : "+ sysCustomer2.getCustomerPurser() + "事业部 : "+ sysCustomerVo2.getCustomerPurser() +
" 业务员 : " + sysCustomer2.getBusinessMembers()); " 业务员 : " + sysCustomerVo2.getBusinessMembers());
}else if (index == 0){
Integer ok = sysCustomerService.insertSysCustomer(sysCustomer);
//添加操作记录
SysCustomerOper sysCustomerOper = new SysCustomerOper();
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser());
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode());
sysCustomerOper.setEnterpriseName(sysCustomer.getEnterpriseName());
sysCustomerOper.setOper("新增");
sysCustomerOper.setOperPeople(ShiroUtils.getLoginName());
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus());
sysCustomerOper.setCreateTime(new Date());
if(ok!=null && ok > 0){
sysCustomerOper.setOperStatus("0");
}else{
sysCustomerOper.setOperStatus("1");
}
// 使用状态-否
sysCustomer.setUseStatus("0");
// 审核状态-待审核
sysCustomer.setAuditStatus("0");
sysCustomerService.submitApply(sysCustomer);
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper);
return AjaxResult.success("添加成功,等待审核");
} }
return AjaxResult.success(""); Integer ok = sysCustomerService.insertSysCustomer(sysCustomer);
//添加操作记录
SysCustomerOper sysCustomerOper = new SysCustomerOper();
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser());
sysCustomerOper.setEnterpriseCode(sysCustomer.getEnterpriseCode());
sysCustomerOper.setEnterpriseName(sysCustomer.getEnterpriseName());
sysCustomerOper.setOper("新增");
sysCustomerOper.setOperPeople(ShiroUtils.getLoginName());
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus());
sysCustomerOper.setCreateTime(new Date());
sysCustomerOper.setOperStatus(ok > 0?"0":"1");
// 使用状态-否
sysCustomer.setUseStatus("0");
// 审核状态-待审核
sysCustomer.setAuditStatus("0");
sysCustomerService.submitApply(sysCustomer);
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper);
return AjaxResult.success("添加成功,等待审核");
} }

6
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java

@ -28,10 +28,10 @@ public interface SysCustomerMapper
/** /**
* 查询客户基本信息列表 * 查询客户基本信息列表
* *
* @param sysCustomer 客户基本信息 * @param sysCustomerVo 客户基本信息
* @return 客户基本信息集合 * @return 客户基本信息集合
*/ */
List<SysCustomerVo> selectSysCustomerList(SysCustomer sysCustomer); List<SysCustomerVo> selectSysCustomerList(SysCustomerVo sysCustomerVo);
/** /**
* 新增客户基本信息 * 新增客户基本信息
@ -75,4 +75,6 @@ public interface SysCustomerMapper
int restoreSysCustomerById(Long id); int restoreSysCustomerById(Long id);
SysCustomerVo cancelSysCustomerById(Long id); SysCustomerVo cancelSysCustomerById(Long id);
SysCustomerVo selectSysCustomerByCustomer(SysCustomerVo sysCustomerVo);
} }

1
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java

@ -86,4 +86,5 @@ public interface ISysCustomerService
public ProcessInstance submitApply(SysCustomer sysCustomer); public ProcessInstance submitApply(SysCustomer sysCustomer);
} }

8
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -91,10 +91,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum(); Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize(); Integer pageSize = pageDomain.getPageSize();
Page<SysCustomerVo> returnList = new Page<>();
//PageHelper 仅对第一List分页有效 //PageHelper 仅对第一List分页有效
Page<SysCustomerVo> list = (Page<SysCustomerVo>) sysCustomerMapper.selectSysCustomerList(sysCustomerVo1); Page<SysCustomerVo> list = (Page<SysCustomerVo>) sysCustomerMapper.selectSysCustomerList(sysCustomerVo1);
Page<SysCustomerVo> returnList = new Page<>();
for(SysCustomerVo sysCustomerVo : list){ for(SysCustomerVo sysCustomerVo : list){
SysUser sysUser = userMapper.selectUserByLoginName(sysCustomerVo.getCreateBy()); SysUser sysUser = userMapper.selectUserByLoginName(sysCustomerVo.getCreateBy());
if (sysUser != null) { if (sysUser != null) {
@ -233,6 +232,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService
return sysCustomerMapper.selectSysCustomerBycode(); return sysCustomerMapper.selectSysCustomerBycode();
} }
@Override
public SysCustomerVo selectSysCustomerByCustomer(SysCustomerVo sysCustomerVo) {
return sysCustomerMapper.selectSysCustomerByCustomer(sysCustomerVo);
}
@Override @Override
public SysCustomer selectSysCustomerByEnterpriseCode(String enterpriseCode) { public SysCustomer selectSysCustomerByEnterpriseCode(String enterpriseCode) {
return sysCustomerMapper.selectSysCustomerByEnterpriseCode(enterpriseCode); return sysCustomerMapper.selectSysCustomerByEnterpriseCode(enterpriseCode);

21
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -130,12 +130,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectSysCustomerList" parameterType="SysCustomerVo" resultMap="SysCustomerResult"> <select id="selectSysCustomerList" parameterType="SysCustomerVo" resultMap="SysCustomerResult">
select s.id,s.enterprise_code,s.enterprise_name,s.english_name,s.customer_abbreviation ,s.customer_purser ,s. select s.id,s.enterprise_code,s.enterprise_name,s.english_name,s.customer_abbreviation ,s.customer_purser ,s.export_sales,
export_sales,s.customer_country,s.postal_code,s.customer_address,s.legal_representative,s. s.customer_country,s.postal_code,s.customer_address,s.legal_representative,
established_time,s.invoicing_customer_name,s.invoicing_company_name,s.invoice_code,s.deposit_bank,s.bank_account,s. s.established_time,s.invoicing_customer_name,s.invoicing_company_name,s.invoice_code,s.deposit_bank,s.bank_account,
common_currency,s.confirm_tax,s.tax_rate,s.integrity_rating,s.registered_capital,s.payment_terms,s.customs_code,s. s.common_currency,s.confirm_tax,s.tax_rate,s.integrity_rating,s.registered_capital,s.payment_terms,s.customs_code,
customer_contact_id,s.customer_contact,s.customer_office,s.contact_number,s.customer_email,s.customer_fax,s. s.customer_contact_id,s.customer_contact,s.customer_office,s.contact_number,s.customer_email,s.customer_fax,
delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address, s.delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address,
s.delivery_customer_postal,s.delivery_customer_fax,s.business_members,s.identifying_people,s.first_add_time, s.delivery_customer_postal,s.delivery_customer_fax,s.business_members,s.identifying_people,s.first_add_time,
s.update_info_time,s.audit_status,s.use_status,s.update_by,s.instance_id, s.instance_type,p.dict_value as instance_type_name, s.update_info_time,s.audit_status,s.use_status,s.update_by,s.instance_id, s.instance_type,p.dict_value as instance_type_name,
s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time
@ -172,7 +172,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysCustomerVo"/> <include refid="selectSysCustomerVo"/>
where enterprise_code = #{enterpriseCode} where enterprise_code = #{enterpriseCode}
</select> </select>
<select id="selectSysCustomerByCustomer" parameterType="SysCustomerVo" resultMap="SysCustomerResult">
<include refid="selectSysCustomerVo"/>
where enterprise_name = #{enterpriseName} and customer_purser = #{customerPurser}
</select>
<insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer insert into sys_customer
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -342,11 +345,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteSysCustomerById" parameterType="Long"> <delete id="deleteSysCustomerById" parameterType="Long">
update set sys_customer set use_status = 1 where id = #{id} delete from sys_customer where id = #{id}
</delete> </delete>
<delete id="deleteSysCustomerByIds" parameterType="String"> <delete id="deleteSysCustomerByIds" parameterType="String">
update set sys_customer set use_status = 1 where id in delete from sys_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

Loading…
Cancel
Save