Commit 44f5018c by guojuxing

商品列表查询

parent 9ee999fe
......@@ -142,14 +142,14 @@ public class EnterpriseListDTO implements Serializable{
Map<Integer, Integer> licenseMap = new HashMap<>(16);
for (String str : licenseArr) {
Integer licenseType = Integer.parseInt(str.substring(0, 1));
Integer licenseValue = Integer.parseInt(str.substring(1, str.length() -1));
Integer licenseValue = Integer.parseInt(str.substring(1, str.length()));
licenseMap.put(licenseType, licenseValue);
}
StringBuilder serviceInfo = new StringBuilder();
for (LicenseTypeEnum licenseTypeEnum : LicenseTypeEnum.values()) {
serviceInfo.append(licenseMap.get(licenseTypeEnum.getCode())).append("-");
}
return serviceInfo.toString().substring(0, serviceInfo.toString().length() - 2);
return serviceInfo.toString().substring(0, serviceInfo.toString().length() - 1);
}
}
......
......@@ -171,7 +171,7 @@
c.service_version serviceVersion,
c.expiration_time expirationTime,
c.`status` serviceStatus,
if(c.expiration_time != null, DATEDIFF(c.expiration_time, now()), 0) aboutToExpireDay
if(c.expiration_time is not null, DATEDIFF(c.expiration_time, now()), 0) aboutToExpireDay
FROM
tab_enterprise a
LEFT JOIN tab_enterprise_license b ON a.enterprise_id = b.enterprise_id
......
......@@ -6,6 +6,7 @@ import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.UserApiService;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.constant.EnterpriseListOrderByEnum;
import com.gic.enterprise.constant.EnterpriseVersionStatusEnum;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseRestResponse;
......@@ -20,6 +21,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @author guojx
* @date 2019/7/17 10:32 AM
......@@ -61,15 +65,27 @@ public class EnterpriseController {
@RequestMapping("/list-enterprise")
public RestResponse listEnterprise(String search, Integer serviceVersion, Integer serviceStatus, Integer orderBy, PageQO pageQO) {
if (orderBy == null) {
orderBy = 0;
}
ServiceResponse enterpriseResult = enterpriseApiService.listEnterprise(search, serviceVersion, serviceStatus,
EnterpriseListOrderByEnum.getOrderBy(orderBy), pageQO.getCurrentPage(), pageQO.getPageSize());
if (enterpriseResult.isSuccess()) {
return RestResponse.success();
return RestResponse.success(enterpriseResult.getResult());
} else {
return EnterpriseRestResponse.failure(enterpriseResult);
}
}
@RequestMapping("/list-enterprise-version-status")
public RestResponse listEnterpriseVersionStatus() {
Map<Integer, String> resultMap = new HashMap<>(16);
for (EnterpriseVersionStatusEnum statusEnum : EnterpriseVersionStatusEnum.values()) {
resultMap.put(statusEnum.getCode(), statusEnum.getMessage());
}
return RestResponse.success(resultMap);
}
@RequestMapping("/edit-enterprise")
public RestResponse editEnterprise(@Validated({EnterpriseDTO.EditEnterpriseValid.class, EnterpriseDTO.SaveEnterpriseValid.class})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment