jz.kai há 3 anos atrás
pai
commit
4924d2dbd9

+ 1 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/LanguageDAO.java

@@ -15,4 +15,5 @@ public interface LanguageDAO {
 	int delete(String id);
 	List<Language> list();
 	List<Language> search(Map<String,Object> searchParams,List<Sort> sortList);
+	Language getByName(String name);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/LanguageService.java

@@ -14,4 +14,5 @@ public interface LanguageService {
 	int delete(String id);
 	List<Language> list();
 	Page<Language> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+	Language getByName(String name);
 }

+ 6 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/LanguageServiceImpl.java

@@ -67,4 +67,10 @@ public class LanguageServiceImpl implements LanguageService {
         
         return page;
 	}
+
+	@Override
+	public Language getByName(String name) {
+		// TODO Auto-generated method stub
+		return languageDAO.getByName(name);
+	}
 }

+ 11 - 2
common/src/main/resources/mapper/base/OrderForm.xml

@@ -140,8 +140,17 @@ id_,client_email,client_name,client_order_number,feilihua_order_number,product_n
 			select * from base_order_form
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			<if test="searchParams.clientName != null">
+				and client_name like #{searchParams.clientName}
+			</if>
+			<if test="searchParams.clientOrderNumber != null">
+				and client_order_number like #{searchParams.clientOrderNumber}
+			</if>
+			<if test="searchParams.feilihuaOrderNumber != null">
+				and feilihua_order_number like #{searchParams.feilihuaOrderNumber}
+			</if>
+			<if test="searchParams.productName != null">
+				and product_name like #{searchParams.productName}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 3 - 0
common/src/main/resources/mapper/sys/Language.xml

@@ -100,4 +100,7 @@ id_,name_,chinese_,english_,del_flag,create_by,create_time,update_by,update_time
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="getByName" parameterType="string" resultMap="LanguageMap">
+		select * from sys_language where del_flag=0 and name_=#{0} limit 1
+	</select>
 </mapper>

+ 204 - 33
web/src/main/java/com/jpsoft/order/modules/base/controller/OrderFormController.java

@@ -208,7 +208,7 @@ public class OrderFormController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String id,
+            String clientName, String clientOrderNumber, String feilihuaOrderNumber, String productName,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -223,8 +223,17 @@ public class OrderFormController {
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("id_","asc"));
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(clientName)) {
+            searchParams.put("clientName","%" + clientName + "%");
+        }
+        if (StringUtils.isNotEmpty(clientOrderNumber)) {
+            searchParams.put("clientOrderNumber","%" + clientOrderNumber + "%");
+        }
+        if (StringUtils.isNotEmpty(feilihuaOrderNumber)) {
+            searchParams.put("feilihuaOrderNumber","%" + feilihuaOrderNumber + "%");
+        }
+        if (StringUtils.isNotEmpty(productName)) {
+            searchParams.put("productName","%" + productName + "%");
         }
 
         Page<OrderForm> page = orderFormService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
