|
@@ -155,9 +155,7 @@ public class IndexController { ;
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "设备申请")
|
|
|
-// @PostMapping("/initNew.htm")
|
|
|
@RequestMapping(value = "/initNew.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
|
|
|
-// @RequestMapping(value = "/initNew.htm", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String initNew(String clientId, String managerId, String gtClientId, String equimentType) {
|
|
|
String machineType = "0";
|
|
@@ -208,15 +206,18 @@ public class IndexController { ;
|
|
|
// return JsonMessage.success("设备申请成功");
|
|
|
return "设备申请成功";
|
|
|
}
|
|
|
- Date applyStartTime = admin.getApplyStartTime();
|
|
|
- Date applyEndTime = admin.getApplyEndTime();
|
|
|
- Date now = new Date();
|
|
|
- if(now.getTime()>applyStartTime.getTime()&&now.getTime()<applyEndTime.getTime()){
|
|
|
- Long id = equipmentApply.getId();
|
|
|
- agree(id);
|
|
|
+ if(admin.getApplyStartTime()!=null&&admin.getApplyEndTime()!=null){
|
|
|
+ Date applyStartTime = admin.getApplyStartTime();
|
|
|
+ Date applyEndTime = admin.getApplyEndTime();
|
|
|
+ Date now = new Date();
|
|
|
+ if(now.getTime()>applyStartTime.getTime()&&now.getTime()<applyEndTime.getTime()){
|
|
|
+ Long id = equipmentApply.getId();
|
|
|
+ agree(id);
|
|
|
// return JsonMessage.success("设备申请成功");
|
|
|
- return "设备申请成功";
|
|
|
+ return "设备申请成功";
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
// return JsonMessage.success("设备申请中,请耐心等待");
|
|
|
return "设备申请中,请耐心等待";
|
|
|
|
|
@@ -1343,6 +1344,43 @@ public class IndexController { ;
|
|
|
|
|
|
return jsonObject.toJSONString();
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 根据设备编号获取商品信息
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getproducts", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
|
|
|
+ @ResponseBody
|
|
|
+ public String getproducts(String clientId) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(clientId)){
|
|
|
+ jsonObject.put("code", 1);
|
|
|
+ jsonObject.put("errmsg", "clientId为空");
|
|
|
+ return jsonObject.toJSONString();
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TEquipment::getClientId,clientId);
|
|
|
+ List<TEquipment> list1 = equipmentService.list(query);
|
|
|
+ TEquipment equipment = list1.get(0);
|
|
|
+ LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
|
+ queryProduct.eq(TProduct::getEquipmentId,equipment.getId());
|
|
|
+ List<TProduct> products = productService.list(queryProduct);
|
|
|
+// TProduct tProduct = products.get(0);
|
|
|
+ for (TProduct product:products){
|
|
|
+ product.setCreateDate(null);
|
|
|
+ product.setModifyDate(null);
|
|
|
+ }
|
|
|
+// jsonObject.put("code", 0);
|
|
|
+// jsonObject.put("productions", JsonUtils.toJson(list));
|
|
|
+// jsonObject.put("errmsg", "");
|
|
|
+// jsonObject.put("total", list.size());
|
|
|
+// return jsonObject.toJSONString();
|
|
|
+ JSONObject jsonObject1 = new JSONObject();
|
|
|
+ jsonObject1.put("code", 0);
|
|
|
+ jsonObject1.put("data", JSONObject.toJSON(products).toString());
|
|
|
+ jsonObject1.put("errmsg", "");
|
|
|
+// return jsonObject1.toString();
|
|
|
+ return JSONObject.toJSON(products).toString();
|
|
|
+ }
|
|
|
// @ApiOperation(value = "分页查询")
|
|
|
// @GetMapping("/testPage")
|
|
|
// public ResponseModel<IPage<?>> testPage(TAdminParam param) {
|
|
@@ -1512,7 +1550,7 @@ public class IndexController { ;
|
|
|
// return JsonMessage.success("success");
|
|
|
return "success";
|
|
|
}
|
|
|
- //验证优惠码
|
|
|
+ //修改机器的分销
|
|
|
@RequestMapping(value = "/updateProportion.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
|
|
|
@ResponseBody
|
|
|
public String updateProportion(String clientId) {
|
|
@@ -1523,7 +1561,6 @@ public class IndexController { ;
|
|
|
if(equipment!=null&&equipment.getId()!=null){
|
|
|
TAdmin admin = adminService.getById(equipment.getAdminId());
|
|
|
String name = admin.getName();
|
|
|
- if(StringUtils.isNotEmpty(name)&&name.substring(name.length()-1).equals("x")){
|
|
|
//查询机器是否已经有设置分销
|
|
|
LambdaQueryWrapper<TProportion> query1 = Wrappers.lambdaQuery();
|
|
|
query1.eq(TProportion::getClientId,equipment.getClientId());
|
|
@@ -1534,33 +1571,34 @@ public class IndexController { ;
|
|
|
}else {
|
|
|
//没有,需要创建
|
|
|
//1,判断是否新机器
|
|
|
- Date createDate = equipment.getCreateDate();
|
|
|
- long time = createDate.getTime();
|
|
|
- DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String day= "2022-09-21 23:59:59";
|
|
|
- try {
|
|
|
- Date parse = simpleDateFormat.parse(day);
|
|
|
- if(time>parse.getTime()){
|
|
|
- return "新机器,不能已此方式生成分销!";
|
|
|
- }
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+// Date createDate = equipment.getCreateDate();
|
|
|
+// long time = createDate.getTime();
|
|
|
+// DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+// String day= "2022-09-21 23:59:59";
|
|
|
+// try {
|
|
|
+// Date parse = simpleDateFormat.parse(day);
|
|
|
+// if(time>parse.getTime()){
|
|
|
+// return "新机器,不能已此方式生成分销!";
|
|
|
+// }
|
|
|
+// } catch (ParseException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
//先找到原账户的分销
|
|
|
LambdaQueryWrapper<TProportion> query2 = Wrappers.lambdaQuery();
|
|
|
query2.eq(TProportion::getAdminId,admin.getId());
|
|
|
List<TProportion> list2 = proportionService.list(query2);
|
|
|
if(list2.size()>0){
|
|
|
TProportion adminProportion = list2.get(0);
|
|
|
- TProportion equipmentProportion = new TProportion();
|
|
|
- equipmentProportion.setCreateDate(new Date());
|
|
|
- equipmentProportion.setModifyDate(new Date());
|
|
|
- equipmentProportion.setAdminId(admin.getId());
|
|
|
- equipmentProportion.setClientId(equipment.getClientId());
|
|
|
- equipmentProportion.setEquipmentId(equipment.getId());
|
|
|
- equipmentProportion.setAdminProportion(adminProportion.getAdminProportion());
|
|
|
- Integer type = adminProportion.getType();
|
|
|
- switch (type) {
|
|
|
+ if(StringUtils.isEmpty(adminProportion.getClientId())){
|
|
|
+ TProportion equipmentProportion = new TProportion();
|
|
|
+ equipmentProportion.setCreateDate(new Date());
|
|
|
+ equipmentProportion.setModifyDate(new Date());
|
|
|
+ equipmentProportion.setAdminId(admin.getId());
|
|
|
+ equipmentProportion.setClientId(equipment.getClientId());
|
|
|
+ equipmentProportion.setEquipmentId(equipment.getId());
|
|
|
+ equipmentProportion.setAdminProportion(adminProportion.getAdminProportion());
|
|
|
+ Integer type = adminProportion.getType();
|
|
|
+ switch (type) {
|
|
|
case 1:
|
|
|
equipmentProportion.setProportion(adminProportion.getAgencyProportion());
|
|
|
equipmentProportion.setAgencyProportion(new BigDecimal("0.00"));
|
|
@@ -1571,11 +1609,14 @@ public class IndexController { ;
|
|
|
case 2:
|
|
|
equipmentProportion.setProportion(adminProportion.getMerchantProportion());
|
|
|
equipmentProportion.setAgencyProportion(adminProportion.getAgencyProportion());
|
|
|
- if(adminProportion.getAgencyProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
- equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
- TAdmin byId = adminService.getById(admin.getAgencyId());
|
|
|
- equipmentProportion.setAgencyName(byId.getUsername());
|
|
|
- }
|
|
|
+// if(adminProportion.getAgencyProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
+// equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
+// TAdmin byId = adminService.getById(admin.getAgencyId());
|
|
|
+// equipmentProportion.setAgencyName(byId.getUsername());
|
|
|
+// }
|
|
|
+ equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
+ TAdmin byId = adminService.getById(admin.getAgencyId());
|
|
|
+ equipmentProportion.setAgencyName(byId.getUsername());
|
|
|
equipmentProportion.setMerchantProportion(new BigDecimal("0.00"));
|
|
|
equipmentProportion.setPersonageProportion(new BigDecimal("0.00"));
|
|
|
equipmentProportion.setType(1);
|
|
@@ -1583,27 +1624,35 @@ public class IndexController { ;
|
|
|
case 3:
|
|
|
equipmentProportion.setProportion(adminProportion.getPersonageProportion());
|
|
|
equipmentProportion.setAgencyProportion(adminProportion.getAgencyProportion());
|
|
|
- if(adminProportion.getAgencyProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
- equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
- TAdmin byId = adminService.getById(admin.getAgencyId());
|
|
|
- equipmentProportion.setAgencyName(byId.getUsername());
|
|
|
- }
|
|
|
+// if(adminProportion.getAgencyProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
+// equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
+// TAdmin byId = adminService.getById(admin.getAgencyId());
|
|
|
+// equipmentProportion.setAgencyName(byId.getUsername());
|
|
|
+// }
|
|
|
+ equipmentProportion.setAgencyId(admin.getAgencyId());
|
|
|
+ TAdmin byId1 = adminService.getById(admin.getAgencyId());
|
|
|
+ equipmentProportion.setAgencyName(byId1.getUsername());
|
|
|
equipmentProportion.setMerchantProportion(adminProportion.getMerchantProportion());
|
|
|
- if(adminProportion.getMerchantProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
- equipmentProportion.setMerchantId(admin.getMerchantId());
|
|
|
- TAdmin byId = adminService.getById(admin.getMerchantId());
|
|
|
- equipmentProportion.setMerchantName(byId.getUsername());
|
|
|
- }
|
|
|
+// if(adminProportion.getMerchantProportion().compareTo(new BigDecimal("0.00"))!=0){
|
|
|
+// equipmentProportion.setMerchantId(admin.getMerchantId());
|
|
|
+// TAdmin byId = adminService.getById(admin.getMerchantId());
|
|
|
+// equipmentProportion.setMerchantName(byId.getUsername());
|
|
|
+// }
|
|
|
+ equipmentProportion.setMerchantId(admin.getMerchantId());
|
|
|
+ TAdmin byId2 = adminService.getById(admin.getMerchantId());
|
|
|
+ equipmentProportion.setMerchantName(byId2.getUsername());
|
|
|
equipmentProportion.setPersonageProportion(new BigDecimal("0.00"));
|
|
|
equipmentProportion.setType(2);
|
|
|
- break;
|
|
|
+ break;
|
|
|
}
|
|
|
- boolean save = proportionService.save(equipmentProportion);
|
|
|
+ boolean save = proportionService.save(equipmentProportion);
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
return "原账户没有设置分销!";
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
return "success";
|
|
|
}
|