中扬CRM客户关系管理系统
#
luxiaotao1123
2022-09-18 1d95fca62de153888b0ffa5458e3d008a424c587
#
6个文件已修改
61 ■■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/CstmrController.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/mapper/CstmrTypeMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/service/CstmrTypeService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/service/impl/CstmrTypeServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/CstmrTypeMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/mould/甲方单位导入模板.xls 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/CstmrController.java
@@ -12,7 +12,9 @@
import com.core.exception.CoolException;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.manager.entity.Cstmr;
import com.zy.crm.manager.entity.CstmrType;
import com.zy.crm.manager.service.CstmrService;
import com.zy.crm.manager.service.CstmrTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
@@ -35,6 +37,8 @@
    @Autowired
    private CstmrService cstmrService;
    @Autowired
    private CstmrTypeService cstmrTypeService;
    @RequestMapping(value = "/cstmr/{id}/auth")
    @ManagerAuth
@@ -195,9 +199,43 @@
            Date now = new Date();
            for (int i = 2; i < totalRows; i++) {
                Cstmr cstmr = new Cstmr();
                Row row = sheet.getRow(i);
                System.out.println(row.getCell(0).getStringCellValue());
                // å®¢æˆ·ä»£å·
                String uuid = row.getCell(0).getStringCellValue();
                if (!Cools.isEmpty(uuid)) {
                    if (cstmrService.selectByUuid(hostId, uuid) != null) {
                        throw new CoolException(uuid + "客户代号已存在,请重新导入");
                    } else {
                        cstmr.setUuid(uuid);
                    }
                } else {
                    cstmr.setUuid(cstmrService.getUuid(hostId));
                }
                // å®¢æˆ·ä»£å·
                String name = row.getCell(1).getStringCellValue();
                if (Cools.isEmpty(name)) {
                    throw new CoolException("第" + i + "行客户名称不能为空,请重新导入");
                }
                cstmr.setName(name);
                // å®¢æˆ·ç±»åˆ«
                String type = row.getCell(2).getStringCellValue();
                if (Cools.isEmpty(type)) {
                    throw new CoolException("第" + i + "行客户类别不能为空,请重新导入");
                }
                CstmrType cstmrType = cstmrTypeService.selectByName(hostId, type);
                if (null == cstmrType) {
                    throw new CoolException("第" + i + "行客户类别不合法,请重新导入");
                }
                cstmr.setCstmrType(cstmrType.getId());
                // å®¢æˆ·ç±»åˆ«
                cstmr.setRela(row.getCell(3).getStringCellValue());
                // ç”µè¯
                cstmr.setTel(row.getCell(4).getStringCellValue());
                // å®¢æˆ·è”系人
                cstmr.setContacts(row.getCell(5).getStringCellValue());
                // å¤‡æ³¨
                cstmr.setRemarks(row.getCell(6).getStringCellValue());
                cstmr.setHostId(hostId);
                cstmr.setDeptId(deptId);
src/main/java/com/zy/crm/manager/mapper/CstmrTypeMapper.java
@@ -3,10 +3,13 @@
import com.zy.crm.manager.entity.CstmrType;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface CstmrTypeMapper extends BaseMapper<CstmrType> {
    CstmrType selectByName(@Param("hostId") Long hostId, @Param("name") String name);
}
src/main/java/com/zy/crm/manager/service/CstmrTypeService.java
@@ -5,4 +5,6 @@
public interface CstmrTypeService extends IService<CstmrType> {
    CstmrType selectByName(Long hostId, String name);
}
src/main/java/com/zy/crm/manager/service/impl/CstmrTypeServiceImpl.java
@@ -9,4 +9,8 @@
@Service("cstmrTypeService")
public class CstmrTypeServiceImpl extends ServiceImpl<CstmrTypeMapper, CstmrType> implements CstmrTypeService {
    @Override
    public CstmrType selectByName(Long hostId, String name) {
        return this.baseMapper.selectByName(hostId, name);
    }
}
src/main/resources/mapper/CstmrTypeMapper.xml
@@ -18,4 +18,14 @@
    </resultMap>
    <select id="selectByName" resultMap="BaseResultMap">
        select top 1 *
        from man_cstmr_type
        where 1=1
        and name = #{name}
        <if test="hostId != null">
            and host_id = #{hostId}
        </if>
    </select>
</mapper>
src/main/webapp/mould/¼×·½µ¥Î»µ¼ÈëÄ£°å.xls
Binary files differ