@@ -251,35 +260,197 @@ public class OrderFormController {
 
             for(int rowIndex=1; rowIndex<=sheet1.getLastRowNum(); rowIndex++){
                 try {
-                    String strBatch = poiUtils.getCellValue(0,rowIndex,0).toString();
-                    String strSerialNo = poiUtils.getCellValue(0,rowIndex,1).toString();
-                    String strComplainant = poiUtils.getCellValue(0,rowIndex,2).toString();
-                    String strComplainantPhone = poiUtils.getCellValue(0,rowIndex,3).toString();
-                    String strProblem = poiUtils.getCellValue(0,rowIndex,4).toString();
-                    String strArea = poiUtils.getCellValue(0,rowIndex,5).toString();
-                    String strSpecialClass = poiUtils.getCellValue(0,rowIndex,6).toString();
-                    String strSuggestedDate = poiUtils.getCellValue(0,rowIndex,7).toString();
-                    String strOrg = poiUtils.getCellValue(0,rowIndex,8).toString();
-                    String strWarnDate1 = poiUtils.getCellValue(0,rowIndex,9).toString();
-                    String strWarnDate2 = poiUtils.getCellValue(0,rowIndex,10).toString();
-                    String strWarnDate3 = poiUtils.getCellValue(0,rowIndex,11).toString();
-                    String strAllotedDate = poiUtils.getCellValue(0,rowIndex,12).toString();
-                    String strRemark = poiUtils.getCellValue(0,rowIndex,13).toString();
-
-                    //案件信息
-//                    Incident incident = new Incident();
-//                    incident.setId(UUID.randomUUID().toString());
-
-//                    if(StringUtils.isNotEmpty(strSuggestedDate)){
-//                        incident.setSuggestedDate(sdf.parse(strSuggestedDate));
-//                    }
-//                    else{
-//                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写建议办结时限!");
-//                        failCount++;
-//                        continue;
-//                    }
-
-//                    incidentService.insert(incident);
+                    String strClientEmail = poiUtils.getCellValue(0,rowIndex,0).toString();
+                    String strClientName = poiUtils.getCellValue(0,rowIndex,1).toString();
+                    String strClientOrderNumber = poiUtils.getCellValue(0,rowIndex,2).toString();
+                    String strFeilihuaOrderNumber = poiUtils.getCellValue(0,rowIndex,3).toString();
+                    String strProductName = poiUtils.getCellValue(0,rowIndex,4).toString();
+                    String strTrademark = poiUtils.getCellValue(0,rowIndex,5).toString();
+                    String strProductSpecification = poiUtils.getCellValue(0,rowIndex,6).toString();
+                    String strOrderQuantity = poiUtils.getCellValue(0,rowIndex,7).toString();
+                    String strUnit = poiUtils.getCellValue(0,rowIndex,8).toString();
+                    String strRequiredDeliveryTime = poiUtils.getCellValue(0,rowIndex,9).toString();
+                    String strReviewDeliveryTime = poiUtils.getCellValue(0,rowIndex,10).toString();
+                    String strStockQuantity = poiUtils.getCellValue(0,rowIndex,11).toString();
+                    String strProductionQuantity = poiUtils.getCellValue(0,rowIndex,12).toString();
+                    String strExpiryTime = poiUtils.getCellValue(0,rowIndex,13).toString();
+
+                    //订单信息
+                    OrderForm orderForm = new OrderForm();
+                    orderForm.setId(UUID.randomUUID().toString());
+                    orderForm.setDelFlag(false);
+                    orderForm.setCreateBy(subject);
+                    orderForm.setCreateTime(new Date());
+
+                    if(StringUtils.isNotEmpty(strClientEmail)){
+                        orderForm.setClientEmail(strClientEmail);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户邮箱!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strClientName)){
+                        orderForm.setClientName(strClientName);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户名称!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strClientOrderNumber)){
+                        orderForm.setClientOrderNumber(strClientOrderNumber);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户订单号!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strFeilihuaOrderNumber)){
+                        orderForm.setFeilihuaOrderNumber(strFeilihuaOrderNumber);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写菲利华订单号!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strProductName)){
+                        orderForm.setProductName(strProductName);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品名称!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strTrademark)){
+                        orderForm.setTrademark(strTrademark);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写牌号!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strProductSpecification)){
+                        orderForm.setProductSpecification(strProductSpecification);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品规格!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strOrderQuantity)){
+                        try {
+                            orderForm.setOrderQuantity(Integer.parseInt(strOrderQuantity));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("订单数量数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写订单数量!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strUnit)){
+                        orderForm.setUnit(strUnit);
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写单位!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strRequiredDeliveryTime)){
+                        try {
+                            orderForm.setRequiredDeliveryTime(sdf.parse(strRequiredDeliveryTime));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("要求交期数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写要求交期!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strReviewDeliveryTime)){
+                        try {
+                            orderForm.setReviewDeliveryTime(sdf.parse(strReviewDeliveryTime));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("评审交期数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写评审交期!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strStockQuantity)){
+                        try {
+                            orderForm.setStockQuantity(Integer.parseInt(strStockQuantity));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("库存数量数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写库存数量!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strProductionQuantity)){
+                        try {
+                            orderForm.setProductionQuantity(Integer.parseInt(strProductionQuantity));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("还需生产数量数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写还需生产数量!");
+                        failCount++;
+                        continue;
+                    }
+
+                    if(StringUtils.isNotEmpty(strExpiryTime)){
+                        try {
+                            orderForm.setExpiryTime(sdf.parse(strExpiryTime));
+                        }
+                        catch (Exception ex){
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("过期时间数据错误!");
+                            failCount++;
+                            continue;
+                        }
+                    }
+                    else{
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写过期时间!");
+                        failCount++;
+                        continue;
+                    }
+
+                    orderFormService.insert(orderForm);
 
                     affectCount++;
                 }
@@ -307,7 +478,7 @@ public class OrderFormController {
                 //格式化holidayInfo
                 SimpleDateFormat sim = new SimpleDateFormat("yyyyMMddHHmmss");
                 String fileName = "error" + sim.format(new Date()) + ".xls";
-                String downloadUrl = OSSUtil.upload(ossConfig,"excellent",fileName,input);
+                String downloadUrl = OSSUtil.upload(ossConfig,"FeilihuaOrder",fileName,input);
 
                 //todo 返回导入失败报表下载链接
                 msgResult.setData(downloadUrl);

+ 51 - 0
web/src/main/java/com/jpsoft/order/modules/open/LanguageApi.java

@@ -0,0 +1,51 @@
+package com.jpsoft.order.modules.open;
+
+import com.jpsoft.order.modules.common.dto.MessageResult;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.common.utils.OSSUtil;
+import com.jpsoft.order.modules.common.utils.POIUtils;
+import com.jpsoft.order.modules.common.utils.PojoUtils;
+import com.jpsoft.order.modules.sys.entity.Language;
+import com.jpsoft.order.modules.sys.service.LanguageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/open/languageApi")
+@Api(description = "languageApi")
+public class LanguageApi {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private LanguageService languageService;
+
+    @ApiOperation(value="根据名称查询实体")
+    @RequestMapping(value = "getByName",method = RequestMethod.POST)
+    public MessageResult<Language> getByName(String name){
+        MessageResult<Language> msgResult = new MessageResult<>();
+
+        try {
+            Language language = languageService.getByName(name);
+
+            if (language != null) {
+                msgResult.setResult(true);
+                msgResult.setData(language);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}