Browse Source

客商新增 销售状态新增 客户档案字段新增

chenc 3 years ago
parent
commit
0729a3a109

+ 1 - 1
src/main/java/org/jeecg/modules/basedata/controller/BaseCustomerIndustryController.java

@@ -152,7 +152,7 @@ public class BaseCustomerIndustryController {
 		Result<BaseCustomerIndustry> result = new Result<BaseCustomerIndustry>();
 		try {
 			// 设置编码
-			CallResult<String> nextSerial = sysSerialPatternService.getNextSerial(baseCustomerIndustry, "base_archives_project_approval", "code", true);
+			CallResult<String> nextSerial = sysSerialPatternService.getNextSerial(baseCustomerIndustry, "base_customer_industry", "code", true);
 			if(!nextSerial.isSucceed()){
 				throw new RuntimeException("获取编号失败");
 			}

+ 9 - 0
src/main/java/org/jeecg/modules/basedata/controller/BaseSalesStatusController.java

@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
+import org.jeecg.modules.system.service.ISysSerialPatternService;
+import org.jeecg.modules.system.vo.CallResult;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -47,6 +49,8 @@ import com.alibaba.fastjson.JSON;
 public class BaseSalesStatusController {
 	@Autowired
 	private IBaseSalesStatusService baseSalesStatusService;
+	 @Autowired
+	 private ISysSerialPatternService sysSerialPatternService;
 	
 	/**
 	  * 分页列表查询
@@ -142,6 +146,11 @@ public class BaseSalesStatusController {
 	public Result<BaseSalesStatus> add(@RequestBody BaseSalesStatus baseSalesStatus) {
 		Result<BaseSalesStatus> result = new Result<BaseSalesStatus>();
 		try {
+			// 设置编码
+			CallResult<String> nextSerial = sysSerialPatternService.getNextSerial(baseSalesStatus, "base_sales_status", "code", true);
+			if(!nextSerial.isSucceed()){
+				throw new RuntimeException("获取编号失败");
+			}
 			baseSalesStatusService.save(baseSalesStatus);
 			result.success("添加成功!");
 		} catch (Exception e) {

+ 55 - 1
src/main/java/org/jeecg/modules/basedata/controller/FdCustomerController.java

@@ -19,8 +19,10 @@ import org.jeecg.common.aspect.annotation.NotDuplicate;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.basedata.entity.BaseCustomerIndustry;
 import org.jeecg.modules.basedata.entity.FdCustomer;
 import org.jeecg.modules.basedata.entity.FdCustomerContacts;
+import org.jeecg.modules.basedata.service.IBaseCustomerIndustryService;
 import org.jeecg.modules.basedata.service.IFdCustomerContactsService;
 import org.jeecg.modules.basedata.service.IFdCustomerService;
 
@@ -28,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 
 
+import org.jeecg.modules.system.service.ISysDictService;
 import org.jeecg.modules.system.service.ISysSerialPatternService;
 import org.jeecg.modules.system.vo.CallResult;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -64,6 +67,11 @@ public class FdCustomerController {
 	@Autowired
 	private ISysSerialPatternService iSysSerialPatternService;
 
+	@Autowired
+	private ISysDictService iSysDictService;
+
+	@Autowired
+	private IBaseCustomerIndustryService iBaseCustomerIndustryService;
 
 
 	/**
@@ -393,10 +401,56 @@ public class FdCustomerController {
 	@GetMapping(value = "/queryById")
 	public Result<FdCustomer> queryById(@RequestParam(name="id",required=true) String id) {
 		Result<FdCustomer> result = new Result<FdCustomer>();
-		FdCustomer fdCustomer = fdCustomerService.getById(id);
+		FdCustomer fdCustomer = fdCustomerService.getFdCustomerById(id);
 		if(fdCustomer==null) {
 			result.error500("未找到对应实体");
 		}else {
+			//根据数据字典中的值获取名称
+			//客商分类名称
+			if(StringUtils.isNotBlank(fdCustomer.getCustomerClassificationDictValue())){
+				fdCustomer.setCustomerClassificationDictName(iSysDictService.queryDictTextByKey("customer_classification", fdCustomer.getCustomerClassificationDictValue()));
+			}
+			//客商来源名称
+			if(StringUtils.isNotBlank(fdCustomer.getCustomerSourceDictValue())){
+				fdCustomer.setCustomerSourceDictName(iSysDictService.queryDictTextByKey("information_sources", fdCustomer.getCustomerSourceDictValue()));
+			}
+			//客商分组名称
+			if(StringUtils.isNotBlank(fdCustomer.getCustomerGroupingDictValue())){
+				fdCustomer.setCustomerGroupingDictName(iSysDictService.queryDictTextByKey("customer_grouping", fdCustomer.getCustomerGroupingDictValue()));
+			}
+			//商务关系名称
+			if(StringUtils.isNotBlank(fdCustomer.getBusinessRelationsDictValue())){
+				fdCustomer.setBusinessRelationsDictName(iSysDictService.queryDictTextByKey("business_relations", fdCustomer.getBusinessRelationsDictValue()));
+			}
+			//使用状态名称
+			if(StringUtils.isNotBlank(fdCustomer.getUseStatusDictValue())){
+				fdCustomer.setUseStatusDictName(iSysDictService.queryDictTextByKey("use_status", fdCustomer.getUseStatusDictValue()));
+			}
+			//休眠类型名称
+			if(StringUtils.isNotBlank(fdCustomer.getSleepTypeDictValue())){
+				fdCustomer.setSleepTypeDictName(iSysDictService.queryDictTextByKey("sleep_type", fdCustomer.getSleepTypeDictValue()));
+			}
+			//单位规模名称
+			if(StringUtils.isNotBlank(fdCustomer.getUnitSizeDictValue())){
+				fdCustomer.setUnitSizeDictName(iSysDictService.queryDictTextByKey("unit_size", fdCustomer.getUnitSizeDictValue()));
+			}
+			//人员规模名称
+			if(StringUtils.isNotBlank(fdCustomer.getPersonnelSizeDictValue())){
+				fdCustomer.setPersonnelSizeDictName(iSysDictService.queryDictTextByKey("personnel_size", fdCustomer.getPersonnelSizeDictValue()));
+			}
+			//注册资金名称
+			if(StringUtils.isNotBlank(fdCustomer.getRegisteredCapitalDictValue())){
+				fdCustomer.setRegisteredCapitalDictName(iSysDictService.queryDictTextByKey("registered_capital", fdCustomer.getRegisteredCapitalDictValue()));
+			}
+			//客户关系名称
+			if(StringUtils.isNotBlank(fdCustomer.getCustomerRelationshipDictValue())){
+				fdCustomer.setCustomerRelationshipDictName(iSysDictService.queryDictTextByKey("customer-relationship", fdCustomer.getCustomerRelationshipDictValue()));
+			}
+			//价值级别名称
+			if(StringUtils.isNotBlank(fdCustomer.getValueLevelDictValue())){
+				fdCustomer.setValueLevelDictName(iSysDictService.queryDictTextByKey("value_level", fdCustomer.getValueLevelDictValue()));
+			}
+
             LambdaQueryWrapper<FdCustomerContacts> query = new LambdaQueryWrapper<>();
             query.eq(FdCustomerContacts::getPkCustomerId,id);
             query.eq(FdCustomerContacts::getIsDefault,"1").eq(FdCustomerContacts::getDelFlag,"0");

+ 57 - 0
src/main/java/org/jeecg/modules/basedata/entity/FdCustomer.java

@@ -218,6 +218,63 @@ public class FdCustomer implements Serializable {
 	@DateTimeFormat(pattern="yyyy-MM-dd")
 	private java.util.Date developmentDate;
 
+	//客商分类名称(数据字典)
+	@TableField(exist = false)
+	private String customerClassificationDictName;
+
+	//客商来源名称(数据字典)
+	@TableField(exist = false)
+	private String customerSourceDictName;
+
+	//客商行业名称
+	@TableField(exist = false)
+	private String baseCustomerIndustryName;
+
+	//销售状态名称
+	@TableField(exist = false)
+	private String baseSalesStatusName;
+
+	//客商分组名称(数据字典)
+	@TableField(exist = false)
+	private String customerGroupingDictName;
+
+	//商务关系名称(数据字典)
+	@TableField(exist = false)
+	private String businessRelationsDictName;
+
+	//上级单位名称(本表)
+	@TableField(exist = false)
+	private String parentName;
+
+	//使用状态名称(数据字典)
+	@TableField(exist = false)
+	private String useStatusDictName;
+
+	//休眠类型名称(数据字典)
+	@TableField(exist = false)
+	private String sleepTypeDictName;
+
+	//单位规模名称(数据字典)
+	@TableField(exist = false)
+	private String unitSizeDictName;
+
+	//人员规模名称(数据字典)
+	@TableField(exist = false)
+	private String personnelSizeDictName;
+
+	//注册资金名称(数据字典)
+	@TableField(exist = false)
+	private String registeredCapitalDictName;
+
+	//客户关系名称(数据字典)
+	@TableField(exist = false)
+	private String customerRelationshipDictName;
+
+	//价值级别名称(数据字典)
+	@TableField(exist = false)
+	private String valueLevelDictName;
+
+
 	@Excel(name = "客户联系人")
 	@TableField(exist = false)
 	private  java.lang.String contactPsn;

+ 3 - 0
src/main/java/org/jeecg/modules/basedata/mapper/FdCustomerMapper.java

@@ -22,4 +22,7 @@ public interface FdCustomerMapper extends BaseMapper<FdCustomer> {
 
     //  添加联系人前查询客户ID
     FdCustomer Customer(@Param("name") String name);
+
+    //根据id查询
+    FdCustomer getFdCustomerById(@Param("id") String id);
 }

+ 15 - 0
src/main/java/org/jeecg/modules/basedata/mapper/xml/FdCustomerMapper.xml

@@ -29,4 +29,19 @@
         where `name` like #{name}
         and del_flag ='0'
     </select>
+
+    <select id="getFdCustomerById" resultType="org.jeecg.modules.basedata.entity.FdCustomer" parameterType="java.lang.String">
+        SELECT
+            *,
+            bci.NAME AS baseCustomerIndustryName,
+            bss.NAME AS baseSalesStatusName,
+            fcp.NAME AS parentName
+        FROM
+            fd_customer fc
+            LEFT JOIN base_customer_industry bci ON fc.base_customer_industry_id = bci.id
+            LEFT JOIN base_sales_status bss ON fc.base_sales_status_id = bss.id
+            LEFT JOIN fd_customer fcp ON fc.parent_id = fcp.id
+        WHERE
+            fc.id = #{id}
+    </select>
 </mapper>

+ 3 - 0
src/main/java/org/jeecg/modules/basedata/service/IFdCustomerService.java

@@ -23,4 +23,7 @@ public interface IFdCustomerService extends IService<FdCustomer> {
     boolean updateCustomer(FdCustomer customerm);
 
     void cusAndContactsDelete(String id);
+
+    //根据id查询
+    FdCustomer getFdCustomerById(String id);
 }

+ 5 - 0
src/main/java/org/jeecg/modules/basedata/service/impl/FdCustomerServiceImpl.java

@@ -148,4 +148,9 @@ public class FdCustomerServiceImpl extends ServiceImpl<FdCustomerMapper, FdCusto
         fdCustomerService.removeById(id);
     }
 
+    @Override
+    public FdCustomer getFdCustomerById(String id) {
+        return fdCustomerService.getFdCustomerById(id);
+    }
+
 }

+ 1 - 1
src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java

@@ -65,7 +65,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
 	 */
 
 	@Override
-	@Cacheable(value = "dictCache")
+//	@Cacheable(value = "dictCache")
 	public String queryDictTextByKey(String code, String key) {
 		log.info("无缓存dictText的时候调用这里!");
 		return sysDictMapper.queryDictTextByKey(code, key);