src/main/java/com/zy/crm/manager/controller/CstmrController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/mapper/CstmrTypeMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/service/CstmrTypeService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/service/impl/CstmrTypeServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/CstmrTypeMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | 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/¼×·½µ¥Î»µ¼ÈëÄ£°å.xlsBinary files differ