Browse Source

2024.1.8

master
yuejiayang 2 years ago
parent
commit
70a80d17b8
  1. 82
      src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java
  2. 61
      src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java
  3. 16
      src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java
  4. 20
      src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java
  5. 22
      src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java
  6. 72
      src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java
  7. 14
      src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java
  8. 8
      src/main/java/com/spring/modules/customer/vo/CustomerInformationVo.java
  9. 35
      src/main/resources/mapper/customer/CustomerGroupInformationMapper.xml
  10. 5
      src/main/resources/mapper/customer/CustomerInformationMapper.xml

82
src/main/java/com/spring/modules/customer/controller/CustomerGroupInformationController.java

@ -0,0 +1,82 @@
package com.spring.modules.customer.controller;
import com.spring.common.utils.PageUtils;
import com.spring.common.utils.R;
import com.spring.modules.customer.entity.CustomerGroupInformationEntity;
import com.spring.modules.customer.service.CustomerGroupInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("plm/customerGroupInformation")
public class CustomerGroupInformationController {
@Autowired
private CustomerGroupInformationService customerGroupInformationService;
/**
* @description: 获取客户组列表
* @author: jiayang_yue
* @date: 2024/1/8 13:12
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/customerGroupInformationSearch")
@ResponseBody
public R customerGroupInformationSearch(@RequestBody CustomerGroupInformationEntity data) {
PageUtils page = customerGroupInformationService.customerGroupInformationSearch(data);
return R.ok().put("page", page);
}
/**
* @description: 新增客户组信息
* @auther: jiayang_yue
* @date: 2024/1/8 13:12
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/customerGroupInformationSave")
@ResponseBody
public R customerGroupInformationSave(@RequestBody CustomerGroupInformationEntity data){
customerGroupInformationService.customerGroupInformationSave(data);
return R.ok();
}
/**
* @description: 编辑客户组信息
* @auther: jiayang_yue
* @date: 2024/1/8 13:12
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/customerGroupInformationEdit")
@ResponseBody
public R customerGroupInformationEdit(@RequestBody CustomerGroupInformationEntity data){
customerGroupInformationService.customerGroupInformationEdit(data);
return R.ok();
}
/**
* @description: 删除客户组信息
* @auther: jiayang_yue
* @date: 2024/1/8 13:12
* @param: [data]
* @return: com.spring.common.utils.R
**/
@PostMapping(value="/customerGroupInformationDelete")
@ResponseBody
public R customerGroupInformationDelete(@RequestBody CustomerGroupInformationEntity data){
customerGroupInformationService.customerGroupInformationDelete(data);
return R.ok();
}
}

61
src/main/java/com/spring/modules/customer/entity/CustomerGroupInformationEntity.java

@ -0,0 +1,61 @@
package com.spring.modules.customer.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.spring.common.utils.QueryPage;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
@TableName("plm_customer_group")
public class CustomerGroupInformationEntity extends QueryPage implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 工厂
**/
private String site;
/**
* 客户组编码
**/
private String customerGroupId;
/**
* 客户组名称
**/
private String customerGroupName;
/**
* 是否可用
**/
private String active;
/**
* 客户组
**/
private String type;
/**
* 创建时间
**/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 创建人
**/
private String createBy;
/**
* 更新时间
**/
@TableField(fill = FieldFill.UPDATE)
private Date updateDate;
/**
* 更新人
**/
private String updateBy;
/**
* 数据集
*/
@TableField(exist = false)
private List<CustomerGroupInformationEntity> informationList;
}

16
src/main/java/com/spring/modules/customer/entity/CustomerInformationEntity.java

@ -40,13 +40,27 @@ public class CustomerInformationEntity extends QueryPage implements Serializable
*/
private BigDecimal potentialRevenueOfYear;
/**
* 关键客户
* 重要程度
*/
private String importantCustomer;
/**
* 客户组1
**/
@TableField("customer_group_id1")
private String customerGroupId1;
/**
* 客户组2
**/
@TableField("customer_group_id2")
private String customerGroupId2;
/**
* 客户状态
*/
private String customerStatus;
/**
* 客户类型
*/
private String customerType;
/**
* 客户描述
*/

20
src/main/java/com/spring/modules/customer/mapper/CustomerGroupInformationMapper.java

@ -0,0 +1,20 @@
package com.spring.modules.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring.modules.customer.entity.CustomerGroupInformationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @description:
* @author: jiayang_yue
* @date: 2023/11/15 10:15
* @param:
* @return:
*/
@Mapper
public interface CustomerGroupInformationMapper extends BaseMapper<CustomerGroupInformationEntity> {
IPage<CustomerGroupInformationEntity> customerGroupInformationSearch(Page<CustomerGroupInformationEntity> CustomerGroupInformationEntityPage, @Param("query") CustomerGroupInformationEntity data);
}

22
src/main/java/com/spring/modules/customer/service/CustomerGroupInformationService.java

@ -0,0 +1,22 @@
package com.spring.modules.customer.service;
import com.spring.common.utils.PageUtils;
import com.spring.modules.customer.entity.CustomerGroupInformationEntity;
/**
* @description:
* @author: jiayang_yue
* @date: 2023/11/15 10:15
* @param:
* @return:
*/
public interface CustomerGroupInformationService {
PageUtils customerGroupInformationSearch(CustomerGroupInformationEntity data);
void customerGroupInformationSave(CustomerGroupInformationEntity data);
void customerGroupInformationEdit(CustomerGroupInformationEntity data);
void customerGroupInformationDelete(CustomerGroupInformationEntity data);
}

