Browse Source

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

dev
zhangsiqi 5 months ago
parent
commit
89ce321450
  1. 25
      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

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

@ -1,5 +1,6 @@
package com.ruoyi.system.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.util.MapUtils;
@ -139,30 +140,24 @@ public class SysCustomerController extends BaseController
SysCustomerVo sysCustomer1 = new SysCustomerVo();
sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName());
sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser());
List<SysCustomerVo> sysCustomerList = sysCustomerService.selectSysCustomerList(sysCustomer1);
int index = sysCustomerList.size();
if (index >= 1){
SysCustomer sysCustomer2 = sysCustomerList.get(0);
SysCustomerVo sysCustomerVo2 = sysCustomerService.selectSysCustomerByCustomer(sysCustomer1);
if(ObjectUtil.isNotEmpty(sysCustomerVo2)){
return AjaxResult.error("该客户已被其他业务员添加,"+" 客户名称 :" +
sysCustomer2.getEnterpriseName() +
"事业部 : "+ sysCustomer2.getCustomerPurser() +
" 业务员 : " + sysCustomer2.getBusinessMembers());
}else if (index == 0){
sysCustomerVo2.getEnterpriseName() +
"事业部 : "+ sysCustomerVo2.getCustomerPurser() +
" 业务员 : " + sysCustomerVo2.getBusinessMembers());
}
Integer ok = sysCustomerService.insertSysCustomer(sysCustomer);
//添加操作记录
SysCustomerOper sysCustomerOper = new SysCustomerOper();
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser());
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode());
sysCustomerOper.setEnterpriseCode(sysCustomer.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");
}
sysCustomerOper.setOperStatus(ok > 0?"0":"1");
// 使用状态-否
sysCustomer.setUseStatus("0");
// 审核状态-待审核
@ -171,8 +166,6 @@ public class SysCustomerController extends BaseController
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper);
return AjaxResult.success("添加成功,等待审核");
}
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 客户基本信息集合
*/
List<SysCustomerVo> selectSysCustomerList(SysCustomer sysCustomer);
List<SysCustomerVo> selectSysCustomerList(SysCustomerVo sysCustomerVo);
/**
* 新增客户基本信息
@ -75,4 +75,6 @@ public interface SysCustomerMapper
int restoreSysCustomerById(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);
}

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();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
Page<SysCustomerVo> returnList = new Page<>();
//PageHelper 仅对第一List分页有效
Page<SysCustomerVo> list = (Page<SysCustomerVo>) sysCustomerMapper.selectSysCustomerList(sysCustomerVo1);
Page<SysCustomerVo> returnList = new Page<>();
for(SysCustomerVo sysCustomerVo : list){
SysUser sysUser = userMapper.selectUserByLoginName(sysCustomerVo.getCreateBy());
if (sysUser != null) {
@ -233,6 +232,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService
return sysCustomerMapper.selectSysCustomerBycode();
}
@Override
public SysCustomerVo selectSysCustomerByCustomer(SysCustomerVo sysCustomerVo) {
return sysCustomerMapper.selectSysCustomerByCustomer(sysCustomerVo);
}
@Override
public SysCustomer selectSysCustomerByEnterpriseCode(String 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>
</select>
<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.
export_sales,s.customer_country,s.postal_code,s.customer_address,s.legal_representative,s.
established_time,s.invoicing_customer_name,s.invoicing_company_name,s.invoice_code,s.deposit_bank,s.bank_account,s.
common_currency,s.confirm_tax,s.tax_rate,s.integrity_rating,s.registered_capital,s.payment_terms,s.customs_code,s.
customer_contact_id,s.customer_contact,s.customer_office,s.contact_number,s.customer_email,s.customer_fax,s.
delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address,
select s.id,s.enterprise_code,s.enterprise_name,s.english_name,s.customer_abbreviation ,s.customer_purser ,s.export_sales,
s.customer_country,s.postal_code,s.customer_address,s.legal_representative,
s.established_time,s.invoicing_customer_name,s.invoicing_company_name,s.invoice_code,s.deposit_bank,s.bank_account,
s.common_currency,s.confirm_tax,s.tax_rate,s.integrity_rating,s.registered_capital,s.payment_terms,s.customs_code,
s.customer_contact_id,s.customer_contact,s.customer_office,s.contact_number,s.customer_email,s.customer_fax,
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.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
@ -172,7 +172,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysCustomerVo"/>
where enterprise_code = #{enterpriseCode}
</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 into sys_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -342,11 +345,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<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 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=")">
#{id}
</foreach>

Loading…
Cancel
Save