72
src/main/java/com/spring/modules/customer/service/impl/CustomerGroupInformationServiceImpl.java

@ -0,0 +1,72 @@
package com.spring.modules.customer.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spring.common.utils.PageUtils;
import com.spring.modules.customer.entity.CustomerGroupInformationEntity;
import com.spring.modules.customer.mapper.CustomerGroupInformationMapper;
import com.spring.modules.customer.service.CustomerGroupInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
/**
* @description:
* @author: jiayang_yue
* @date: 2023/11/15 10:15
* @param:
* @return:
*/
@Service
public class CustomerGroupInformationServiceImpl extends ServiceImpl<CustomerGroupInformationMapper,CustomerGroupInformationEntity> implements CustomerGroupInformationService {
@Autowired
private CustomerGroupInformationMapper customerGroupInformationMapper;
@Override
public PageUtils customerGroupInformationSearch(CustomerGroupInformationEntity data) {
IPage<CustomerGroupInformationEntity> resultList = this.customerGroupInformationMapper.customerGroupInformationSearch(new Page<CustomerGroupInformationEntity>(data.getPage(), data.getLimit()), data);
return new PageUtils(resultList);
}
@Override
public void customerGroupInformationSave(CustomerGroupInformationEntity data) {
// 校验
HashMap<String, Object> map = new HashMap<>();
map.put("site", data.getSite());
map.put("customer_group_id", data.getCustomerGroupId());
int count = customerGroupInformationMapper.selectByMap(map).size();
if (count > 0) {
throw new RuntimeException("商品组编码已存在!");
}
customerGroupInformationMapper.insert(data);
}
@Override
public void customerGroupInformationEdit(CustomerGroupInformationEntity data) {
UpdateWrapper<CustomerGroupInformationEntity> updateInformationWrapper = new UpdateWrapper<>();
updateInformationWrapper.eq("customer_group_id", data.getCustomerGroupId());
updateInformationWrapper.eq("site",data.getSite());
customerGroupInformationMapper.update(data,updateInformationWrapper);
}
@Override
public void customerGroupInformationDelete(CustomerGroupInformationEntity data) {
HashMap<String, Object> map = new HashMap<>();
map.put("site", data.getSite());
map.put("customer_group_id", data.getCustomerGroupId());
customerGroupInformationMapper.deleteByMap(map);
}
}

14
src/main/java/com/spring/modules/customer/service/impl/CustomerInformationServiceImpl.java

@ -67,20 +67,6 @@ public class CustomerInformationServiceImpl extends ServiceImpl<CustomerInformat
public void customerInformationSave(CustomerInformationVo data) {
// 新增客户信息
customerInformationMapper.insert(data);
// 新增客户联系人
CustomerContactEntity customerContactData = getCustomerContactData(data);
customerContactData.setCreateBy(data.getCreateBy());
customerContactMapper.insert(customerContactData);
// 新增客户联系地址
if (StringUtils.isNotBlank(data.getAddressName())) {
CustomerAddressEntity customerAddressData = new CustomerAddressEntity();
customerAddressData.setSite(data.getSite());
customerAddressData.setCustomerNo(data.getCustomerNo());
customerAddressData.setDefaultAddress(data.getDefaultAddress());
customerAddressData.setAddressStatus(data.getAddressStatus());
customerAddressData.setAddressType(data.getAddressType());
customerAddressMapper.insert(customerAddressData);
}
}
/**

8
src/main/java/com/spring/modules/customer/vo/CustomerInformationVo.java

@ -49,4 +49,12 @@ public class CustomerInformationVo extends CustomerInformationEntity {
* 联系地址类型
**/
private String addressType;
/**
* 客户组名称1
*/
private String customerGroupName1;
/**
* 客户组名称2
*/
private String customerGroupName2;
}

35
src/main/resources/mapper/customer/CustomerGroupInformationMapper.xml

@ -0,0 +1,35 @@
<?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.spring.modules.customer.mapper.CustomerGroupInformationMapper">
<!-- 信息列表 -->
<select id="customerGroupInformationSearch" parameterType="com.spring.modules.customer.entity.CustomerGroupInformationEntity" resultType="com.spring.modules.customer.entity.CustomerGroupInformationEntity">
SELECT
site,
customer_group_id,
customer_group_name,
active,
type,
create_by,
create_date,
update_by,
update_date
FROM plm_customer_group
<where>
site = #{query.site}
<if test = "query.customerGroupId != null and query.customerGroupId != ''">
AND customer_group_id like #{query.customerGroupId}
</if>
<if test = "query.customerGroupName != null and query.customerGroupName != ''">
AND customer_group_name like #{query.customerGroupName}
</if>
<if test = "query.active != null and query.active != ''">
AND active = #{query.active}
</if>
<if test = "query.type != null and query.type != ''">
AND type = #{query.type}
</if>
</where>
</select>
</mapper>

5
src/main/resources/mapper/customer/CustomerInformationMapper.xml

@ -12,7 +12,12 @@
turnover_of_year,
potential_revenue_of_year,
important_customer,
customer_group_id1,
dbo.get_customer_group_name(site, customer_group_id1, '1') as customerGroupName1,
customer_group_id2,
dbo.get_customer_group_name(site, customer_group_id2, '2') as customerGroupName2,
customer_status,
customer_type,
customer_description,
customer_industry,
create_date,

Loading…
Cancel
Save